From 4a6d69f3ff895918b1b8f1e8e9b122ed8fcd5afa Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 24 十一月 2022 17:15:47 +0800
Subject: [PATCH] 1.自动排程实现静态部分

---
 src/views/zzmx/wlqd.vue |   80 ++++++++++++++++++++++-----------------
 1 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/src/views/zzmx/wlqd.vue b/src/views/zzmx/wlqd.vue
index 35783d0..3da1dfe 100644
--- a/src/views/zzmx/wlqd.vue
+++ b/src/views/zzmx/wlqd.vue
@@ -3,7 +3,7 @@
     <div class="body" :style="{height:mainHeight+'px'}">
       <div class="bodyTopButtonGroup" style="justify-content: space-between">
         <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
-        <!--        <el-button icon="el-icon-download" @click="upload">瀵煎叆</el-button>-->
+        <el-button icon="el-icon-download" @click="upload">瀵煎叆</el-button>
       </div>
 
       <div class="bodyTopFormGroup">
@@ -15,7 +15,7 @@
           style="display: flex;justify-content: space-between"
         >
           <div class="elForm">
-            <el-form-item label-width="70px" label="姣嶄欢缂栫爜" style=" display: flex;">
+            <el-form-item label="姣嶄欢缂栫爜" label-width="70px" style=" display: flex;">
               <el-input v-model="form.parentpartcode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="姣嶄欢鍚嶇О" style=" display: flex;">
@@ -269,6 +269,7 @@
               placeholder="璇烽�夋嫨"
               :popper-append-to-body="false"
               :disabled="operation!=='add'"
+              filterable
               @change="partSelectChange"
             >
               <el-option
@@ -284,6 +285,7 @@
               v-model="dialogForm.parentpartname"
               style="width: 200px"
               placeholder="璇烽�夋嫨"
+              filterable
               :disabled="operation!=='add'"
               :popper-append-to-body="false"
               @change="partSelectChange"
@@ -312,24 +314,10 @@
             <!--            />-->
             <!--          </el-select>-->
           </el-form-item>
-          <el-form-item label="璁¢噺鍗曚綅" prop="uomcode">
-            <el-select
-              v-model="dialogForm.uomcode"
-              disabled
-              style="width: 200px"
-              placeholder="璇烽�夋嫨"
-              :popper-append-to-body="false"
-            >
-              <el-option
-                v-for="item in openTypeArr"
-                :key="item.partcode"
-                :label="item.uom_code"
-                :value="item.partcode"
-              />
-            </el-select>
-            <!--            <el-input v-model="dialogForm.uomcode" readonly style="width: 200px" />-->
+          <el-form-item label="璁¢噺鍗曚綅">
+            <el-input v-model="dialogForm.uomname" disabled style="width: 200px" />
           </el-form-item>
-          <!--          <el-form-item label="瀛樿揣绫诲瀷" prop="uomcode">-->
+          <!--          <el-form-item label="瀛樿揣绫诲瀷">-->
           <!--            <el-input v-model="dialogForm.chlx" readonly style="width: 200px" />-->
           <!--          </el-form-item>-->
           <el-form-item label="鍩虹鏁伴噺" prop="quantity">
@@ -344,6 +332,7 @@
             <el-select
               v-model="dialogForm.status"
               style="width: 200px"
+              filterable
               placeholder="璇烽�夋嫨"
               :disabled="operation==='preview'"
               :popper-append-to-body="false"
@@ -412,6 +401,7 @@
             <el-select
               v-if="row.isVisible===1"
               v-model="row.SMATERIRL_CODE"
+              filterable
               placeholder="璇烽�夋嫨"
               @change="val=>tableChange(val,row)"
             >
@@ -428,7 +418,7 @@
         <el-table-column
           prop="SMATERIRL_NAME"
           label="瀛愪欢鍚嶇О"
-
+          filterable
           show-tooltip-when-overflow
         >
 
@@ -456,7 +446,7 @@
           show-tooltip-when-overflow
         />
         <el-table-column
-          prop="uomcode"
+          prop="uomname"
           label="璁¢噺鍗曚綅"
           width="110"
         />
@@ -503,7 +493,13 @@
           width="110"
         >
           <template slot-scope="{row}">
-            <el-select v-if="row.isVisible===1" v-model="row.PN_TYPE" placeholder="璇烽�夋嫨">
+            <el-select
+              v-if="row.isVisible===1"
+              v-model="row.PN_TYPE"
+              :disabled="row.PN_TYPE==='Z'"
+              placeholder="璇烽�夋嫨"
+              @change="val=>changeType(val,row)"
+            >
               <el-option
                 v-for="item in sxArr"
                 :key="item.code"
@@ -522,7 +518,7 @@
         >
           <template slot-scope="{row}">
             <div class="operationClass">
-              <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">淇濆瓨</el-button>
+              <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">纭畾</el-button>
               <el-button v-if="row.isVisible===1" type="text" @click="cancelRow(row)">鍙栨秷</el-button>
               <el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">缂栬緫</el-button>
               <el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">鍒犻櫎</el-button>
@@ -541,7 +537,7 @@
             :disabled="$store.state.app.buttonIsDisabled"
             type="primary"
             @click="dialogVisibleConfirm"
-          >纭� 瀹�</el-button>
+          >淇濆瓨</el-button>
         </div>
       </span>
     </el-dialog>
@@ -612,6 +608,7 @@
         parentpartname: '',
         parentpartspec: '',
         uomcode: '',
+        uomname: '',
         // chlx: '',
         quantity: '',
         status: '',
@@ -635,9 +632,6 @@
         quantity: [
           { required: true, message: '璇疯緭鍏ュ熀纭�鏁伴噺', trigger: ['blur', 'change'] }
         ],
-        // uomcode: [
-        //   { required: true, message: '璇疯緭鍏ヨ閲忓崟浣�', trigger: ['blur', 'change'] }
-        // ],
         // version: [
         //   { required: true, message: '璇疯緭鍏ョ増鏈彿', trigger: ['blur', 'change'] }
         // ],
@@ -654,8 +648,8 @@
         { code: 'F', name: '杈呮枡' }
       ],
 
-      title_value: '鏁版嵁瀵煎叆 / 鐐规閮ㄤ綅',
-      code: '4',
+      title_value: '鏁版嵁瀵煎叆 / 鐗╂枡娓呭崟',
+      code: '21',
       shows: false
 
     }
@@ -725,7 +719,8 @@
       this.dialogForm.parentpartcode = res.partcode
       this.dialogForm.parentpartname = res.partname
       this.dialogForm.parentpartspec = res.partspec
-      this.dialogForm.uomcode = res.uom_code
+      // this.dialogForm.uomcode = res.uom_code
+      this.dialogForm.uomname = res.uom_name
 
       if (this.PartSelectArrTemp.length > 0) {
         this.PartSelectArr.unshift(this.PartSelectArrTemp[0])
@@ -789,7 +784,6 @@
       this.getPartSelect()
 
       this.dialogForm.startdate = handleDatetime(new Date())
-      console.log(this.dialogForm.startdate, 7)
     },
     // 淇敼鎸夐挳
     async edit(operation, row) {
@@ -815,7 +809,8 @@
             SMATERIRL_CODE: item.partcode,
             SMATERIRL_NAME: item.partname,
             SMATERIRL_SPEC: item.partspec,
-            uomcode: item.uom_name,
+            uomcode: item.uom_code,
+            uomname: item.uom_name,
             BASE_QUANTITY: item.base_quantity,
             LOSS_QUANTITY: item.loss_quantity,
             TOTAL_QUANTITY: item.total_quantity,
@@ -830,6 +825,7 @@
           this.dialogForm.parentpartname = row.partname
           this.dialogForm.parentpartspec = row.partspec
           this.dialogForm.uomcode = row.uom_code
+          this.dialogForm.uomname = row.uom_name
           this.dialogForm.startdate = row.startdate
           this.dialogForm.status = row.status
           this.dialogForm.quantity = row.quantity
@@ -853,10 +849,17 @@
       row.SMATERIRL_NAME = res.partname
       row.SMATERIRL_SPEC = res.partspec
       row.uomcode = res.uom_code
+      row.uomname = res.uom_name
 
       // this.PartSelectArr.forEach((item, index) => {
       //   this.PartSelectArr.splice(index, 1)
       // })
+    },
+    // 鐗╂枡娓呭崟灞炴�х被鍨嬪�兼敼鍙樻椂瑙﹀彂
+    changeType(val, row) {
+      this.dialogTableDataArr.forEach(item => {
+        item.PN_TYPE = item.SMATERIRL_CODE === row.SMATERIRL_CODE ? 'Z' : 'F'
+      })
     },
     addDialog() {
       if (this.dialogTableDataArr.find(item => item.isVisible === 1)) {
@@ -873,10 +876,11 @@
         SMATERIRL_NAME: '',
         SMATERIRL_SPEC: '',
         uomcode: '',
+        uomname: '',
         BASE_QUANTITY: '',
         LOSS_QUANTITY: '',
         TOTAL_QUANTITY: '',
-        PN_TYPE: ''
+        PN_TYPE: this.dialogTableDataArr.length === 0 ? 'Z' : 'F'
       })
     },
     saveRow(row) {
@@ -905,6 +909,10 @@
       })
     },
     delRow(row) {
+      if (row.PN_TYPE === 'Z') {
+        return this.$message.info('涓绘枡涓嶅彲鍒犻櫎锛�')
+      }
+
       this.PartSelectArrAll.forEach(item => {
         if (item.partcode === row.SMATERIRL_CODE) {
           this.PartSelectArr.unshift(item)
@@ -945,6 +953,7 @@
       this.dialogForm.parentpartname = ''
       this.dialogForm.parentpartspec = ''
       this.dialogForm.uomcode = ''
+      this.dialogForm.uomname = ''
       // this.dialogForm.chlx = ''
       this.dialogForm.quantity = ''
       this.dialogForm.status = ''
@@ -973,7 +982,7 @@
             parentpartcode: this.dialogForm.parentpartcode,
             parentpartname: this.dialogForm.parentpartname,
             parentpartspec: this.dialogForm.parentpartspec,
-            uomcode: this.dialogForm.uomcode,
+            uomcode: this.PartSelectArrTemp.length > 0 ? this.PartSelectArrTemp[0].uom_code : this.dialogForm.uomcode,
             quantity: this.dialogForm.quantity,
             status: this.dialogForm.status,
             startdate: this.dialogForm.startdate,
@@ -981,7 +990,8 @@
             worklist: this.dialogTableDataArr,
             opertype: this.operation === 'add' ? 'Add' : 'Update'
           }
-          console.log(data, 89)
+          // console.log(data)
+
           this.$store.state.app.buttonIsDisabled = true
           AddUpdateBoIventory(data).then(res => {
             if (res.code === '200') {

--
Gitblit v1.9.3