付宇航 il y a 1 an
Parent
commit
e0ce7094fa
2 fichiers modifiés avec 45 ajouts et 16 suppressions
  1. 26 12
      src/components/EnginNodeInfo/index.vue
  2. 19 4
      src/views/zdsz/engineeringCivil/index.vue

+ 26 - 12
src/components/EnginNodeInfo/index.vue

@@ -206,7 +206,7 @@ import {
 } from '@/api/zdsz/enginee'
 export default {
     name:'EnginNodeInfo',
-    props:['types','enginType','name','currentContain'],
+    props:['types','enginType','name','currentContain','updateOption','status'],
     dicts:[
         'visit_type',
         'self_closing_valve_type',
@@ -262,18 +262,31 @@ export default {
         getEnginMaterialQualityList({enginType:this.enginType}).then(res => {
             this.materialQualityList = res.data
         })
+        console.log('update',this.updateOption)
     },
     mounted(){
         console.log('当前节点name',this.name)
-        console.log('当前节点currentContain',this.currentContain)
-        this.materialComponList = this.currentContain.find(e => {
-            if( e instanceof Array){
-                return e
-            }
-            // 不处理图片
-            if(e == 'zEngiineeringPhotoBoList') return
-        })
+        console.log('update',this.updateOption)
+
+        if(this.status == '修改'){
+            this.currentContain.find(e => {
+                if( e instanceof Array){
+                    this.materialComponList = this.updateOption.zEngineeringInfoBoList[0].zEngineeringMaterialBo
+                }
+                this.nodeInfo[e] = this.updateOption[e]
+            })
+        }else{
+            this.materialComponList = this.currentContain.find(e => {
+                if( e instanceof Array){
+                    return e
+                }
+                // 不处理图片
+                if(e == 'zEngiineeringPhotoBoList') return
+
+            })
+        }
         console.log('用料信息',this.materialComponList)
+        console.log('节点信息',this.nodeInfo)
         // 添加用料对象
         // this.addMaterial()
     },
@@ -288,9 +301,6 @@ export default {
                 }
                 this.nodeInfoBo[e] = this.nodeInfo[e]
             })
-            // if(this.nodeInfo.hasOwnProperty('zEngiineeringPhotoBoList')){
-            //     delete this.nodeInfo.zEngiineeringPhotoBoList
-            // }
             this.nodeInfoBo.type = this.name
             // 接口数据格式修改 图片和用料放到nodeInfoBo节点详情对象中
             this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.nodeInfo.zEngiineeringPhotoBoList
@@ -316,6 +326,10 @@ export default {
                 material
             )
         },
+        // 填充已有数据
+        updateInfo(e){
+            console.log('填充',e)
+        },
         getUrl(url) {
             this.nodeInfo.zEngiineeringPhotoBoList = this.$refs.obsImageUpload.fileList ? this.$refs.obsImageUpload.fileList.map(e=>e.url):[];
         },

+ 19 - 4
src/views/zdsz/engineeringCivil/index.vue

@@ -324,7 +324,9 @@
           :name="e"
           :ref="'EnginNodeInfo'+idx"
           :currentContain="(listContain.find(i => i.name == e)).components"
+          :updateOption='(updateOption.find(i => i.type == e)) || {}'
           :types="currentCheckList"
+          :status="enginNodeStatus"
           enginType="民用工程"
         />
         <!-- <el-tabs type="border-card" >
@@ -386,6 +388,7 @@ export default {
     "engin_cycle"],
   data() {
     return {
+      updateOption:[],
       listContain:[
         {
           name:'放线',
@@ -720,7 +723,8 @@ export default {
       unitOptions: [],             // 单元集合
       houseOptions: [],            // 房间集合
       enginClassification_list: [], // 室内节点,
-      checkList: []// 节点集合
+      checkList: [],// 节点集合
+      enginNodeStatus:null
     };
   },
   created() {
@@ -742,7 +746,7 @@ export default {
       }, 'add')
     },
     currentEnginTypeChanged() {
-      this.$forceUpdate();
+      this.currentCheckList = []
       if (this.queryParams.enginType == undefined || this.queryParams.enginType == ''
         || this.queryParams.currentEnginTypeChange == undefined || this.queryParams.currentEnginTypeChange == ''
       )
@@ -784,6 +788,7 @@ export default {
       })
     },
     enginTypeHasChanged() {
+      this.currentCheckList = []
       this.queryParams.currentEnginTypeChange = ''
       this.currentEnginTypeChangeOptions = []
       getDicts(this.queryParams.enginType).then(res => {
@@ -903,6 +908,7 @@ export default {
       this.nodeDetailVisible = false
     },
     toNodeDetail() {
+      this.enginNodeStatus = '新增'
       let nodeCollection = []
       // 收集节点信息
       this.currentCheckList.forEach((e,idx) => {
@@ -918,6 +924,8 @@ export default {
             type: 'success'
           });
           this.open = false
+          console.log('选中节点集合',this.currentCheckList)
+          this.currentCheckList = []
           // this.$emit('closeToSucceed')
         }
       })
@@ -956,6 +964,7 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
+      this.enginNodeStatus = '修改'
       this.loading = true;
       // this.reset();
       const id = row.id || this.ids
@@ -969,8 +978,14 @@ export default {
       getEngineeringCivil(id).then(res => {
         this.loading = false;
         let newData = res.data
-        console.log(newData)
-        console.log(res.data.zEngineeringNodeBoList[0].type)
+        this.updateOption = res.data.zEngineeringNodeBoList
+        // start update修改数据
+        res.data.zEngineeringNodeBoList.forEach((e,idx) => {
+          this.currentCheckList.push(e.type)
+        })
+        
+        console.log('选中节点集合',this.currentCheckList)
+        // end
         let zEngineeringNodeBo = {
           type: res.data.zEngineeringNodeBoList[0].type,
           zEngineeringInfoBo: res.data.zEngineeringNodeBoList[0].zEngineeringInfoBo