|
@@ -39,57 +39,60 @@
|
|
|
></Cascader> -->
|
|
|
<Input
|
|
|
iconType="search"
|
|
|
- v-model="inputVal2"
|
|
|
+ v-model="queryText"
|
|
|
+ placeholder="搜索设备名称或本地编码"
|
|
|
@pressEnter="pressEnter"
|
|
|
/>
|
|
|
</div>
|
|
|
- <el-table
|
|
|
- v-if="tableHeight > 0"
|
|
|
- size="small"
|
|
|
- ref="multipleTable"
|
|
|
- :data="equiptable"
|
|
|
- tooltip-effect="dark"
|
|
|
- style="width: 100%"
|
|
|
- :height="tableHeight"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- >
|
|
|
- <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
- <el-table-column type="localName" label="本地名称" width="300">
|
|
|
- <template slot-scope="scope">{{
|
|
|
- scope.row.localName ? scope.row.localName : "--"
|
|
|
- }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="localId" label="本地编码" width="300">
|
|
|
- <template slot-scope="scope">{{
|
|
|
- scope.row.localId ? scope.row.localId : "--"
|
|
|
- }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="bimLocation"
|
|
|
- label="位置"
|
|
|
- show-overflow-tooltip
|
|
|
- width="300"
|
|
|
- >
|
|
|
- <template slot-scope="scope">{{
|
|
|
- scope.row.building || scope.row.floor
|
|
|
- ? scope.row.building && scope.row.floor
|
|
|
- ? scope.row.building.localName +
|
|
|
- "-" +
|
|
|
- scope.row.floor.localName
|
|
|
- : scope.row.building
|
|
|
- ? scope.row.building.localName
|
|
|
- : scope.row.floor.localName
|
|
|
- : "--"
|
|
|
- }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="codeName"
|
|
|
- label="类型"
|
|
|
- show-overflow-tooltip
|
|
|
- width="300"
|
|
|
+ <div class="localDom" ref="localDom">
|
|
|
+ <el-table
|
|
|
+ v-if="tableHeight > 0"
|
|
|
+ size="small"
|
|
|
+ ref="multipleTable"
|
|
|
+ :data="equiptable"
|
|
|
+ tooltip-effect="dark"
|
|
|
+ style="width: 100%"
|
|
|
+ :height="tableHeight"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
+ <el-table-column type="localName" label="本地名称" width="300">
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.localName ? scope.row.localName : "--"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="localId" label="本地编码" width="300">
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.localId ? scope.row.localId : "--"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="bimLocation"
|
|
|
+ label="位置"
|
|
|
+ show-overflow-tooltip
|
|
|
+ width="300"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{
|
|
|
+ scope.row.building || scope.row.floor
|
|
|
+ ? scope.row.building && scope.row.floor
|
|
|
+ ? scope.row.building.localName +
|
|
|
+ "-" +
|
|
|
+ scope.row.floor.localName
|
|
|
+ : scope.row.building
|
|
|
+ ? scope.row.building.localName
|
|
|
+ : scope.row.floor.localName
|
|
|
+ : "--"
|
|
|
+ }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="codeName"
|
|
|
+ label="类型"
|
|
|
+ show-overflow-tooltip
|
|
|
+ width="300"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
<Pagination
|
|
|
class="page-box"
|
|
|
:pageCountShow="true"
|
|
@@ -104,7 +107,7 @@
|
|
|
<span class="equip-title">已选实例</span>
|
|
|
<span class="equip-num">{{ choiceEquipList.length }}</span>
|
|
|
</div>
|
|
|
- <div class="top-r">清空</div>
|
|
|
+ <div class="top-r" @click="clearChoiceEqipment">清空</div>
|
|
|
</div>
|
|
|
<ul class="choiceList">
|
|
|
<li class="choiceList-item">
|
|
@@ -130,7 +133,9 @@
|
|
|
v-for="(item, key) in items.children"
|
|
|
:key="key"
|
|
|
>
|
|
|
- <div class="item-title">{{ item.localName }}</div>
|
|
|
+ <div class="item-title">
|
|
|
+ {{ item.localName ? item.localName : "空" }}
|
|
|
+ </div>
|
|
|
<i
|
|
|
class="el-icon-error"
|
|
|
@click="deleteItem(items, key)"
|
|
@@ -168,7 +173,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
inputVal2: "",
|
|
|
- isShowModel: true,
|
|
|
+ isShowModel: false,
|
|
|
equipTypeString: "", //设备类型选中条件
|
|
|
buildIdString: "", //建筑id 类型string
|
|
|
floorIdString: "", // 楼层id 类型string
|
|
@@ -177,9 +182,12 @@ export default {
|
|
|
equipData: [], //选中得设备数组
|
|
|
buildFloorList: [], // 建筑查询数据
|
|
|
categoryList: [], //设备类型
|
|
|
- currentPage2: 5,
|
|
|
tableHeight: 0, //table的高度
|
|
|
choiceEquipList: [], // 选中得设备数组//非树机构
|
|
|
+ pageSize: 20,
|
|
|
+ currentPage: 1,
|
|
|
+ local: null,
|
|
|
+ queryText: "", //搜索框数据
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -196,26 +204,8 @@ export default {
|
|
|
this.equipTypeString = classCode.length
|
|
|
? ";classCode in " + JSON.stringify(classCode)
|
|
|
: "";
|
|
|
-
|
|
|
- let data = {
|
|
|
- Cascade: [
|
|
|
- {
|
|
|
- Name: "building",
|
|
|
- Projection: ["id", "name", "localName"],
|
|
|
- },
|
|
|
- {
|
|
|
- Name: "floor",
|
|
|
- Projection: ["id", "name", "localName"],
|
|
|
- },
|
|
|
- ],
|
|
|
- Orders: "name asc, createTime desc",
|
|
|
- PageNumber: 1,
|
|
|
- PageSize: 20,
|
|
|
- Filters: `projectId='${this.projectId}'${this.filtIdListString}${this.buildIdString}${this.floorIdString}${this.equipTypeString}`,
|
|
|
- };
|
|
|
- queryEquip(data).then((res) => {
|
|
|
- this.tableTotal = res.total;
|
|
|
- });
|
|
|
+ // 调用设备接口
|
|
|
+ this.queryEquip();
|
|
|
},
|
|
|
// 筛选楼层
|
|
|
changeFloor(list) {
|
|
@@ -261,6 +251,11 @@ export default {
|
|
|
: isfloornull
|
|
|
? ";" + isfloornull
|
|
|
: "";
|
|
|
+ // 调用设备接口
|
|
|
+ this.queryEquip();
|
|
|
+ },
|
|
|
+ // 搜索设备
|
|
|
+ queryEquip() {
|
|
|
let data = {
|
|
|
Cascade: [
|
|
|
{
|
|
@@ -273,17 +268,22 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
Orders: "name asc, createTime desc",
|
|
|
- PageNumber: 1,
|
|
|
- PageSize: 20,
|
|
|
- Filters: `projectId='${this.projectId}'${this.filtIdListString}${this.buildIdString}${this.floorIdString}${this.equipTypeString}`,
|
|
|
+ PageNumber: this.currentPage,
|
|
|
+ PageSize: this.pageSize,
|
|
|
+ Filters: `projectId='${this.projectId}'${this.filtIdListString}${this.buildIdString}${this.floorIdString}${this.equipTypeString};localName contain "${this.queryText}" or localId contain "${this.queryText}"`,
|
|
|
};
|
|
|
- queryEquip(data).then((res) => {
|
|
|
- this.tableTotal = res.total;
|
|
|
- this.equiptable = res.content;
|
|
|
- });
|
|
|
+ this.localLoading();
|
|
|
+ queryEquip(data)
|
|
|
+ .then((res) => {
|
|
|
+ this.tableTotal = res.total;
|
|
|
+ this.equiptable = res.content;
|
|
|
+ this.$loading.close(this.local);
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log("it is error!", error);
|
|
|
+ this.$loading.close(this.local);
|
|
|
+ });
|
|
|
},
|
|
|
- // 切换分页
|
|
|
- currentChangeHandle() {},
|
|
|
// 关闭弹窗
|
|
|
modalClose() {
|
|
|
this.isShowModel = false;
|
|
@@ -291,17 +291,15 @@ export default {
|
|
|
},
|
|
|
// 确认/提交
|
|
|
finish() {
|
|
|
- // 获取数组
|
|
|
- let list = [];
|
|
|
- this.equipData.forEach((items) => {
|
|
|
- list = list.concat([...items.children]);
|
|
|
- });
|
|
|
// 将选中的设备类存到vuex中
|
|
|
- this.SETEQUIPLIST(list);
|
|
|
+ this.SETEQUIPLIST(this.choiceEquipList);
|
|
|
+ // 获取专业和设备类型
|
|
|
this.modalClose();
|
|
|
},
|
|
|
// 搜索回车
|
|
|
- pressEnter() {},
|
|
|
+ pressEnter() {
|
|
|
+ this.queryEquip();
|
|
|
+ },
|
|
|
// /是否下拉折叠
|
|
|
collapse(item) {
|
|
|
item.showChildren = !item.showChildren;
|
|
@@ -310,17 +308,20 @@ export default {
|
|
|
deleteItem(items, key) {
|
|
|
let deleteItem = items.children.splice(key, 1);
|
|
|
items.number = items.children.length;
|
|
|
- console.log("deleteItem");
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(deleteItem[0]);
|
|
|
let index = -1;
|
|
|
this.choiceEquipList.forEach((item, i) => {
|
|
|
if (item.id == deleteItem[0].id) {
|
|
|
index = i;
|
|
|
}
|
|
|
});
|
|
|
- if(index>=0){
|
|
|
- this.choiceEquipList.splice(key,1)
|
|
|
+ if (index >= 0) {
|
|
|
+ this.choiceEquipList.splice(key, 1);
|
|
|
}
|
|
|
- this.handleSelectionChange(this.choiceEquipList)
|
|
|
+ this.handleSelectionChange(this.choiceEquipList);
|
|
|
+ },
|
|
|
+ clearChoiceEqipment() {
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
},
|
|
|
/**
|
|
|
* 构建树list
|
|
@@ -382,8 +383,8 @@ export default {
|
|
|
let obj = {
|
|
|
id: item.classCode,
|
|
|
title: item.codeName,
|
|
|
- children: [],
|
|
|
- number: 0,
|
|
|
+ children: [item],
|
|
|
+ number: 1,
|
|
|
showChildren: true,
|
|
|
};
|
|
|
arr.push(obj);
|
|
@@ -393,16 +394,29 @@ export default {
|
|
|
id: item.classCode,
|
|
|
title: item.codeName,
|
|
|
children: [],
|
|
|
- number: 0,
|
|
|
+ number: 1,
|
|
|
showChildren: true,
|
|
|
};
|
|
|
+ obj.children.push(item);
|
|
|
arr.push(obj);
|
|
|
+ console.log("this.equipData", arr);
|
|
|
}
|
|
|
});
|
|
|
this.equipData = arr;
|
|
|
},
|
|
|
+ // 切换分页
|
|
|
currentChangeHandle(pageMsg) {
|
|
|
- console.log(pageMsg);
|
|
|
+ this.pageSize = pageMsg.newPageSize;
|
|
|
+ this.currentPage = pageMsg.newPage;
|
|
|
+ this.queryEquip();
|
|
|
+ },
|
|
|
+ // 局部加载
|
|
|
+ localLoading() {
|
|
|
+ this.local = this.$loading({
|
|
|
+ el: this.$refs.localDom,
|
|
|
+ type: "local",
|
|
|
+ size: "min",
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
@@ -428,7 +442,12 @@ export default {
|
|
|
);
|
|
|
});
|
|
|
const domLeft = document.getElementById("left");
|
|
|
- this.tableHeight = domLeft.offsetHeight - 140;
|
|
|
+ if (domLeft) {
|
|
|
+ this.tableHeight = domLeft.offsetHeight - 140;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 调取设备接口
|
|
|
+ // this.queryEquip()
|
|
|
},
|
|
|
};
|
|
|
</script>
|