Commit 787a58ae by sunhaiwei

生产计划和生产任务删除的时候添加校验

parent 429ad3de
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock'; import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
import {rksqMesProductOutput} from "/@/api/scgl/ccmx"; import {rksqMesProductOutput} from "/@/api/scgl/ccmx";
import {useUserStore} from "/@/store/modules/user";
const pageParamsInfo = ref<any>({}); const pageParamsInfo = ref<any>({});
const { const {
...@@ -284,10 +285,16 @@ ...@@ -284,10 +285,16 @@
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id],record);
} }
function deleteList(ids) { const userStore = useUserStore();
function deleteList(ids,record) {
//当前登录人的id
let userId = userStore.getUserInfo.id;
//创建人的id
let createUserId = record.createUserId;
Modal.confirm({ Modal.confirm({
title: '提示信息', title: '提示信息',
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
...@@ -295,6 +302,8 @@ ...@@ -295,6 +302,8 @@
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
if (userId==createUserId) {
if (record.zt!='已下发') {
deleteMesProductionPlan(ids).then((_) => { deleteMesProductionPlan(ids).then((_) => {
handleSuccess(); handleSuccess();
notification.success({ notification.success({
...@@ -302,6 +311,18 @@ ...@@ -302,6 +311,18 @@
description: t('删除成功!'), description: t('删除成功!'),
}); });
}); });
} else {
notification.warning({
message: 'Tip',
description: t('已下发的计划不能删除!'),
});
}
} else {
notification.warning({
message: 'Tip',
description: t('不是本人的计划不能删除!'),
});
}
}, },
onCancel() {}, onCancel() {},
}); });
......
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock'; import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
import {recallMesProductionPlan, revokeMesProductionTask} from "/@/api/scgl/scjh"; import {recallMesProductionPlan, revokeMesProductionTask} from "/@/api/scgl/scjh";
import {useUserStore} from "/@/store/modules/user";
const pageParamsInfo = ref<any>({}); const pageParamsInfo = ref<any>({});
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } = const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } =
...@@ -271,7 +272,7 @@ ...@@ -271,7 +272,7 @@
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id],record);
} }
function handleBack(record: Recordable) { function handleBack(record: Recordable) {
...@@ -302,8 +303,13 @@ ...@@ -302,8 +303,13 @@
onCancel() {}, onCancel() {},
}); });
} }
const userStore = useUserStore();
function deleteList(ids) { function deleteList(ids,record) {
//当前登录人的id
let userId = userStore.getUserInfo.id;
//创建人的id
let createUserId = record.createUserId;
Modal.confirm({ Modal.confirm({
title: '提示信息', title: '提示信息',
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
...@@ -311,6 +317,8 @@ ...@@ -311,6 +317,8 @@
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
if (userId==createUserId) {
if (record.zt=='草稿') {
deleteMesProductionTask(ids).then((_) => { deleteMesProductionTask(ids).then((_) => {
handleSuccess(); handleSuccess();
notification.success({ notification.success({
...@@ -318,6 +326,18 @@ ...@@ -318,6 +326,18 @@
description: t('删除成功!'), description: t('删除成功!'),
}); });
}); });
} else {
notification.warning({
message: 'Tip',
description: t('已进行的任务不能删除!'),
});
}
} else {
notification.warning({
message: 'Tip',
description: t('不是本人的任务不能删除!'),
});
}
}, },
onCancel() {}, onCancel() {},
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment