cz před 1 rokem
rodič
revize
9e7e95e604

+ 2 - 2
src/components/testForm/index.vue

@@ -333,7 +333,7 @@ const recursionFn = (arr, val, valueAtt, childrenAtt) => {
   }
 };
 const selectDataEcho = (item, val) => {
-  if (item.type === "picker" && item.itemType === "onePicker") {
+  if (item.type === "picker" && item.itemType === "onePicker" && val) {
     const textAtt = item.fieldNames
       ? item.fieldNames.text
       : onePickerFieldNames.text;
@@ -342,7 +342,7 @@ const selectDataEcho = (item, val) => {
       : onePickerFieldNames.value;
     const current = item.data.find((x) => x[valueAtt] == val);
     return current ? current[textAtt] : "";
-  } else if (item.type === "cascader" && item.itemType === "common") {
+  } else if (item.type === "cascader" && item.itemType === "common" && val) {
     const textAtt = item.fieldNames ? item.fieldNames.text : fieldNames.text;
     const valueAtt = item.fieldNames ? item.fieldNames.value : fieldNames.value;
     const childrenAtt = item.fieldNames.children

+ 94 - 50
src/views/MES/supplementaryOrder/add.vue

@@ -23,7 +23,7 @@ const unitModal = ref(false);
 const classification = ref([]);
 const formData = reactive({
   data: {
-    prodOrderId: "",
+    // prodOrderId: "",
     respUserSet: [],
     fileList: [],
   },
@@ -90,26 +90,41 @@ const formConfig = reactive([
       value: "value",
     },
     data: [],
-    changeFn: (val, data) => {
-      proxy.formChange(val, data, formData);
-      if (val.selectedValues[0]) {
-        let current = data.data.find((x) => x.value == val.selectedValues[0]);
-        if (current) {
-          proxy
-            .post("/contractProductBom/getList", {
-              contractId: current.contractId,
-            })
-            .then((res) => {
-              formConfig[4].data = res.data.map((x) => ({
-                ...x,
-                label: x.productName,
-                value: x.materialId,
-              }));
-            });
-        }
-      }
-      data.showPicker = false;
-    },
+    readonly: true,
+    // changeFn: (val, data) => {
+    //   proxy.formChange(val, data, formData);
+    //   if (val.selectedValues[0]) {
+    //     let current = data.data.find((x) => x.value == val.selectedValues[0]);
+    //     if (current) {
+    //       proxy
+    //         .post("/contractProductBom/getList", {
+    //           contractId: current.contractId,
+    //         })
+    //         .then((res) => {
+    //           formConfig[4].data = res.data.map((x) => ({
+    //             ...x,
+    //             label: x.productName,
+    //             value: x.materialId,
+    //           }));
+    //         });
+    //     }
+    //   }
+    //   data.showPicker = false;
+    // },
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "产品编码",
+    prop: "productCode",
+    readonly: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "产品名称",
+    prop: "productName",
+    readonly: true,
   },
   {
     type: "picker",
@@ -127,7 +142,7 @@ const formConfig = reactive([
       if (val.selectedValues[0]) {
         let current = data.data.find((x) => x.value == val.selectedValues[0]);
         if (current) {
-          formData.data.productCode = current.productCode;
+          formData.data.materialCode = current.productCode;
           formData.data.productQuantity = current.quantity;
         }
       }
@@ -138,7 +153,7 @@ const formConfig = reactive([
     type: "input",
     itemType: "text",
     label: "物品编码",
-    prop: "productCode",
+    prop: "materialCode",
     readonly: true,
   },
   {
@@ -149,6 +164,18 @@ const formConfig = reactive([
     readonly: true,
   },
   {
+    type: "picker",
+    label: "报损工序",
+    prop: "processId",
+    itemType: "onePicker",
+    showPicker: false,
+    fieldNames: {
+      text: "label",
+      value: "value",
+    },
+    data: [],
+  },
+  {
     type: "input",
     label: "报损数量",
     prop: "quantity",
@@ -167,6 +194,7 @@ const formConfig = reactive([
   },
 ]);
 const rules = {
+  processId: [{ required: true, message: "请选择报损工序" }],
   type: [{ required: true, message: "请选择类型" }],
   repoTime: [{ required: true, message: "请选择发起时间" }],
   respUserSet: [{ required: true, message: "请选择责任人" }],
@@ -202,51 +230,67 @@ const getDict = () => {
       produceStatus: "0,1",
     })
     .then((res) => {
-      prodOrderList.value = res.data.rows.map((x) => ({
+      formConfig[3].data = res.data.rows.map((x) => ({
         ...x,
         label: x.code,
         value: x.id,
       }));
-      formConfig[3].data = prodOrderList.value;
+    });
+
+  proxy
+    .post("/productionProcesses/page", {
+      pageNum: 1,
+      pageSize: 999,
+    })
+    .then((res) => {
+      formConfig[9].data = res.data.rows.map((x) => ({
+        ...x,
+        label: x.name,
+        value: x.id,
+      }));
+      formConfig[9].data.unshift({
+        label: "无",
+        value: "",
+      });
     });
 };
 getDict();
 
 const getDetail = () => {
   proxy
-    .post("/reportLossesDetails/detail", {
+    .post("/produceOrderDetail/detail", {
       id: route.query.id,
     })
     .then(
       (res) => {
-        formData.data = res.data;
-        formData.data.fileList = [];
-        formData.data.respUserSet = res.data.respUserSet.split(",");
-        proxy
-          .post("/fileInfo/getList", { businessIdList: [route.query.id] })
-          .then((res) => {
-            if (
-              res.data[route.query.id] &&
-              res.data[route.query.id].length > 0
-            ) {
-              formData.data.fileList = res.data[route.query.id].map((item) => {
-                return {
-                  ...item,
-                  url: item.fileUrl,
-                };
-              });
-            } else {
-              formData.data.fileList = [];
-            }
-          });
+        formData.data = {
+          prodTaskId: res.data.id,
+          prodOrderId: res.data.produceOrderId,
+          productCode: res.data.productCode,
+          productName: res.data.productName,
+          productId: res.data.productId,
+          respUserSet: [getUserInfo().userId],
+          respUserSetName: getUserInfo().nickName,
+          processId: "",
+          fileList: [],
+        };
+        console.log(formData.data, "saa");
+        formConfig[6].data = res.data.contractProductBomList.map((x) => ({
+          ...x,
+          label: x.productName + `(${x.productCode})`,
+          value: x.productId,
+        }));
+
+        console.log(res, "saaas");
         setTimeout(() => {
           formDom.value.formDataShowLabelOne();
-        }, 200);
+        }, 2000);
       },
       (err) => {
+        showFailToast("扫码异常");
         setTimeout(() => {
           onClickLeft();
-        }, 1000);
+        }, 2000);
       }
     );
 };
@@ -278,8 +322,8 @@ onMounted(() => {
   if (route.query && route.query.id) {
     // formData.data = { ...route.query };
     getDetail();
-    formOption.readonly = true;
-    formOption.hiddenSubmitBtn = true;
+    // formOption.readonly = true;
+    // formOption.hiddenSubmitBtn = true;
   } else {
     formData.data.respUserSet = [getUserInfo().userId];
     formData.data.respUserSetName = getUserInfo().nickName;

+ 33 - 3
src/views/MES/supplementaryOrder/index.vue

@@ -54,7 +54,7 @@ const listConfig = ref([
     prop: "materialName",
   },
   {
-    label: "报数量",
+    label: "报数量",
     prop: "quantity",
     style: {
       color: "red",
@@ -77,11 +77,41 @@ const onLoad = () => {
 const onClickLeft = () => proxy.$router.push("/main/working");
 
 const onClickRight = () => {
-  proxy.$router.push({
-    path: "/main/supplementaryOrderAdd",
+  // proxy.$router.push({
+  //   path: "/main/supplementaryOrderAdd",
+  // });
+  uni.postMessage({
+    data: {
+      type: "scanCode",
+      scanType: "2",
+    },
   });
 };
 
+const showScanData = (val) => {
+  if (val) {
+    proxy.$router.push({
+      path: "/main/supplementaryOrderAdd",
+      query: {
+        type: "add",
+        id: val,
+      },
+    });
+  } else {
+    return showFailToast("内容为空");
+  }
+};
+
+// onMounted(() => {
+//   nextTick(() => {
+//     window.getVueMessage = (data, type) => {
+//       if (data && type && type == 2) {
+//         showScanData(data);
+//       }
+//     };
+//   });
+// });
+
 const toDtl = (row) => {
   proxy.$router.push({
     path: "/main/supplementaryOrderAdd",

+ 24 - 11
src/views/working/index.vue

@@ -112,6 +112,7 @@ const toRouter = (item) => {
     uni.postMessage({
       data: {
         type: "scanCode",
+        scanType: "1",
       },
     });
   } else {
@@ -123,14 +124,26 @@ const toRouter = (item) => {
   }
 };
 
-const showScanData = (val) => {
-  if (val) {
-    proxy.$router.push({
-      path: "/main/productionReportAdd",
-      query: {
-        id: val,
-      },
-    });
+const showScanData = (val, type) => {
+  if (val && type) {
+    if (type == "1") {
+      // 报工
+      proxy.$router.push({
+        path: "/main/productionReportAdd",
+        query: {
+          id: val,
+        },
+      });
+    } else if (type == "2") {
+      // 报损
+      proxy.$router.push({
+        path: "/main/supplementaryOrderAdd",
+        query: {
+          type: "add",
+          id: val,
+        },
+      });
+    }
   } else {
     return showFailToast("内容为空");
   }
@@ -138,9 +151,9 @@ const showScanData = (val) => {
 
 onMounted(() => {
   nextTick(() => {
-    window.getVueMessage = (data) => {
-      if (data) {
-        showScanData(data);
+    window.getVueMessage = (data, type) => {
+      if (data && type) {
+        showScanData(data, type);
       }
     };
   });