浏览代码

民用添加用料

付宇航 1 年之前
父节点
当前提交
0bd1f7d60a

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

@@ -95,7 +95,7 @@
                     >
                     <!--                  :rules="{required: true, message: '请输入规格', trigger: 'blur'}"-->
                     <!--                  <el-input v-model="item.specifications" placeholder="请输入规格" style="width: 100%"/>-->
-                    <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 100%">
+                    <el-select v-model="status == '修改' ? item.specificationsName : item.specifications" placeholder="请选择规格" style="width: 100%">
                         <el-option
                         v-for="e in specificationsList"
                         :key="e.id"
@@ -267,25 +267,26 @@ export default {
     mounted(){
         console.log('当前节点name',this.name)
         console.log('update',this.updateOption)
+        console.log('当前节点currentContain',this.currentContain)
+        this.materialComponList = this.currentContain.find(e => {
+            if( e instanceof Array){
+                return e
+            }
+
+        })
 
         if(this.status == '修改'){
             this.currentContain.find(e => {
+                console.log(this.updateOption)
                 if( e instanceof Array){
-                    this.materialComponList = this.updateOption.zEngineeringInfoBoList[0].zEngineeringMaterialBo
+                    this.zEngineeringMaterialBo = 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
-
-            })
+            this.nodeInfo.zEngiineeringPhotoBoList = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoList
         }
-        console.log('用料信息',this.materialComponList)
+        console.log('用料组件',this.materialComponList)
+        console.log('用料信息',this.zEngineeringMaterialBo)
         console.log('节点信息',this.nodeInfo)
         // 添加用料对象
         // this.addMaterial()

+ 11 - 12
src/components/EngineeNode/index.vue

@@ -83,13 +83,13 @@
             <el-input v-model="zEngineeringInfoBo.headPhone" placeholder="请填写负责人电话" :disabled="formType"></el-input>
             </el-form-item>
             <el-form-item label="回填时间" prop="backfillTime">
-            <el-date-picker
-                :disabled="formType"
-                v-model="zEngineeringInfoBo.backfillTime"
-                value-format="yyyy-MM-dd hh:mm:ss"
-                type="datetime"
-                placeholder="请选择回填日期">
-            </el-date-picker>
+              <el-date-picker
+                  :disabled="formType"
+                  v-model="zEngineeringInfoBo.backfillTime"
+                  value-format="yyyy-MM-dd hh:mm:ss"
+                  type="datetime"
+                  placeholder="请选择回填日期">
+              </el-date-picker>
             </el-form-item>
             <el-form-item label="施工时间" prop="constructTime">
             <el-date-picker
@@ -350,7 +350,7 @@ export default {
                 });
                 return false
               }
-            })
+            }) 
           });
           return p;
         },
@@ -364,7 +364,7 @@ export default {
             // todo: 将当前tab页所选节点信息录入
             this.zEngineeringInfoBo = currentNodeInfo.zEngineeringInfoBo
             // console.log('_______',this.zEngineeringInfoBo)
-
+          
           }else{
             // todo: 校验当前表单
             this.$refs.nodeForm.validate(e => {
@@ -436,7 +436,6 @@ export default {
             this.nodeType=null
             this.reset()
             this.nodeDetailVisible = false
-            this.$emit('files',true)
         },
         created() {
             this.params = this.queryParams
@@ -631,7 +630,7 @@ export default {
         },
         open(queryParams,type = null,nodeOptions = []){
             this.formType = false
-            this.nodeList = []
+            this.nodeList = [] 
             this.currentNode = []
             this.zEngineeringNodeBoList = []
             console.log(queryParams)
@@ -688,7 +687,7 @@ export default {
               this.tabsModel = nodeOptions[0].name
               console.log('当前工程所有节点',this.nodeList)
             }
-
+            
             // end
             this.currentType = type
             console.log(this.queryParams)

+ 1 - 1
src/components/EngineePipe/index.vue

@@ -121,7 +121,7 @@ import {getComprehensive, delComprehensive} from "@/api/zdsz/comprehensive";
 import {
   getEngineeList,                            // 查询工程列表
   addEnginee,                                // 新增工程
-  getDictList
+  getDictList,
 } from "@/api/zdsz/enginee"
 import EngineeNode from '@/components/EngineeNode/index'  // 节点信息
 

+ 93 - 33
src/views/zdsz/engineeringCivil/index.vue

@@ -131,7 +131,7 @@
         </template>
       </el-table-column>
       <el-table-column label="完工状态" align="center" prop="completionStatus"/>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -156,6 +156,13 @@
             @click="addNewPipe(scope.row)"
           >新增顶管工程
           </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="addMaterial(scope.row)"
+          >新增物料
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -175,6 +182,7 @@
           <el-col :span="12">
             <el-form-item label="行政区" prop="district">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.district"
                 placeholder="请选择行政区"
                 @change="districtHasChanged"
@@ -191,6 +199,7 @@
           <el-col :span="12">
             <el-form-item label="小区" prop="areaId">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.areaId"
                 placeholder="请选择小区"
                 @change="communityHasChanged"
@@ -209,6 +218,7 @@
           <el-col :span="12">
             <el-form-item label="楼栋" prop="buildingId">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.buildingId"
                 placeholder="请选择楼栋"
                 @change="buildingHasChanged"
@@ -225,6 +235,7 @@
           <el-col :span="12">
             <el-form-item label="单元" prop="unitId">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.unitId"
                 placeholder="请选择单元"
                 @change="unitHasChanged"
@@ -243,6 +254,7 @@
           <el-col :span="12">
             <el-form-item label="房间" prop="houseId">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.houseId"
                 placeholder="请选择房间"
               >
@@ -258,6 +270,7 @@
           <el-col :span="12">
             <el-form-item label="工程类型" prop="enginType">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.enginType"
                 placeholder="请选择工程类型"
                 @change="enginTypeHasChanged"
@@ -274,9 +287,10 @@
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="工程分类" prop="currentEnginTypeChange">
+            <el-form-item label="工程分类" prop="enginClassification">
               <el-select
-                v-model="queryParams.currentEnginTypeChange"
+                :disabled="title == '添加用料' "
+                v-model="queryParams.enginClassification"
                 placeholder="请选择工程分类"
                 @change="currentEnginTypeChanged"
               >
@@ -292,6 +306,7 @@
           <el-col :span="12">
             <el-form-item label="工程周期" prop="enginCycle">
               <el-select
+                :disabled="title == '添加用料' "
                 v-model="queryParams.enginCycle"
                 placeholder="请填写工程周期"
               >
@@ -337,7 +352,7 @@
         </el-tabs> -->
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button :loading="buttonLoading" type="primary" @click="toNodeDetail">新增</el-button>
+        <el-button :loading="buttonLoading" type="primary" @click="toNodeDetail">{{ enginNodeStatus }}</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -616,7 +631,7 @@ export default {
         enginClassification: undefined,
         enginCycle: undefined,
         completionStatus: undefined,
-        currentEnginTypeChange: undefined,
+        enginClassification: undefined,
         imgUrl: undefined,
         zEngineeringNodeBoList: {
           type: undefined,
@@ -743,14 +758,47 @@ export default {
         type: '民用工程'
       }, 'add')
     },
+    // 新增物料
+    addMaterial(data){
+      this.title = "添加用料";
+      // this.enginNodeStatus = '修改'
+      this.loading = true;
+      this.reset();
+      const id = data.id || this.ids
+      getEngineeringCivil(id).then(res => {
+        this.loading = false;
+        let newData = res.data
+        // 手动调用行政区发生改变
+        this.districtHasChanged(newData.district)
+        this.communityHasChanged(newData.areaId)
+        this.buildingHasChanged(newData.buildingId,newData.areaId)
+        this.unitHasChanged(newData.unitId)
+        // 获取工程分类
+        this.enginTypeHasChanged(newData.enginType)
+        let val = newData.enginType + "_" + newData.enginClassification
+        this.currentCheckList = []
+        getDicts(val).then(res => {
+          this.checkList = res.data
+        })
+        
+        this.queryParams = newData
+        console.log(this.queryParams.areaId)
+        
+        // console.log('选中节点集合',this.currentCheckList)
+        // this.enginClassification = zEngineeringNodeBo.type
+        // newData.zEngineeringNodeBo = zEngineeringNodeBo
+        this.currentType = 'addMaterial'
+        this.open = true
+
+      })
+    },
     currentEnginTypeChanged() {
       this.currentCheckList = []
       if (this.queryParams.enginType == undefined || this.queryParams.enginType == ''
-        || this.queryParams.currentEnginTypeChange == undefined || this.queryParams.currentEnginTypeChange == ''
+        || this.queryParams.enginClassification == undefined || this.queryParams.enginClassification == ''
       )
         return
-      console.log(this.queryParams)
-      let val = this.queryParams.enginType + "_" + this.queryParams.currentEnginTypeChange
+      let val = this.queryParams.enginType + "_" + this.queryParams.enginClassification
       getDicts(val).then(res => {
         this.checkList = res.data
       })
@@ -772,10 +820,10 @@ export default {
         this.buildingOptions = res.data
       })
     },
-    buildingHasChanged(buildingId) {
+    buildingHasChanged(buildingId,areaId) {
       console.log(buildingId)
       this.queryParams.unitId = null
-      getUnits(this.queryParams.areaId,buildingId ).then(res => {
+      getUnits(areaId || this.queryParams.areaId,buildingId ).then(res => {
         this.unitOptions = res.data
       })
     },
@@ -785,11 +833,11 @@ export default {
         this.houseOptions = res.data
       })
     },
-    enginTypeHasChanged() {
+    enginTypeHasChanged(enginType = null) {
       this.currentCheckList = []
-      this.queryParams.currentEnginTypeChange = ''
+      this.queryParams.enginClassification = ''
       this.currentEnginTypeChangeOptions = []
-      getDicts(this.queryParams.enginType).then(res => {
+      getDicts(enginType || this.queryParams.enginType).then(res => {
         this.currentEnginTypeChangeOptions = res.data
       })
     },
@@ -912,7 +960,6 @@ export default {
       this.nodeDetailVisible = false
     },
     toNodeDetail() {
-      this.enginNodeStatus = '新增'
       let nodeCollection = []
       // 收集节点信息
       this.currentCheckList.forEach((e,idx) => {
@@ -921,18 +968,34 @@ export default {
          nodeCollection.push(nodeItem)
       })
       this.queryParams.zEngineeringNodeBoList = nodeCollection
-      addEngineeringCivil(this.queryParams).then(res => {
-        if(res.code == 200){
-          this.$message({
-            message: '新增成功',
-            type: 'success'
-          });
-          this.open = false
-          console.log('选中节点集合',this.currentCheckList)
-          this.currentCheckList = []
-          // this.$emit('closeToSucceed')
-        }
+      if(this.enginNodeStatus == '修改'){
+        putEngineeringCivil(this.queryParams).then(res => {
+          if(res.code == 200){
+            this.$message({
+              message: '修改成功',
+              type: 'success'
+            });
+            this.open = false
+            console.log('选中节点集合',this.currentCheckList)
+            this.currentCheckList = []
+            // this.$emit('closeToSucceed')
+          }
+        })
+      }else{
+        addEngineeringCivil(this.queryParams).then(res => {
+          if(res.code == 200){
+            this.$message({
+              message: '新增成功',
+              type: 'success'
+            });
+            this.open = false
+            console.log('选中节点集合',this.currentCheckList)
+            this.currentCheckList = []
+            // this.$emit('closeToSucceed')
+          }
       })
+      }
+      
       return
       getDictList({enginType: ['new_built', 'old_renovation']}).then(res => {
         this.nodeList = res.data
@@ -962,6 +1025,7 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
+      this.enginNodeStatus = '新增'
       this.reset();
       this.open = true;
       this.title = "添加民用工程";
@@ -972,17 +1036,14 @@ export default {
       this.loading = true;
       // this.reset();
       const id = row.id || this.ids
-      // getEngineeringCivil(id).then(response => {
-      //   this.loading = false;
-      //   this.queryParams = response.data;
-      //   console.log(this.form)
-      //   this.open = true;
-      //
-      // });
       getEngineeringCivil(id).then(res => {
         this.loading = false;
         let newData = res.data
+        // 手动调用行政区发生改变
+        // this.districtHasChanged(newData.district)
+        this.queryParams = newData
         this.updateOption = res.data.zEngineeringNodeBoList
+        console.log(this.queryParams.areaId)
         // start update修改数据
         res.data.zEngineeringNodeBoList.forEach((e,idx) => {
           this.currentCheckList.push(e.type)
@@ -1014,7 +1075,6 @@ export default {
         this.enginClassification = zEngineeringNodeBo.type
         newData.zEngineeringNodeBo = zEngineeringNodeBo
         this.currentType = 'put'
-        this.queryParams = newData
         console.log('修改queryparams传值', this.queryParams)
         console.log(this.queryParams)
         this.zEngineeringInfoBo = newData.zEngineeringNodeBo.zEngineeringInfoBo