|
@@ -48,41 +48,57 @@
|
|
|
></span>
|
|
|
</Popover>
|
|
|
</div>
|
|
|
- <ul>
|
|
|
- <li @click="getEquipItem('lengganji.svg')">
|
|
|
- <div class="left">
|
|
|
- <div class="icon">
|
|
|
- <!-- <svg class="xxx">
|
|
|
- <use
|
|
|
- xlink:href="@/assets/images/equip/lengganji.svg#notification"
|
|
|
- ></use>
|
|
|
- </svg> -->
|
|
|
+ <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(b)" 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>
|
|
|
+ <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>
|
|
|
</div>
|
|
|
- <div class="right">
|
|
|
- <div class="t">冷干机</div>
|
|
|
- <div class="b">W3456112345093</div>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li @click="getEquipItem('shuibeng.svg')">
|
|
|
- <div class="left">
|
|
|
- <div class="icon"></div>
|
|
|
- </div>
|
|
|
- <div class="right">
|
|
|
- <div class="t">水泵</div>
|
|
|
- <div class="b">A245234345287</div>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li @click="getEquipItem('shuixiang.svg')">
|
|
|
- <div class="left">
|
|
|
- <div class="icon"></div>
|
|
|
- </div>
|
|
|
- <div class="right">
|
|
|
- <div class="t">水箱</div>
|
|
|
- <div class="b">Y2344560096</div>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ </el-collapse-transition>
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- 添加设备 -->
|
|
|
<div class="addbtn" @click="openAddEqupModle">
|
|
|
<i class="el-icon-plus"></i>
|
|
@@ -92,6 +108,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapMutations, mapState } from "vuex";
|
|
|
+import { equipmentList } from "./equipData";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -160,6 +177,8 @@ export default {
|
|
|
],
|
|
|
},
|
|
|
],
|
|
|
+ equipmentList: [],
|
|
|
+ hoverIndex: -1,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -168,6 +187,13 @@ export default {
|
|
|
openAddEqupModle() {
|
|
|
this.$emit("openAddEqupModle");
|
|
|
},
|
|
|
+ // 设置hover显示
|
|
|
+ sethover(b) {
|
|
|
+ this.hoverIndex = b;
|
|
|
+ },
|
|
|
+ deletehover() {
|
|
|
+ this.hoverIndex = -1;
|
|
|
+ },
|
|
|
// 获取设备图例
|
|
|
getEquipItem(id) {
|
|
|
const obj = {
|
|
@@ -179,13 +205,68 @@ export default {
|
|
|
},
|
|
|
// 筛选
|
|
|
screen() {},
|
|
|
+ // 判断是否再数组中
|
|
|
+ isinlist(item, idName, name, list) {
|
|
|
+ let index = -1;
|
|
|
+ list.forEach((item, i) => {
|
|
|
+ if (item[idName] == item[idName]) {
|
|
|
+ index = i;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (index < 0) {
|
|
|
+ list.push({
|
|
|
+ [idName]: item[idName],
|
|
|
+ [name]: item[name],
|
|
|
+ isShow: true,
|
|
|
+ children: [],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return index;
|
|
|
+ },
|
|
|
+ // 折叠
|
|
|
+ collapse(item) {
|
|
|
+ item.isShow = !item.isShow;
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(["editCmd"]),
|
|
|
},
|
|
|
+ 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;
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
+div {
|
|
|
+ -moz-user-select: none; /*火狐*/
|
|
|
+ -webkit-user-select: none; /*webkit浏览器*/
|
|
|
+ -ms-user-select: none; /*IE10*/
|
|
|
+ -khtml-user-select: none; /*早期浏览器*/
|
|
|
+ user-select: none;
|
|
|
+}
|
|
|
ul,
|
|
|
li {
|
|
|
margin: 0;
|
|
@@ -205,37 +286,61 @@ li {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
}
|
|
|
- ul {
|
|
|
- li {
|
|
|
+ .porfess {
|
|
|
+ .porfess-title {
|
|
|
width: 100%;
|
|
|
- height: 48px;
|
|
|
+ padding: 16px 16px 0 16px;
|
|
|
display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
cursor: pointer;
|
|
|
- .left {
|
|
|
- width: 28px;
|
|
|
- display: flex;
|
|
|
- height: 100%;
|
|
|
- align-items: center;
|
|
|
- .icon {
|
|
|
- width: 100%;
|
|
|
- height: 28px;
|
|
|
- border-radius: 50% 50%;
|
|
|
- }
|
|
|
+ }
|
|
|
+ .equipType {
|
|
|
+ .equipType-title {
|
|
|
+ margin: 20px 0 20px 18px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
- .right {
|
|
|
- padding: 4px;
|
|
|
- box-sizing: border-box;
|
|
|
- .t {
|
|
|
- font-size: 14px;
|
|
|
- color: #1f2429;
|
|
|
- }
|
|
|
- .b {
|
|
|
- font-size: 10px;
|
|
|
- color: #8d9399;
|
|
|
+ ul {
|
|
|
+ li {
|
|
|
+ width: 100%;
|
|
|
+ height: 48px;
|
|
|
+ display: flex;
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ background: #f5f6f7;
|
|
|
+ }
|
|
|
+ .left {
|
|
|
+ width: 60px;
|
|
|
+ display: flex;
|
|
|
+ height: 100%;
|
|
|
+ align-items: center;
|
|
|
+ .showEyes {
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ }
|
|
|
+ .icon {
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ border-radius: 50% 50%;
|
|
|
+ background: red;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ padding: 4px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ .t {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #1f2429;
|
|
|
+ }
|
|
|
+ .b {
|
|
|
+ font-size: 10px;
|
|
|
+ color: #8d9399;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.addbtn {
|
|
|
width: 100%;
|
|
|
height: 40px;
|
|
@@ -251,10 +356,48 @@ li {
|
|
|
color: #0091ff;
|
|
|
}
|
|
|
}
|
|
|
+ .caret-icon {
|
|
|
+ animation: nowhirling 0.2s linear forwards;
|
|
|
+ }
|
|
|
+ .caret-icon-active {
|
|
|
+ animation: whirling 0.2s linear forwards;
|
|
|
+ }
|
|
|
}
|
|
|
.reset {
|
|
|
position: absolute;
|
|
|
bottom: 16px;
|
|
|
left: 24px;
|
|
|
}
|
|
|
+@keyframes whirling {
|
|
|
+ 0% {
|
|
|
+ transform: rotate(-90deg);
|
|
|
+ -ms-transform: rotate(-90deg); /* Internet Explorer */
|
|
|
+ -moz-transform: rotate(-90deg); /* Firefox */
|
|
|
+ -webkit-transform: rotate(-90deg); /* Safari 和 Chrome */
|
|
|
+ -o-transform: rotate(-90deg); /* Opera */
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ -ms-transform: rotate(0deg); /* Internet Explorer */
|
|
|
+ -moz-transform: rotate(0deg); /* Firefox */
|
|
|
+ -webkit-transform: rotate(0deg); /* Safari 和 Chrome */
|
|
|
+ -o-transform: rotate(0deg); /* Opera */
|
|
|
+ }
|
|
|
+}
|
|
|
+@keyframes nowhirling {
|
|
|
+ 0% {
|
|
|
+ transform: rotate(0deg);
|
|
|
+ -ms-transform: rotate(0deg); /* Internet Explorer */
|
|
|
+ -moz-transform: rotate(0deg); /* Firefox */
|
|
|
+ -webkit-transform: rotate(0deg); /* Safari 和 Chrome */
|
|
|
+ -o-transform: rotate(0deg); /* Opera */
|
|
|
+ }
|
|
|
+ 100% {
|
|
|
+ transform: rotate(-90deg);
|
|
|
+ -ms-transform: rotate(-90deg); /* Internet Explorer */
|
|
|
+ -moz-transform: rotate(-90deg); /* Firefox */
|
|
|
+ -webkit-transform: rotate(-90deg); /* Safari 和 Chrome */
|
|
|
+ -o-transform: rotate(-90deg); /* Opera */
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|