update 修复bug987 库、类下有参数的话删除要走审批
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="closeFun">取消</el-button>
|
||||
<el-button type="primary" @click="onConfirmFun">确定</el-button>
|
||||
<el-button type="primary" :loading="confirmLoading" @click="onConfirmFun">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<EditPen />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="del" @click="deleteParamFun(dataType[data.type])">
|
||||
<div class="del" @click="deleteParamFun(dataType[data.type], data)">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user