Procházet zdrojové kódy

fix:工序表单组件删除添加判断

luoxiao před 1 měsícem
rodič
revize
5c66353482

+ 12 - 0
src/api/craft/opExcel/index.ts

@@ -0,0 +1,12 @@
+import request from "@/utils/request";
+
+// 返回一工段为
+export function opExcelPage(operationId) {
+  return request({
+    url: "/api/v1/opExcelForm/page",
+    method: "post",
+    data: {
+      operationId: operationId,
+    },
+  });
+}

+ 11 - 1
src/views/base/craftManagement/route/components/processComponent.vue

@@ -165,6 +165,8 @@ import {
   processesByRouteId,
   saveProcessInRoute,
 } from "@/api/craft/route/index";
+
+import { opExcelPage } from "@/api/craft/opExcel";
 const prodtCode = ref("");
 const routerId = ref("");
 const router = useRouter();
@@ -378,7 +380,15 @@ const onUpdate = () => {
   selectIndex.value = -1;
 };
 
-const clickDelete = (index) => {
+const clickDelete = async (index) => {
+  if (selectProComs.value[index].compentType === "operationExcel") {
+    let operationId = route.fullPath.split("/")[4];
+    let res = await opExcelPage(operationId);
+    if (res.data.totalCount > 0) {
+      ElMessage.error("请先删除工序表单数据!");
+      return;
+    }
+  }
   selectProComs.value.splice(index, 1);
   selectIndex.value = -1;
   isChanged.value = true;