diff --git a/src/api/data/simulationParameterLibrary.ts b/src/api/data/simulationParameterLibrary.ts index 195ab030..6b2a62f2 100644 --- a/src/api/data/simulationParameterLibrary.ts +++ b/src/api/data/simulationParameterLibrary.ts @@ -69,3 +69,7 @@ export const editSimulationParameterApi = (params: any) => { export const updateSimulationParameterValuesApi = (params: any) => { return post(`${PREFIX}simulationParameterLibrary/updateSimulationParameterValues`, params); }; +// 判断下级是否有参数对象 +export const hasParameterObjectApi = (params: any) => { + return get(`${PREFIX}simulationParameterLibrary/hasParameterObject`, params); +}; diff --git a/src/views/simulation/parameter/components/addParamLib.vue b/src/views/simulation/parameter/components/addParamLib.vue index a617f49f..558c1a1c 100644 --- a/src/views/simulation/parameter/components/addParamLib.vue +++ b/src/views/simulation/parameter/components/addParamLib.vue @@ -10,7 +10,7 @@ @@ -33,11 +33,13 @@ const closeFun = () => { emits('close'); }; +const confirmLoading = ref(false); const onConfirmFun = () => { if (!formData.value.parameterLibraryName) { ElMessage.warning('请输入参数库名称!'); return; } else { + confirmLoading.value = true; emits('createFun', formData.value); } }; diff --git a/src/views/simulation/parameter/index.vue b/src/views/simulation/parameter/index.vue index caa808cd..372713eb 100644 --- a/src/views/simulation/parameter/index.vue +++ b/src/views/simulation/parameter/index.vue @@ -26,7 +26,7 @@ -
+
@@ -162,6 +162,7 @@ import { addLibraryCategoryObjectApi, deleteSimulationParameterApi, updateSimulationParameterValuesApi, + hasParameterObjectApi, } from '@/api/data/simulationParameterLibrary'; import addParamLib from './components/addParamLib.vue'; import addParamType from './components/addParamType.vue'; @@ -372,38 +373,58 @@ const creatLibParamObjFun = async (data: any) => { showParamObjVisible.value = false; }; -const deleteParamFun = (flag: any) => { +const deleteParamFun = async (flag: any, row?: any) => { + // 如果删除的是参数,要走审批流程 if (flag === 'param') { delParams.value = { - type: currentNode.value.type, - id: currentNode.value.id, + // type: currentNode.value.type, + // id: currentNode.value.id, + type: row.type, + id: row.id, }; approveDelShow.value = true; return; - } - ElMessageBox.confirm( - `确认要删除这个${flag === 'lib' ? '参数库' : flag === 'type' ? '参数库分类' : '参数对象'}吗?`, - '警告', - { - confirmButtonText: '确认', - cancelButtonText: '取消', - type: 'warning', - } - ).then(async () => { - const res: any = await deleteSimulationParameterApi({ - type: currentNode.value.type, - id: currentNode.value.id, + } else { + // 0228需求 参数库、分类删除逻辑修改:下级有参数data=true,走审核流程;下级没有参数,直接删除 + const { data } = await hasParameterObjectApi({ + type: row.type, + id: row.id, }); - if (res && res.code === 200) { - ElMessage.success('删除成功!'); - libTreeRef.value.remove(currentNode.value.nodeKey); - currentNode.value = {}; - paramObjInfo.value = ''; + if (data) { + // 走审核流程 + delParams.value = { + type: row.type, + id: row.id, + }; + approveDelShow.value = true; + } else { + // 走删除流程 + ElMessageBox.confirm( + `确认要删除这个${flag === 'lib' ? '参数库' : flag === 'type' ? '参数库分类' : '参数对象'}吗?`, + '警告', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ).then(async () => { + const res: any = await deleteSimulationParameterApi({ + type: currentNode.value.type, + id: currentNode.value.id, + }); + if (res && res.code === 200) { + ElMessage.success('删除成功!'); + libTreeRef.value.remove(currentNode.value.nodeKey); + currentNode.value = {}; + paramObjInfo.value = ''; + } + }); } - }); + } }; const updateParamFun = () => { + // dzh todo 增加审批 const params = { fileId: currentNode.value.fileId, parameterList: newParamTableData.value,