fix: 工况库提示保存
This commit is contained in:
@@ -185,7 +185,7 @@ import {
|
||||
} from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { cloneDeep, groupBy } from 'lodash-es';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { onBeforeRouteLeave, useRouter } from 'vue-router';
|
||||
import loadcaseProTable from '@/components/loadCaseTable/commonTable/loadcaseProTable.vue';
|
||||
import { getLoadcaseLibColumn, getPerformanceLibColumn, taskPoolDictOptions } from '@/components/loadCaseTable/utils/project.ts';
|
||||
import addApproveUser from './addApproveUsers.vue';
|
||||
@@ -293,13 +293,21 @@ const tenantId = 'carsafe';
|
||||
const isEmptyPool = ref(true);
|
||||
const currentPoolBrief = ref();
|
||||
const currentPoolBriefVersion = ref();
|
||||
const onConfirmFun = async (formData:any) => {
|
||||
const onConfirmFun = async (formData: any) => {
|
||||
dialogApproveUserVisible.value = false;
|
||||
if (isEmptyPool.value) {
|
||||
await createTaskPoolFun(formData);
|
||||
} else {
|
||||
await updateTaskPoolFun(formData);
|
||||
}
|
||||
if (pendingRoute.value) {
|
||||
const to = pendingRoute.value;
|
||||
pendingRoute.value = null;
|
||||
suppressConfirm.value = true;
|
||||
router.push(to.fullPath || to.path).catch(() => {
|
||||
suppressConfirm.value = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const createTaskPoolFun = async (formData:any) => {
|
||||
@@ -556,23 +564,30 @@ const tableKey = ref<any>(new Date().getTime());
|
||||
const changeLoadcaseOrPerformanceType = () => {
|
||||
tableKey.value = new Date().getTime();
|
||||
};
|
||||
const router = useRouter();
|
||||
const pendingRoute: any = ref(null);
|
||||
const suppressConfirm = ref(false);
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
if (isHaveNotSave()) {
|
||||
ElMessageBox.confirm('当前有修改未保存!是否将修改提交评审后离开!', '提示', {
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
dialogApproveUserVisible.value = true;
|
||||
})
|
||||
.catch(() => {
|
||||
next();
|
||||
});
|
||||
|
||||
return;
|
||||
} else {
|
||||
if (suppressConfirm.value) {
|
||||
suppressConfirm.value = false;
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (!isHaveNotSave()) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm('当前有修改未保存!是否将修改提交评审后离开!', '提示', {
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
pendingRoute.value = to;
|
||||
dialogApproveUserVisible.value = true;
|
||||
next(false);
|
||||
}).catch(() => {
|
||||
next();
|
||||
});
|
||||
});
|
||||
const poolList: Ref<Pool[]> = ref([]);
|
||||
const queryPoolListFun = async () => {
|
||||
@@ -590,13 +605,12 @@ const queryPoolListFun = async () => {
|
||||
const versionList = ref();
|
||||
const onPoolChangeFun = (pool: any) => {
|
||||
if (isHaveNotSave()) {
|
||||
ElMessageBox.confirm('当前有修改未保存!是否将修改提交评审后离开!', '提示', {
|
||||
ElMessageBox.confirm('当前有修改未保存!是否先提交评审?', '提示', {
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
dialogApproveUserVisible.value = true;
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
currentPoolBrief.value = pool;
|
||||
@@ -610,7 +624,20 @@ const onPoolChangeFun = (pool: any) => {
|
||||
}
|
||||
};
|
||||
const onVersionChangeFun = () => {
|
||||
refreshTreeFun();
|
||||
if (!isHaveNotSave()) {
|
||||
refreshTreeFun();
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm('当前有修改未保存!是否先提交评审?', '提示', {
|
||||
confirmButtonText: '是',
|
||||
cancelButtonText: '否',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
dialogApproveUserVisible.value = true;
|
||||
})
|
||||
.catch(() => {
|
||||
refreshTreeFun();
|
||||
});
|
||||
};
|
||||
const queryTaskPoolFun = async () => {
|
||||
if (!currentPoolBriefVersion.value) {
|
||||
@@ -797,6 +824,7 @@ const exportLoading = ref(false);
|
||||
const onExportPoolFun = async () => {
|
||||
exportLoading.value = true;
|
||||
if (!currentPoolBriefVersion.value) {
|
||||
exportLoading.value = false;
|
||||
return ElMessage.warning('请选择工况库及版本');
|
||||
}
|
||||
const req = {
|
||||
|
||||
Reference in New Issue
Block a user