695593266@qq.com 8 сар өмнө
parent
commit
f3161ed133

+ 8 - 1
src/api/produce/index.js

@@ -156,4 +156,11 @@ export async function isJuRen(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-// http://localhost:8084/api/main/asset/pdaPage?categoryLevelId=9&keyWord=&pageNum=1&size=100&taskId=1894207928134549506
+
+export async function pleaseEntrustManagement(data) {
+  const res = await request.post(`/mes/please_entrust_management/add`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 38 - 9
src/views/produce/components/outsourcing/index.vue

@@ -212,12 +212,13 @@
             style="width: 260px"
           ></el-input>
         </el-form-item>
-        <el-form-item label="请托到:" prop="taskIds">
+        <el-form-item label="请托到:" prop="taskIdes">
           <el-select
-            v-model="taskIds"
+            v-model="attributeData.taskIdes"
             placeholder="请选择"
             style="width: 260px"
             @change="changeTaskId"
+            multiple
           >
             <el-option
               v-for="item in newStepsList"
@@ -269,7 +270,7 @@
 
         <el-form-item label="请托单位:">
           <el-select
-            v-model="attributeData.taskIds"
+            v-model="attributeData.factoriesId"
             placeholder="请选择"
             style="width: 260px"
             @change="changeTaskId"
@@ -314,7 +315,7 @@
         <el-form-item label="交付交期:" prop="requireDeliveryTime">
           <el-date-picker
             v-model="attributeData.requireDeliveryTime"
-            value-format="yyyy-MM-dd HH:mm:ss"
+            value-format="yyyy-MM-dd"
             style="width: 260px"
             type="date"
             placeholder="选择日期"
@@ -362,7 +363,9 @@
           produceRoutingId: '', //工艺路线id
           supplierId: '', //供应商id
           supplierName: '',
-          taskIdes: []
+          taskIdes: [],
+          factoriesId: '',
+          factoriesName: ''
         },
         isInWarehouse: true,
         produceList: [],
@@ -532,9 +535,11 @@
       handleClick(tab, event) {
         this.activeName = tab._props.name;
         if (this.activeName == '1') {
-          this.attributeData.name = this.outsourceFormVal.name + '委托';
+          this.resetData();
+          this.attributeData.name = this.taskName + '委托';
         } else if (this.activeName == '2') {
-          this.attributeData.name = this.outsourceFormVal.name + '请托';
+          this.resetData();
+          this.attributeData.name = this.taskName + '请托';
         }
       },
 
@@ -596,12 +601,26 @@
         }
       },
 
+      resetData() {
+        this.attributeData.type = '';
+        this.attributeData.sceneText = '';
+        this.attributeData.taskIds = '';
+        this.attributeData.isFirstTask = '';
+        this.attributeData.clientEnvironmentId = 1;
+        this.attributeData.requireDeliveryTime = '';
+        this.attributeData.warehouseId = '';
+        this.attributeData.produceRoutingId = '';
+        this.attributeData.supplierId = '';
+        this.attributeData.taskIdes = [];
+        this.attributeData.factoriesId = '';
+      },
+
       //跳转
 
       confirm() {
         this.$refs.form.validate((valid) => {
           if (valid) {
-            console.log(this.attributeData, '11111187887877');
+            // if (this.activeName == '1') {
             if (this.attributeData.supplierId) {
               const obj = this.gysList.find(
                 (item) => item.id === this.attributeData.supplierId
@@ -609,7 +628,17 @@
               this.attributeData.supplierName = obj ? obj.name : '';
             }
             this.attributeData.taskIds = this.attributeData.taskIdes.join(',');
-            this.$emit('changePlugIn', this.attributeData);
+            this.$emit('changePlugIn', this.attributeData, this.activeName);
+            // } else if (this.activeName == '2') {
+            //   const obj = this.factoryList.find(
+            //     (item) => item.id === this.attributeData.factoriesId
+            //   );
+            //   this.attributeData.factoriesName = obj ? obj.name : '';
+            //   this.attributeData.taskIds =
+            //     this.attributeData.taskIdes.join(',');
+            //   console.log(this.attributeData);
+            //   this.$emit('changePlugIn', this.attributeData, this.activeName);
+            // }
           } else {
             console.log('error submit!!');
             return false;

+ 11 - 3
src/views/produce/index.vue

@@ -363,7 +363,8 @@
     listTask,
     factoryworkstationPage,
     nextTask,
-    singleListTask
+    singleListTask,
+    pleaseEntrustManagement
   } from '@/api/produce/index';
   import prenatalExamination from './components/prenatalExamination/index.vue';
 
@@ -690,9 +691,9 @@
       },
 
       // 切换组件
-      async changePlugIn(e) {
+      async changePlugIn(e, index) {
+        // if (index == '1') {
         this.outObj = e;
-
         let req = {
           taskId: e.taskId,
           taskIds: e.taskIds,
@@ -705,6 +706,13 @@
 
         this.isStep = false;
         this.isOutsource = true;
+        // } else if (index == '2') {
+        //   this.outObj = e;
+
+        //   const res = await pleaseEntrustManagement(this.outObj);
+
+        //   console.log(res, '请托的结果');
+        // }
       },
 
       workSelect(data) {

+ 19 - 1
src/views/produceOrder/index.vue

@@ -52,6 +52,8 @@
           <el-button type="success" @click="cardPrinting()"
             >工艺卡打印</el-button
           >
+
+          <el-button type="success" @click="originCode()">朔源码</el-button>
         </template>
 
         <template v-slot:code="{ row }">
@@ -209,6 +211,8 @@
       @createSuccess="createSuccess"
       v-if="dispatchVisible"
     />
+
+    <originCode ref="originCodeRef" />
   </div>
 </template>
 
@@ -240,6 +244,7 @@
 
   import { debounce } from 'lodash';
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import originCode from './originCode.vue';
 
   export default {
     mixins: [tableColumnsMixin],
@@ -256,7 +261,8 @@
       detailsPop,
       EquipmentDialog,
       xlhView,
-      workReport
+      workReport,
+      originCode
     },
 
     data() {
@@ -825,6 +831,18 @@
         this.reload();
       },
 
+      originCode() {
+        if (!this.selection.length) {
+          return this.$message.warning('请至少选择一条工单!');
+        }
+
+        if (this.selection.length > 1) {
+          return this.$message.warning('只能选择一条工单');
+        }
+
+        this.$refs.originCodeRef.open(this.selection[0].id);
+      },
+
       /* 表格数据源 */
       async datasource({ page, limit, where, order }) {
         // console.log('1123',where)

+ 139 - 0
src/views/produceOrder/originCode.vue

@@ -0,0 +1,139 @@
+<template>
+  <ele-modal
+    title="朔源码"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="800px"
+    :maxable="true"
+  >
+    <div id="printSection">
+      <div
+        style="
+          position: relative;
+          width: 98mm;
+          height: 70mm;
+          box-sizing: border-box;
+          font-size: 10px;
+          color: green;
+          margin: 0 auto;
+          font-weight: 700;
+        "
+      >
+        <div
+          style="
+            display: flex;
+            flex-direction: row;
+            width: 260px;
+            height: 260px;
+          "
+        >
+          <img style="width: 100%; height: 100%" :src="url" />
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import QRCode from 'qrcode';
+  export default {
+    data() {
+      return {
+        batchNo: '',
+        createDate: '',
+        enforceStandards: '',
+        layBy: '',
+        level: '',
+        netWeight: '',
+        notice: '',
+        productName: '',
+        purchaseOrigins: '',
+        specification: '',
+        warrantyPeriod: '',
+        warrantyPeriodUnit: '',
+        weightUnit: '',
+        url: '',
+        workOrderId: '',
+        qrCodeUrl: '',
+        QRvisible: false
+      };
+    },
+    mounted() {},
+
+    methods: {
+      open(workOrderId) {
+        this.QRvisible = true;
+        this.workOrderId = workOrderId;
+
+        this.qrCodeUrl =
+          window.location.origin + `/traceability?id=${this.workOrderId}`;
+        // this.qrCodeUrl = `http://192.168.1.22:9999/traceability?id=${this.workOrderId}`;
+
+        this.$nextTick(() => {
+          this.generateQRCodes();
+        });
+      },
+
+      generateQRCodes() {
+        if (this.workOrderId) {
+          QRCode.toDataURL(this.qrCodeUrl)
+            .then((url) => {
+              // item.qrcode = url;
+              this.url = url;
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        }
+      },
+
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+
+      // print() {
+      //   const printSection = document.getElementById('printSection');
+      //   // 创建打印任务
+      //   const printWindow = window.open('', '_blank');
+      //   printWindow.document.open();
+      //   printWindow.document.write('<html><head><title>打印预览</title>');
+      //   printWindow.document.write(
+      //     '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+      //   );
+      //   printWindow.document.write('</head><body>');
+      //   printWindow.document.write(printSection.innerHTML);
+      //   printWindow.document.write('</body></html>');
+      //   printWindow.document.close();
+      //   // printWindow.onload = function () {
+      //   //   printWindow.print();
+      //   // };
+      // }
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 1 - 1
src/views/produceOrder/workReport.vue

@@ -594,8 +594,8 @@
       },
 
       open(row) {
+        this.curTaskObj = null;
         this.workOrderInfo = row;
-        console.log(row, 'workOrderInfo');
         this.routeObj.id = this.workOrderInfo.id;
         this.getTaskFn();
         this.drawer = true;