乐菲 3 недель назад
Родитель
Сommit
46983833e8

+ 2 - 1
.env.dev

@@ -5,7 +5,8 @@ NODE_ENV = 'development'
 VUE_APP_TITLE = WMS开发环境
 
 # 芋道管理系统/开发环境
-VUE_APP_BASE_API = 'http://192.168.1.94:48080'
+# VUE_APP_BASE_API = 'http://192.168.1.94:48080'
+VUE_APP_BASE_API = 'http://113.105.183.190:48028'
 # VUE_APP_BASE_API = 'http://61.155.26.34:36936'
 # VUE_APP_BASE_API = 'http://127.0.0.1:48080'
 # VUE_APP_BASE_API = 'http://2227el9013.iok.la'

+ 1 - 1
src/api/wms/inLibrary/locationAdjustment.js

@@ -22,7 +22,7 @@ export function exportLocationAdjustmentExcel(query) {
 // 货位调整
 export function LocationAdjustment(data) {
   return request({
-    url: "/wms/location-adjustment/adjust",
+    url: "/rtkwms/location-adjustment/adjust",
     method: "post",
     data: data,
   });

+ 2 - 1
src/layout/components/AppMain.vue

@@ -20,7 +20,8 @@ export default {
       return this.$store.state.tagsView.cachedViews;
     },
     key() {
-      return this.$route.fullPath;
+      // 只使用path作为key,避免查询参数变化导致组件重新创建
+      return this.$route.path;
     },
   },
 };

+ 61 - 16
src/layout/components/TagsView/index.vue

@@ -98,7 +98,13 @@ export default {
   },
   methods: {
     isActive(route) {
-      return route.fullPath === this.$route.fullPath;
+      // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+      const isQueryFormNew = route.path === "/querymanage/queryFormNew";
+      if (isQueryFormNew) {
+        return route.fullPath === this.$route.fullPath;
+      } else {
+        return route.path === this.$route.path;
+      }
     },
     activeStyle(tag) {
       if (!this.isActive(tag)) return {};
@@ -112,9 +118,13 @@ export default {
     },
     isFirstView() {
       try {
+        // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+        const isQueryFormNew =
+          this.selectedTag.path === "/querymanage/queryFormNew";
+        const compareKey = isQueryFormNew ? "fullPath" : "path";
         return (
-          this.selectedTag.fullPath === this.visitedViews[1].fullPath ||
-          this.selectedTag.fullPath === "/index"
+          this.selectedTag[compareKey] === this.visitedViews[1][compareKey] ||
+          this.selectedTag.path === "/index"
         );
       } catch (err) {
         return false;
@@ -122,9 +132,13 @@ export default {
     },
     isLastView() {
       try {
+        // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+        const isQueryFormNew =
+          this.selectedTag.path === "/querymanage/queryFormNew";
+        const compareKey = isQueryFormNew ? "fullPath" : "path";
         return (
-          this.selectedTag.fullPath ===
-          this.visitedViews[this.visitedViews.length - 1].fullPath
+          this.selectedTag[compareKey] ===
+          this.visitedViews[this.visitedViews.length - 1][compareKey]
         );
       } catch (err) {
         return false;
@@ -171,13 +185,27 @@ export default {
       const tags = this.$refs.tag;
       this.$nextTick(() => {
         for (const tag of tags) {
-          if (tag.to.fullPath === this.$route.fullPath) {
-            this.$refs.scrollPane.moveToTarget(tag);
-            // when query is different then update
-            if (tag.to.fullPath !== this.$route.fullPath) {
-              this.$store.dispatch("tagsView/updateVisitedView", this.$route);
+          // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+          const isQueryFormNew =
+            this.$route.path === "/querymanage/queryFormNew";
+          if (isQueryFormNew) {
+            if (tag.to.fullPath === this.$route.fullPath) {
+              this.$refs.scrollPane.moveToTarget(tag);
+              // when query is different then update
+              if (tag.to.fullPath !== this.$route.fullPath) {
+                this.$store.dispatch("tagsView/updateVisitedView", this.$route);
+              }
+              break;
+            }
+          } else {
+            if (tag.to.path === this.$route.path) {
+              this.$refs.scrollPane.moveToTarget(tag);
+              // when query is different then update
+              if (tag.to.fullPath !== this.$route.fullPath) {
+                this.$store.dispatch("tagsView/updateVisitedView", this.$route);
+              }
+              break;
             }
-            break;
           }
         }
       });
@@ -193,15 +221,25 @@ export default {
       });
     },
     closeRightTags() {
-      this.$tab.closeRightPage(this.selectedTag).then((visitedViews) => {
-        if (!visitedViews.find((i) => i.fullPath === this.$route.fullPath)) {
+      this.$tab.closeRightPage(this.selectedTag).then(({ visitedViews }) => {
+        // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+        const isQueryFormNew = this.$route.path === "/querymanage/queryFormNew";
+        const compareKey = isQueryFormNew ? "fullPath" : "path";
+        if (
+          !visitedViews.find((i) => i[compareKey] === this.$route[compareKey])
+        ) {
           this.toLastView(visitedViews);
         }
       });
     },
     closeLeftTags() {
-      this.$tab.closeLeftPage(this.selectedTag).then((visitedViews) => {
-        if (!visitedViews.find((i) => i.fullPath === this.$route.fullPath)) {
+      this.$tab.closeLeftPage(this.selectedTag).then(({ visitedViews }) => {
+        // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+        const isQueryFormNew = this.$route.path === "/querymanage/queryFormNew";
+        const compareKey = isQueryFormNew ? "fullPath" : "path";
+        if (
+          !visitedViews.find((i) => i[compareKey] === this.$route[compareKey])
+        ) {
           this.toLastView(visitedViews);
         }
       });
@@ -214,7 +252,14 @@ export default {
     },
     closeAllTags(view) {
       this.$tab.closeAllPage().then(({ visitedViews }) => {
-        if (this.affixTags.some((tag) => tag.path === this.$route.path)) {
+        // 只对/querymanage/queryFormNew路由采用fullPath,其他路由采用path
+        const isQueryFormNew = this.$route.path === "/querymanage/queryFormNew";
+        const compareKey = isQueryFormNew ? "fullPath" : "path";
+        if (
+          this.affixTags.some(
+            (tag) => tag[compareKey] === this.$route[compareKey]
+          )
+        ) {
           return;
         }
         this.toLastView(visitedViews, view);

+ 40 - 22
src/plugins/tab.js

@@ -1,5 +1,5 @@
-import store from '@/store'
-import router from '@/router';
+import store from "@/store";
+import router from "@/router";
 
 export default {
   // 刷新当前tab页签
@@ -8,19 +8,19 @@ export default {
     if (obj === undefined) {
       matched.forEach((m) => {
         if (m.components && m.components.default && m.components.default.name) {
-          if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
+          if (!["Layout", "ParentView"].includes(m.components.default.name)) {
             obj = { name: m.components.default.name, path: path, query: query };
           }
         }
       });
     }
-    return store.dispatch('tagsView/delCachedView', obj).then(() => {
-      const { path, query } = obj
+    return store.dispatch("tagsView/delCachedView", obj).then(() => {
+      const { path, query } = obj;
       router.replace({
-        path: '/redirect' + path,
-        query: query
-      })
-    })
+        path: "/redirect" + path,
+        query: query,
+      });
+    });
   },
   // 关闭当前tab页签,打开新页签
   closeOpenPage(obj) {
@@ -32,36 +32,54 @@ export default {
   // 关闭指定tab页签
   closePage(obj) {
     if (obj === undefined) {
-      return store.dispatch('tagsView/delView', router.currentRoute).then(({ lastPath }) => {
-        return router.push(lastPath || '/');
-      });
+      return store
+        .dispatch("tagsView/delView", router.currentRoute)
+        .then(({ lastPath }) => {
+          return router.push(lastPath || "/");
+        });
     }
-    return store.dispatch('tagsView/delView', obj);
+    return store.dispatch("tagsView/delView", obj);
   },
   // 关闭所有tab页签
   closeAllPage() {
-    return store.dispatch('tagsView/delAllViews');
+    return store.dispatch("tagsView/delAllViews");
   },
   // 关闭左侧tab页签
   closeLeftPage(obj) {
-    return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute);
+    return store.dispatch("tagsView/delLeftTags", obj || router.currentRoute);
   },
   // 关闭右侧tab页签
   closeRightPage(obj) {
-    return store.dispatch('tagsView/delRightTags', obj || router.currentRoute);
+    return store.dispatch("tagsView/delRightTags", obj || router.currentRoute);
   },
   // 关闭其他tab页签
   closeOtherPage(obj) {
-    return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
+    return store.dispatch(
+      "tagsView/delOthersViews",
+      obj || router.currentRoute
+    );
   },
   // 添加tab页签
   openPage(title, url, params) {
-    var obj = { path: url, meta: { title: title } }
-    store.dispatch('tagsView/addView', obj);
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path
+    const isQueryFormNew = url === "/querymanage/queryFormNew";
+    let obj = { path: url, meta: { title: title } };
+
+    // 如果是/querymanage/queryFormNew路由,需要设置fullPath
+    if (isQueryFormNew && params) {
+      // 构建fullPath,包含path和query参数
+      const queryString = Object.keys(params)
+        .map((key) => `${key}=${encodeURIComponent(params[key])}`)
+        .join("&");
+      obj.fullPath = `${url}?${queryString}`;
+      obj.query = params;
+    }
+
+    store.dispatch("tagsView/addView", obj);
     return router.push({ path: url, query: params });
   },
   // 修改tab页签
   updatePage(obj) {
-    return store.dispatch('tagsView/updateVisitedView', obj);
-  }
-}
+    return store.dispatch("tagsView/updateVisitedView", obj);
+  },
+};

+ 32 - 10
src/store/modules/tagsView.js

@@ -5,12 +5,15 @@ const state = {
 
 const mutations = {
   ADD_VISITED_VIEW: (state, view) => {
-    // 使用fullPath作为判断依据,支持相同路径不同参数的路由打开多个标签页
-    if (state.visitedViews.some((v) => v.fullPath === view.fullPath)) return;
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+    const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+    const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
+    if (state.visitedViews.some((v) => v[keyToUse] === view[keyToUse])) return;
     let title = view.meta.title || "no-name";
 
     // 为 /querymanage/queryFormNew 路由设置动态标题
-    if (view.path === "/querymanage/queryFormNew") {
+    if (isQueryFormNew) {
       title = view.query.name || view.meta.title || "查询表单";
     }
 
@@ -29,8 +32,11 @@ const mutations = {
 
   DEL_VISITED_VIEW: (state, view) => {
     for (const [i, v] of state.visitedViews.entries()) {
-      // 使用fullPath匹配要删除的标签页
-      if (v.fullPath === view.fullPath) {
+      // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+      const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+      const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
+      if (v[keyToUse] === view[keyToUse]) {
         state.visitedViews.splice(i, 1);
         break;
       }
@@ -42,8 +48,12 @@ const mutations = {
   },
 
   DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+    const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+    const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
     state.visitedViews = state.visitedViews.filter((v) => {
-      return v.meta.affix || v.fullPath === view.fullPath;
+      return v.meta.affix || v[keyToUse] === view[keyToUse];
     });
   },
   DEL_OTHERS_CACHED_VIEWS: (state, view) => {
@@ -65,10 +75,14 @@ const mutations = {
   },
 
   UPDATE_VISITED_VIEW: (state, view) => {
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+    const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+    const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
     for (let v of state.visitedViews) {
-      if (v.fullPath === view.fullPath) {
+      if (v[keyToUse] === view[keyToUse]) {
         // 为 /querymanage/queryFormNew 路由更新动态标题
-        if (view.path === "/querymanage/queryFormNew") {
+        if (isQueryFormNew) {
           v.title = view.query.name || view.meta.title || "查询表单";
         }
         // 更新view的所有属性,包括fullPath和query参数
@@ -79,8 +93,12 @@ const mutations = {
   },
 
   DEL_RIGHT_VIEWS: (state, view) => {
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+    const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+    const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
     const index = state.visitedViews.findIndex(
-      (v) => v.fullPath === view.fullPath
+      (v) => v[keyToUse] === view[keyToUse]
     );
     if (index === -1) {
       return;
@@ -98,8 +116,12 @@ const mutations = {
   },
 
   DEL_LEFT_VIEWS: (state, view) => {
+    // 只对/querymanage/queryFormNew路由采用fullpath,其他路由采用path作为判断依据
+    const isQueryFormNew = view.path === "/querymanage/queryFormNew";
+    const keyToUse = isQueryFormNew ? "fullPath" : "path";
+
     const index = state.visitedViews.findIndex(
-      (v) => v.fullPath === view.fullPath
+      (v) => v[keyToUse] === view[keyToUse]
     );
     if (index === -1) {
       return;

+ 283 - 287
src/views/wms/incoming/register/materialRegistration.vue

@@ -10,8 +10,7 @@
           icon="el-icon-check"
           :loading="sureLoading"
           @click="submitForm"
-          >提交</el-button
-        >
+        >提交</el-button>
       </el-col>
     </el-row>
 
@@ -64,8 +63,8 @@
               clearable
               :disabled="
                 form.receiptType === '4' ||
-                form.receiptType === '2' ||
-                !!materialLots
+                  form.receiptType === '2' ||
+                  !!materialLots
               "
               placeholder="请选择源单单号"
               :options="orderOptions"
@@ -225,8 +224,7 @@
             style="width: 60%"
             icon="el-icon-upload2"
             @click="handleUpload"
-            >附件上传</el-button
-          >
+          >附件上传</el-button>
         </el-col>
         <el-col :span="form.receiptType === '4' ? 8 : 16">
           <el-form-item label="备注" prop="remark">
@@ -251,8 +249,7 @@
               icon="el-icon-plus"
               size="mini"
               @click="handleAdd"
-              >新增</el-button
-            >
+            >新增</el-button>
           </el-col>
         </el-row>
         <!-- 列表 -->
@@ -327,8 +324,7 @@
                 icon="el-icon-delete"
                 class="text-danger"
                 @click="handleDelete(scope.row)"
-                >删除</el-button
-              >
+              >删除</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -353,32 +349,32 @@ import {
   validateIsQuality,
   // getRegisterMaterialLabelPrintData,
   getFilesById,
-  getMaterialInfo,
-} from "@/api/wms/incoming/register";
-import OrderSelect from "./components/OrderSelect.vue";
-import MaterialSelect from "./components/MaterialSelect.vue";
-import PrintTemplate from "./components/PrintTemplate.vue";
-import { printLabel } from "@/api/common";
+  getMaterialInfo
+} from '@/api/wms/incoming/register'
+import OrderSelect from './components/OrderSelect.vue'
+import MaterialSelect from './components/MaterialSelect.vue'
+import PrintTemplate from './components/PrintTemplate.vue'
+import { printLabel } from '@/api/common'
 // 物料下拉
 // import { getMaterialDropDownList } from "@/api/wms/base/material";
 // 客户下拉选择
-import CustomerSelect from "./components/CustomerSelect.vue";
+import CustomerSelect from './components/CustomerSelect.vue'
 // 东苏发单据打印
-import IssuePrinit from "../../output/productionIssue/issueDetails/IssuePrinit.vue";
-const AccessTokenKey = "ACCESS_TOKEN";
+import IssuePrinit from '../../output/productionIssue/issueDetails/IssuePrinit.vue'
+const AccessTokenKey = 'ACCESS_TOKEN'
 // 供应商下拉列表
-import SupplierListSelect from "./components/SupplierListSelect.vue";
-import { getDropDownList } from "@/api/wms/orders/purchase";
+import SupplierListSelect from './components/SupplierListSelect.vue'
+import { getDropDownList } from '@/api/wms/orders/purchase'
 // 部门
-import DepartMentSelect from "./components/DepartMentSelect.vue";
-import AttachmentUpload from "./components/AttachmentUpload.vue";
+import DepartMentSelect from './components/DepartMentSelect.vue'
+import AttachmentUpload from './components/AttachmentUpload.vue'
 // 单位
-import UnitCodeSelect from "./components/UnitCodeSelect.vue";
-import { getAppendixTableData } from "@/api/system/appendix.js";
-import LabelRepair from "@/views/wms/incoming/register/components/LabelRepair.vue";
+import UnitCodeSelect from './components/UnitCodeSelect.vue'
+import { getAppendixTableData } from '@/api/system/appendix.js'
+import LabelRepair from '@/views/wms/incoming/register/components/LabelRepair.vue'
 
 export default {
-  name: "MaterialRegistration",
+  name: 'MaterialRegistration',
   components: {
     OrderSelect,
     MaterialSelect,
@@ -389,7 +385,7 @@ export default {
     DepartMentSelect,
     AttachmentUpload,
     UnitCodeSelect,
-    LabelRepair,
+    LabelRepair
   },
   data() {
     return {
@@ -398,7 +394,7 @@ export default {
       // 供应商置灰状态
       supplierDisabled: false,
       // 生产日期
-      produceDate: "",
+      produceDate: '',
       printData: [],
       // 遮罩层
       loading: false,
@@ -416,7 +412,7 @@ export default {
       // WMS 入库业务-来料登记主列表
       list: [],
       // 弹出层标题
-      title: "",
+      title: '',
       currentData: [],
       // 是否显示弹出层
       open: false,
@@ -433,7 +429,7 @@ export default {
         receiptQty: null,
         testStatus: null,
         createTime: [],
-        materialName: null,
+        materialName: null
       },
       // 显示客户
       receiptShow: true,
@@ -448,9 +444,9 @@ export default {
       //  过保质期提示
       warningText: null,
       // 单据打印参数
-      tokens: "",
-      baseUrl: "",
-      reportId: "",
+      tokens: '',
+      baseUrl: '',
+      reportId: '',
       // 登记的参数
       registerParams: {
         areaTest: null,
@@ -458,16 +454,16 @@ export default {
         purchaseOrderNo: null,
         materialNo: null,
         receiptQty: null,
-        testStatus: null,
+        testStatus: null
       },
       // 表单参数
       form: {
-        printer: "",
-        BtReportId: "",
-        BtReportUrl: "",
-        BtReportName: "",
-        HicoreReportName: "",
-        reportType: "0",
+        printer: '',
+        BtReportId: '',
+        BtReportUrl: '',
+        BtReportName: '',
+        HicoreReportName: '',
+        reportType: '0',
         deliverBatch: null,
         materialNo: null,
         produceDate: null,
@@ -478,7 +474,7 @@ export default {
         validTill: null,
         receiptQty: null,
         size: null,
-        remark: null,
+        remark: null
       },
       nextIndex: 0,
       nextPrintState: false,
@@ -491,145 +487,145 @@ export default {
         purchaseOrderNo: [
           {
             required: true,
-            message: "请输入关键字选择采购订单",
-            trigger: "change",
-          },
+            message: '请输入关键字选择采购订单',
+            trigger: 'change'
+          }
         ],
         materialNo: [
           {
             required: true,
-            message: "请输入关键字选择物料编码",
-            trigger: "change",
-          },
+            message: '请输入关键字选择物料编码',
+            trigger: 'change'
+          }
         ],
         bagQty: [
-          { required: true, message: "到货包数不能为空", trigger: "change" },
+          { required: true, message: '到货包数不能为空', trigger: 'change' }
         ],
         receiptQty: [
-          { required: true, message: "到货包数不能为空", trigger: "blur" },
+          { required: true, message: '到货包数不能为空', trigger: 'blur' }
         ],
         mantissaQty: [
-          { required: true, message: "到货尾数不能为空", trigger: "change" },
+          { required: true, message: '到货尾数不能为空', trigger: 'change' }
         ],
         pieceQty: [
-          { required: true, message: "到货件数不能为空", trigger: "change" },
+          { required: true, message: '到货件数不能为空', trigger: 'change' }
         ],
         deliverBatch: [
-          { required: true, message: "送货批次不能为空", trigger: "change" },
+          { required: true, message: '送货批次不能为空', trigger: 'change' }
         ],
         customerCode: [
-          { required: true, message: "请选择客户", trigger: "change" },
+          { required: true, message: '请选择客户', trigger: 'change' }
         ],
         receiptType: [
-          { required: true, message: "请选择物料类别", trigger: "change" },
+          { required: true, message: '请选择物料类别', trigger: 'change' }
         ],
         produceDate: [
-          { required: false, message: "生产日期不能为空", trigger: "change" },
+          { required: true, message: '生产日期不能为空', trigger: 'change' }
         ],
         supplierCode: [
-          { required: false, message: "供应商不能为空", trigger: "change" },
+          { required: false, message: '供应商不能为空', trigger: 'change' }
         ],
 
         departmentNo: [
           {
             required: true,
-            message: "部门不能为空",
-            trigger: "change",
-          },
+            message: '部门不能为空',
+            trigger: 'change'
+          }
         ],
         inType: [
           {
             required: true,
-            message: "入库类型不能为空",
-            trigger: "change",
-          },
-        ],
-      },
-    };
+            message: '入库类型不能为空',
+            trigger: 'change'
+          }
+        ]
+      }
+    }
   },
   created() {
-    this.tokens = localStorage.getItem(AccessTokenKey);
-    this.reportId = this.$route.meta.reportId;
-    this.baseUrl = process.env.VUE_APP_REPORT_API;
-    this.getTemplateList();
+    this.tokens = localStorage.getItem(AccessTokenKey)
+    this.reportId = this.$route.meta.reportId
+    this.baseUrl = process.env.VUE_APP_REPORT_API
+    this.getTemplateList()
 
-    const { materialLots } = this.$route.query;
+    const { materialLots } = this.$route.query
     if (materialLots) {
-      this.materialLots = materialLots;
+      this.materialLots = materialLots
       // 物料列表
-      this.handleGetMaterialInfo({ materialLots });
+      this.handleGetMaterialInfo({ materialLots })
     }
   },
   methods: {
     // 获取来料登记详情
     handleGetMaterialInfo({ materialLots }) {
-      getMaterialInfo({ materialLots }).then(async ({ code, data, msg }) => {
+      getMaterialInfo({ materialLots }).then(async({ code, data, msg }) => {
         this.form = {
           ...this.form,
           ...data,
           produceDate: data.produceDate
-            ? new Date(data.produceDate).toLocaleString().replace(/\//g, "-")
-            : "",
+            ? new Date(data.produceDate).toLocaleString().replace(/\//g, '-')
+            : '',
           validTill: data.validTill
-            ? new Date(data.validTill).toLocaleString().replace(/\//g, "-")
-            : "",
-        };
+            ? new Date(data.validTill).toLocaleString().replace(/\//g, '-')
+            : ''
+        }
         if (data.receiptType == 2) {
-          this.otherShow = false;
+          this.otherShow = false
         }
         // 补打列表
         this.$nextTick(() => {
-          this.$refs.labelRepair.queryParams.materialLots = materialLots;
-          this.$refs.labelRepair.loading = false;
-          this.$refs.labelRepair.list = data.qrCodes;
-        });
+          this.$refs.labelRepair.queryParams.materialLots = materialLots
+          this.$refs.labelRepair.loading = false
+          this.$refs.labelRepair.list = data.qrCodes
+        })
         // 物料列表
-        this.list = data.materials;
+        this.list = data.materials
         // 附件列表
-        this.$refs.attachmentUpload.fileList = data.filesListVos;
-        await this.supplierChange({ code: this.form.supplierCode });
-        await this.fetchOrderNoList(this.form.supplierCode);
+        this.$refs.attachmentUpload.fileList = data.filesListVos
+        await this.supplierChange({ code: this.form.supplierCode })
+        await this.fetchOrderNoList(this.form.supplierCode)
         await this.OrderNoChange({
           erpOrderNo: this.form.purchaseOrderNo,
           id: this.orderOptions.find(
             (ret) => ret.erpOrderNo === this.form.purchaseOrderNo
-          ),
-        });
-        await this.materialNoChange({ ...this.form });
-      });
+          )
+        })
+        await this.materialNoChange({ ...this.form })
+      })
     },
     // 模板选择
     reportChange(e) {
-      const fdIndex = this.btTemplateList.findIndex((ret) => ret.id === e);
-      this.form.HicoreReportName = this.btTemplateList[fdIndex].sysName;
-      this.form.BtReportName = this.btTemplateList[fdIndex].originName;
-      this.form.BtReportUrl = this.btTemplateList[fdIndex].url;
+      const fdIndex = this.btTemplateList.findIndex((ret) => ret.id === e)
+      this.form.HicoreReportName = this.btTemplateList[fdIndex].sysName
+      this.form.BtReportName = this.btTemplateList[fdIndex].originName
+      this.form.BtReportUrl = this.btTemplateList[fdIndex].url
     },
     // 获取BT打印模板
     getTemplateList() {
       getAppendixTableData({
         pageNum: 1,
         pageSize: 999,
-        printFlag: "1",
-        filesMenuId: "1000000000000000001",
+        printFlag: '1',
+        filesMenuId: '1000000000000000001'
       }).then(({ data }) => {
-        this.btTemplateList = data?.list ?? [];
-      });
+        this.btTemplateList = data?.list ?? []
+      })
     },
     handleAdd() {
       this.list.push({
-        qty: "",
-        length: "",
-        width: "",
-        thickness: "",
-        id: this.list.length,
-      });
+        qty: '',
+        length: '',
+        width: '',
+        thickness: '',
+        id: this.list.length
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row, $index) {
-      const { id } = row;
-      const index = this.list.findIndex((item) => item.id === id);
-      this.list.splice(index, 1);
+      const { id } = row
+      const index = this.list.findIndex((item) => item.id === id)
+      this.list.splice(index, 1)
     },
     /** 表单重置 */
     reset() {
@@ -645,62 +641,62 @@ export default {
         width: undefined,
         length: undefined,
         thickness: undefined,
-        pieceQty: undefined,
-      };
-      this.resetForm("form");
+        pieceQty: undefined
+      }
+      this.resetForm('form')
     },
     // 小数点问题处理
     getHandleNumber(val) {
-      return Math.round(parseFloat(val) * 100000000) / 100000000;
+      return Math.round(parseFloat(val) * 100000000) / 100000000
     },
     // 根据每批尾数计算到货数量
     mantissaQtyChange(v) {
-      const { bagQty, pieceQty } = this.form;
+      const { bagQty, pieceQty } = this.form
       if (v * 1 > pieceQty * 1) {
-        this.$modal.msgWarning("到货尾数不能大于到货件数~");
-        this.form.receiptQty = "";
-        return;
+        this.$modal.msgWarning('到货尾数不能大于到货件数~')
+        this.form.receiptQty = ''
+        return
       }
       if (bagQty === undefined || pieceQty === undefined) {
-        this.$modal.msgWarning("请先输入到货包数或每包件数!");
-        return;
+        this.$modal.msgWarning('请先输入到货包数或每包件数!')
+        return
       }
       this.form.receiptQty = this.getHandleNumber(
         bagQty * pieceQty + parseFloat(v)
-      );
+      )
     },
     // 根据到货包数计算到货数量
     mantissaQtyChangeOfPack(v) {
-      const { mantissaQty, pieceQty } = this.form;
+      const { mantissaQty, pieceQty } = this.form
       if (mantissaQty === undefined || pieceQty === undefined) {
-        this.form.receiptQty = "";
-        return;
+        this.form.receiptQty = ''
+        return
       }
       this.form.receiptQty = this.getHandleNumber(
         v * pieceQty + parseFloat(mantissaQty)
-      );
+      )
     },
     // 根据每包数量计算到货数量
     mantissaQtyChangeOfPice(v) {
-      const { mantissaQty, bagQty } = this.form;
+      const { mantissaQty, bagQty } = this.form
       if (mantissaQty === undefined || bagQty === undefined) {
-        this.form.receiptQty = "";
-        return;
+        this.form.receiptQty = ''
+        return
       }
       this.form.receiptQty = this.getHandleNumber(
         v * bagQty + parseFloat(mantissaQty)
-      );
+      )
     },
     reLoading(timeout) {
       const loading = this.$loading({
         lock: true,
-        text: "标签打印中,请勿重复操作",
-        spinner: "el-icon-loading",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
+        text: '标签打印中,请勿重复操作',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
       setTimeout(() => {
-        loading.close();
-      }, timeout * 1000);
+        loading.close()
+      }, timeout * 1000)
     },
     /** 提交按钮 */
     async submitForm() {
@@ -711,142 +707,142 @@ export default {
       //   }
       // }
       try {
-        await this.$refs.form.validate();
-        this.sureLoading = true;
+        await this.$refs.form.validate()
+        this.sureLoading = true
         const files = this.uploadFiles.map((item) => {
-          const { fileId } = item.url;
-          return fileId;
-        });
+          const { fileId } = item.url
+          return fileId
+        })
         const isAll = this.list.some(
           (item) => item.qty && item.length && item.width
-        );
-        if (this.form.unitName === "平方米" && this.list.length === 0) {
-          this.$modal.msgWarning("请填写物料的长度、宽度、数量等信息!");
-          return;
+        )
+        if (this.form.unitName === '平方米' && this.list.length === 0) {
+          this.$modal.msgWarning('请填写物料的长度、宽度、数量等信息!')
+          return
         }
-        if (this.form.unitName === "平方米" && !isAll && this.list.length > 0) {
-          this.$modal.msgWarning("长度/宽度/数量不能为空!");
-          return;
+        if (this.form.unitName === '平方米' && !isAll && this.list.length > 0) {
+          this.$modal.msgWarning('长度/宽度/数量不能为空!')
+          return
         }
-        this.form.files = files;
-        this.form.unitCode = undefined;
+        this.form.files = files
+        this.form.unitCode = undefined
         const subitParams = {
           ...this.form,
-          materials: this.list || [],
-        };
+          materials: this.list || []
+        }
         if (this.form.checkIncoming === 0) {
-          this.$modal.confirm("此物料为免检物料,可直接入库").then(() => {
-            this.commonSubmit(subitParams);
-          });
+          this.$modal.confirm('此物料为免检物料,可直接入库').then(() => {
+            this.commonSubmit(subitParams)
+          })
         } else {
-          this.commonSubmit(subitParams);
+          this.commonSubmit(subitParams)
         }
       } catch (error) {
-        console.log(error);
+        console.log(error)
       } finally {
-        this.sureLoading = false;
+        this.sureLoading = false
       }
     },
 
     // 打印
     async commonSubmit(subitParams) {
-      const result = await createIncomingReceipt(subitParams);
-      const { data: materialLots } = result;
+      const result = await createIncomingReceipt(subitParams)
+      const { data: materialLots } = result
 
       if (
-        (process.env.VUE_APP_TITLE === "麦禾田WMS管理系统" ||
-          process.env.VUE_APP_TITLE === "WMS开发环境") &&
+        (process.env.VUE_APP_TITLE === '麦禾田WMS管理系统' ||
+          process.env.VUE_APP_TITLE === 'WMS开发环境') &&
         !this.form.id &&
         false
       ) {
-        this.$modal.msgSuccess("登记成功,正在打印");
+        this.$modal.msgSuccess('登记成功,正在打印')
         const params = {
-          materialLots,
-        };
+          materialLots
+        }
 
-        const printDetailData = await getLabelPrintData(params); // 获取打印数据
-        const { data: productsDetails } = printDetailData;
-        this.printData.push(...productsDetails);
+        const printDetailData = await getLabelPrintData(params) // 获取打印数据
+        const { data: productsDetails } = printDetailData
+        this.printData.push(...productsDetails)
         // 打印参数
         const printParams = {
           printJson: JSON.stringify(this.printData),
-          fileUrl: this.form.BtReportUrl,
-        };
+          fileUrl: this.form.BtReportUrl
+        }
         try {
-          const data = await printLabel(printParams); // 打印
-          console.log(data, "???");
+          const data = await printLabel(printParams) // 打印
+          console.log(data, '???')
         } catch (error) {
-          console.log(error);
+          console.log(error)
         } finally {
-          this.printData = [];
+          this.printData = []
           this.$router.replace({
             path:
-              "/entry-exit/purchase-out-in/material-regist-enter?materialLots?materialLots=" +
-              materialLots,
-          });
+              '/entry-exit/purchase-out-in/material-regist-enter?materialLots?materialLots=' +
+              materialLots
+          })
         }
       } else {
         if (this.form.id) {
-          this.$modal.msgSuccess("修改成功");
+          this.$modal.msgSuccess('修改成功')
         } else {
-          this.$modal.msgSuccess("登记成功");
+          this.$modal.msgSuccess('登记成功')
           this.$router.replace({
             path:
-              "/entry-exit/purchase-out-in/material-regist-enter?materialLots?materialLots=" +
-              materialLots,
-          });
-          console.log(this.reportId);
-          const src = `${this.baseUrl}/jmreport/view/${this.reportId}?token=${this.tokens}&materialLots=${materialLots}`;
-          this.$refs.issuePrint.dialogVisible = true;
-          this.$refs.issuePrint.src = src;
+              '/entry-exit/purchase-out-in/material-regist-enter?materialLots?materialLots=' +
+              materialLots
+          })
+          console.log(this.reportId)
+          const src = `${this.baseUrl}/jmreport/view/${this.reportId}?token=${this.tokens}&materialLots=${materialLots}`
+          this.$refs.issuePrint.dialogVisible = true
+          this.$refs.issuePrint.src = src
         }
       }
     },
     // 根据到货包数 到货包数*每包数量计算到货总数
     handleBagQtyChange(row) {
-      const { bagQty, qty } = row;
+      const { bagQty, qty } = row
       if (!bagQty || !qty) {
-        this.form.receiptQty = null;
-        return;
+        this.form.receiptQty = null
+        return
       }
-      this.form.receiptQty = this.getHandleNumber(bagQty * qty);
-      if (this.form.unitCode === "Pcs") {
+      this.form.receiptQty = this.getHandleNumber(bagQty * qty)
+      if (this.form.unitCode === 'Pcs') {
         this.form.receiptQty = this.list.reduce((acc, cur) => {
           acc =
             this.getHandleNumber(acc) +
-            this.getHandleNumber(cur.qty * cur.bagQty);
-          return acc;
-        }, 0);
+            this.getHandleNumber(cur.qty * cur.bagQty)
+          return acc
+        }, 0)
       }
     },
     // 根据每包数量 每包数量 * 到货包数
     handleQtyChange(row) {
-      const { bagQty, qty } = row;
+      const { bagQty, qty } = row
       if (!bagQty || !qty) {
-        this.form.receiptQty = null;
-        return;
+        this.form.receiptQty = null
+        return
       }
-      this.form.receiptQty = this.getHandleNumber(bagQty * qty);
-      if (this.form.unitCode === "Pcs") {
+      this.form.receiptQty = this.getHandleNumber(bagQty * qty)
+      if (this.form.unitCode === 'Pcs') {
         this.form.receiptQty = this.list.reduce((acc, cur) => {
           acc =
             this.getHandleNumber(acc) +
-            this.getHandleNumber(cur.qty * cur.bagQty);
-          return acc;
-        }, 0);
+            this.getHandleNumber(cur.qty * cur.bagQty)
+          return acc
+        }, 0)
       }
     },
     // 原单单号change事件
     OrderNoChange(item) {
       if (item) {
-        const { erpOrderNo, id, supplierCode } = item;
-        this.form.purchaseOrderNo = erpOrderNo;
+        const { erpOrderNo, id, supplierCode } = item
+        this.form.purchaseOrderNo = erpOrderNo
         if (supplierCode) {
-          this.form.supplierCode = supplierCode;
+          this.form.supplierCode = supplierCode
         }
-        this.$refs.materialOrder.inStockId = id;
+        this.$refs.materialOrder.inStockId = id
         // this.fetchMaterialNoList(id);
-        this.materialDisabled = false;
+        this.materialDisabled = false
       }
     },
     // 物料编码change事件
@@ -860,102 +856,102 @@ export default {
           needProduceDate,
           size,
           unitCode,
-          unitName,
-        } = item;
-        this.form.size = size;
-        this.form.materialNo = materialNo;
-        this.form.materialName = materialName;
-        this.form.checkIncoming = checkIncoming;
-        this.form.storageEnvironment = storageEnvironment;
-        this.form.unitCode = unitCode;
-        this.form.unitName = unitName;
+          unitName
+        } = item
+        this.form.size = size
+        this.form.materialNo = materialNo
+        this.form.materialName = materialName
+        this.form.checkIncoming = checkIncoming
+        this.form.storageEnvironment = storageEnvironment
+        this.form.unitCode = unitCode
+        this.form.unitName = unitName
         if (needProduceDate === 1) {
-          this.rules.produceDate[0].required = true;
+          this.rules.produceDate[0].required = true
         } else {
-          this.rules.produceDate[0].required = false;
+          this.rules.produceDate[0].required = false
         }
       }
     },
     // 收料类别
     receiptTypeChange(v) {
-      console.log(v);
-      if (v === "1") {
-        this.receiptShow = true;
-        this.otherShow = true;
+      console.log(v)
+      if (v === '1') {
+        this.receiptShow = true
+        this.otherShow = true
         if (this.purchaseOrderNo === undefined) {
-          this.materialDisabled = true;
-          this.form.customerCode = undefined;
-          this.$refs.form.rules.purchaseOrderNo[0].required = true;
-          this.fetchOrderNoList();
+          this.materialDisabled = true
+          this.form.customerCode = undefined
+          this.$refs.form.rules.purchaseOrderNo[0].required = true
+          this.fetchOrderNoList()
         }
-      } else if (v === "4") {
-        this.otherShow = true;
-        this.receiptShow = false;
-        this.$refs.form.rules.purchaseOrderNo[0].required = false;
-        this.form.customerCode = undefined;
-        this.form.purchaseOrderNo = undefined;
+      } else if (v === '4') {
+        this.otherShow = true
+        this.receiptShow = false
+        this.$refs.form.rules.purchaseOrderNo[0].required = false
+        this.form.customerCode = undefined
+        this.form.purchaseOrderNo = undefined
         // this.fetchMaterialNoList();
-        this.$refs.materialOrder.inStockId = undefined;
+        this.$refs.materialOrder.inStockId = undefined
       } else {
-        this.$refs.form.rules.purchaseOrderNo[0].required = false;
-        this.receiptShow = false;
-        this.otherShow = false;
-        this.materialDisabled = false;
+        this.$refs.form.rules.purchaseOrderNo[0].required = false
+        this.receiptShow = false
+        this.otherShow = false
+        this.materialDisabled = false
         // this.fetchMaterialNoList();
-        this.form.purchaseOrderNo = undefined;
-        this.form.supplierCode = undefined;
-        this.$refs.materialOrder.inStockId = undefined;
+        this.form.purchaseOrderNo = undefined
+        this.form.supplierCode = undefined
+        this.$refs.materialOrder.inStockId = undefined
       }
     },
     // 根据宽度计算每包数量
     widthChange(row) {
-      const { length } = row;
+      const { length } = row
       if (length === null || length === undefined || length === 0) {
-        row.qty = undefined;
-        return;
+        row.qty = undefined
+        return
       }
-      row.qty = this.getHandleNumber((row.width / 1000) * length);
+      row.qty = this.getHandleNumber((row.width / 1000) * length)
       this.form.receiptQty = this.list.reduce(
         (sum, item) =>
           this.getHandleNumber(sum + item.qty * parseFloat(item.bagQty)),
         0
-      );
+      )
     },
     // 根据长度计算每包数量
     lengthChange(row) {
-      const { width } = row;
+      const { width } = row
       if (width === null || width === undefined || width === 0) {
-        row.qty = undefined;
-        return;
+        row.qty = undefined
+        return
       }
-      row.qty = this.getHandleNumber((width / 1000) * row.length);
+      row.qty = this.getHandleNumber((width / 1000) * row.length)
       this.form.receiptQty = this.list.reduce(
         (sum, item) =>
           this.getHandleNumber(sum + item.qty * parseFloat(item.bagQty)),
         0
-      );
+      )
     },
     // 生产日期change事件
     produceDateChange(v) {
-      const currentDate = new Date();
-      const selectedDate = new Date(v);
+      const currentDate = new Date()
+      const selectedDate = new Date(v)
 
       if (selectedDate > currentDate) {
-        this.$modal.msgWarning("生产日期不能超过当前日期,请重新选择!");
-        this.form.produceDate = undefined;
+        this.$modal.msgWarning('生产日期不能超过当前日期,请重新选择!')
+        this.form.produceDate = undefined
       } else if (v) {
         const params = {
           produceDate: v,
-          materialNo: this.form.materialNo,
-        };
+          materialNo: this.form.materialNo
+        }
 
         validateIsQuality(params)
           .then((res) => {
             if (Object.keys(res.data).length > 0) {
-              this.warningText = res.data["1005000162"];
-              this.form.validTill = res.data.validTillW;
+              this.warningText = res.data['1005000162']
+              this.form.validTill = res.data.validTillW
               if (this.warningText) {
-                this.dialogVisible = true;
+                this.dialogVisible = true
               }
             }
             // if (res.data === '1005000162') {
@@ -964,18 +960,18 @@ export default {
           })
           .catch((error) => {
             // 处理错误
-            console.log(error);
-          });
+            console.log(error)
+          })
       }
     },
     // 查询子组件物料编码列表
     fetchMaterialNoList(inStockId) {
-      this.$refs.materialOrder.inStockId = inStockId;
+      this.$refs.materialOrder.inStockId = inStockId
     },
     supplierChange(item) {
       if (item) {
-        const { code } = item;
-        this.fetchOrderNoList(code);
+        const { code } = item
+        this.fetchOrderNoList(code)
       }
     },
     // 查询子组件源单单号列表
@@ -983,53 +979,53 @@ export default {
       const params = {
         pageNo: 1,
         pageSize: 100,
-        supplierCode,
-      };
+        supplierCode
+      }
       getDropDownList(params)
         .then((res) => {
-          this.orderOptions = res.data || [];
+          this.orderOptions = res.data || []
         })
         .finally(() => {
-          this.loading = false;
-        });
+          this.loading = false
+        })
     },
     // 附件上传
     handleUpload() {
-      this.$refs.attachmentUpload.isUploadShow = -1;
-      this.$refs.attachmentUpload.title = "上传附件";
+      this.$refs.attachmentUpload.isUploadShow = -1
+      this.$refs.attachmentUpload.title = '上传附件'
       if (this.uploadFiles.length > 0) {
         // const { fileId } = this.uploadFiles[0].name
         const fileIds = this.uploadFiles.map((item) => {
-          const { fileId } = item.name;
-          return fileId;
-        });
+          const { fileId } = item.name
+          return fileId
+        })
         const params = {
-          files: fileIds.join(",") || null,
-        };
+          files: fileIds.join(',') || null
+        }
         getFilesById(params).then((res) => {
-          this.$refs.attachmentUpload.fileList = res.data || [];
-        });
+          this.$refs.attachmentUpload.fileList = res.data || []
+        })
       }
-      this.$refs.attachmentUpload.visible = true;
+      this.$refs.attachmentUpload.visible = true
     },
     // 获取上传的附件
     getFileList(data) {
-      this.uploadFiles = data;
+      this.uploadFiles = data
     },
     // 查看附件
     handleUploaded(data) {
-      this.$refs.attachmentUpload.fileList = data;
-      this.$refs.attachmentUpload.title = "查看附件";
-      this.$refs.attachmentUpload.isUploadShow = 0;
-      this.$refs.attachmentUpload.visible = true;
+      this.$refs.attachmentUpload.fileList = data
+      this.$refs.attachmentUpload.title = '查看附件'
+      this.$refs.attachmentUpload.isUploadShow = 0
+      this.$refs.attachmentUpload.visible = true
     },
     // 单位
     unitChange(v) {
-      const { name } = v;
-      this.form.unitCode = name;
-    },
-  },
-};
+      const { name } = v
+      this.form.unitCode = name
+    }
+  }
+}
 </script>
 <style scoped>
 .validateDate {

+ 11 - 6
src/views/wms/output/inrequest/components/InRequestForm.vue

@@ -45,11 +45,11 @@
         <el-form-item label="部门" prop="departmentNo">
           <DepartMentSelect
             ref="departMentSelect"
-            :disabled="formData.businessType ? false : true"
             v-model="formData.departmentNo"
-            @change="selectDepart"
+            :disabled="formData.businessType ? false : true"
             placeholder="请选择部门"
             clearable
+            @change="selectDepart"
           />
         </el-form-item>
       </el-col>
@@ -431,10 +431,15 @@ export default {
     "$route.query.id": {
       immediate: true,
       handler(newId) {
-        if (newId) {
-          this.open(newId);
-        } else {
-          this.reset();
+        // 只有当组件处于当前路由时才执行操作
+        if (
+          this.$route.path.includes("/outStorageManage/inrequest/InRequestForm")
+        ) {
+          if (newId) {
+            this.open(newId);
+          } else {
+            this.reset();
+          }
         }
       },
     },

+ 191 - 159
src/views/wms/quality/iqcInspection/components/AwaitIqcInspection.vue

@@ -1,9 +1,8 @@
 <template>
   <!-- 列表 -->
   <div>
-
     <AutoResizer :given-height="220">
-      <template #default="{height}">
+      <template #default="{ height }">
         <el-table
           v-if="columnsList.length > 0"
           v-loading="loading"
@@ -78,7 +77,10 @@
             prop="testStatus"
           >
             <template slot-scope="scope">
-              <dict-tag :type="DICT_TYPE.WMS_TEST_STATUS" :value="scope.row.testStatus" />
+              <dict-tag
+                :type="DICT_TYPE.WMS_TEST_STATUS"
+                :value="scope.row.testStatus"
+              />
             </template>
           </el-table-column>
           <el-table-column
@@ -146,14 +148,16 @@
                 icon="el-icon-magic-stick"
                 size="mini"
                 @click="handleInspection(scope.row)"
-              >检验执行</el-button>
+                >检验执行</el-button
+              >
               <el-button
                 type="text"
                 icon="el-icon-delete"
                 size="mini"
                 class="text-danger"
                 @click="handleDelete(scope.row)"
-              >删除</el-button>
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
@@ -177,45 +181,50 @@
       append-to-body
       @close="inspectClose"
     >
-      <span>
-        该检验项还未新增方案,请确定是否去新增方案
-      </span>
+      <span> 该检验项还未新增方案,请确定是否去新增方案 </span>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="open=false">取 消</el-button>
+        <el-button @click="open = false">取 消</el-button>
       </div>
     </el-dialog>
 
     <!-- 检验标准新增 -->
-    <UpdateInspection ref="updateInspection" @addComplete="addComplete" @choiceComplete="getList" />
+    <UpdateInspection
+      ref="updateInspection"
+      @addComplete="addComplete"
+      @choiceComplete="getList"
+    />
     <!-- <UpdateInspection ref="updateInspection" @updateCase="getList" @addComplete="getList" /> -->
   </div>
-
 </template>
 
 <script>
-import { getIqcInspectionPage, createMaterialItemResult, deleteInspection } from '@/api/wms/quality/iqcInspectionExecute'
-import UpdateInspection from './UpdateInspection.vue'
-import { getFormColumnsList } from '@/api/system/saveColumns/index'
-import { mapGetters } from 'vuex'
-import { isArray } from 'min-dash'
+import {
+  getIqcInspectionPage,
+  createMaterialItemResult,
+  deleteInspection,
+} from "@/api/wms/quality/iqcInspectionExecute";
+import UpdateInspection from "./UpdateInspection.vue";
+import { getFormColumnsList } from "@/api/system/saveColumns/index";
+import { mapGetters } from "vuex";
+import { isArray } from "min-dash";
 
 export default {
-  name: 'AwaitIqcInspection',
+  name: "AwaitIqcInspection",
   components: {
-    UpdateInspection
+    UpdateInspection,
   },
   props: {
-    'activeName': {
+    activeName: {
       type: String,
-      default: ''
+      default: "",
     },
-    'queryParamspro': {
+    queryParamspro: {
       type: Object,
-      default: () => {}
-    }
+      default: () => {},
+    },
   },
-  inject: ['paramsQuery'],
+  inject: ["paramsQuery"],
   data() {
     return {
       // 遮罩层
@@ -231,7 +240,7 @@ export default {
       //   用户列表
       users: [],
       // 弹出层标题
-      title: '',
+      title: "",
       //   是否显示查看弹出层
       viewOpen: false,
       advParams: {},
@@ -239,92 +248,94 @@ export default {
       queryParams: {
         pageNo: 1,
         pageSize: 10,
-        auditStatus: -1
+        auditStatus: -1,
       },
       excueParams: {},
       //   表单参数
       form: {
-        code: ''
+        code: "",
       },
       // 表单校验
       rules: {
-        code: [{
-          required: true,
-          message: '检验类别不能为空',
-          trigger: 'change'
-        }]
+        code: [
+          {
+            required: true,
+            message: "检验类别不能为空",
+            trigger: "change",
+          },
+        ],
       },
       // 显示隐藏列参数
       columns: [
-        { key: 0, label: '物料批次', visible: true },
-        { key: 1, label: '送货批次', visible: true },
-        { key: 2, label: '采购订单', visible: true },
-        { key: 3, label: '采购数量', visible: true },
-        { key: 4, label: '物料编码', visible: true },
-        { key: 5, label: '物料名称', visible: true },
-        { key: 6, label: '到货数量', visible: true },
-        { key: 7, label: '检验状态', visible: true },
-        { key: 8, label: '单位', visible: true },
-        { key: 9, label: '供应商', visible: true },
-        { key: 10, label: '存储条件', visible: true },
-        { key: 11, label: '登记时间', visible: true },
-        { key: 12, label: '登记人', visible: true },
-        { key: 13, label: '累计已到货数量', visible: true },
-        { key: 14, label: '检验单号', visible: true },
-        { key: 15, label: '检验数量', visible: true },
-        { key: 16, label: '审核状态', visible: true },
-        { key: 17, label: '审核人', visible: true },
-        { key: 18, label: '审核时间', visible: true },
-        { key: 19, label: '检验时间', visible: true },
-        { key: 20, label: '检验人', visible: true },
-        { key: 21, label: '处理结果', visible: true },
-        { key: 22, label: '检验结果', visible: true }
+        { key: 0, label: "物料批次", visible: true },
+        { key: 1, label: "送货批次", visible: true },
+        { key: 2, label: "采购订单", visible: true },
+        { key: 3, label: "采购数量", visible: true },
+        { key: 4, label: "物料编码", visible: true },
+        { key: 5, label: "物料名称", visible: true },
+        { key: 6, label: "到货数量", visible: true },
+        { key: 7, label: "检验状态", visible: true },
+        { key: 8, label: "单位", visible: true },
+        { key: 9, label: "供应商", visible: true },
+        { key: 10, label: "存储条件", visible: true },
+        { key: 11, label: "登记时间", visible: true },
+        { key: 12, label: "登记人", visible: true },
+        { key: 13, label: "累计已到货数量", visible: true },
+        { key: 14, label: "检验单号", visible: true },
+        { key: 15, label: "检验数量", visible: true },
+        { key: 16, label: "审核状态", visible: true },
+        { key: 17, label: "审核人", visible: true },
+        { key: 18, label: "审核时间", visible: true },
+        { key: 19, label: "检验时间", visible: true },
+        { key: 20, label: "检验人", visible: true },
+        { key: 21, label: "处理结果", visible: true },
+        { key: 22, label: "检验结果", visible: true },
       ],
       // 显示隐藏持久化参数
-      columnsList: []
-    }
+      columnsList: [],
+    };
   },
   computed: {
-    ...mapGetters([
-      'userId'
-    ])
+    ...mapGetters(["userId"]),
   },
   watch: {
     // 监听路由参数的变化
-    '$route'() {
+    $route() {
       // 判断 id 是否存在并调用 getList 方法
       if (this.$route.query) {
-        this.getList()
+        this.getList();
       }
-    }
+    },
   },
   created() {
     // 获取显隐列列表
-    this.getColumnsList()
-    this.getList()
+    this.getColumnsList();
+    this.getList();
   },
   methods: {
     /** 查询列表 */
     getList() {
-      this.loading = true
+      this.loading = true;
       // 执行查询
       const params = {
         ...this.paramsQuery,
         ...this.queryParams,
-        ...this.advParams
-      }
-      getIqcInspectionPage(params).then(response => {
-        this.list = response.data.list
-        this.users = response.data.users
-        this.total = response.data.total
-      }).finally(() => {
-        this.loading = false
-      })
+        ...this.advParams,
+      };
+      getIqcInspectionPage(params)
+        .then((response) => {
+          this.list = response.data.list;
+          this.users = response.data.users;
+          this.total = response.data.total;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
     },
     /** 取消按钮 */
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     /** 表单重置 */
     reset() {
@@ -337,14 +348,14 @@ export default {
         wmsStoreId: undefined,
         inQty: undefined,
         funitId: undefined,
-        remark: undefined
-      }
-      this.resetForm('form')
+        remark: undefined,
+      };
+      this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNo = 1
-      this.getList()
+      this.queryParams.pageNo = 1;
+      this.getList();
     },
     // handleName(row, column, cellValue) {
     //   const user = this.users.find(item => item.id.toString() === cellValue)
@@ -352,49 +363,65 @@ export default {
     // },
     // 检验执行
     async handleInspection(row) {
-      const { materialNo, materialLots, masterId, groupMasterId, auditStatus, materialName, processNo, unitCode } = row
+      const {
+        materialNo,
+        materialLots,
+        masterId,
+        groupMasterId,
+        auditStatus,
+        materialName,
+        processNo,
+        unitCode,
+      } = row;
       this.excueParams = {
         materialLots,
         materialNo,
-        processNo
-      }
+        processNo,
+      };
       if (!masterId && !groupMasterId) {
-        this.open = true
-        this.form.materialNo = materialNo
-        this.form.name = materialName
-        this.form.code = masterId
+        this.open = true;
+        this.form.materialNo = materialNo;
+        this.form.name = materialName;
+        this.form.code = masterId;
       }
       if (!masterId && groupMasterId) {
-        this.excueParams.wmsMaterialItemMasterId = groupMasterId
+        this.excueParams.wmsMaterialItemMasterId = groupMasterId;
       }
       if ((masterId && !groupMasterId) || (masterId && groupMasterId)) {
-        this.excueParams.wmsMaterialItemMasterId = masterId
+        this.excueParams.wmsMaterialItemMasterId = masterId;
       }
-      createMaterialItemResult(this.excueParams)
-        .then(({ code, data, msg }) => {
-          if (code === 0) {
-            // 跳转到检验执行
-            //  麦禾田  path: '/wmsquality/iqcInspection/inspect-details',
-            // 东苏发  path: '/quality/iqcInspection/inspect-details',
-            this.$router.push({
-              path: '/quality/iqcInspection/inspect-details',
-              query: { auditStatus, materialName, materialLots, materialNo, processNo, type: 0, unitCode },
-              replace: true
-            })
-            return
-          }
-          if (data.code !== 0) {
-            this.$modal.msgWarning(data?.msg)
-            this.$refs.updateInspection.btnText = 'add'
-            this.$refs.updateInspection.visible = true
-            this.$refs.updateInspection.commitDisable = true
-            this.$refs.updateInspection.queryObj.version = '草稿'
-            this.$refs.updateInspection.queryParams.type = 0
-            this.$refs.updateInspection.queryParams.materialNo = materialNo
-            this.$refs.updateInspection.queryParams.name = materialName
-            this.$refs.updateInspection.queryParams.processNo = 'PURCHASE'
+      createMaterialItemResult(this.excueParams).then(({ code, data, msg }) => {
+        if (code === 0) {
+          // 跳转到检验执行
+          //  麦禾田  path: '/wmsquality/iqcInspection/inspect-details',
+          // 东苏发  path: '/quality/iqcInspection/inspect-details',
+          this.$router.push({
+            path: "/quality/iqcInspection/inspect-details",
+            query: {
+              auditStatus,
+              materialName,
+              materialLots,
+              materialNo,
+              processNo,
+              type: 0,
+              unitCode,
+            },
+            replace: true,
+          });
+        } else {
+          if (data?.code !== 0) {
+            this.$modal.msgWarning(data?.msg);
+            this.$refs.updateInspection.btnText = "add";
+            this.$refs.updateInspection.visible = true;
+            this.$refs.updateInspection.commitDisable = true;
+            this.$refs.updateInspection.queryObj.version = "草稿";
+            this.$refs.updateInspection.queryParams.type = 0;
+            this.$refs.updateInspection.queryParams.materialNo = materialNo;
+            this.$refs.updateInspection.queryParams.name = materialName;
+            this.$refs.updateInspection.queryParams.processNo = "PURCHASE";
           }
-        })
+        }
+      });
       // this.$refs.inspectDetail.queryParams.materialLots = materialLots
       // this.$refs.inspectDetail.queryParams.materialNo = materialNo
       // this.$refs.inspectDetail.apiStatus = auditStatus
@@ -406,63 +433,68 @@ export default {
       // this.$refs.inspectDetail.queryParams.type = 0
     },
     submitForm() {
-      const { code, materialNo, name } = this.form
-      this.excueParams.wmsMaterialItemMasterId = code
-      this.$refs.updateInspection.btnText = 'add'
-      this.$refs.updateInspection.commitDisable = true
-      this.$refs.updateInspection.queryObj.version = '草稿'
-      this.$refs.updateInspection.queryParams.type = 0
-      this.$refs.updateInspection.queryParams.materialNo = materialNo
-      this.$refs.updateInspection.queryParams.name = name
-      this.$refs.updateInspection.queryParams.processNo = 'PURCHASE'
-      this.$refs.updateInspection.visible = true
+      const { code, materialNo, name } = this.form;
+      this.excueParams.wmsMaterialItemMasterId = code;
+      this.$refs.updateInspection.btnText = "add";
+      this.$refs.updateInspection.commitDisable = true;
+      this.$refs.updateInspection.queryObj.version = "草稿";
+      this.$refs.updateInspection.queryParams.type = 0;
+      this.$refs.updateInspection.queryParams.materialNo = materialNo;
+      this.$refs.updateInspection.queryParams.name = name;
+      this.$refs.updateInspection.queryParams.processNo = "PURCHASE";
+      this.$refs.updateInspection.visible = true;
     },
     // 删除检验项
     handleDelete(row) {
-      const { id, materialLots } = row
-      this.$modal.confirm('是否确认物料批次为"' + materialLots + '"的数据项?').then(function() {
-        return deleteInspection(id)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {})
+      const { id, materialLots } = row;
+      this.$modal
+        .confirm('是否确认物料批次为"' + materialLots + '"的数据项?')
+        .then(function () {
+          return deleteInspection(id);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
     },
     inspectRefresh() {
-      this.getList()
-      this.$emit('inspectComplete')
+      this.getList();
+      this.$emit("inspectComplete");
     },
     inspectClose() {
-      this.form.code = undefined
+      this.form.code = undefined;
     },
     addComplete() {
-      this.getList()
-      this.open = false
+      this.getList();
+      this.open = false;
     },
     // 获取显示隐藏列
     getColumnsList() {
-      const { componentName } = this.$route.meta || null
+      const { componentName } = this.$route.meta || null;
       const params = {
         userId: this.userId,
-        vueForm: componentName
-      }
-      getFormColumnsList(params).then(res => {
-        if (isArray(res.data)) {
-          this.columnsList = res.data.length === 0 ? this.columns : res.data
-        } else {
-          this.columnsList = this.columns
-        }
-      }).catch((err) => {
-        if (err) {
-          this.columnsList = this.columns
-        }
-      }).finally(() => {
-        this.$emit('columns', this.columnsList)
-      })
-    }
-  }
-}
+        vueForm: componentName,
+      };
+      getFormColumnsList(params)
+        .then((res) => {
+          if (isArray(res.data)) {
+            this.columnsList = res.data.length === 0 ? this.columns : res.data;
+          } else {
+            this.columnsList = this.columns;
+          }
+        })
+        .catch((err) => {
+          if (err) {
+            this.columnsList = this.columns;
+          }
+        })
+        .finally(() => {
+          this.$emit("columns", this.columnsList);
+        });
+    },
+  },
+};
 </script>
 
-    <style>
-
-    </style>
+<style></style>