From ecd5f28ec3dd41d74f6da96b92e32c600e2cf3d1 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期二, 22 八月 2023 15:10:29 +0800
Subject: [PATCH] 小修改

---
 src/views/spare/modules/sparePartScrapRequirement/SparePartScrapRequirementForm.vue |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/views/spare/modules/sparePartScrapRequirement/SparePartScrapRequirementForm.vue b/src/views/spare/modules/sparePartScrapRequirement/SparePartScrapRequirementForm.vue
index 798b1a2..1cf9ac2 100644
--- a/src/views/spare/modules/sparePartScrapRequirement/SparePartScrapRequirementForm.vue
+++ b/src/views/spare/modules/sparePartScrapRequirement/SparePartScrapRequirementForm.vue
@@ -18,12 +18,20 @@
                 v-model='model.departId'
                 dictCode="sys_depart,depart_name,id,del_flag!='1'"
               />-->
-              <a-select
+              <a-tree-select
+                style="width: 100%"
+                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+                :tree-data="treeData"
+                placeholder="璇烽�夋嫨鐢宠閮ㄩ棬"
+                tree-default-expand-all
+                v-model='model.departId'
+              />
+<!--              <a-select
                 :placeholder="'璇烽�夋嫨鐢宠閮ㄩ棬'"
                 :options="this.departs"
                 style="width: 100%"
                 v-model='model.departId'
-              />
+              />-->
             </a-form-model-item>
           </a-col>
           <a-col :span='12'>
@@ -51,6 +59,7 @@
           :dataSource='sparesScrapRequirementDetailTable.dataSource'
           :maxHeight='300'
           :disabled='formDisabled'
+          @valueChange="changeAuxiliaryQuantity"
           :alwaysEdit='true'
           :rowNumber='true'
           :bordered='bordered'
@@ -94,6 +103,7 @@
   },
   data() {
     return {
+      treeData:[],
       bordered:true,
       departs: [],
       labelCol: {
@@ -215,16 +225,18 @@
             width: '200px',
             placeholder: '璇疯緭鍏�${title}',
             defaultValue: 0,
-            formatter({ cellValue, row, column }) {
-
+            Function({cellValue, row, column}){
+              console.log(cellValue)
+              console.log(row)
+              console.log(column)
               if (cellValue != null) {
                 let conversionRatio = row.conversionRatio
-
+                console.log(conversionRatio)
                 row.auxiliaryQuantity = Math.abs(cellValue * conversionRatio)
 
               }
+              console.log(cellValue)
               return cellValue
-
             },
             validateRules: [
               {
@@ -293,6 +305,7 @@
         add: '/spare/sparePartRequirement/add',
         edit: '/spare/sparePartRequirement/edit',
         queryById: '/spare/sparePartRequirement/queryById',
+        loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
         getSysDeparts: "/eam/equipment/getSysDeparts",
         sparesScrapRequirementDetail: {
           list: '/spare/sparePartRequirement/querySparesScrapRequirementDetailByMainId'
@@ -326,9 +339,18 @@
     })
   },
   created() {
-    this.getSysDeparts()
+    this.initOptions()
   },
   methods: {
+    initOptions() {
+      getAction(this.url.loadOptions).then(res => {
+        if (res.success) {
+          this.treeData = res.result
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
     getSysDeparts() {
       getAction(this.url.getSysDeparts).then((res) => {
         if (res.success) {
@@ -375,8 +397,6 @@
             auxiliaryUnitId: data[i].auxiliaryUnitId,
             mainUnitIdName: data[i].mainUnitId_dictText,
             auxiliaryUnitIdName: data[i].auxiliaryUnitId_dictText,
-            mainQuantity: data[i].mainQuantity,
-            auxiliaryQuantity: data[i].auxiliaryQuantity,
             requirementTime: data[i].requirementTime,
             conversionRatio: data[i].conversionRatio
 
@@ -439,6 +459,13 @@
       this.visible = false
       this.$emit('close')
       this.$refs.form.clearValidate()
+    },
+    changeAuxiliaryQuantity(target){
+      console.log(target.columnIndex)
+      let num=target.columnIndex
+      if (target.columnIndex ===num){
+        target.row.auxiliaryQuantity=Math.abs(target.row.conversionRatio*target.row.mainQuantity)
+      }
     }
   }
 }

--
Gitblit v1.9.3