Browse Source

Merge branch 'dev' of git.sagacloud.cn:web/persagy-plan-editer into dev

zhangyu 4 years ago
parent
commit
9c71a3b595

+ 0 - 1
src/api/labsl.ts

@@ -58,7 +58,6 @@ export function planerRead(postParams: any): any {
 export function planerSave(postParams: any): any {
     return httputils.postJson(`${baseApi}/planar/graph/drafts/save`, postParams);
 }
-
 /**
  * 已发布的平面图接口
  */

+ 1 - 1
src/components/editview/leftToolBar/addBaseItem.vue

@@ -17,7 +17,7 @@
                 ><i :class="[item.isClip ? 'caret-icon-active' : 'caret-icon', 'el-icon-arrow-down']"></i>
             </div>
             <el-collapse-transition>
-                <div v-show="item.isClip">
+                <div v-show="item.isClip">``
                     <div class="legend-content" v-for="(itemList, i) in item.itemList" :key="i">
                         <div @click="collapse(itemList)" class="title">
                             {{ itemList.title }}

+ 1 - 1
src/components/editview/leftToolBar/addEquipmentDialog.vue

@@ -219,7 +219,7 @@ export default {
     // eslint-disable-next-line @typescript-eslint/no-empty-function
     created() {},
     mounted() {
-        window.vm = this;
+        // window.vm = this;
         /*   setTimeout(() => {
             this.showPopover = true;
         }, 2000); */

+ 3 - 4
src/components/editview/leftToolBar/editInfoPoint.vue

@@ -219,7 +219,7 @@
  * 添加设备,设备组,空间 三个共用
  */
 import { mapState, mapMutations } from "vuex";
-import { planerSave, pubPlanerUpdate } from "@/api/labsl";
+import { planerSave, planerUpdate, pubPlanerUpdate } from "@/api/labsl";
 import { dictQuery } from "@/api/datacenter";
 import { imgBaseUrl, imgServeUpload } from "@/api/imageservice";
 import { cloneDeep } from "lodash";
@@ -339,7 +339,7 @@ export default {
         },
     },
     mounted() {
-        window.vm = this;
+        // window.vm = this;
     },
     methods: {
         ...mapMutations(["ADDSTYLE"]),
@@ -391,7 +391,6 @@ export default {
                     debugger;
                     this[data].imgUrl = res;
                 });
-           
         },
         async getInfoPoint() {
             console.time(1);
@@ -458,7 +457,7 @@ export default {
             console.log("===================");
             // 未发布接口
             if (this.state === "Draft") {
-                res = await planerSave({
+                res = await planerUpdate({
                     content: [
                         {
                             buildingId: this.buildingId,

+ 138 - 69
src/components/editview/leftToolBar/equipmentList.vue

@@ -46,53 +46,31 @@
             </Popover> -->
         </div>
         <!-- 设备 list -->
-        <div ref="localDom" class="box-porfess" id="boxPorfess">
-            <div class="porfess" v-show="!pressMsgData.length" 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 ref="localDom" class="box-profess" id="boxprofess">
+            <div class="profess" v-show="!pressMsgData.length" v-for="items in equipmentList" :key="items.classCode">
+                <div @click="collapse(items)" class="profess-title">
+                    <i v-bind:class="[items.isShow ? 'caret-icon-active' : 'caret-icon', 'el-icon-caret-bottom ']"></i>
+                    <span class="code-name">{{ items.codeName }}</span>
                 </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 v-for="(a, b) in item.children" :key="b" @mouseover="sethover(index, i, b)" @click="clickEquipItem(a)">
-                                        <div class="left">
-                                            <div class="showEyes">
-                                                <Icon
-                                                    v-show="hoverIndex == '' + index + i + b"
-                                                    :name="a.visible ? 'preview' : 'hide'"
-                                                    @click="ShowItem(a)"
-                                                />
-                                            </div>
-                                            <div class="icon">
-                                                <img width="28" height="28" :src="a.img.url" alt="" />
-                                            </div>
-                                        </div>
-                                        <div class="right">
-                                            <div class="t" :title="a.legendData.properties.localName">
-                                                {{ a.legendData.properties.localName ? a.legendData.properties.localName : "--" }}
-                                            </div>
-                                            <div class="b" :title="a.legendData.properties.localId">
-                                                {{ a.legendData.properties.localId ? a.legendData.properties.localId : "--" }}
-                                            </div>
-                                        </div>
-                                        <div class="icons">
-                                            <Popover v-show="hoverIndex == '' + index + i + b" type="base" placement="top-center">
-                                                <template slot="content">
-                                                    <Button @click="deleteItem(a)" type="text" icon="edit">删除</Button>
-                                                </template>
-                                                <Icon name="more" />
-                                            </Popover>
-                                        </div>
-                                    </li>
-                                </ul>
-                            </el-collapse-transition>
+                        <div
+                            class="equipType"
+                            @mouseouter="currentEquipment = ''"
+                            @mouseover="currentEquipment = item.id"
+                            @click="chioceItem(item)"
+                            v-for="(item, i) in items.children"
+                            :key="i"
+                        >
+                            <span
+                                class="local-name"
+                                :class="[item.visible ? 'visible' : 'hidden', item.selected ? 'selected' : 'normal']"
+                                :title="`${item.legendData.localName}${item.legendData.localId ? '-' + item.legendData.localId : ''}`"
+                                >{{ item.legendData.localName
+                                }}<span class="local-id" :title="item.legendData.localId">-{{ item.legendData.localId }}</span>
+                            </span>
+                            <!-- hover行显示小眼睛 -->
+                            <Icon v-show="currentEquipment === item.id" :name="item.visible ? 'preview' : 'hide'" @click="toggleItemVisible(item)" />
                         </div>
                     </div>
                 </el-collapse-transition>
@@ -146,15 +124,91 @@ export default {
             getPressMsg: "", //搜索框
             pressMsgData: [], //搜索对应得数组
             equipmentTree: [], //三级设备树
+            equipmentList: [], //二维数组
             local: null, //table loading
+            currentEquipment: "", //当前列表hover的设备
         };
     },
+    computed: {
+        ...mapState(["editCmd", "equipmentItemList", "equipmentItemNum", "equipItemMap", "equipItemNum"]),
+    },
+    watch: {
+        equipmentItemNum: {
+            handler: function (val) {
+                // this.localLoading();
+                // this.getCategory(this.equipmentItemList);
+            },
+            deep: true,
+            immediate: true,
+        },
+        equipItemNum(newV, oldV) {
+            console.log(":::::::");
+            console.log(newV, oldV);
+            newV && this.getEquipmentList();
+        },
+        // equipItemMap: {
+        //     handler(newV, oldV) {
+        //         // console.log("watch:::::");
+        //         // console.log(newV);
+        //         if (newV) {
+        //             // this.getEquipmentList(newV);
+        //         }
+        //     },
+        //     deep: true,
+        //     immediate: false,
+        // },
+    },
+    mounted() {
+        window.vm = this;
+        this.getEquipmentList();
+        // const dombox = document.getElementById("equiplist");
+        // const boxprofess = document.getElementById("boxprofess");
+        // if (dombox) {
+        //     boxprofess.style.height = dombox.offsetHeight - 90 + "px";
+        // }
+    },
     methods: {
         ...mapMutations(["SETCHOICELEHEND", "SETLEGENDOBJ"]),
         // 打开添加弹窗
         openAddEqupModle() {
             this.$emit("openAddEqupModle");
         },
+        /**
+         * 查新设备列表
+         */
+        getEquipmentList() {
+            console.log("%cgetEquipmentList:::", "color:blue;background:#fff");
+            // console.log(this.equipItemMap);
+            // const arr = this._(this.equipItemMap).values().groupBy("legendData.classCode").values().value();
+            const arr = Object.values(this.equipItemMap);
+            const obj = this._(arr).groupBy("legendData.classCode").value();
+            console.log(arr);
+            const equipmentList = [];
+            for (const key in obj) {
+                const element = obj[key];
+                equipmentList.push({
+                    classCode: element[0].legendData.classCode,
+                    codeName: element[0].legendData.codeName,
+                    children: element,
+                    isShow: true,
+                });
+            }
+            console.log(equipmentList);
+            this.equipmentList = equipmentList;
+            // console.log(this.equipmentList);
+        },
+        /**
+         * 点击设备,更改设备的cho
+         */
+        chioceItem(item) {
+            bus.$emit("chioceItem", item);
+        },
+        /**
+         * 切换设备显隐状态
+         */
+        toggleItemVisible(item) {
+            console.log(item);
+        },
         // 设置hover显示
         sethover(a, b, c) {
             this.hoverIndex = "" + a + b + c;
@@ -239,6 +293,7 @@ export default {
         },
         // 获取设备相关的专业以及设备类型
         getCategory(itemList) {
+            console.log("getCategory:::::");
             // id 数组
             const idList = [];
             itemList.forEach((item) => {
@@ -282,26 +337,6 @@ export default {
             bus.$emit("chioceItem", item);
         },
     },
-    computed: {
-        ...mapState(["editCmd", "equipmentItemList", "equipmentItemNum"]),
-    },
-    watch: {
-        equipmentItemNum: {
-            handler: function (val) {
-                // this.localLoading();
-                // this.getCategory(this.equipmentItemList);
-            },
-            deep: true,
-            immediate: true,
-        },
-    },
-    mounted() {
-        // const dombox = document.getElementById("equiplist");
-        // const boxPorfess = document.getElementById("boxPorfess");
-        // if (dombox) {
-        //     boxPorfess.style.height = dombox.offsetHeight - 90 + "px";
-        // }
-    },
 };
 </script>
 <style lang="less" scoped>
@@ -334,20 +369,54 @@ li {
             cursor: pointer;
         }
     }
-    .box-porfess {
+    .box-profess {
         // min-height: 500px;
         flex: 1;
         overflow-y: scroll;
+        padding: 12px 0;
     }
-    .porfess {
-        .porfess-title {
+    .profess {
+        .profess-title {
             width: 100%;
-            padding: 16px 16px 0 16px;
+            height: 40px;
+            line-height: 40px;
             display: flex;
-            justify-content: space-between;
+            padding: 0 16px;
+            display: flex;
+            align-items: center;
             cursor: pointer;
+            font-size: 14px;
+            font-weight: 600;
+            color: #1f2429;
+            .code-name {
+                margin-left: 10px;
+            }
         }
         .equipType {
+            padding: 0 10px 0 40px;
+            display: flex;
+            align-items: center;
+            &:hover {
+                background-color: #f5f6f7;
+            }
+            .local-name {
+                flex: 1;
+                height: 40px;
+                line-height: 40px;
+                font-size: 14px;
+                font-weight: 600;
+                color: #1f2429 !important;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+
+                .local-id {
+                    font-weight: 500;
+                    color: #8d9399;
+                    line-height: 16px;
+                }
+            }
+
             .equipType-title {
                 margin: 20px 0 20px 18px;
                 cursor: pointer;