fix: 配置-参数配置里面的删除按钮,建议点击后增加二次确认避免误触

This commit is contained in:
TsMask
2023-12-25 17:05:20 +08:00
parent 715471f950
commit 12f810d890

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { reactive, ref, onMounted, watch, toRaw, nextTick } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { message } from 'ant-design-vue/lib';
import { Modal, message } from 'ant-design-vue/lib';
import useI18n from '@/hooks/useI18n';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
@@ -403,27 +403,37 @@ function arrayEditOk(from: Record<string, any>) {
/**多列表删除单行 */
function arrayDelete(rowIndex: Record<string, any>) {
const index = rowIndex.value;
delParamConfigInfo({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
topTag: treeState.selectNode.topTag,
loc: index,
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.configManage.configParamForm.delItemOk', {
num: `${treeState.selectNode.topDisplay} Index-${index}`,
}),
duration: 2,
const title = `${treeState.selectNode.topDisplay} Index-${index}`;
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.configManage.configParamForm.delItemTip', {
num: title,
}),
onOk() {
delParamConfigInfo({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
topTag: treeState.selectNode.topTag,
loc: index,
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.configManage.configParamForm.delItemOk', {
num: title,
}),
duration: 2,
});
arrayEditClose();
fnActiveConfigNode('#');
} else {
message.error({
content: `${res.msg}`,
duration: 2,
});
}
});
arrayEditClose();
fnActiveConfigNode('#');
} else {
message.error({
content: `${res.msg}`,
duration: 2,
});
}
},
});
}
@@ -721,27 +731,37 @@ function arrayChildEditOk(from: Record<string, any>) {
function arrayChildDelete(rowIndex: Record<string, any>) {
const index = rowIndex.value;
const loc = `${arrayChildState.loc}/${index}`;
delParamConfigInfo({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
topTag: treeState.selectNode.topTag,
loc,
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.configManage.configParamForm.delItemOk', {
num: `${arrayChildState.title} Index-${index}`,
}),
duration: 2,
const title = `${arrayChildState.title} Index-${index}`;
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.configManage.configParamForm.delItemTip', {
num: title,
}),
onOk() {
delParamConfigInfo({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
topTag: treeState.selectNode.topTag,
loc,
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('views.configManage.configParamForm.delItemOk', {
num: title,
}),
duration: 2,
});
arrayEditClose();
fnActiveConfigNode('#');
} else {
message.error({
content: `${res.msg}`,
duration: 2,
});
}
});
arrayEditClose();
fnActiveConfigNode('#');
} else {
message.error({
content: `${res.msg}`,
duration: 2,
});
}
},
});
}
@@ -908,7 +928,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
if (row.array) {
return result;
}
// 可选的同时没有值不检查
if (row.optional === 'true' && !value) {
return result;