|
@@ -71,7 +71,11 @@
|
|
|
@pressEnter="pressEnter"
|
|
|
@clear="pressEnter"
|
|
|
/>
|
|
|
- <div class="msgPoint-list" v-show="!pressMsgData.length">
|
|
|
+ <div
|
|
|
+ class="msgPoint-list"
|
|
|
+ ref="localDom"
|
|
|
+ v-show="!pressMsgData.length"
|
|
|
+ >
|
|
|
<div class="type-list" v-for="(item, key) in msgData" :key="key">
|
|
|
<div class="type-title" @click="clips(item)">
|
|
|
<i
|
|
@@ -111,6 +115,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { queryEquipMsg, queryDict } from "@/api/editer";
|
|
|
+import bus from "@/bus/bus";
|
|
|
export default {
|
|
|
props: ["InfoPointList", "EquipData", "equipHeight"],
|
|
|
data() {
|
|
@@ -118,10 +123,10 @@ export default {
|
|
|
activeName: "first",
|
|
|
width: "",
|
|
|
height: "",
|
|
|
- checked1: "checked",
|
|
|
- msgData: [],
|
|
|
+ msgData: [], //存储二级树
|
|
|
pressMsgData: [], // 搜索后得信息点数组
|
|
|
getPressMsg: "", //输入信息
|
|
|
+ local: "", //局部加载
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -144,6 +149,7 @@ export default {
|
|
|
// 切换选中选项
|
|
|
changeCheck(item) {
|
|
|
item.checked = !item.checked;
|
|
|
+ bus.$emit("changeEquipMsgPoint", item);
|
|
|
},
|
|
|
// 搜索回车操作
|
|
|
pressEnter() {
|
|
@@ -165,49 +171,80 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
EquipData(val) {
|
|
|
+ this.msgData = []; //存储二级树
|
|
|
+ this.pressMsgData = []; // 搜索后得信息点数组
|
|
|
+ this.getPressMsg = ""; //输入信息
|
|
|
+ // 启动局部 loading
|
|
|
+
|
|
|
+ this.local = this.$loading({
|
|
|
+ el: this.$refs.localDom,
|
|
|
+ type: "local",
|
|
|
+ size: "min",
|
|
|
+ });
|
|
|
+
|
|
|
const data = {
|
|
|
Type: val.properties.classCode,
|
|
|
};
|
|
|
- queryDict(data).then((res) => {
|
|
|
- let arr = [];
|
|
|
- // 勾选设备中选中的对象
|
|
|
- const msgData = res.content;
|
|
|
- // 设置已经勾选数据
|
|
|
- if (this.InfoPointList && this.InfoPointList.length) {
|
|
|
- msgData.map((item) => {
|
|
|
- item.checked = false;
|
|
|
- this.InfoPointList.forEach((a) => {
|
|
|
- if (a.id == item.id) {
|
|
|
- item.checked = true;
|
|
|
- }
|
|
|
+ queryDict(data)
|
|
|
+ .then((res) => {
|
|
|
+ let arr = [];
|
|
|
+ // 勾选设备中选中的对象
|
|
|
+ const msgData = res.content;
|
|
|
+ // 设置已经勾选数据
|
|
|
+ if (this.InfoPointList && this.InfoPointList.length) {
|
|
|
+ msgData.map((item) => {
|
|
|
+ item.checked = false;
|
|
|
+ this.InfoPointList.forEach((a) => {
|
|
|
+ if (a.id == item.id) {
|
|
|
+ item.checked = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return item;
|
|
|
});
|
|
|
- return item;
|
|
|
- });
|
|
|
- } else {
|
|
|
- msgData.map((item) => {
|
|
|
- item.checked = false;
|
|
|
- return item;
|
|
|
- });
|
|
|
- }
|
|
|
- this.msgData = msgData;
|
|
|
- // 生成二级树
|
|
|
- msgData.forEach((item) => {
|
|
|
- const itemTag = item.secondTag
|
|
|
- ? item.secondTag
|
|
|
- : item.firstTag
|
|
|
- ? item.firstTag
|
|
|
- : "--";
|
|
|
- if (arr.length) {
|
|
|
- let index = -1;
|
|
|
- arr.forEach((aItem) => {
|
|
|
- if (aItem.tag == itemTag) {
|
|
|
- index = 1;
|
|
|
- aItem.children.push(item);
|
|
|
- aItem.number++;
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ msgData.map((item) => {
|
|
|
+ item.checked = false;
|
|
|
+ return item;
|
|
|
});
|
|
|
+ }
|
|
|
+ // 生成二级树
|
|
|
+ msgData.forEach((item) => {
|
|
|
+ const itemTag = item.secondTag
|
|
|
+ ? item.secondTag
|
|
|
+ : item.firstTag
|
|
|
+ ? item.firstTag
|
|
|
+ : "--";
|
|
|
+ if (arr.length) {
|
|
|
+ let index = -1;
|
|
|
+ arr.forEach((aItem) => {
|
|
|
+ if (aItem.tag == itemTag) {
|
|
|
+ index = 1;
|
|
|
+ aItem.children.push(item);
|
|
|
+ aItem.number++;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- if (index == -1) {
|
|
|
+ if (index == -1) {
|
|
|
+ const tag = item.secondTag
|
|
|
+ ? item.secondTag
|
|
|
+ : item.firstTag
|
|
|
+ ? item.firstTag
|
|
|
+ : "--";
|
|
|
+ const tagName = item.secondName
|
|
|
+ ? item.secondName
|
|
|
+ : item.firstName
|
|
|
+ ? item.firstName
|
|
|
+ : "--";
|
|
|
+ let obj = {
|
|
|
+ tagName: tagName,
|
|
|
+ tag: tag,
|
|
|
+ children: [item],
|
|
|
+ number: 1,
|
|
|
+ showChildren: true,
|
|
|
+ };
|
|
|
+ arr.push(obj);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
const tag = item.secondTag
|
|
|
? item.secondTag
|
|
|
: item.firstTag
|
|
@@ -221,36 +258,21 @@ export default {
|
|
|
let obj = {
|
|
|
tagName: tagName,
|
|
|
tag: tag,
|
|
|
- children: [item],
|
|
|
+ children: [],
|
|
|
number: 1,
|
|
|
showChildren: true,
|
|
|
};
|
|
|
+ obj.children.push(item);
|
|
|
arr.push(obj);
|
|
|
}
|
|
|
- } else {
|
|
|
- const tag = item.secondTag
|
|
|
- ? item.secondTag
|
|
|
- : item.firstTag
|
|
|
- ? item.firstTag
|
|
|
- : "--";
|
|
|
- const tagName = item.secondName
|
|
|
- ? item.secondName
|
|
|
- : item.firstName
|
|
|
- ? item.firstName
|
|
|
- : "--";
|
|
|
- let obj = {
|
|
|
- tagName: tagName,
|
|
|
- tag: tag,
|
|
|
- children: [],
|
|
|
- number: 1,
|
|
|
- showChildren: true,
|
|
|
- };
|
|
|
- obj.children.push(item);
|
|
|
- arr.push(obj);
|
|
|
- }
|
|
|
+ });
|
|
|
+ this.msgData = arr;
|
|
|
+ this.$loading.close(this.local);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log("接口报错", err);
|
|
|
+ this.$loading.close(this.local);
|
|
|
});
|
|
|
- this.msgData = arr;
|
|
|
- });
|
|
|
},
|
|
|
},
|
|
|
mounted() {},
|