🔨 数据清理时添加条数限制.

This commit is contained in:
lijiahang
2024-08-29 18:26:26 +08:00
parent d7b747eac4
commit 104a9a0aa3
61 changed files with 490 additions and 283 deletions

View File

@@ -55,12 +55,12 @@
:options="toOptions(connectTypeKey)"
allow-clear />
</a-form-item>
<!-- 清理数量 -->
<a-form-item field="clearLimit" label="清理数量">
<a-input-number v-model="formModel.clearLimit"
<!-- 数量限制 -->
<a-form-item field="limit" label="数量限制">
<a-input-number v-model="formModel.limit"
:min="1"
:max="clearLimit"
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
:max="maxLimit"
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
hide-button
allow-clear />
</a-form-item>
@@ -80,7 +80,7 @@
import { ref } from 'vue';
import useLoading from '@/hooks/loading';
import useVisible from '@/hooks/visible';
import { connectStatusKey, connectTypeKey, clearLimit } from '../types/const';
import { connectStatusKey, connectTypeKey, maxClearLimit } from '../types/const';
import { getHostConnectLogCount, clearHostConnectLog } from '@/api/asset/host-connect-log';
import { Message, Modal } from '@arco-design/web-vue';
import { useDictStore } from '@/store';
@@ -101,14 +101,16 @@
type: undefined,
status: undefined,
startTimeRange: undefined,
clearLimit,
limit: maxLimit.value,
};
};
const maxLimit = ref<number>(0);
const formModel = ref<HostConnectLogQueryRequest>({});
// 打开
const open = (record: any) => {
maxLimit.value = maxClearLimit;
renderForm({ ...defaultForm(), ...record });
setVisible(true);
};
@@ -122,8 +124,8 @@
// 确定
const handlerOk = async () => {
if (!formModel.value.clearLimit) {
Message.error('请输入清理数量');
if (!formModel.value.limit) {
Message.error('请输入数量限制');
return false;
}
setLoading(true);
@@ -148,7 +150,7 @@
const doClear = (count: number) => {
Modal.confirm({
title: '删除清空',
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
onOk: async () => {
setLoading(true);
try {

View File

@@ -12,8 +12,8 @@ export const HostConnectStatus = {
FORCE_OFFLINE: 'FORCE_OFFLINE',
};
// 清理数量
export const clearLimit = 2000;
// 最大清理数量
export const maxClearLimit = 2000;
// 主机连接状态 字典项
export const connectStatusKey = 'hostConnectStatus';

View File

@@ -14,7 +14,6 @@
@close="handleClose">
<a-spin class="full" :loading="loading">
<a-form :model="formModel"
ref="formRef"
label-align="right"
:auto-label-width="true">
<!-- 执行时间 -->
@@ -48,12 +47,12 @@
:options="toOptions(execStatusKey)"
placeholder="请选择执行状态" />
</a-form-item>
<!-- 清理数量 -->
<a-form-item field="clearLimit" label="清理数量">
<a-input-number v-model="formModel.clearLimit"
<!-- 数量限制 -->
<a-form-item field="limit" label="数量限制">
<a-input-number v-model="formModel.limit"
:min="1"
:max="clearLimit"
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
:max="maxLimit"
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
hide-button
allow-clear />
</a-form-item>
@@ -77,7 +76,7 @@
import { getExecCommandLogCount, clearExecCommandLog } from '@/api/exec/exec-command-log';
import { Message, Modal } from '@arco-design/web-vue';
import { useDictStore } from '@/store';
import { clearLimit } from '../types/const';
import { maxClearLimit } from '../types/const';
import UserSelector from '@/components/user/user/selector/index.vue';
const emits = defineEmits(['clear']);
@@ -86,7 +85,7 @@
const { loading, setLoading } = useLoading();
const { toOptions } = useDictStore();
const formRef = ref<any>();
const maxLimit = ref<number>(0);
const formModel = ref<ExecLogQueryRequest>({});
const defaultForm = (): ExecLogQueryRequest => {
@@ -97,12 +96,13 @@
command: undefined,
status: undefined,
startTimeRange: undefined,
clearLimit,
limit: maxLimit.value,
};
};
// 打开
const open = (record: any) => {
maxLimit.value = maxClearLimit;
renderForm({ ...defaultForm(), ...record });
setVisible(true);
};
@@ -116,8 +116,8 @@
// 确定
const handlerOk = async () => {
if (!formModel.value.clearLimit) {
Message.error('请输入清理数量');
if (!formModel.value.limit) {
Message.error('请输入数量限制');
return false;
}
setLoading(true);
@@ -142,7 +142,7 @@
const doClear = (count: number) => {
Modal.confirm({
title: '删除清空',
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
onOk: async () => {
setLoading(true);
try {

View File

@@ -1,2 +1,2 @@
// 清理数量
export const clearLimit = 1000;
// 最大清理数量
export const maxClearLimit = 1000;

View File

@@ -14,7 +14,6 @@
@close="handleClose">
<a-spin class="full" :loading="loading">
<a-form :model="formModel"
ref="formRef"
label-align="right"
:auto-label-width="true">
<!-- 上传时间 -->
@@ -49,12 +48,12 @@
placeholder="请选择状态"
allow-clear />
</a-form-item>
<!-- 清理数量 -->
<a-form-item field="clearLimit" label="清理数量">
<a-input-number v-model="formModel.clearLimit"
<!-- 数量限制 -->
<a-form-item field="limit" label="数量限制">
<a-input-number v-model="formModel.limit"
:min="1"
:max="clearLimit"
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
:max="maxLimit"
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
hide-button
allow-clear />
</a-form-item>
@@ -74,7 +73,7 @@
import { ref } from 'vue';
import useLoading from '@/hooks/loading';
import useVisible from '@/hooks/visible';
import { clearLimit, uploadTaskStatusKey } from '../types/const';
import { maxClearLimit, uploadTaskStatusKey } from '../types/const';
import { getUploadTaskCount, clearUploadTask } from '@/api/exec/upload-task';
import { Message, Modal } from '@arco-design/web-vue';
import { useDictStore } from '@/store';
@@ -86,7 +85,7 @@
const { loading, setLoading } = useLoading();
const { toOptions } = useDictStore();
const formRef = ref<any>();
const maxLimit = ref<number>(0);
const formModel = ref<UploadTaskQueryRequest>({});
const defaultForm = (): UploadTaskQueryRequest => {
@@ -96,11 +95,13 @@
description: undefined,
status: undefined,
createTimeRange: undefined,
limit: maxLimit.value,
};
};
// 打开
const open = (record: any) => {
maxLimit.value = maxClearLimit;
renderForm({ ...defaultForm(), ...record });
setVisible(true);
};
@@ -114,8 +115,8 @@
// 确定
const handlerOk = async () => {
if (!formModel.value.clearLimit) {
Message.error('请输入清理数量');
if (!formModel.value.limit) {
Message.error('请输入数量限制');
return false;
}
setLoading(true);
@@ -140,7 +141,7 @@
const doClear = (count: number) => {
Modal.confirm({
title: '删除清空',
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
onOk: async () => {
setLoading(true);
try {

View File

@@ -26,8 +26,8 @@ export const UploadTaskFileStatus = {
CANCELED: 'CANCELED',
};
// 清理数量
export const clearLimit = 2000;
// 最大清理数量
export const maxClearLimit = 2000;
// 上传任务状态 字典项
export const uploadTaskStatusKey = 'uploadTaskStatus';

View File

@@ -14,7 +14,6 @@
@close="handleClose">
<a-spin class="full" :loading="loading">
<a-form :model="formModel"
ref="formRef"
label-align="right"
:auto-label-width="true">
<!-- 执行时间 -->
@@ -43,12 +42,12 @@
:options="toOptions(execStatusKey)"
placeholder="请选择执行状态" />
</a-form-item>
<!-- 清理数量 -->
<a-form-item field="clearLimit" label="清理数量">
<a-input-number v-model="formModel.clearLimit"
<!-- 数量限制 -->
<a-form-item field="limit" label="数量限制">
<a-input-number v-model="formModel.limit"
:min="1"
:max="clearLimit"
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
:max="maxLimit"
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
hide-button
allow-clear />
</a-form-item>
@@ -72,7 +71,7 @@
import { getExecJobLogCount, clearExecJobLog } from '@/api/job/exec-job-log';
import { Message, Modal } from '@arco-design/web-vue';
import { useDictStore } from '@/store';
import { clearLimit } from '../types/const';
import { maxClearLimit } from '../types/const';
import ExecJobSelector from '@/components/exec/job/selector/index.vue';
const emits = defineEmits(['clear']);
@@ -81,7 +80,7 @@
const { loading, setLoading } = useLoading();
const { toOptions } = useDictStore();
const formRef = ref<any>();
const maxLimit = ref<number>(0);
const formModel = ref<ExecLogQueryRequest>({});
const defaultForm = (): ExecLogQueryRequest => {
@@ -92,12 +91,13 @@
command: undefined,
status: undefined,
startTimeRange: undefined,
clearLimit,
limit: maxLimit.value,
};
};
// 打开
const open = (record: any) => {
maxLimit.value = maxClearLimit;
renderForm({ ...defaultForm(), ...record });
setVisible(true);
};
@@ -111,8 +111,8 @@
// 确定
const handlerOk = async () => {
if (!formModel.value.clearLimit) {
Message.error('请输入清理数量');
if (!formModel.value.limit) {
Message.error('请输入数量限制');
return false;
}
setLoading(true);
@@ -137,7 +137,7 @@
const doClear = (count: number) => {
Modal.confirm({
title: '删除清空',
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
onOk: async () => {
setLoading(true);
try {

View File

@@ -1,2 +1,2 @@
// 清理数量
export const clearLimit = 1000;
// 最大清理数量
export const maxClearLimit = 1000;

View File

@@ -4,13 +4,13 @@
<!-- 不一致提示 -->
<a-alert v-if="app.version && webVersion !== app.version"
class="alert-wrapper">
当前前端版本与后端版本不一致, 请使用 Ctrl + F5 刷新页面
当前前端版本与后端版本不一致, 请使用 Ctrl + F5 强制刷新页面
</a-alert>
<!-- 升级提示 -->
<a v-if="app.version && repo.tag_name && ('v' + app.version) !== repo.tag_name"
<a v-if="app.version && repo.tagName && ('v' + app.version) !== repo.tagName"
class="alert-href"
target="_blank"
:href="`https://github.com/dromara/orion-visor/releases/tag/${repo.tag_name}`">
:href="`https://github.com/dromara/orion-visor/releases/tag/${repo.tagName}`">
<a-alert class="alert-wrapper">
新版本已发布, 请及时升级版本
</a-alert>
@@ -23,7 +23,7 @@
:column="1">
<!-- 机器码 -->
<a-descriptions-item label="机器码">
<span class="text-copy span-blue uuid-wrapper" @click="copy(app.uuid, true)">
<span class="text-copy uuid-wrapper" @click="copy(app.uuid, true)">
{{ app.uuid }}
</span>
</a-descriptions-item>
@@ -37,7 +37,7 @@
</a-descriptions-item>
<!-- 当前后端版本 -->
<a-descriptions-item label="最新发布版本">
{{ repo.tag_name }}
{{ repo.tagName }}
</a-descriptions-item>
<!-- 当前后端版本 -->
<a-descriptions-item label="最新更新日志">
@@ -58,9 +58,9 @@
</script>
<script lang="ts" setup>
import type { AppInfoResponse, RepoReleaseResponse } from '@/api/system/setting';
import type { AppInfoResponse, AppReleaseResponse } from '@/api/system/setting';
import { onMounted, reactive } from 'vue';
import { getRepoLatestRelease, getSystemAppInfo } from '@/api/system/setting';
import { getAppLatestRelease, getSystemAppInfo } from '@/api/system/setting';
import { copy } from '@/hooks/copy';
import { Message } from '@arco-design/web-vue';
@@ -71,8 +71,8 @@
uuid: '',
});
const repo = reactive<RepoReleaseResponse>({
tag_name: '',
const repo = reactive<AppReleaseResponse>({
tagName: '',
body: '',
});
@@ -86,14 +86,14 @@
}
});
// 加载仓库信息
// 加载版本信息
onMounted(async () => {
try {
const { data } = await getRepoLatestRelease();
repo.tag_name = data.tag_name;
const { data } = await getAppLatestRelease();
repo.tagName = data.tagName;
repo.body = data.body;
} catch (e) {
Message.error('获取仓库信息失败, 请等待后重试');
Message.error('获取应用最新版本失败, 请等待后重试');
}
});
@@ -116,6 +116,7 @@
}
.uuid-wrapper {
color: rgb(var(--arcoblue-6));
font-weight: 600;
}

View File

@@ -61,12 +61,12 @@
placeholder="请选择执行结果"
allow-clear />
</a-form-item>
<!-- 清理数量 -->
<a-form-item field="clearLimit" label="清理数量">
<a-input-number v-model="formModel.clearLimit"
<!-- 数量限制 -->
<a-form-item field="limit" label="数量限制">
<a-input-number v-model="formModel.limit"
:min="1"
:max="clearLimit"
:placeholder="`请输入最大清理数量 最大: ${clearLimit}`"
:max="maxLimit"
:placeholder="`请输入数量限制 最大: ${maxLimit}`"
hide-button
allow-clear />
</a-form-item>
@@ -90,7 +90,7 @@
import { getOperatorLogCount, clearOperatorLog } from '@/api/user/operator-log';
import { Message, Modal } from '@arco-design/web-vue';
import { useDictStore } from '@/store';
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey, clearLimit } from '../types/const';
import { operatorLogModuleKey, operatorLogResultKey, operatorLogTypeKey, operatorRiskLevelKey, maxClearLimit } from '../types/const';
import { labelFilter } from '@/types/form';
import UserSelector from '@/components/user/user/selector/index.vue';
@@ -105,10 +105,11 @@
riskLevel: undefined,
result: undefined,
startTimeRange: undefined,
clearLimit,
limit: maxLimit.value,
};
};
const maxLimit = ref<number>(0);
const typeOptions = ref<SelectOptionData[]>(toOptions(operatorLogTypeKey));
const formModel = ref<OperatorLogQueryRequest>({});
@@ -116,6 +117,7 @@
// 打开
const open = (record: OperatorLogQueryRequest) => {
maxLimit.value = maxClearLimit;
renderForm({ ...defaultForm(), ...record });
setVisible(true);
};
@@ -146,8 +148,8 @@
// 确定
const handlerOk = async () => {
if (!formModel.value.clearLimit) {
Message.error('请输入清理数量');
if (!formModel.value.limit) {
Message.error('请输入数量限制');
return false;
}
setLoading(true);
@@ -172,7 +174,7 @@
const doClear = (count: number) => {
Modal.confirm({
title: '删除清空',
content: `确定要删除 ${Math.min(count, formModel.value.clearLimit || 0)} 条数据吗? 确定后将立即删除且无法恢复!`,
content: `确定要删除 ${count} 条数据吗? 确定后将立即删除且无法恢复!`,
onOk: async () => {
setLoading(true);
try {

View File

@@ -27,8 +27,8 @@ export const getLogDetail = (record: OperatorLogQueryResponse): Record<string, a
}
};
// 清理数量
export const clearLimit = 2000;
// 最大清理数量
export const maxClearLimit = 2000;
// 操作日志模块 字典项
export const operatorLogModuleKey = 'operatorLogModule';