|
@@ -38,10 +38,11 @@ import addBusiness from "@/components/business_space/dialogs/addDialog/businessD
|
|
|
import showTools from "@/utils/handsontable/notShow"
|
|
|
import handsonUtils from "@/utils/hasontableUtils"
|
|
|
import Handsontable from "handsontable-pro"
|
|
|
+import buildFloor from '@/utils/handsontable/buildFloorData'
|
|
|
import 'handsontable-pro/dist/handsontable.full.css'
|
|
|
import zhCN from 'handsontable-pro/languages/zh-CN';
|
|
|
import qrcode from "@/components/ledger/lib/qrcode";
|
|
|
-import { queryZone, updateZone, deleteZone, createZone, BeatchQueryParam } from "@/api/scan/request";
|
|
|
+import { queryZone, updateZone, deleteZone, createZone, BeatchQueryParam, updateRelateInSpAndBuild } from "@/api/scan/request";
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
export default {
|
|
|
props: {
|
|
@@ -95,10 +96,12 @@ export default {
|
|
|
buildMess: null,
|
|
|
filtersArr: [], //表格数据被过滤后的下标
|
|
|
copyMain: [], //深拷贝数组
|
|
|
+ buildFloorData: [], //楼层数据
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.setData()
|
|
|
+ buildFloor.getData(this.buildFloorData)
|
|
|
},
|
|
|
mounted() { },
|
|
|
methods: {
|
|
@@ -107,7 +110,7 @@ export default {
|
|
|
this.param.UserId = this.userId
|
|
|
this.param.secret = this.secret
|
|
|
},
|
|
|
- //获取表头
|
|
|
+ //获取表格数据
|
|
|
getHeader(headers, buildFloorSelectd) {
|
|
|
this.headers = headers
|
|
|
this.buildFloorSelectd = buildFloorSelectd
|
|
@@ -124,9 +127,24 @@ export default {
|
|
|
PageSize: this.page.pageSize
|
|
|
}
|
|
|
}
|
|
|
- if (this.buildFloorSelectd.length && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
|
|
|
- params.data.Filters = `BuildingId='${this.buildFloorSelectd[0]}';FloorId='${this.buildFloorSelectd[1]}'`
|
|
|
+ if (this.buildFloorSelectd[0] == "noKnow") {
|
|
|
+ params.data.Filters += `buildingId isNull`
|
|
|
+ } else if (this.buildFloorSelectd[0] && this.buildFloorSelectd[0] != "all") {
|
|
|
+ params.data.Filters += `buildingId='${this.buildFloorSelectd[0]}'`
|
|
|
}
|
|
|
+ if (this.buildFloorSelectd.length > 1) {
|
|
|
+ if (this.buildFloorSelectd[1] == "noKnow") {
|
|
|
+ params.data.Filters += `;floorId isNull`
|
|
|
+ } else if (this.buildFloorSelectd[1] && this.buildFloorSelectd[1] != "all") {
|
|
|
+ params.data.Filters += `;floorId='${this.buildFloorSelectd[1]}'`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!params.data.Filters) {
|
|
|
+ delete params.data.Filters
|
|
|
+ }
|
|
|
+ // if (this.buildFloorSelectd.length && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
|
|
|
+ // params.data.Filters = `BuildingId='${this.buildFloorSelectd[0]}';FloorId='${this.buildFloorSelectd[1]}'`
|
|
|
+ // }
|
|
|
// else if (buildFloorSelectd.length && buildFloorSelectd[0] && !buildFloorSelectd[1]) {
|
|
|
// params.data.Filters = `BuildingId='${buildFloorSelectd[0]}'`
|
|
|
// } else {
|
|
@@ -134,7 +152,14 @@ export default {
|
|
|
// }
|
|
|
queryZone(params, res => {
|
|
|
this.page.total = res.Total
|
|
|
- this.main = res.Content
|
|
|
+ this.main = res.Content.map((item) => {
|
|
|
+ if (item.hasOwnProperty("BuildingId") && item.hasOwnProperty("FloorId")) {
|
|
|
+ item.flowBuild = item.BuildingId + "-" + item.FloorId
|
|
|
+ } else if (item.hasOwnProperty("BuildingId") && !item.hasOwnProperty("FloorId")) {
|
|
|
+ item.flowBuild = item.BuildingId
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ });
|
|
|
if (this.main && this.main.length && this.main[0].RoomID) {
|
|
|
this.copyMain = tools.deepCopy(this.main);
|
|
|
}
|
|
@@ -168,6 +193,7 @@ export default {
|
|
|
sortIndicator: true, //添加排序
|
|
|
renderAllRows: true,
|
|
|
autoColumnSize: true,
|
|
|
+ observeChanges: false,
|
|
|
language: "zh-CN",
|
|
|
manualColumnResize: true,
|
|
|
manualColumnMove: true,
|
|
@@ -339,6 +365,10 @@ export default {
|
|
|
//生成要修改字段列表
|
|
|
change.map((item) => {
|
|
|
let key = item[1].split(".")[0]
|
|
|
+ if (key == "flowBuild" && keyList.indexOf(key) == -1) {
|
|
|
+ keyList.push("BuildingId", "FloorId")
|
|
|
+ param.data.Projection.push("BuildingId", "FloorId")
|
|
|
+ }
|
|
|
if (item[1] && keyList.indexOf(key) == -1) {
|
|
|
keyList.push(key)
|
|
|
}
|
|
@@ -349,13 +379,44 @@ export default {
|
|
|
//生成对应修改数据
|
|
|
data.map((item, index) => {
|
|
|
keyList.map(value => {
|
|
|
- let itemData = tools.dataForKey(item, value)
|
|
|
- tools.setDataForKey(item, value, itemData == "" ? null : itemData)
|
|
|
+ if (value == "BuildingId") {
|
|
|
+ let itemData = tools.dataForKey(item, "flowBuild")
|
|
|
+ if (itemData == "") {
|
|
|
+ tools.setDataForKey(item, "BuildingId", null)
|
|
|
+ tools.setDataForKey(item, "FloorId", null)
|
|
|
+ } else {
|
|
|
+ let BuildingId = itemData.split("-")[0]
|
|
|
+ let FloorId = itemData.split("-")[1]
|
|
|
+ if (BuildingId && FloorId) {
|
|
|
+ tools.setDataForKey(item, "BuildingId", BuildingId)
|
|
|
+ tools.setDataForKey(item, "FloorId", FloorId)
|
|
|
+ } else if (BuildingId && !FloorId) {
|
|
|
+ tools.setDataForKey(item, "BuildingId", BuildingId)
|
|
|
+ tools.setDataForKey(item, "FloorId", null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let itemData = tools.dataForKey(item, value)
|
|
|
+ tools.setDataForKey(item, value, itemData == "" ? null : itemData)
|
|
|
+ }
|
|
|
})
|
|
|
param.data.Content.push(item);
|
|
|
})
|
|
|
- param.Projection = []
|
|
|
- updateZone(param, (res) => { })
|
|
|
+ if (param.data.Projection.indexOf('BuildingId') > -1) {
|
|
|
+ let pa = param.data.Content.map(t => {
|
|
|
+ return {
|
|
|
+ type: this.zoneCode,
|
|
|
+ spaceId: t.RoomID,
|
|
|
+ id: t.FloorId || t.BuildingId || null,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ updateRelateInSpAndBuild(pa, res => {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ param.data.Projection = []
|
|
|
+ updateZone(param, (res) => { })
|
|
|
+ }
|
|
|
},
|
|
|
//获取被筛选掉的行号
|
|
|
trimmedRows() {
|
|
@@ -436,7 +497,7 @@ export default {
|
|
|
item,
|
|
|
head.Path,
|
|
|
// child.error ? "表号功能号格式错误" : "表号功能号不存在"
|
|
|
- child.error ? child.value? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
|
|
|
+ child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
|
|
|
);
|
|
|
}
|
|
|
});
|
|
@@ -459,6 +520,9 @@ export default {
|
|
|
let arr = tools.copyArr(list)
|
|
|
let data = showTools.headerTextFilter(arr, "space", this.onlyRead, this.showType)
|
|
|
data.unshift("是否关联平面图", "与空间相关联的设备");
|
|
|
+ if (this.showType == "all") {
|
|
|
+ data.splice(4, 0, "所属建筑楼层")
|
|
|
+ }
|
|
|
return data;
|
|
|
},
|
|
|
/**
|
|
@@ -479,6 +543,17 @@ export default {
|
|
|
renderer: this.facilityRender,
|
|
|
readOnly: true
|
|
|
});
|
|
|
+ if (this.showType == "all") {
|
|
|
+ data.splice(4, 0, {
|
|
|
+ data: "flowBuild",
|
|
|
+ renderer: tools.customDropdownRenderer,
|
|
|
+ editor: "chosen",
|
|
|
+ chosenOptions: {
|
|
|
+ data: this.buildFloorData
|
|
|
+ },
|
|
|
+ readOnly: this.onlyRead
|
|
|
+ })
|
|
|
+ }
|
|
|
return data;
|
|
|
},
|
|
|
myRenderer(instance, td, row, col, prop, value, cellProperties) {
|