From f8c92594757c7a3db7188bb384f4fd2fb841604a Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 29 六月 2022 08:43:54 +0800
Subject: [PATCH] 1.完成存货档案2.修改以前bug

---
 src/views/sbgl/sbqd.vue |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/views/sbgl/sbqd.vue b/src/views/sbgl/sbqd.vue
index ad2373f..22f286a 100644
--- a/src/views/sbgl/sbqd.vue
+++ b/src/views/sbgl/sbqd.vue
@@ -224,7 +224,7 @@
         <el-form-item label="璁惧缁�" prop="devicegroupcode">
           <el-select v-model="dialogForm.devicegroupcode" :popper-append-to-body="false" :disabled="dialogForm.devicetypecode===''" style="width: 220px" placeholder="璇烽�夋嫨">
             <el-option
-              v-for="item in DeviceGroupArr"
+              v-for="item in DeviceGroupDialogArr"
               :key="item.code"
               :label="item.name"
               :value="item.code"
@@ -289,6 +289,7 @@
       :visible.sync="DeviceTypeDialogVisible"
       width="50%"
       top="15vh"
+
       class="DeviceTypeDialogVisible"
       @close="handleCloseDeviceType"
     >
@@ -299,8 +300,8 @@
       <el-table
         :data="DeviceTypeArray"
         border
+        height="400"
         highlight-current-row
-        :style="{width: 100+'%',height:tableHeight-300+'px'}"
         :header-cell-style="this.$headerCellStyle"
         :cell-style="this.$cellStyle"
         @sort-change="sortChangeOfDeviceType"
@@ -385,7 +386,7 @@
         :data="DeviceGroupArray"
         border
         highlight-current-row
-        :style="{width: 100+'%',height:tableHeight-300+'px'}"
+        height="400"
         :header-cell-style="this.$headerCellStyle"
         :cell-style="this.$cellStyle"
         @sort-change="sortChangeOfDeviceGroup"
@@ -547,6 +548,7 @@
         status: '',
         ratio: ''
       },
+      DeviceGroupDialogArr: [], // 璁惧缁勬暟缁�
       WorkLineArr: [], // 鎵�灞炰骇绾挎暟缁�
       operation: '',
       dialogFormRules: {
@@ -626,7 +628,7 @@
     },
     // 璁惧绫诲瀷鏀瑰彉鏃�
     async deviceTypeChange(val) {
-      this.form.DeviceType = val
+      this.form.DeviceGroup = ''
       const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val })
       this.DeviceGroupArr = res
     },
@@ -670,10 +672,11 @@
       this.dialogVisible = true
     },
     // 淇敼鎸夐挳
-    edit(operation, row) {
+    async edit(operation, row) {
       this.operation = operation
       this.dialogVisible = true
-      // console.log(row)
+      await this.devicetypecodeChange(row.eqptype_code)
+      await this.workshopcodeChange(row.wksp_code)
       this.$nextTick(() => {
         this.dialogForm.id = row.id
         this.dialogForm.devicecode = row.code
@@ -727,7 +730,7 @@
     // 瀵硅瘽妗嗚澶囩被鍨嬩笅鎷夐�夋嫨鏀瑰彉鏃�
     async devicetypecodeChange(val) {
       const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val })
-      this.DeviceGroupArr = res
+      this.DeviceGroupDialogArr = res
       this.dialogForm.devicegroupcode = ''
     },
     // 瀵硅瘽妗嗗彇娑�
@@ -809,7 +812,8 @@
     },
     // 鏂板鎸夐挳
     addDeviceType() {
-      this.DeviceTypeArray.unshift({ code: '', name: '', group: '', remark: '', isVisible: 1 })
+      const number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
+      this.DeviceTypeArray.unshift({ code: '', name: '', group: '', remark: '', isVisible: 1, number: number })
     },
     // 鍒犻櫎
     DeviceTypeDel(row) {
@@ -854,7 +858,7 @@
     // 鍙栨秷
     DeviceTypeCancel(row) {
       this.DeviceTypeArray.forEach((item, index) => {
-        if (item.isVisible === 1 && item.code === row.code) {
+        if (item.isVisible === 1 && item.number === row.number) {
           this.DeviceTypeArray.splice(index, 1)
         }
       })
@@ -884,7 +888,8 @@
     },
     // 鏂板
     addDeviceGroup() {
-      this.DeviceGroupArray.unshift({ code: '', name: '', eqptype_code: '', eqptype_name: '', remark: '', isVisible: 1 })
+      const number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
+      this.DeviceGroupArray.unshift({ code: '', name: '', eqptype_code: '', eqptype_name: '', remark: '', isVisible: 1, number: number })
     },
     // 鎺掑簭
     sortChangeOfDeviceGroup({ column, prop, order }) {
@@ -958,7 +963,7 @@
     // 鍙栨秷鎸夐挳
     DeviceGroupCancel(row) {
       this.DeviceGroupArray.forEach((item, index) => {
-        if (item.isVisible === 1 && item.code === row.code) {
+        if (item.isVisible === 1 && item.number === row.number) {
           this.DeviceGroupArray.splice(index, 1)
         }
       })

--
Gitblit v1.9.3