Browse Source

feature/bug修改

dengrui 10 months ago
parent
commit
b27aad8fa7

+ 4 - 5
src/views/base/craftManagement/route/bindProcess.vue

@@ -181,7 +181,7 @@ import { formOption } from "./bindConfig";
 import { ElMessage } from "element-plus";
 import { useScreenshot } from "./screenshot.ts";
 defineOptions({
-  name: "bindProcess/:id?",
+  name: "bindProcess/:id/:prodtCode",
 });
 
 const { capture } = useScreenshot();
@@ -270,7 +270,7 @@ const list1 = ref([]);
 // 保存中间的工序列表
 const saveFlow = async () => {
   const { code } = await saveProcessInRoute({
-    processRouteId: route.params.id,
+    processRouteId: route.fullPath.split("/")[4],
     routeData: JSON.stringify({ ...flowData.value }),
   });
   if (code == "200") {
@@ -330,7 +330,7 @@ const loadTreeData = () => {
 const cancelStatus = ref(true);
 //通过id获取现存储信息
 const loadProcessesFlow = async () => {
-  const res = await processesByRouteId(route.params.id);
+  const res = await processesByRouteId(route.fullPath.split("/")[4]);
   if (res.data) {
     if (res.data.routeData && res.data.routeData != "") {
       flowData.value = JSON.parse(res.data.routeData);
@@ -354,8 +354,7 @@ const reset = () => {
 };
 const editProComponent = async () => {
   router.push({
-    path: `/base/craftManagement/processCom/${currentProcess.value.operationId}`,
-    query: { prodtCode: route.query.prodtCode, routeId: route.query.routeId },
+    path: `/base/craftManagement/processCom/${route.fullPath.split("/")[4]}/${route.fullPath.split("/")[5]}`,
   });
 };
 

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

@@ -31,8 +31,8 @@
             >
               <div
                 v-if="
-                  route.query.prodtCode != '' ||
-                  (route.query.prodtCode == '' && com.compentName != '物料采集')
+                  prodtCode != '' ||
+                  (prodtCode == '' && com.compentName != '物料采集')
                 "
               >
                 {{ com.compentName }}
@@ -102,7 +102,8 @@ import {
   processesByRouteId,
   saveProcessInRoute,
 } from "@/api/craft/route/index";
-
+const prodtCode = ref("");
+const routerId = ref("");
 const router = useRouter();
 const route = useRoute();
 
@@ -110,14 +111,18 @@ const route = useRoute();
 const isChanged = ref(true);
 const isNoneedEdit = ref(false); //有些组件是不需要编辑的,所以下面也不展示table
 const loadTopList = () => {
-  getCompoentsList(route.params.id).then((res) => {
+  getCompoentsList(routerId.value).then((res) => {
     selectProComs.value = res.data || [];
     selectIndex.value = -1;
     isChanged.value = false;
   });
 };
 onMounted(async () => {
+  prodtCode.value = route.fullPath.split("/")[5];
+  routerId.value = route.fullPath.split("/")[4];
   await loadTopList();
+
+  console.log(prodtCode.value, "2", routerId.value, "3");
 });
 
 // 顶部====================
@@ -127,11 +132,11 @@ const back = () => {
 
 const save = async () => {
   for (let i = 0; i < selectProComs.value.length; i++) {
-    selectProComs.value[i].operationId = route.params.id;
+    selectProComs.value[i].operationId = routerId.value;
     selectProComs.value[i].sortNum = i;
   }
   let p = {
-    operationId: route.params.id,
+    operationId: routerId.value,
     dtos: selectProComs.value,
   };
   let { res, code } = await saveCompoents(p);
@@ -177,7 +182,6 @@ const clickToolCom = (com, index) => {
 };
 
 const onUpdate = () => {
-  console.log("update");
   isChanged.value = true;
   selectIndex.value = -1;
 };

+ 8 - 10
src/views/base/craftManagement/route/index.vue

@@ -152,7 +152,7 @@ const importExcelData = () => {
 
 // 选择产品相关
 const ctableRef = ref(null);
-const commonRef=ref(null);
+const commonRef = ref(null);
 
 const onSelectedFinish = (selectedValue) => {
   // search.value.prodtName = selectedValue.materialName;
@@ -160,11 +160,11 @@ const onSelectedFinish = (selectedValue) => {
   form.value.prodtCode = selectedValue.materialCode;
   form.value.prodtModel = selectedValue.spec;
 };
-const onCommonFinish = (selectedValue)=>{
+const onCommonFinish = (selectedValue) => {
   form.value.commonRouteId = selectedValue.id;
   form.value.commonRouteName = selectedValue.processRouteName;
   form.value.commonRouteCode = selectedValue.processRouteCode;
-}
+};
 const startChooseProduct = () => {
   if (ctableRef.value) {
     ctableRef.value.startSelect();
@@ -205,8 +205,7 @@ const router = useRouter();
 // 绑定工序
 const bindProcess = (row) => {
   router.push({
-    path: `/base/craftManagement/bindProcess/${row.id}`,
-    query: { prodtCode: row.prodtCode,routeId: row.id},
+    path: `/base/craftManagement/bindProcess/${row.id}/${row.prodtCode}`,
   });
 };
 
@@ -271,7 +270,7 @@ option.value = Object.assign(option.value, {
       prop: "commonRouteId",
       addDisplay: false,
       editDisplay: false,
-      hide:true,
+      hide: true,
       width: 150,
       overHidden: true,
     },
@@ -288,14 +287,14 @@ option.value = Object.assign(option.value, {
         },
       ],
       overHidden: true,
-      click:() => {
+      click: () => {
         startChooseRoute();
       },
     },
     {
       label: "通用工艺编码",
       prop: "commonRouteCode",
-      disabled:true,
+      disabled: true,
       editDisplay: false,
       width: 150,
       overHidden: true,
@@ -410,7 +409,7 @@ option.value = Object.assign(option.value, {
       prop: "processRouteVersion",
       addDisplay: true,
       editDisplay: true,
-      value: '1.0',
+      value: "1.0",
       rules: [
         {
           required: true,
@@ -434,7 +433,6 @@ option.value = Object.assign(option.value, {
       width: 150,
       overHidden: true,
     },
-
   ],
 });
 </script>

+ 4 - 6
src/views/base/craftManagement/routeCommon/index.vue

@@ -126,7 +126,7 @@ const tmpForm = ref({});
 
 onMounted(() => {
   // console.log("crudRef", crudRef)
-  search.value.routeType="common";
+  search.value.routeType = "common";
   dataList();
 });
 
@@ -137,7 +137,7 @@ const uploadRef = ref(null);
 const uploadFinished = () => {
   // 上传完成后的刷新操作
   page.currentPage = 1;
-  search.value.routeType="common";
+  search.value.routeType = "common";
   dataList();
 };
 const importExcelData = () => {
@@ -189,8 +189,7 @@ const router = useRouter();
 // 绑定工序
 const bindProcess = (row) => {
   router.push({
-    path: `/base/craftManagement/bindProcess/${row.id}`,
-    query: { prodtCode: row.prodtCode,routeId: row.id},
+    path: `/base/craftManagement/bindProcess/${row.id}/${row.prodtCode}`,
   });
 };
 
@@ -316,8 +315,7 @@ option.value = Object.assign(option.value, {
       width: 150,
       hide: true,
       display: false,
-      value:"common",
-
+      value: "common",
     },
   ],
 });