Переглянути джерело

feat(inspectionWork): 优化工单详情跳转逻辑

yusheng 5 днів тому
батько
коміт
cf3c970a6f

+ 25 - 2
src/api/inspectionPlan/index.js

@@ -46,6 +46,30 @@ export async function purchaseorderreceive(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// 采购收货单
+
+export async function purchaseorderreceivePage(params) {
+  const res = await request.get(`/eom/purchaseorderreceive/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 受托收货单
+
+export async function saleentrustedreceive(params) {
+  const res = await request.get(`/eom/saleentrustedreceive/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 采购收货单 详情
 
 export async function purchaseorderreceiveGetById(id) {
@@ -160,7 +184,7 @@ export async function getBatchInfoData(params) {
 // 详情接口
 
 export async function getDetailInfo(id) {
-  console.log('请求没有 1111')
+  console.log('请求没有 1111');
   const res = await request.get(`/main/category/info/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
@@ -219,5 +243,4 @@ export async function checkTemplateById(id) {
   if (res.data.code == 0) {
     return res.data;
   }
-
 }

+ 47 - 12
src/views/inspectionWork/components/inspectionWorkList.vue

@@ -41,12 +41,12 @@
       </template>
 
       <template v-slot:sourceCode="{ row }">
-        <span>
+        <!-- <span>
           {{
             row.qualityPlanCode ? row.qualityPlanCode : row.workOrderCode
           }}</span
-        >
-        <!-- <el-link
+        > -->
+        <el-link
           type="primary"
           :underline="false"
           @click="openWorkDetails(row)"
@@ -54,7 +54,7 @@
           {{
             row.qualityPlanCode ? row.qualityPlanCode : row.workOrderCode
           }}</el-link
-        > -->
+        >
       </template>
 
       <template v-slot:files="scope">
@@ -338,7 +338,11 @@
   import { inspectionProjectStatus } from '@/enum/dict.js';
   import { recordingMethodList } from '@/utils/util.js';
   import certificate from '@/views/certificateManagement/components/certificate.vue';
-
+  import {
+    purchaseorderreceivePage,
+    saleentrustedreceive
+  } from '@/api/inspectionPlan/index.js';
+  import { produceOrder } from '@/api/aps/index.js';
   export default {
     name: 'InspectionWorkList',
     mixins: [dictMixins, tabMixins],
@@ -953,16 +957,47 @@
         });
       },
       async openWorkDetails(row) {
-        if (row.qualityPlanCode) {
+        let url = '';
+        if (row.qualityPlanId) {
           const data = await planDetails(row.qualityPlanId);
-          window.history.pushState(
-            null,
-            '',
-            `/page-eos/purchaseOrder?isView=true&id=${data.data.planSourceId}&activeComp=invoice`
-          );
+          const { planSource, planSourceCode } = data.data;
+          if (planSource == 1) {
+            const list = await purchaseorderreceivePage({
+              pageNum: 1,
+              size: 20,
+              receiveNo: planSourceCode
+            });
+            if (list?.list.length) {
+              url = `/page-eos/purchaseOrder?isView=true&id=${list.list[0].id}&activeComp=invoice`;
+            }
+          }
+          if (planSource == 5) {
+            const list = await saleentrustedreceive({
+              pageNum: 1,
+              size: 20,
+              code: planSourceCode
+            });
+            if (list?.list.length) {
+              url = `/page-eos/saleManage/saleOrder?isView=true&id=${list.list[0].id}&activeComp=entrustedReceive`;
+            }
+          }
         } else {
-          this.$refs.mesWorkOrderRef.open(row);
+          if (row.workOrderCode) {
+            const list = await produceOrder({
+              pageNum: 1,
+              size: 20,
+              code: row.workOrderCode
+            });
+            url = `/page-mes/produceOrder?isWt=true&item=${JSON.stringify(
+              list.list[0]
+            )}`;
+          }
+        }
+
+        if (!url) {
+          return;
         }
+        window.history.pushState(null, '', url);
       },
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);

+ 306 - 307
src/views/unqualifiedProduct/unqualifiedList/keepsample/index.vue

@@ -13,10 +13,20 @@
         :cache-key="cacheKeyUrl"
       >
         <template v-slot:action="{ row }">
+          <el-link
+            slot="reference"
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            v-if="row.status == 0"
+            @click="disposeList(row)"
+          >
+            处置
+          </el-link>
           <el-popconfirm
             class="ele-action"
             title="确定要删除吗?"
-            v-if="row.status == 1"
+            v-if="row.status ==0"
             @confirm="remove(row)"
           >
             <template v-slot:reference>
@@ -25,16 +35,6 @@
               </el-link>
             </template>
           </el-popconfirm>
-          <el-link
-            slot="reference"
-            type="primary"
-            :underline="false"
-            icon="el-icon-edit"
-            v-if="row.status == 0"
-            @click="disposeList(row)"
-          >
-            处置
-          </el-link>
         </template>
       </ele-pro-table>
     </el-card>
@@ -43,310 +43,309 @@
 </template>
 
 <script>
-import OrderSearch from '../components/probationalGoods-search.vue';
-import SalesToProduction from '../components/salesToProduction.vue';
-import dictMixins from '@/mixins/dictMixins';
-
-import tabMixins from '@/mixins/tableColumnsMixin';
-import {
-  getKeepsampleList,
-  deleteScrapProducts
-} from '@/api/unacceptedProduct/index';
-export default {
-  components: {
-    OrderSearch,
-    SalesToProduction
-  },
-  mixins: [dictMixins, tabMixins],
-  data() {
-    return {
-      cacheKeyUrl: 'qms-c2e9664a-keepsample',
-      loading: false,
-      dialogVisible: false,
-      current: null,
-      selection: [],
-      disposeType: '',
-      releasParams: {
-        teamId: '',
-        id: ''
-      }
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      return [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'code',
-          label: '编码',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'sampleCode',
-          label: '样品编码',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryCode',
-          label: '物品编码',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'categoryName',
-          label: '物品名称',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'batchNo',
-          label: '批次号',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'brandNum',
-          label: '牌号',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'modelType',
-          label: '型号',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          label: '机型',
-          prop: 'modelKey',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          label: '颜色',
-          prop: 'colorKey',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'measureQuantity',
-          label: '计量数量',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-
-        {
-          prop: 'measureUnit',
-          label: '计量单位',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'weight',
-          label: '重量',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'weightUnit',
-          label: '重量单位',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        //
-        {
-          prop: 'sampleCondition',
-          label: '留样条件',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'producerManufacturer',
-          label: '生产商/受托生产',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'samplePlace',
-          label: '留样地点',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'sampleRemark',
-          label: '留样备注',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'sampleDate',
-          label: '留样日期',
-          align: 'center',
-          width: 100,
-          showOverflowTooltip: true
-        },
-        //
-        // {
-        //   prop: 'disposeTime',
-        //   label: '处置时间',
-        //   align: 'center',
-        //   width: 180,
-        //   showOverflowTooltip: true
-        // },
-        {
-          prop: 'produceRoutingName',
-          label: '工艺路线',
-          align: 'center'
-        },
-        {
-          prop: 'produceTaskName',
-          label: '工序',
-          align: 'center'
-        },
-        {
-          prop: 'unqualifiedReason',
-          label: '原因',
-          align: 'center'
-        },
-
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          width: 160
-        },
-        // {
-        //   prop: 'reviewerName',
-        //   label: '创建人',
-        //   align: 'center'
-        // },
-        {
-          prop: 'depotName',
-          label: '仓库名称',
-          align: 'center'
-        },
-        {
-          prop: 'status',
-          label: '状态',
-          align: 'center',
-          formatter: (row, column, cellValue) => {
-            return cellValue == 0 ? '未入库' : cellValue == 1 ? '已入库' : '';
-          }
-        }
+  import OrderSearch from '../components/probationalGoods-search.vue';
+  import SalesToProduction from '../components/salesToProduction.vue';
+  import dictMixins from '@/mixins/dictMixins';
 
-        // {
-        //   columnKey: 'action',
-        //   label: '操作',
-        //   width: 150,
-        //   align: 'center',
-        //   resizable: false,
-        //   fixed: 'right',
-        //   slot: 'action',
-        //   showOverflowTooltip: true
-        // }
-      ];
-    }
-  },
-  created() {},
-  filters: {},
-  methods: {
-    /* 表格数据源 */
-    datasource({ page, limit, where }) {
-      return getKeepsampleList({
-        pageNum: page,
-        size: limit,
-        ...where
-      });
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import {
+    getKeepsampleList,
+    deleteScrapProducts
+  } from '@/api/unacceptedProduct/index';
+  export default {
+    components: {
+      OrderSearch,
+      SalesToProduction
     },
-    remove(row) {
-      let ids = row ? [row.id] : this.selection.map((item) => item.id);
-      deleteScrapProducts(ids).then((res) => {
-        this.$message.success('删除' + res);
-        this.reload();
-      });
+    mixins: [dictMixins, tabMixins],
+    data() {
+      return {
+        cacheKeyUrl: 'qms-c2e9664a-keepsample',
+        loading: false,
+        dialogVisible: false,
+        current: null,
+        selection: [],
+        disposeType: '',
+        releasParams: {
+          teamId: '',
+          id: ''
+        }
+      };
     },
-    open(type) {
-      let isCode = true,
-        isBatchNo = true;
-      this.selection.forEach((item) => {
-        this.selection.forEach((item1) => {
-          if (item.productCodeNew != item1.productCodeNew) {
-            isCode = false;
-          }
-          if (item.batchNo != item1.batchNo) {
-            isBatchNo = false;
+    computed: {
+      // 表格列配置
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'sampleCode',
+            label: '样品编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            label: '机型',
+            prop: 'modelKey',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '颜色',
+            prop: 'colorKey',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureQuantity',
+            label: '计量数量',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          //
+          {
+            prop: 'sampleCondition',
+            label: '留样条件',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'producerManufacturer',
+            label: '生产商/受托生产',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'samplePlace',
+            label: '留样地点',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'sampleRemark',
+            label: '留样备注',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'sampleDate',
+            label: '留样日期',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true
+          },
+          //
+          // {
+          //   prop: 'disposeTime',
+          //   label: '处置时间',
+          //   align: 'center',
+          //   width: 180,
+          //   showOverflowTooltip: true
+          // },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center'
+          },
+          {
+            prop: 'produceTaskName',
+            label: '工序',
+            align: 'center'
+          },
+          {
+            prop: 'unqualifiedReason',
+            label: '原因',
+            align: 'center'
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            width: 160
+          },
+          // {
+          //   prop: 'reviewerName',
+          //   label: '创建人',
+          //   align: 'center'
+          // },
+          {
+            prop: 'depotName',
+            label: '仓库名称',
+            align: 'center'
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 0 ? '未入库' : cellValue == 1 ? '已入库' : '';
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action',
+            showOverflowTooltip: true
           }
-        });
-      });
-      if (!isCode) {
-        this.$message.error('产品编码不一致!');
-        return;
+        ];
       }
-      if (!isBatchNo) {
-        this.$message.error('批次号不一致!');
-        return;
-      }
-      this.$refs.salesToProductionRef.open(this.selection, type);
     },
-    async disposeList(row) {
-      if (row && row.id) {
-        this.current = row;
-        this.dialogVisible = true;
-        return;
+    created() {},
+    filters: {},
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return getKeepsampleList({
+          pageNum: page,
+          size: limit,
+          ...where
+        });
+      },
+      remove(row) {
+        let ids = row ? [row.id] : this.selection.map((item) => item.id);
+        deleteScrapProducts(ids).then((res) => {
+          this.$message.success('删除' + res);
+          this.reload();
+        });
+      },
+      open(type) {
+        let isCode = true,
+          isBatchNo = true;
+        this.selection.forEach((item) => {
+          this.selection.forEach((item1) => {
+            if (item.productCodeNew != item1.productCodeNew) {
+              isCode = false;
+            }
+            if (item.batchNo != item1.batchNo) {
+              isBatchNo = false;
+            }
+          });
+        });
+        if (!isCode) {
+          this.$message.error('产品编码不一致!');
+          return;
+        }
+        if (!isBatchNo) {
+          this.$message.error('批次号不一致!');
+          return;
+        }
+        this.$refs.salesToProductionRef.open(this.selection, type);
+      },
+      async disposeList(row) {
+        if (row && row.id) {
+          this.current = row;
+          this.dialogVisible = true;
+          return;
+        }
+        let ids = this.current
+          ? [this.current.id]
+          : this.selection.map((item) => item.id);
+        await dispose({
+          id: ids,
+          disposeType: Number(this.disposeType)
+        });
+        this.dialogVisible = false;
+        this.current = null;
+        this.$message.success('处置成功!');
+        this.getList();
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
       }
-      let ids = this.current
-        ? [this.current.id]
-        : this.selection.map((item) => item.id);
-      await dispose({
-        id: ids,
-        disposeType: Number(this.disposeType)
-      });
-      this.dialogVisible = false;
-      this.current = null;
-      this.$message.success('处置成功!');
-      this.getList();
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$nextTick(() => {
-        this.$refs.table.reload({ page: 1, where });
-      });
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped></style>