Browse Source

台账信息更新修改

zhangyu 5 years ago
parent
commit
84dbb0f3a0

+ 8 - 5
src/components/business_space/business/handsontable.vue

@@ -336,22 +336,25 @@ export default {
         	Projection: []
 				},
         zone: this.zoneObj.code
-      };
+      }, keyList = [];
       //生成要修改字段列表
       change.map((item) => {
-        if(item[1] && param.data.Projection.indexOf(item[1]) == -1) {
-          param.data.Projection.push(item[1])
+        let key = item[1].split(".")[0]
+        if(item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key)
+        }
+        if(item[1] && item[3] == "" && param.data.Projection.indexOf(key) == -1) {
+          param.data.Projection.push(key)
         }
       })
       //生成对应修改数据
       data.map((item, index) => {
-        param.data.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value)
           tools.setDataForKey(item, value, itemData == "" ? null : itemData)
         })
         param.data.Content.push(item);
 			})
-      param.Projection = []
 			updateZone(param, (res) => {})
     },
     //获取被筛选掉的行号

+ 12 - 11
src/components/ledger/handsontables/assets.vue

@@ -609,20 +609,24 @@ export default {
       let param = {
         Content: [],
         Projection: []
-      }
+      }, keyList = []
       //生成要修改字段列表
       change.map(item => {
-        if (item[1] && param.Projection.indexOf(item[1]) == -1) {
-          if (item[1].split(".")[0] == "flowBuild") {
-            param.Projection.push("BuildingId","FloorId")
-          } else {
-            param.Projection.push(item[1].split(".")[0])
-          }
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key)
+        }
+        if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1) {
+          param.Projection.push(key)
+        }
+        if (key == "flowBuild" && keyList.indexOf(key) == -1) {
+          keyList.push("BuildingId","FloorId")
+          param.Projection.push("BuildingId","FloorId")
         }
       })
       //生成对应修改数据
       data.map((item, index) => {
-        param.Projection.map(value => {
+        keyList.map(value => {
           if (value == "BuildingId") {
             let itemData = tools.dataForKey(item, "flowBuild")
             if (itemData == "") {
@@ -643,11 +647,9 @@ export default {
             let itemData = tools.dataForKey(item, value)
             tools.setDataForKey(item, value, itemData == "" ? null : itemData)
           }
-          
         });
         param.Content.push(item)
       })
-      param.Projection = []
       updateProperty(param, res => { })
     },
     //修改资产类型
@@ -795,7 +797,6 @@ export default {
     },
     //获取被筛选掉的行号
     trimmedRows() {
-      debugger
       var plugin = this.hot.getPlugin("trimRows").trimmedRows;
       let dataLength = this.tableData.length;
       let dataArr = new Array();

+ 8 - 5
src/components/ledger/handsontables/device.vue

@@ -551,22 +551,25 @@ export default {
       let param = {
         Content: [],
         Projection: []
-      };
+      }, keyList = [];
       //生成要修改字段列表
       change.map(item => {
-        if (item[1] && param.Projection.indexOf(item[1]) == -1 && item[1] != 'PropertyId') {
-          param.Projection.push(item[1].split(".")[0]);
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1 && item[1] != 'PropertyId') {
+          keyList.push(key);
+        }
+        if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1 && item[1] != 'PropertyId') {
+          param.Projection.push(key);
         }
       });
       //生成对应修改数据
       data.map((item, index) => {
-        param.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value);
           tools.setDataForKey(item, value, itemData == "" ? null : itemData);
         });
         param.Content.push(item);
       });
-      param.Projection = []
       updateEquip(param, res => { });
     },
     //修改设备类型

+ 8 - 5
src/components/ledger/handsontables/system.vue

@@ -451,22 +451,25 @@ export default {
       let param = {
         Content: [],
         Projection: []
-      };
+      }, keyList = [];
        //生成要修改字段列表
       change.map(item => {
-        if (item[1] && param.Projection.indexOf(item[1]) == -1) {
-          param.Projection.push(item[1].split(".")[0]);
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key);
+        }
+        if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1) {
+          param.Projection.push(key);
         }
       });
       //生成对应修改数据
       data.map((item, index) => {
-        param.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value);
           tools.setDataForKey(item, value, itemData == "" ? null : itemData);
         });
         param.Content.push(item);
       });
-      param.Projection = []
       updateGeneralSys(param, res => { });
     },
     //获取到了正确的信息

+ 11 - 4
src/utils/handsontable/buildFloorData.js

@@ -68,10 +68,17 @@ const buildFloor = {
       data.forEach(item => {
         if (item.children && item.children.length) {
           item.children.forEach(child => {
-            buildFloorData.push({
-              Code: item.value + "-" + child.value,
-              Name: item.label + "-" + child.label
-            })
+            if (child.value = "") {
+              buildFloorData.push({
+                Code: item.value + "-" + child.value,
+                Name: item.label + "-" + child.label
+              })
+            } else {
+              buildFloorData.push({
+                Code: item.value,
+                Name: item.label + "-" + child.label
+              })
+            }
           })
         } else {
           buildFloorData.push({

+ 11 - 9
src/views/ledger/cenotelist/index.vue

@@ -169,16 +169,20 @@ export default {
       let param = {
         Content: [],
         Projection: []
-      };
-      //生成要修改字段列表
-      change.map((item) => {
-        if(item[1] && param.Projection.indexOf(item[1]) == -1) {
-          param.Projection.push(item[1])
+      }, keyList = [];
+       //生成要修改字段列表
+      change.map(item => {
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key);
         }
-      })
+        if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1) {
+          param.Projection.push(key);
+        }
+      });
       //生成对应修改数据
       data.map((item, index) => {
-        param.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value)
           tools.setDataForKey(item, value, itemData == "" ? null : itemData)
         })
@@ -190,8 +194,6 @@ export default {
         // }
         param.Content.push(item);
       })
-      param.Projection = []
-
       await updataCenoteTableData(param, (res) => {
         
       })

+ 10 - 6
src/views/ledger/facility/partsmanage/index.vue

@@ -241,16 +241,20 @@ export default {
           Content: [],
           Projection: []
         }
-      };
+      }, keyList = [];
       //生成要修改字段列表
-      change.map(item => {
-        if (item[1] && param.data.Projection.indexOf(item[1]) == -1) {
-          param.data.Projection.push(item[1].split(".")[0]);
+      change.map((item) => {
+        let key = item[1].split(".")[0]
+        if(item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key)
         }
-      });
+        if(item[1] && item[3] == "" && param.data.Projection.indexOf(key) == -1) {
+          param.data.Projection.push(key)
+        }
+      })
       //生成对应修改数据
       data.map((item, index) => {
-        param.data.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value);
           tools.setDataForKey(item, value, itemData == "" ? null : itemData);
         });

+ 11 - 9
src/views/ledger/rentlist/index.vue

@@ -185,16 +185,20 @@ export default {
       let param = {
         Content: [],
         Projection: []
-      }
-      //生成要修改字段列表
-      change.map((item) => {
-        if(item[1] && param.Projection.indexOf(item[1]) == -1) {
-          param.Projection.push(item[1])
+      }, keyList = [];
+       //生成要修改字段列表
+      change.map(item => {
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key);
         }
-      })
+        if (item[1] && item[3] == "" && param.Projection.indexOf(key) == -1) {
+          param.Projection.push(key);
+        }
+      });
       //生成对应修改数据
       data.map((item, index) => {
-        param.Projection.map(value => {
+        keyList.map(value => {
           let itemData = tools.dataForKey(item, value)
           tools.setDataForKey(item, value, itemData == "" ? null : itemData)
         })
@@ -206,8 +210,6 @@ export default {
         // }
         param.Content.push(item);
       });
-
-      param.Projection = []
       await updataRentTableData(param, (res) => {
         
       })