From d105bd9dd591264a7b1f79f1fdbbf0e764ff073e Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 31 八月 2022 15:39:42 +0800
Subject: [PATCH] 1.修改分页bug

---
 src/views/scgl/sckbg.vue |  143 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 98 insertions(+), 45 deletions(-)

diff --git a/src/views/scgl/sckbg.vue b/src/views/scgl/sckbg.vue
index c12ae07..0736e29 100644
--- a/src/views/scgl/sckbg.vue
+++ b/src/views/scgl/sckbg.vue
@@ -145,18 +145,23 @@
               <el-table-column
                 prop="plan_startdate"
                 label="璁″垝寮�宸ユ棩鏈�"
-                width="185"
+                width="150"
                 sortable="custom"
-              />
+              >
+                <template slot-scope="{row}">
+                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0,11) }}</div>
+                  <div v-else>/</div>
+                </template>
+              </el-table-column>
               <el-table-column
                 prop="plan_enddate"
                 label="璁″垝瀹屽伐鏃ユ湡"
-                width="185"
+                width="150"
                 sortable="custom"
                 fixed="right"
               >
                 <template slot-scope="{row}">
-                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
+                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0,11) }}</div>
                   <div v-else>/</div>
                 </template>
               </el-table-column>
@@ -339,18 +344,23 @@
               <el-table-column
                 prop="plan_startdate"
                 label="璁″垝寮�宸ユ棩鏈�"
-                width="185"
+                width="150"
                 sortable="custom"
-              />
+              >
+                <template slot-scope="{row}">
+                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0,11) }}</div>
+                  <div v-else>/</div>
+                </template>
+              </el-table-column>
               <el-table-column
                 prop="plan_enddate"
                 label="璁″垝瀹屽伐鏃ユ湡"
-                width="185"
+                width="150"
                 sortable="custom"
                 fixed="right"
               >
                 <template slot-scope="{row}">
-                  <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
+                  <div v-if="row.plan_startdate">{{ row.plan_startdate.substring(0,11) }}</div>
                   <div v-else>/</div>
                 </template>
               </el-table-column>
@@ -415,26 +425,25 @@
               <el-table-column
                 prop="wo_code"
                 label="宸ュ崟鍙�"
-                width="160"
+                min-width="160"
                 sortable="custom"
               />
               <el-table-column
                 prop="partcode"
                 label="浜у搧缂栫爜"
-                width="110"
+                min-width="110"
                 sortable="custom"
               />
               <el-table-column
                 prop="partname"
-                width="160"
+                min-width="160"
                 label="浜у搧鍚嶇О"
-                show-tooltip-when-overflow
                 sortable="custom"
               />
               <el-table-column
                 prop="stepname"
                 label="宸ュ簭"
-                width="120"
+                min-width="120"
                 sortable="custom"
               />
               <el-table-column
@@ -617,6 +626,23 @@
               :key="item.code"
               :label="item.name"
               :value="item.code"
+            />
+          </el-select>
+        </el-form-item>
+        <!--        <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="鎶ュ伐浜哄憳锛�">-->
+        <!--          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />-->
+        <!--        </el-form-item>-->
+        <el-form-item v-if="dialogTitle==='鑷埗鎶ュ伐'" label="鎶ュ伐浜猴細">
+          <el-select
+            v-model="dialogForm.operation"
+            style="width: 200px;"
+            placeholder="璇烽�夋嫨"
+          >
+            <el-option
+              v-for="item in OperationArr"
+              :key="item.usercode"
+              :label="item.username"
+              :value="item.usercode"
             />
           </el-select>
         </el-form-item>
@@ -803,8 +829,8 @@
         <el-form-item
           v-if="dialogTitle==='澶栧崗鏀舵枡'"
           label="涓嶈壇鍘熷洜锛�"
-          prop="badcode"
         >
+          <!--          prop="badcode"-->
           <el-select
             v-model="dialogForm.badcode"
             style="width: 200px;"
@@ -817,6 +843,20 @@
               :key="item.code"
               :label="item.name"
               :value="item.code"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="dialogTitle==='澶栧崗鏀舵枡'" label="鏀舵枡浜猴細">
+          <el-select
+            v-model="dialogForm.operation"
+            style="width: 200px;"
+            placeholder="璇烽�夋嫨"
+          >
+            <el-option
+              v-for="item in OperationArr"
+              :key="item.usercode"
+              :label="item.username"
+              :value="item.usercode"
             />
           </el-select>
         </el-form-item>
@@ -960,7 +1000,7 @@
             placeholder="璇烽�夋嫨"
           >
             <el-option
-              v-for="item in badOperationArr"
+              v-for="item in OperationArr"
               :key="item.usercode"
               :label="item.username"
               :value="item.usercode"
@@ -1028,8 +1068,8 @@
           />
           <el-table-column
             prop="repair_qty"
-            label="缁翠慨鏁伴噺"
-            width="90"
+            label="缁翠慨鍚堟牸鏁伴噺"
+            width="110"
           >
             <template slot-scope="{row}">
               <!--              {{ row.repair_qty }}-->
@@ -1192,6 +1232,7 @@
 
         startqtySum: '', // 涓嶈兘瓒呰繃鐨勬暟鍊�
 
+        operation: getCookie('navTabId'), // 鎶ュ伐浜猴紙鏀舵枡浜猴級
         remarks: ''// 澶囨敞
 
       },
@@ -1284,7 +1325,8 @@
         operation: getCookie('navTabId')
       },
       badTableDataDialog: [], // 涓嶈壇瀵硅瘽妗唗able琛ㄦ牸
-      badOperationArr: [] // 缁翠慨浜哄憳鏁扮粍
+      OperationArr: [], // 浜哄憳鏁扮粍
+      sendButtonIsDisabled: false// 涓嬭揪鎸夐挳鏄惁鍙偣鍑�
     }
   },
   // computed: {
@@ -1315,6 +1357,8 @@
     })
     // webapp_urlprotocol_startup()
     // webapp_ws_autoupdate(true)
+
+    this.getMesOrderSelectUserAll() // 鑾峰彇鎵�鏈変汉鍛�
   },
   methods: {
     tableRowClassName({ row, rowIndex }) {
@@ -1581,7 +1625,7 @@
     // 鐢熶骇鐝粍涓嬫媺鏀瑰彉
     usergroupChange(val) {
       this.dialogForm.usergroupcode = val
-      this.getUserTableData()
+      this.getMesOrderSelectUserZZ2()
     },
     // 鑾峰彇鑷埗鎶ュ伐鐢熶骇鐝粍涓嬫媺鍒楄〃
     async getMesOrderStepReportSelectUserGroup() {
@@ -1592,6 +1636,11 @@
     async getMesOrderSelectUserZZ() {
       const { data: res } = await MesOrderSelectUser({ usercode: this.dialogForm.usergroupcode })
       this.ZZuserArr = res
+    },
+    async getMesOrderSelectUserZZ2() {
+      const { data: res } = await MesOrderSelectUser({ usercode: '' })
+      this.ZZuserArr = res
+      await this.getUserTableData()
     },
     // 鑾峰彇鑷埗鐢熶骇璁惧涓嬫媺
     async getMesOrderStepStartSelectEqp() {
@@ -1630,6 +1679,8 @@
         item.isVisible = 0
         item.number = number
       })
+
+      this.ZZuserArr = [...this.ZZuserArr].filter(x => [...this.userTableData].every(y => y.usercode !== x.usercode))
     },
     // 鐢ㄦ埛娣诲姞
     userAdd() {
@@ -1640,6 +1691,11 @@
     },
     // 鐢ㄦ埛鍒楄〃鍒犻櫎
     userDel(row) {
+      this.ZZuserArr.splice(0, 0, {
+        usercode: row.usercode,
+        username: row.username
+      })
+
       this.userTableData.forEach((item, index) => {
         if (item.number === row.number) {
           this.userTableData.splice(index, 1)
@@ -1652,6 +1708,13 @@
       if (row.usercode === '') {
         return this.$message.info('浜哄憳鍚嶇О涓嶈兘涓虹┖锛�')
       }
+
+      this.ZZuserArr.forEach((item, index) => {
+        if (item.usercode === row.usercode) {
+          this.ZZuserArr.splice(index, 1)
+        }
+      })
+
       this.userTableData.forEach(item => {
         if (item.number === row.number) {
           item.isVisible = 0
@@ -1718,7 +1781,7 @@
       this.dialogForm.nextstepcode = '' // 涓嬮亾宸ュ簭缂栫爜
 
       this.dialogForm.remarks = '' // 澶囨敞
-
+      this.dialogForm.operation = getCookie('navTabId') // 鎶ュ伐浜猴紙鏀舵枡浜猴級
       this.userTableData = [] // 浜哄憳鍒楄〃
 
       this.$refs.dialogForm.clearValidate()
@@ -1784,12 +1847,12 @@
             SavaMesOrderStepIn(data).then(res => {
               if (res.code === '200') {
                 this.$message.success('鏀舵枡鎴愬姛锛�')
-                this.dialogVisible = false
 
                 if (this.dialogForm.nextstepcode !== '') {
-                  this.WXprint2()
+                  this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
                   this.dialogVisible2 = true
                 }
+                this.dialogVisible = false
                 this.tabClick()
               } else {
                 this.$message.error('鏀舵枡澶辫触!')
@@ -1860,13 +1923,13 @@
             SavaMesOrderStepReport(data).then(res => {
               if (res.code === '200') {
                 this.$message.success('鎶ュ伐鎴愬姛锛�')
-                this.dialogVisible = false
 
                 console.log(this.dialogForm.nextstepcode, 1)
                 if (this.dialogForm.nextstepcode !== '') {
-                  this.ZZprint2()
+                  this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
                   this.dialogVisible2 = true
                 }
+                this.dialogVisible = false
                 this.tabClick()
               } else {
                 this.$message.error('鎶ュ伐澶辫触!')
@@ -1889,27 +1952,27 @@
         correctLevel: QRCode.CorrectLevel.L// 瀹归敊鐜囷紝L/M/H
       })
     },
-    ZZprint2() {
+    ZZprint2(username) {
       this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
       this.qrForm.startqty = this.dialogForm.startqty
       this.qrForm.wo_code = this.dialogForm.wo_code
       this.qrForm.partcode = this.dialogForm.partcode
       this.qrForm.partname = this.dialogForm.partname
       this.qrForm.nextstepname = this.dialogForm.nextstepname
-      this.qrForm.operator = getCookie('username')
+      this.qrForm.operator = username
       this.qrForm.operatorTime = handleDatetime2(new Date())
       this.$nextTick(() => {
         this.bindQRCode(this.qrForm.qrvalue)
       })
     },
-    WXprint2() {
+    WXprint2(username) {
       this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
       this.qrForm.startqty = this.dialogForm.sqty
       this.qrForm.wo_code = this.dialogForm.wo_code
       this.qrForm.partcode = this.dialogForm.partcode
       this.qrForm.partname = this.dialogForm.partname
       this.qrForm.nextstepname = this.dialogForm.nextstepname
-      this.qrForm.operator = getCookie('username')
+      this.qrForm.operator = username
       this.qrForm.operatorTime = handleDatetime2(new Date())
       this.$nextTick(() => {
         this.bindQRCode(this.qrForm.qrvalue)
@@ -1952,17 +2015,11 @@
       const data = {
         Data: this.badTableDataDialog
       }
-      // console.log(JSON.stringify(data), 1)
-      // console.log(this.badDialogForm.operation, 1)
-      // this.badPrintOperator =
-      // this.badPrint(this.badOperationArr.find(item => item.usercode === this.badDialogForm.operation).username)
-      // this.dialogVisible2 = true
-
       EditOrderNgStepSeave(data, this.badDialogForm.operation).then(res => {
         if (res.code === '200' || res.code === '301') {
           this.getBadList()
           this.badDialogVisible = false
-          this.badPrint(this.badOperationArr.find(item => item.usercode === this.badDialogForm.operation).username)
+          this.badPrint(this.OperationArr.find(item => item.usercode === this.badDialogForm.operation).username)
           this.dialogVisible2 = true
           return this.$message.success('淇濆瓨鎴愬姛锛�')
         }
@@ -1988,12 +2045,12 @@
       this.badDialogForm.operation = getCookie('navTabId')
       this.badTableDataDialog = []
     },
+    async  getMesOrderSelectUserAll() {
+      const { data: res } = await MesOrderSelectUser({ usercode: '' })
+      this.OperationArr = res
+    },
     // 鐐瑰嚮缁翠慨澶勭悊鎸夐挳  鎴�  鎵弿鏉$爜鐨勬壂鎻忓洖杞︿簨浠�
     async repairHandle(row) {
-      const { data: res1 } = await MesOrderSelectUser({ usercode: '' })
-      this.badOperationArr = res1
-
-      console.log(row)
       let data
       if (row.wo_code) {
         data = {
@@ -2059,10 +2116,6 @@
       })
     },
     badSave(row) {
-      console.log(row, 1)
-      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty), 2)
-      // console.log(parseFloat(row.ng_qty), 2)
-      // console.log(parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty), 2)
       if (parseFloat(row.bad_qty) + parseFloat(row.repair_qty) > parseFloat(row.ng_qty)) {
         this.badCancel(row)
         return this.$message.info('缁翠慨鏁伴噺涓庢姤搴熸暟閲忎箣鍜屼笉鑳藉ぇ浜庝笉鑹暟閲忥紒')
@@ -2070,8 +2123,8 @@
       this.badTableDataDialog.forEach((item, index) => {
         if (item.id === row.id && item.m_id === row.m_id) {
           this.badTableDataDialog.splice(index, 1, {
-            bad_qty: row.bad_qty,
-            repair_qty: row.repair_qty,
+            bad_qty: parseFloat(row.bad_qty),
+            repair_qty: parseFloat(row.repair_qty),
             isVisible: 0,
             defect_code: row.defect_code,
             defect_name: row.defect_name,

--
Gitblit v1.9.3