|
@@ -1,6 +1,6 @@
|
|
|
<!-- 设备列表 -->
|
|
|
<template>
|
|
|
- <div class="equip-list">
|
|
|
+ <div class="equip-list" id="equiplist">
|
|
|
<!-- 筛选 -->
|
|
|
<div class="clp">
|
|
|
<Input
|
|
@@ -48,55 +48,77 @@
|
|
|
</Popover>
|
|
|
</div>
|
|
|
<!-- 设备 list -->
|
|
|
- <div class="porfess" v-for="(items, index) in equipmentList" :key="index">
|
|
|
- <div @click="collapse(items)" class="porfess-title">
|
|
|
- <span>{{ items.porfess }}</span>
|
|
|
- <i
|
|
|
- v-bind:class="[
|
|
|
- items.isShow ? 'caret-icon-active' : 'caret-icon',
|
|
|
- 'el-icon-arrow-down',
|
|
|
- ]"
|
|
|
- ></i>
|
|
|
- </div>
|
|
|
- <el-collapse-transition>
|
|
|
- <div v-show="items.isShow">
|
|
|
- <div class="equipType" v-for="(item, i) in items.children" :key="i">
|
|
|
- <div class="equipType-title" @click="collapse(item)">
|
|
|
- <i
|
|
|
- v-bind:class="[
|
|
|
- item.isShow ? 'caret-icon-active' : 'caret-icon',
|
|
|
- 'el-icon-caret-bottom',
|
|
|
- ]"
|
|
|
- ></i>
|
|
|
- <span>{{ item.equipType }}</span>
|
|
|
- </div>
|
|
|
- <el-collapse-transition>
|
|
|
- <ul @mouseout="deletehover" v-show="item.isShow">
|
|
|
- <li
|
|
|
- @click="getEquipItem('lengganji.svg')"
|
|
|
- v-for="(a, b) in item.children"
|
|
|
- :key="b"
|
|
|
- @mouseover="sethover(b)"
|
|
|
- >
|
|
|
- <div class="left">
|
|
|
- <div class="showEyes">
|
|
|
- <Icon v-show="hoverIndex == b" name="preview" />
|
|
|
+ <div class="box-porfess" id="boxPorfess">
|
|
|
+ <!-- 测试代码 开始 -->
|
|
|
+ <div @click="getEquipItem('lengganji.svg')">123</div>
|
|
|
+ <!-- 测试代码 结束-->
|
|
|
+ <div class="porfess" v-for="(items, index) in equipmentTree" :key="index">
|
|
|
+ <div @click="collapse(items)" class="porfess-title">
|
|
|
+ <span>{{ items.aliasName }}</span>
|
|
|
+ <i
|
|
|
+ v-bind:class="[
|
|
|
+ items.isShow ? 'caret-icon-active' : 'caret-icon',
|
|
|
+ 'el-icon-arrow-down',
|
|
|
+ ]"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ <el-collapse-transition>
|
|
|
+ <div v-show="items.isShow">
|
|
|
+ <div class="equipType" v-for="(item, i) in items.children" :key="i">
|
|
|
+ <div class="equipType-title" @click="collapse(item)">
|
|
|
+ <i
|
|
|
+ v-bind:class="[
|
|
|
+ item.isShow ? 'caret-icon-active' : 'caret-icon',
|
|
|
+ 'el-icon-caret-bottom',
|
|
|
+ ]"
|
|
|
+ ></i>
|
|
|
+ <span>{{ item.aliasName }}</span>
|
|
|
+ </div>
|
|
|
+ <el-collapse-transition>
|
|
|
+ <ul @mouseout="deletehover" v-show="item.isShow">
|
|
|
+ <li
|
|
|
+ @click="getEquipItem('lengganji.svg')"
|
|
|
+ v-for="(a, b) in item.children"
|
|
|
+ :key="b"
|
|
|
+ @mouseover="sethover(index, i, b)"
|
|
|
+ >
|
|
|
+ <div class="left">
|
|
|
+ <div class="showEyes">
|
|
|
+ <Icon
|
|
|
+ v-show="hoverIndex == '' + index + i + b"
|
|
|
+ name="preview"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="icon">
|
|
|
+ <img
|
|
|
+ width="28"
|
|
|
+ height="28"
|
|
|
+ src="./../../../assets/images/equip/lengganji.svg"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="icon"></div>
|
|
|
- </div>
|
|
|
- <div class="right">
|
|
|
- <div class="t">{{ a.name }}</div>
|
|
|
- <div class="b">W3456112345093</div>
|
|
|
- </div>
|
|
|
- <div class="icons">
|
|
|
- <Icon v-show="hoverIndex == b" name="more" />
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </el-collapse-transition>
|
|
|
+ <div class="right">
|
|
|
+ <div class="t" :title="a.localName">
|
|
|
+ {{ a.localName ? a.localName : "--" }}
|
|
|
+ </div>
|
|
|
+ <div class="b" :title="a.localId">
|
|
|
+ {{ a.localId ? a.localId : "--" }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="icons">
|
|
|
+ <Icon
|
|
|
+ v-show="hoverIndex == '' + index + i + b"
|
|
|
+ name="more"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </el-collapse-transition>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </el-collapse-transition>
|
|
|
+ </el-collapse-transition>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 添加设备 -->
|
|
@@ -108,78 +130,14 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapMutations, mapState } from "vuex";
|
|
|
-import { equipmentList } from "./equipData";
|
|
|
+import { queryCategory } from "@/api/editer";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- cascaderData6: [
|
|
|
- {
|
|
|
- title: "United Kingdom",
|
|
|
- id: "id1",
|
|
|
- children: [
|
|
|
- { id: "id2", title: "London" },
|
|
|
- { id: "id3", title: "Edinburgh" },
|
|
|
- { id: "id4", title: "Cardiff" },
|
|
|
- { id: "id5", title: "Birmingham" },
|
|
|
- { id: "id6", title: "Liverpool" },
|
|
|
- { id: "id7", title: "Oxford" },
|
|
|
- { id: "id8", title: "Plymouth" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: "AMERICAN",
|
|
|
- id: "id9",
|
|
|
- children: [
|
|
|
- { id: "id10", title: "Chicago" },
|
|
|
- { id: "id11", title: "Philadelphia" },
|
|
|
- { id: "id12", title: "Boston" },
|
|
|
- { id: "id13", title: "Houston" },
|
|
|
- { id: "id14", title: "Atlanta" },
|
|
|
- { id: "id15", title: "San Francisco" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: "CHINA",
|
|
|
- id: "id16",
|
|
|
- children: [
|
|
|
- { id: "id17", title: "BeiJing" },
|
|
|
- { id: "id18", title: "ShangHAI" },
|
|
|
- {
|
|
|
- title: "GuiYang",
|
|
|
- id: "id19",
|
|
|
- children: [
|
|
|
- { id: "id20", title: "Qingyan" },
|
|
|
- { id: "id21", title: "Guian" },
|
|
|
- ],
|
|
|
- },
|
|
|
- { id: "id22", title: "ZunYi" },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: "韩国",
|
|
|
- id: "id23",
|
|
|
- children: [
|
|
|
- { id: "id24", title: "首尔" },
|
|
|
- { id: "id25", title: "仁川" },
|
|
|
- { id: "id26", title: "釜山" },
|
|
|
- {
|
|
|
- id: "id27",
|
|
|
- title: "蔚山",
|
|
|
- children: [
|
|
|
- { id: "id10", title: "Chicago" },
|
|
|
- { id: "id11", title: "Philadelphia" },
|
|
|
- { id: "id12", title: "Boston" },
|
|
|
- { id: "id13", title: "Houston" },
|
|
|
- { id: "id14", title: "Atlanta" },
|
|
|
- { id: "id15", title: "San Francisco" },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- equipmentList: [],
|
|
|
+ cascaderData6: [],
|
|
|
hoverIndex: -1,
|
|
|
baseItemVal: "",
|
|
|
+ equipmentTree: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -189,8 +147,8 @@ export default {
|
|
|
this.$emit("openAddEqupModle");
|
|
|
},
|
|
|
// 设置hover显示
|
|
|
- sethover(b) {
|
|
|
- this.hoverIndex = b;
|
|
|
+ sethover(a, b, c) {
|
|
|
+ this.hoverIndex = "" + a + b + c;
|
|
|
},
|
|
|
deletehover() {
|
|
|
this.hoverIndex = -1;
|
|
@@ -230,37 +188,59 @@ export default {
|
|
|
},
|
|
|
//
|
|
|
changeItem() {},
|
|
|
- pressEnter(){}
|
|
|
+ pressEnter() {},
|
|
|
+ // 获取设备相关的专业以及设备类型
|
|
|
+ getCategory(idList) {
|
|
|
+ queryCategory(idList).then((res) => {
|
|
|
+ // 返回专业及其类型,根据类型 添加设备
|
|
|
+ let category = res.content;
|
|
|
+ category.forEach((item) => {
|
|
|
+ item.isShow = true;
|
|
|
+ if (item.children && item.children.length) {
|
|
|
+ item.children.map((child) => {
|
|
|
+ let obj = [];
|
|
|
+ child.isShow = true;
|
|
|
+ this.equipmentList.forEach((choiceItem) => {
|
|
|
+ choiceItem.isShow = true;
|
|
|
+ if (choiceItem.classCode == child.aliasCode) {
|
|
|
+ obj.push(choiceItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (obj.length) {
|
|
|
+ child.children = obj;
|
|
|
+ }
|
|
|
+ return child;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.equipmentTree = category;
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(["editCmd"]),
|
|
|
- // equipmentList
|
|
|
+ ...mapState(["editCmd", "equipmentList"]),
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ equipmentList: {
|
|
|
+ handler: function (val) {
|
|
|
+ if (!val.length) return;
|
|
|
+ const idList = [];
|
|
|
+ val.forEach((item) => {
|
|
|
+ idList.push(item.id);
|
|
|
+ });
|
|
|
+ this.getCategory(idList);
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
- let list = [];
|
|
|
- // 获取树专业
|
|
|
- equipmentList.forEach((items) => {
|
|
|
- const porfessId = items.porfessId;
|
|
|
- const equipTypeId = items.equipTypeId;
|
|
|
- const listIndex = this.isinlist(items, "porfessId", "porfess", list);
|
|
|
- // 第二次;
|
|
|
- list.forEach((listItem) => {
|
|
|
- this.isinlist(items, "equipTypeId", "equipType", listItem.children);
|
|
|
- // 第三层
|
|
|
- if (porfessId == listItem.porfessId) {
|
|
|
- listItem.children.forEach((item) => {
|
|
|
- if (equipTypeId == item.equipTypeId) {
|
|
|
- item.children.push({
|
|
|
- name: items.name,
|
|
|
- id: items.id,
|
|
|
- url: items.url,
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.equipmentList = list;
|
|
|
+ const dombox = document.getElementById("equiplist");
|
|
|
+ const boxPorfess = document.getElementById("boxPorfess");
|
|
|
+ if (dombox) {
|
|
|
+ boxPorfess.style.height = dombox.offsetHeight - 90 + "px";
|
|
|
+ console.log("boxPorfess", boxPorfess.style);
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -291,6 +271,10 @@ li {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
}
|
|
|
+ .box-porfess {
|
|
|
+ min-height: 500px;
|
|
|
+ overflow-y: scroll;
|
|
|
+ }
|
|
|
.porfess {
|
|
|
.porfess-title {
|
|
|
width: 100%;
|
|
@@ -310,6 +294,8 @@ li {
|
|
|
height: 48px;
|
|
|
display: flex;
|
|
|
cursor: pointer;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
&:hover {
|
|
|
background: #f5f6f7;
|
|
|
}
|
|
@@ -326,21 +312,34 @@ li {
|
|
|
width: 28px;
|
|
|
height: 28px;
|
|
|
border-radius: 50% 50%;
|
|
|
- background: red;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
}
|
|
|
}
|
|
|
.right {
|
|
|
padding: 4px;
|
|
|
box-sizing: border-box;
|
|
|
+ flex: 1;
|
|
|
.t {
|
|
|
font-size: 14px;
|
|
|
color: #1f2429;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
.b {
|
|
|
font-size: 10px;
|
|
|
color: #8d9399;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
}
|
|
|
+ .icons {
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -348,10 +347,11 @@ li {
|
|
|
|
|
|
.addbtn {
|
|
|
width: 100%;
|
|
|
- height: 46px;
|
|
|
+ height: 40px;
|
|
|
position: absolute;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
+ transform: translateY(-40%);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|