From 949701537db93e3b43169e3a15f7caf6cbb3c9ef Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 21 三月 2023 16:25:14 +0800
Subject: [PATCH] 1.节拍工价优化

---
 src/views/zzmx/jpgj.vue |  110 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 84 insertions(+), 26 deletions(-)

diff --git a/src/views/zzmx/jpgj.vue b/src/views/zzmx/jpgj.vue
index cf72335..a3070af 100644
--- a/src/views/zzmx/jpgj.vue
+++ b/src/views/zzmx/jpgj.vue
@@ -3,8 +3,8 @@
     <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 v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+        <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>
       </div>
 
       <div class="bodyTopFormGroup">
@@ -13,10 +13,10 @@
           :model="form"
           label-width="100px"
           inline
-          style="display: flex;justify-content: space-between"
+          style="display: flex;"
         >
           <div class="elForm">
-            <el-form-item label-width="70px" label="浜у搧鍚嶇О" style=" display: flex;">
+            <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
               <el-select
                 v-model="form.partcode"
                 filterable
@@ -88,9 +88,12 @@
               </el-select>
             </el-form-item>
           </div>
-          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
-            <el-button type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
-            <el-button type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+          <div
+            class="bodySearchReset"
+            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+          >
+            <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
+            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
           </div>
         </el-form>
         <div
@@ -125,12 +128,14 @@
           <el-table-column
             prop="partcode"
             min-width="160"
+            show-tooltip-when-overflow
             label="浜у搧缂栫爜"
             sortable="custom"
           />
           <el-table-column
             prop="partname"
             label="浜у搧鍚嶇О"
+            show-tooltip-when-overflow
             min-width="160"
             sortable="custom"
           />
@@ -151,6 +156,7 @@
             label="鐢熶骇杞﹂棿"
             min-width="110"
             sortable="custom"
+            show-tooltip-when-overflow
           />
           <el-table-column
             prop="route_name"
@@ -164,16 +170,19 @@
             label="鍔犲伐宸ュ簭"
             sortable="custom"
             min-width="110"
+            show-tooltip-when-overflow
           />
           <el-table-column
             prop="eqp_name"
             label="鍔犲伐璁惧"
+            show-tooltip-when-overflow
             min-width="110"
             sortable="custom"
           />
           <el-table-column
             prop="eqp_value"
             label="璁惧鑺傛媿"
+            show-tooltip-when-overflow
             width="110"
             sortable="custom"
           >
@@ -186,6 +195,7 @@
             prop="stand_value"
             label="鐢熶骇鑺傛媿"
             width="110"
+            show-tooltip-when-overflow
             sortable="custom"
           >
             <template slot-scope="{row}">
@@ -196,6 +206,7 @@
           <el-table-column
             prop="cavity_qty"
             label="鍨嬭厰鏁�"
+            show-tooltip-when-overflow
             width="110"
             sortable="custom"
           />
@@ -203,6 +214,7 @@
             prop="unprice"
             width="110"
             label="璁′欢鍗曚环"
+            show-tooltip-when-overflow
             sortable="custom"
           />
 
@@ -214,10 +226,14 @@
             <template slot-scope="{row}">
               <div class="operationClass">
                 <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
-                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
+                  <i
+                    :style="{color:$store.state.settings.theme}"
+                    class="el-icon-edit-outline"
+                    @click="edit('edit',row)"
+                  />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
-                  <i class="el-icon-delete" @click="del(row)" />
+                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                 </el-tooltip>
               </div>
             </template>
@@ -237,6 +253,7 @@
     </div>
 
     <el-dialog
+      v-el-drag-dialog
       :title="operation==='add'?'鏂板':'缂栬緫'"
       :visible.sync="dialogVisible"
       width="1000px"
@@ -247,7 +264,7 @@
     >
       <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
         <div style="display: flex;align-items: center">
-          <i class="el-icon-s-comment" style="color:#42b983;margin-top: -20px" />
+          <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" />
           <el-form-item prop="partcode" label="浜у搧鍚嶇О">
             <el-select
               v-show="operation==='add'"
@@ -302,7 +319,11 @@
       </el-form>
       <div style="display: flex;flex-direction: column;margin-bottom: 20px">
         <div>
-          <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />宸ュ簭闆嗗悎
+          <i
+            class="el-icon-s-operation"
+            :style="{color:$store.state.settings.theme}"
+            style="margin: -20px 10px 20px 0;"
+          />宸ュ簭闆嗗悎
         </div>
         <div style="display: flex;background-color: #F2F6FC;padding:20px 0  20px 20px; min-height: 100px">
           <el-radio-group v-model="dialogForm.stepcode" @change="radioChange">
@@ -319,11 +340,16 @@
 
       <div style="display: flex;flex-direction: column;min-height: 300px">
         <div>
-          <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />璁惧鍒楄〃
+          <i
+            class="el-icon-s-operation"
+            :style="{color:$store.state.settings.theme}"
+            style="margin: -20px 10px 20px 0"
+          />璁惧鍒楄〃
         </div>
 
         <el-table
           ref="eqpDialogArrRef"
+          :key="tableTimeStampKey"
           class="tableFixed"
           :data="eqpDialogArr"
           :height="tableHeight"
@@ -344,26 +370,30 @@
           />
           <el-table-column
             prop="eqpcode"
-            label="璁惧缂栫爜"
+            :label="eqpTable.steptype==='W'?'渚涘簲鍟嗙紪鐮�':'璁惧缂栫爜'"
             sortable="custom"
-            min-width="110"
+            show-tooltip-when-overflow
+            min-width="120"
           />
           <el-table-column
             prop="eqpname"
-            label="璁惧鍚嶇О"
-            min-width="110"
+            :label="eqpTable.steptype==='W'?'渚涘簲鍟嗗悕绉�':'璁惧鍚嶇О'"
+            min-width="120"
+            show-tooltip-when-overflow
             sortable="custom"
           />
           <el-table-column
             prop="wksp_name"
             sortable="custom"
             label="鐢熶骇杞﹂棿"
+            show-tooltip-when-overflow
             min-width="110"
           />
           <el-table-column
             sortable="custom"
             prop="eqp_value"
             label="璁惧鑺傛媿"
+            show-tooltip-when-overflow
             width="110"
           >
             <template slot-scope="{row}">
@@ -431,10 +461,10 @@
           >
             <template slot-scope="{row}">
               <div class="operationClass">
-                <el-button v-show="row.isVisible===1" type="text" @click="saveRow(row)">淇濆瓨</el-button>
-                <el-button v-show="row.isVisible===1" type="text" @click="cancelRow(row)">鍙栨秷</el-button>
-                <el-button v-show="row.isVisible===0" type="text" @click="editRow(row)">缂栬緫</el-button>
-                <el-button v-show="row.isVisible===0" type="text" @click="copyRow(row)">澶嶅埗</el-button>
+                <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveRow(row)">淇濆瓨</el-button>
+                <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelRow(row)">鍙栨秷</el-button>
+                <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRow(row)">缂栬緫</el-button>
+                <el-button v-if="row.isVisible===0" v-waves type="text" @click="copyRow(row)">澶嶅埗</el-button>
               </div>
             </template>
           </el-table-column>
@@ -456,9 +486,9 @@
 
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
-          <el-button @click="dialogVisibleCancel">杩� 鍥�</el-button>
-          <!--          <el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>-->
-          <!--          <el-button type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>-->
+          <el-button v-waves @click="dialogVisibleCancel">杩� 鍥�</el-button>
+          <!--          <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>-->
+          <!--          <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>-->
         </div>
       </span>
     </el-dialog>
@@ -486,12 +516,15 @@
   StepSelectEqpList
 } from '@/api/zzmx'
 import ImportPicker from '@/components/ImportPicker'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
 
 export default {
   name: 'JPGJ',
   components: {
     Pagination, ImportPicker
   },
+  directives: { elDragDialog, waves },
   data() {
     return {
       isIpad: false,
@@ -533,6 +566,7 @@
         partcode: '',
         routecode: '',
         stepcode: '',
+        steptype: '',
         page: 1,
         rows: 10,
         prop: 'eqpcode',
@@ -545,6 +579,9 @@
       editStepName: '', // 缂栬緫鏃跺姞宸ュ伐搴忓悕绉�
       operation: '',
       dialogFormRules: {},
+      radioChangeTempValue: '',
+
+      tableTimeStampKey: new Date().getTime(),
 
       title_value: '鏁版嵁瀵煎叆 / 鑺傛媿宸ヤ环',
       code: '24',
@@ -643,12 +680,15 @@
     },
     async routeDialogChange(val) {
       const { data: res } = await RouteSelectStep({ routecode: val })
+      // this.stepDialogArr = res.filter(i => i.flag === 'Z')
       this.stepDialogArr = res
       this.eqpDialogArr = []
+      this.radioChangeTempValue = ''
     },
     radioChange(val) {
       this.isEqpTableEdit = true
 
+      this.radioChangeTempValue = val
       // this.dialogForm.stepcode = this.stepDialogArr.find(item => item.name === val).code
       this.getEqpTable(val)
     },
@@ -666,11 +706,13 @@
     },
     async getEqpTable(val) {
       if (typeof val === 'string') {
+        this.eqpTable.steptype = this.stepDialogArr.find(item => item.name === val).flag
         this.eqpTable.partcode = this.dialogForm.partcode
         this.eqpTable.routecode = this.dialogForm.routecode
         this.eqpTable.stepcode = this.stepDialogArr.find(item => item.name === val).code
-      // } else if (typeof val === 'number') {
+        // } else if (typeof val === 'number') {
       } else {
+        this.eqpTable.steptype = this.stepDialogArr[0].flag
         this.eqpTable.partcode = this.dialogForm.partcode
         this.eqpTable.routecode = this.dialogForm.routecode
         this.eqpTable.stepcode = this.stepDialogArr[0].code
@@ -688,6 +730,17 @@
     },
     // 淇濆瓨琛�
     async saveRow(row) {
+      if (parseFloat(row.eqp_value) > 0 && parseFloat(row.cavity_qty) === 0) {
+        return this.$message.info('鑵斿瀷鏁板繀椤诲ぇ浜庨浂锛�')
+      }
+      if (parseFloat(row.eqp_value) === 0 && parseFloat(row.cavity_qty) > 0) {
+        return this.$message.info('鐢熶骇鑺傛媿蹇呴』澶т簬闆讹紒')
+      }
+
+      if (parseFloat(row.unprice) <= 0 && this.eqpTable.steptype !== 'W') {
+        return this.$message.info('璁′欢鍗曚环蹇呴』澶т簬闆讹紒')
+      }
+
       const data = {
         partcode: this.eqpTable.partcode, //  浜у搧缂栫爜
         routecode: this.eqpTable.routecode, //  宸ヨ壓璺嚎缂栫爜
@@ -705,12 +758,16 @@
       if (res.code === '200') {
         this.isEqpTableEdit = true
         this.$message.success('淇濆瓨鎴愬姛锛�')
-        await this.getEqpTable()
+        this.radioChange(this.radioChangeTempValue)
       }
     },
     // 鍙栨秷琛�
     cancelRow(row) {
       this.getEqpTable()
+
+      this.radioChange(this.radioChangeTempValue)
+      this.dialogForm.stepcode = this.radioChangeTempValue
+
       this.isEqpTableEdit = true
     },
     // 缂栬緫琛�
@@ -726,6 +783,7 @@
           }
         })
         this.isEqpTableEdit = false
+        this.tableTimeStampKey = new Date().getTime()
       } else {
         return this.$message.info('鍙兘涓�琛屼竴琛屼慨鏀癸紒')
       }
@@ -764,7 +822,7 @@
       const res = await SaveBeatRate(newData)
       if (res.code === '200') {
         this.$message.success('澶嶅埗鎴愬姛锛�')
-        await this.getEqpTable()
+        this.radioChange(this.radioChangeTempValue)
         this.isEqpTableEdit = true
       }
     },

--
Gitblit v1.9.3