Browse Source

指定字段清空

haojianlong 3 years ago
parent
commit
614aadffeb

+ 16 - 10
src/components/business_space/business/handsontable.vue

@@ -541,8 +541,9 @@ export default {
     updateBusiness(data, change) {
       let param = {
         data: {
-          Content: [],
-          Projection: []
+          content: [],
+          projection: [],
+          nullItems: []
         },
         zone: this.zoneCode
       };
@@ -552,15 +553,19 @@ export default {
         let key = item[1].split(".")[0]
         if (key == "flowBuild" && keyList.indexOf(key) == -1) {
           keyList.push("BuildingId", "FloorId")
-          param.data.Projection.push("BuildingId", "FloorId")
+          param.data.projection.push("BuildingId", "FloorId")
         }
         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)
+        if (item[1] && item[3] == "" && param.data.projection.indexOf(key) == -1) {
+          param.data.projection.push(key)
           keyList.push(item[1])
         }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.data.nullItems.indexOf(item[1]) == -1) {
+          param.data.nullItems.push(item[1])
+        }
       })
       //生成对应修改数据
       data.map((item, index) => {
@@ -586,10 +591,10 @@ export default {
             tools.setDataForKey(item, value, itemData == "" ? null : itemData)
           }
         })
-        param.data.Content.push(item);
+        param.data.content.push(item);
       })
-      if (param.data.Projection.indexOf('BuildingId') > -1) {
-        let pa = param.data.Content.map(t => {
+      if (param.data.projection.indexOf('BuildingId') > -1) {
+        let pa = param.data.content.map(t => {
           return {
             type: this.zoneCode,
             spaceId: t.id,
@@ -606,7 +611,7 @@ export default {
       } else {
         // updateZone(param, (res) => {
         // })
-        let obj = param.data.Content.map(i => {
+        let obj = param.data.content.map(i => {
           i.Outline = typeof i.Outline == 'string' ? JSON.parse(i.Outline) : i.Outline
           return {
             ...i,
@@ -615,7 +620,8 @@ export default {
         })
         let updateParam = {
           content: obj,
-          // projection: param.data.Projection
+          nullItems: param.data.nullItems
+          // projection: param.data.projection
         };
         zoneUpdate(updateParam, res => {
           this.$message.success('更新成功')

+ 6 - 1
src/components/ledger/handsontables/assets.vue

@@ -756,7 +756,8 @@ export default {
     updateProperty(data, change) {
       let param = {
         content: [],
-        projection: []
+        projection: [],
+        nullItems: []
       }, keyList = []
       //生成要修改字段列表
       change.map(item => {
@@ -771,6 +772,10 @@ export default {
         if (item[1] && item[3] == "" && param.projection.indexOf(key) == -1) {
           param.projection.push(key)
         }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
+          param.nullItems.push(item[1])
+        }
       })
       //生成对应修改数据
       data.map((item, index) => {

+ 6 - 1
src/components/ledger/handsontables/device.vue

@@ -859,7 +859,8 @@ export default {
     updateBusiness(data, change) {
       let param = {
           content: [],
-          projection: []
+          projection: [],
+          nullItems: []
         },
         keyList = [];
       //生成要修改字段列表
@@ -881,6 +882,10 @@ export default {
           param.projection.push(key);
           keyList.push(item[1])
         }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
+          param.nullItems.push(item[1])
+        }
       });
       //生成对应修改数据
       data.map((item, index) => {

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

@@ -511,8 +511,9 @@ export default {
     // 修改
     updateBusiness(data, change) {
       let param = {
-        Content: [],
-        Projection: []
+        content: [],
+        projection: [],
+        nullItems: []
       }, keyList = [];
       //生成要修改字段列表
       change.map(item => {
@@ -520,10 +521,14 @@ export default {
         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 (item[1] && item[3] == "" && param.projection.indexOf(key) == -1) {
+          param.projection.push(key);
           keyList.push(item[1])
         }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
+          param.nullItems.push(item[1])
+        }
       });
       //生成对应修改数据
       data.map((item, index) => {
@@ -531,7 +536,7 @@ export default {
           let itemData = tools.dataForKey(item, value);
           tools.setDataForKey(item, value, itemData == "" ? null : itemData);
         });
-        param.Content.push(item);
+        param.content.push(item);
       });
       updateGeneralSys(param, res => {
       });

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

@@ -196,8 +196,9 @@ export default {
     // 修改表格内容
     async updateTableData(data, change) {
       let param = {
-        Content: [],
-        Projection: []
+        content: [],
+        projection: [],
+        nullItems: []
       }, keyList = [];
       //生成要修改字段列表
       change.map(item => {
@@ -205,8 +206,12 @@ export default {
         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 (item[1] && item[3] == "" && param.projection.indexOf(key) == -1) {
+          param.projection.push(key);
+        }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
+          param.nullItems.push(item[1])
         }
       });
       //生成对应修改数据
@@ -221,7 +226,7 @@ export default {
         // } else {
         //   item[keyarr[0]] = item[keyarr[0]] != ""? item[keyarr[0]]: null
         // }
-        param.Content.push(item);
+        param.content.push(item);
       })
       await updataCenoteTableData(param, (res) => {
 
@@ -536,7 +541,7 @@ export default {
       if (param.data.length) {
         BeatchQueryParam(param, res => {
           this.tableData = data.map(item => {
-            res.Content.map(child => {
+            res.data.map(child => {
               if (item.id == child.objectId) {
                 if (child.data || child.data == 0) {
                   this.tableHeader.map(head => {

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

@@ -257,7 +257,8 @@ export default {
         projectId: this.projectId,
         data: {
           content: [],
-          projection: []
+          projection: [],
+          nullItems: []
         }
       }, keyList = [];
       //生成要修改字段列表
@@ -269,6 +270,10 @@ export default {
         if (item[1] && item[3] == "" && param.data.projection.indexOf(key) == -1) {
           param.data.projection.push(key)
         }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.data.nullItems.indexOf(item[1]) == -1) {
+          param.data.nullItems.push(item[1])
+        }
       })
       //生成对应修改数据
       data.map((item, index) => {

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

@@ -211,8 +211,9 @@ export default {
     // 修改表格内容
     async updateTableData(data, change) {
       let param = {
-        Content: [],
-        Projection: []
+        content: [],
+        projection: [],
+        nullItems: []
       }, keyList = [];
       //生成要修改字段列表
       change.map(item => {
@@ -220,8 +221,12 @@ export default {
         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 (item[1] && item[3] == "" && param.projection.indexOf(key) == -1) {
+          param.projection.push(key);
+        }
+        // 保存置空字段
+        if (item[1] && item[3] == "" && param.nullItems.indexOf(item[1]) == -1) {
+          param.nullItems.push(item[1])
         }
       });
       //生成对应修改数据
@@ -236,7 +241,7 @@ export default {
         // } else {
         //   item[keyarr[0]] = item[keyarr[0]] != ""? item[keyarr[0]]: null
         // }
-        param.Content.push(item);
+        param.content.push(item);
       });
       await updataRentTableData(param, (res) => {
 
@@ -546,7 +551,7 @@ export default {
       if (param.data.length) {
         BeatchQueryParam(param, res => {
           this.tableData = data.map(item => {
-            res.Content.map(child => {
+            res.data.map(child => {
               if (item.id == child.objectId) {
                 if (child.data || child.data == 0) {
                   this.tableHeader.map(head => {