From bb2ed2e56da26a6b79575f5be9f60ca2d90774d0 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 01 八月 2024 17:17:32 +0800
Subject: [PATCH] 1.工序、工价界面优化

---
 src/views/basicSettings/meterPrice.vue |  134 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 115 insertions(+), 19 deletions(-)

diff --git a/src/views/basicSettings/meterPrice.vue b/src/views/basicSettings/meterPrice.vue
index d1ee3d0..7d5ea87 100644
--- a/src/views/basicSettings/meterPrice.vue
+++ b/src/views/basicSettings/meterPrice.vue
@@ -192,7 +192,7 @@
       :title="operation==='add'?'鏂板':'缂栬緫'"
       :visible.sync="dialogVisible"
       width="1100px"
-      top="15vh"
+      top="5vh"
       :close-on-click-modal="false"
       @closed="handleClose"
       @close="handleClose"
@@ -252,28 +252,101 @@
           </el-form-item>
         </div>
       </el-form>
-
+      <!--      :expand-row-keys="expandRowKeys"-->
+      <!--      row-key="code"-->
       <el-table
         :data="stepDialogArr"
         style="width: 100%"
-        height="300"
+        height="600"
+
         border
         :header-cell-style="this.$headerCellStyle"
         :cell-style="this.$cellStyle"
         :row-class-name="tableRowClassName"
       >
+        <el-table-column type="expand">
+          <template slot-scope="props">
+            <el-table
+              :data="props.row.children"
+              style="width: 96%;margin: auto;"
+              border
+              :row-class-name="tableRowClassName"
+            >
+              <el-table-column
+                prop="eqp_code"
+                label="璁惧/寰�鏉ョ紪鐮�"
+                min-width="120"
+              />
+              <el-table-column
+                prop="eqp_name"
+                label="璁惧/寰�鏉ュ悕绉�"
+                min-width="120"
+              />
+              <el-table-column
+                prop="eqp_value"
+                label="璁惧鑺傛媿"
+                min-width="150"
+              >
+                <template slot-scope="{row}">
+                  <div style="display: flex">
+                    <el-input
+                      v-model="row.eqp_value"
+                      placeholder="璇疯緭鍏�"
+                      oninput="value=value.replace(/[^0-9.]/g,'')"
+                      @change="val=>eqpValueChange(val,row)"
+                    />
+                    <div style="margin-left: 5px">绉�</div>
+                  </div>
+
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="stand_value"
+                label="鐢熶骇鑺傛媿"
+                min-width="120"
+              >
+                <template slot-scope="{row}">
+                  <div>{{ row.stand_value + ' ' + '绉�' }}</div>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="cavity_qty"
+                label="鑵斿瀷鏁�"
+                min-width="120"
+              >
+                <template slot-scope="{row}">
+                  <el-input
+                    v-model="row.cavity_qty"
+                    placeholder="璇疯緭鍏�"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
+                    @change="val=>cavityQtyChange(val,row)"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="unprice"
+                label="宸ュ簭宸ヤ环"
+                min-width="120"
+              >
+                <template slot-scope="{row}">
+                  <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" />
+                </template>
+              </el-table-column>
+            </el-table>
+          </template>
+        </el-table-column>
         <el-table-column
-          prop="step_seq"
+          prop="seq"
           label="宸ュ簭椤哄簭"
           width="100"
         />
         <el-table-column
-          prop="step_code"
+          prop="code"
           label="宸ュ簭缂栫爜"
           width="200"
         />
         <el-table-column
-          prop="step_name"
+          prop="name"
           label="宸ュ簭鍚嶇О"
           width="200"
         />
@@ -479,8 +552,9 @@
       editPartName: '', // 缂栬緫鏃朵骇鍝佸悕绉�
       editRouteName: '', // 缂栬緫鏃跺伐鑹鸿矾绾垮悕绉�
       editStepName: '', // 缂栬緫鏃跺姞宸ュ伐搴忓悕绉�
-      operation: ''
+      operation: '',
 
+      expandRowKeys: []// 榛樿灞曞紑
     }
   },
 
@@ -581,6 +655,12 @@
     async routeDialogChange(val) {
       const { data: res } = await RouteSelectStep({ partcode: this.dialogForm.partcode, routecode: val })
       this.stepDialogArr = res
+
+      this.expandRowKeys = this.stepDialogArr.map(i => {
+        if (i.children.length > 0) {
+          return i.code
+        }
+      })
     },
 
     // 鏂板鎸夐挳
@@ -654,22 +734,22 @@
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const children = []
-          this.stepDialogArr.forEach(i => {
-            children.push({
-              'code': i.step_code,
-              'name': i.step_name,
-              'seq': i.step_seq,
-              'isbott': i.isbott,
-              'isend': i.isend,
-              'unprice': i.unprice
-            })
-          })
+          // this.stepDialogArr.forEach(i => {
+          //   children.push({
+          //     'code': i.step_code,
+          //     'name': i.step_name,
+          //     'seq': i.step_seq,
+          //     'isbott': i.isbott,
+          //     'isend': i.isend,
+          //     'unprice': i.unprice
+          //   })
+          // })
 
           const data = [
             {
               'partcode': this.dialogForm.partcode,
               'defaultroute_code': this.dialogForm.routecode,
-              'children': children
+              'children': this.stepDialogArr
             }
           ]
           SaveBeatRate(data).then(res => {
@@ -684,7 +764,23 @@
         }
       })
     },
-
+    // 璁惧鑺傛媿鍊兼敼鍙�
+    eqpValueChange(val, row) {
+      console.log(val, row)
+      if (parseFloat(row.cavity_qty) !== 0) {
+        row.stand_value = parseFloat((parseFloat(val) / parseFloat(row.cavity_qty)).toFixed(2))
+      } else {
+        row.stand_value = 0
+      }
+    },
+    // 鑵斿瀷鏁板�兼敼鍙�
+    cavityQtyChange(val, row) {
+      if (parseFloat(val) !== 0) {
+        row.stand_value = parseFloat((parseFloat(row.eqp_value) / parseFloat(val)).toFixed(2))
+      } else {
+        row.stand_value = 0
+      }
+    },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {
       this.$nextTick(() => {

--
Gitblit v1.9.3