From fcf84a57f9e7b938e9fde2b93d5e71adfd62fb43 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期日, 07 九月 2025 00:51:05 +0800
Subject: [PATCH] 派工界面增加选择主管工艺

---
 src/views/flowmgr/taskassign.vue |  127 +++++++++++++++++++++++++++++++++---------
 1 files changed, 99 insertions(+), 28 deletions(-)

diff --git a/src/views/flowmgr/taskassign.vue b/src/views/flowmgr/taskassign.vue
index 74e16b6..66c4599 100644
--- a/src/views/flowmgr/taskassign.vue
+++ b/src/views/flowmgr/taskassign.vue
@@ -8,7 +8,7 @@
 -->
 <template>
   <basic-container>
-    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit">
+    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit"><!-- -->
       <template #machineCode="{}">
         <el-tree-select ref="tree" filterable  v-model="attachForm.machineCode"
          node-key="machineCode"
@@ -22,6 +22,15 @@
           >
         </el-autocomplete>
       </template>
+
+      <template #programmer="{}">
+        <el-autocomplete ref="autoProgrammer" :disabled="drawingNoMatch"  v-model="attachForm.programmer"
+        :fetch-suggestions="queryProgrammerAsync"
+        :trigger-on-focus="false" @select="handleProgrammerSelect"
+          >
+        </el-autocomplete>
+      </template>
+
     </avue-form>
   </basic-container>
 </template>
@@ -36,6 +45,8 @@
     'attachForm.drawingNo': function (val) {
       if(val && this.attachForm.processNo && this.attachForm.processEdition) {
         this.attachForm.title = `${val}-${this.attachForm.processNo}-${this.attachForm.processEdition}-璁″垝浠诲姟`;
+
+        
       }
     },
     'attachForm.processNo': function (val) {
@@ -64,6 +75,7 @@
         isLeaf: (data) => !data.hasChildren
       },
       timeout:0, //闆朵欢鍙峰姞杞界殑timeout
+      drawingNoMatch:true,//闆朵欢鍙锋槸鍚﹀尮閰嶅垎宸ヨ〃
       attachOption: {
         labelWidth: 160,
         submitBtn: true,
@@ -85,7 +97,8 @@
             span: 12,
             dataType: 'string',
             blur: (col) => {
-              this.handleTrim(col)
+              this.handleTrim(col);
+              
             },
             rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
           },
@@ -158,23 +171,7 @@
               this.handleTrim(col)
             },
           },
-          /*{
-            label: '鍔犲伐鏈哄簥',
-            prop: 'machineCode',
-            type: 'select',
-			      filterable: true,
-            dicUrl: `/blade-mdm/machine/page?size=10000`,
-            dicFormatter: function (res) {
-              that.machineCodeList = res.data.records;
-              return res.data.records;
-            },
-            rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
-            props: {
-              label: 'code',
-              value: 'code',
-            },
-            span: 12
-          },*/
+          
           {
             label: '鍔犲伐鏈哄簥',
             prop: 'machineCode',
@@ -216,7 +213,15 @@
               this.handleTrim(col)
             },
             // rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
-          }
+          },
+          {
+            label: '涓荤宸ヨ壓',
+            prop: 'programmer',
+            type: 'input',//column 12
+            disabled:true,
+            span: 12,
+            dataType: 'string',
+          },
         ],
       },
       attachForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},//榛樿7澶�
@@ -270,6 +275,7 @@
       // 濡傛灉鏃笉鏄痬achine鑺傜偣涔熸病鏈夊瓙鑺傜偣锛岀洿鎺ヨ繑鍥炲師鑺傜偣
       return node;
     },
+    
     querySearchAsync(query, cb) {//闆剁粍浠跺彿鎼滅储寤鸿
       axios({
         url: '/blade-mdm/producedivision/select-data',
@@ -299,6 +305,39 @@
     handleSelect(item) {
       this.attachForm.productModel = item.cph;
     },
+
+    queryProgrammerAsync(query, cb) {//涓荤宸ヨ壓鎼滅储寤鸿
+      axios({
+        url: '/blade-mdm/producedivision/select-programmer',
+        method: 'get',
+        params: {programmer: query},
+      }).then(
+        res => {
+          if(res.data.code == 200){
+            let list = res.data.data;
+            for(let i of list){
+              i.value = '涓荤宸ヨ壓锛�'+i.programmerName+',鏍″锛�'+i.checkerName;
+            }
+
+            clearTimeout(this.timeout)
+            this.timeout = setTimeout(() => {
+              cb(list);
+            }, 600)
+            
+          }
+        },
+        error => {
+          console.log(error);
+        }
+      );
+      
+    },
+    handleProgrammerSelect(item){
+      this.attachForm.producePlanId = item.id;
+      this.attachForm.planDrawingNo = this.attachForm.drawingNo;//璁板綍姝ゆ椂鐨勯浂缁勪欢鍙�
+      console.log('productid',this.attachForm )
+
+    },
     handleTrim(col){
       //console.log(col)
       let value = this.attachForm[col.column.prop];
@@ -313,13 +352,45 @@
     },
     formSubmit(form, done) {
       var form = { ...form };
-      /*
-      this.machineCodeList.forEach(item => {
-        if (form.machineCode == item.code) {
-          form.machineMode = item.name;
-        }
-      })
-      */
+      console.log('submit',form);
+      if(this.attachForm.planDrawingNo == this.attachForm.drawingNo && this.attachForm.producePlanId){
+        //鎵嬪姩鎸囧畾浜嗕汉鍛樿亴璐h〃id锛屼笉鐢ㄧ户缁粠鏈嶅姟绔獙璇�
+         this.startDispatch(form,done);
+      }else{
+        axios({
+          url: '/blade-mdm/producedivision/select-by-drawingno',
+          method: 'get',
+          params: {drawingNo:this.attachForm.drawingNo},
+        }).then(
+          res => {
+            
+            if(res.data.code == 200){
+              this.$message({
+                type: 'success',
+                message: '鎿嶄綔鎴愬姛!',
+              });
+            
+              this.attachForm.producePlanId = res.data.data.id;
+              this.drawingNoMatch = true;
+              console.log('planid',this.attachForm.productPlanId)
+              this.startDispatch(form,done);
+            }else{
+              this.drawingNoMatch = false;
+             
+              this.$alert(res.data.msg+".鎴栬�呮墜鍔ㄩ�夋嫨涓荤宸ヨ壓銆�", '鍙戣捣浠诲姟澶辫触',{type:'error',confirmButtonText:'鍏抽棴'});
+            }
+            done();
+          },
+          error => {
+            console.log(error);
+            done();
+          }
+        );
+      }
+      
+    },
+    startDispatch(form,done){
+      //楠岃瘉閮介�氳繃浜嗭紝鎵ц鍚姩娴佺▼
       axios({
         url: '/blade-mdm/flow/dispatch/start',
         method: 'post',
@@ -334,7 +405,7 @@
             });
             this.$refs.form.resetForm();
             this.attachForm = this.defaultForm;
-            
+            this.drawingNoMatch = true;
           }else{
             this.$alert(res.data.msg, '鍙戣捣浠诲姟澶辫触',{type:'error',confirmButtonText:'鍏抽棴'});
           }

--
Gitblit v1.9.3