🔨 数据清理时添加条数限制.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// 清理数量
|
||||
export const clearLimit = 1000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 1000;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -26,8 +26,8 @@ export const UploadTaskFileStatus = {
|
||||
CANCELED: 'CANCELED',
|
||||
};
|
||||
|
||||
// 清理数量
|
||||
export const clearLimit = 2000;
|
||||
// 最大清理数量
|
||||
export const maxClearLimit = 2000;
|
||||
|
||||
// 上传任务状态 字典项
|
||||
export const uploadTaskStatusKey = 'uploadTaskStatus';
|
||||
|
||||
Reference in New Issue
Block a user