@@ -79,7 +76,8 @@
-
+
{
this.forceRerender();
- },200)
+ }, 200)
+ this.getInputData()
},
beforeDestroy() {
clearInterval(this.timing);
},
methods: {
- //更新的点击事件
- // showChild(item,type) {
- // let fn = `this.showChild${type}(${item})`;
- // eval(fn);
- // console.log(fn);
- // },
+ getInputData(name) {
+ this.departnew = name
+ console.log(this.departnew);
+ },
//重新渲染
forceRerender() {
this.componentKey ++;
@@ -503,87 +508,48 @@ console.log("val",val)
console.log('val', result.data)
this.arr = result.data
for (var a = 0; a < result.data.length; a++) {
- //拿到楼号
- // that.floorInfo1.push(result.data[a].floorName)
- // console.log(that.floorInfo1);
- //判断楼号
- // var str = that.floorInfo1.floor;
- // var spstr = str.split("");
- //判断城南基地部分数字楼层拿到所有部门
- // if (spstr[spstr.length - 1] == 0) {
- for (let i = 0; i < result.data.length; i++) {
- // that.floorInfo1.floor = val + '主楼'
- // var str1 = result.data[i].floor
- // var spstr1 = str1.split("");
- // if (spstr1[spstr1.length - 1] == 0) {
- // that.floorInfo.push(result.data[i].floorName)
- that.floorInfo1.push(result.data[i].floorName)
- // that.departInfo.push(result.data[i].depart)
- // that.tableData.push(Object.values(result.data[i]))
- // }
- //表格数据
- that.tableData.push(Object.values(result.data[i]))
+ for (let i = 0; i < result.data.length; i++) {
+ that.floorInfo1.push(result.data[i].floorName)
+
+ //表格数据
+ that.tableData.push(Object.values(result.data[i]))
+ }
+ for (let v = 0; v < that.tableData.length; v++) {
+ that.departInfo.push(that.tableData[v])
+ that.departInfo[v].splice(1, 1)
+ that.departInfo[v].splice(2, 1)
+ that.departInfo[v].splice(6, 1)
+ that.departInfo[v].splice(4, 1)
}
- for (let v = 0; v < that.tableData.length; v++) {
- that.departInfo.push(that.tableData[v].slice(0, 4))
- }
that.config5.data = that.departInfo
- console.log(that.tableData);
- const qcData = new Set(that.config5.data)
- that.departQcData = qcData
-
- //去除部门数组中的空字符串
- // var newArr1 = that.departInfo.filter(i => i && i.trim())
- //楼号去重
+ // 去重
+
const qcData1 = new Set(that.floorInfo1)
- that.floorNameQcData = qcData1
-
- //去重
- // const qcData = new Set(newArr1)
- // that.departQcData = qcData
-
+ that.floorNameQcData.floorName = qcData1
+ var floorname = []
+ this.floorNameQcData.floorName.forEach(function (item1, index, set) {
+ floorname.push(item1)
+ })
//拿到对应楼号对应部门
- // for (let j = 0; j < result.data.length; j++) {
- // if (that.floorNameQcData == result.data[j].floorName) {
- // console.log(8989898);
- // that.departInfo.push(result.data[j].depart)
- // //表格数据
- // // that.departInfo.push(result.data[j].depart)
- // }
- // }
- //去除部门数组中的空字符串
- // var newArr1 = that.departInfo.filter(i => i && i.trim())
- //去重
- // const qcData = new Set(newArr1)
- // that.departQcData = qcData
- // } else {
- //拿到对应楼层对应部门
- // for (let j = 0; j < result.data.length; j++) {
- // if (that.floorInfo1.floor === result.data[j].floor) {
- // that.departInfo.push(result.data[j].depart)
- // //表格数据
-
- // }
- // }
- // that.tableData.push(Object.values(result.data[]))
- // that.config5.data = that.tableData
- // for (let v = 0; v < that.config5.data.length; v++){
- // that.config5.data[v].pop()
- // }
-
- // console.log("that.config5",that.config5);
- // //去除部门数组中的空字符串
- // var newArr = that.departInfo.filter(i => i && i.trim())
- // // console.log(that.config5.data);
- // //去重
- // const qcData = new Set(newArr)
- // that.departQcData = qcData
+
+ var groupList = [];
+ //楼号分类
+ for (var j = 0; j < result.data.length; j++) {
+ if (!groupList[result.data[j].floorName]) {
+ var arr1 = [];
+ arr1.push(result.data[j]);
+ groupList[result.data[j].floorName] = arr1;
+ } else {
+ groupList[result.data[j].floorName].push(result.data[j])
+ }
+ }
+ that.floorNameQcData.floorName.depart = groupList
+
var arr = Object.entries(result.data(a))
console.log("arr", arr)
- // }
}
@@ -591,9 +557,7 @@ console.log("val",val)
.catch(error => {
console.log(error)
})
- // }else{
-
- // }
+
} else if (val == "健康中心" || val == "老卫生所" || val == "龙吟广场" || val == "栖霞基地") {
if (val == '健康中心') {
that.floorInfo = "健康中心主楼"
@@ -602,7 +566,6 @@ console.log("val",val)
}
that.val = false
console.log("val", val)
-
axios.get('/json/' + val + '.json')
.then(result => {
console.log('val', result.data)
@@ -616,9 +579,13 @@ console.log("val",val)
//表格数据
that.tableData.push(Object.values(result.data[j]))
}
+
for (let v = 0; v < that.tableData.length; v++) {
- that.departInfo1.push(that.tableData[v].slice(0, 4))
+ that.departInfo1.push(that.tableData[v])
+ that.departInfo1[v].splice(1, 1)
+ that.departInfo1[v].splice(4, 1)
}
+
that.config5.data = that.departInfo1
//去除部门数组中的空字符串
@@ -626,6 +593,7 @@ console.log("val",val)
//去重
const qcData = new Set(newArr)
that.departQcData = qcData
+ console.log(that.departQcData);
// that.departInfo = result.data[8]
// }
@@ -644,75 +612,79 @@ console.log("val",val)
this.loading = false;
}, 500);
},
- showChild(item, index) {
- console.log(item);
+ showChild(item) {
this.isShow = !this.isShow
- for (let i = 0; i < this.config5.data.length; i++) {
- this.departInfo = this.config5.data[i]
- if (item == this.departInfo[2]) {
- for (let a = 0; a < this.arr.length; a++) {
- this.departQcData1.push(this.arr[a].depart)
- console.log(this.arr[a].depart);
- }
- console.log(this.departQcData1);
- //去除部门数组中的空字符串
- var newArr = this.departQcData1.filter(i => i && i.trim())
- // console.log(that.config5.data);
- //去重
- const qcData = new Set(newArr)
- this.departQcData = qcData
- console.log(this.departQcData);
+ var listdepart = []
+ // 通过点击获取对应的部门
+ if (item != null) {
+ for (let i = 0; i < this.floorNameQcData.floorName.depart[item].length; i++) {
+ listdepart.push(this.floorNameQcData.floorName.depart[item][i].depart)
}
+ //去除部门数组中的空字符串
+ var newArr1 = listdepart.filter(i => i && i.trim())
+ //去重
+ const qcData = new Set(newArr1)
+ this.floorNameQcData.departQcData = qcData
+ } else {
+ for (let i = 0; i < this.config5.data.length; i++) {
+ this.departInfo = this.config5.data[i]
+ if (item == this.departInfo[2]) {
+ for (let a = 0; a < this.arr.length; a++) {
+ this.departQcData1.push(this.arr[a].depart)
+ console.log(this.arr[a].depart);
+ }
+
+ }
+
+ }
+ //去除部门数组中的空字符串
+ var newArr = this.departQcData1.filter(i => i && i.trim())
+ // console.log(that.config5.data);
+ //去重
+ const qcData = new Set(newArr)
+ this.departQcData = qcData
+ console.log(this.departQcData);
}
-
-
-
- // this.componentKey1++
-
- // for (let i = 0; i < this.config5.data.length; i++) {
- // this.tableData = this.config5.data[i]
- // if (item == this.tableData[2]) {
- // this.tableData1.push(this.tableData)
- // }
- // }
- // this.config6.data = this.tableData1
-
- // this.tableData1 = []
-
-
},
departSearch(item) {
console.log(item);
this.componentKey1++
this.isShow1 = false
- var floorname = ''
-
- this.floorNameQcData.forEach(function (item1, index, set) {
- floorname = item1
- })
- if (floorname != '') {
- for (let i = 0; i < this.config5.data.length; i++) {
- this.tableData = this.config5.data[i]
- if (item == this.tableData[0] && floorname == this.tableData[2]) {
- this.tableData1.push(this.tableData)
- }
- }
- this.config6.data = this.tableData1
- console.log(this.config6.data);
- this.tableData1 = []
- } else {
for (let i = 0; i < this.config5.data.length; i++) {
this.tableData = this.config5.data[i]
if (item == this.tableData[0]) {
this.tableData1.push(this.tableData)
}
- }
+ }
+ this.config6.data = []
this.config6.data = this.tableData1
console.log(this.config6.data);
this.tableData1 = []
- }
+ // }
+ },
+ sreach() {
+ this.componentKey1++
+ this.isShow1 = false
+ const departnew = this.departnew;
+ // const cha = document.getElementById("cha");
+ // var cha1 = ("#cha").val()
+ var listTable = [];
+ for (let i = 0; i < this.config5.data.length; i++) {
+
+ listTable = this.config5.data[i];
+ for (let j = 0; j < listTable.length; j++) {
+ if (listTable[0].indexOf(departnew) != -1) {
+ this.tableData2.push(listTable)
+ }
+ }
+
+
+ }
+ console.log(this.tableData2);
+ this.config6.data = this.tableData2
+ this.tableData2 = []
}
},
};
@@ -720,31 +692,6 @@ console.log("val",val)