Jelajahi Sumber

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

zhangyu 4 tahun lalu
induk
melakukan
59331896b9
1 mengubah file dengan 57 tambahan dan 25 penghapusan
  1. 57 25
      src/views/home.vue

+ 57 - 25
src/views/home.vue

@@ -71,10 +71,10 @@
                 <div class="main-body" v-loading="cardLoading">
                     <div class="has-data-body" v-if="cardTree.length">
                         <div class="building" v-for="buildingData in cardTree" :key="buildingData.buildingId">
-                            <p class="buinding-name"><span class="border-left"></span> {{ buildingData.buildingName }}</p>
+                            <p class="buinding-name"><span class="border-left"></span> {{ buildingData.localName }}</p>
                             <div class="floor" v-for="floor in buildingData.floorList" :key="floor.floorId">
-                                <p class="floor-name">{{ floor.floorName }}</p>
-                                <template v-for="t in floor.floor">
+                                <p class="floor-name">{{ floor.localName }}</p>
+                                <template v-for="t in floor.planarGraphList">
                                     <topoImageCard
                                         :isPub="isPub"
                                         :data="t"
@@ -190,11 +190,11 @@ export default {
             categoryName: "", // 跳转编辑页面时分类名称
             imgUrl: "/image-service/common/image_get?systemId=dataPlatform&key=",
             cardLoading: false,
+            folderId: "", //文件夹id
         };
     },
     created() {
         window.vm = this;
-        this.changeFolder();
     },
     methods: {
         testClick(data) {
@@ -307,6 +307,8 @@ export default {
          * 更改选中的文件夹
          */
         changeFolder(data) {
+            console.log(data);
+            this.folderId = data.id;
             this.queryGraph();
             return true;
             // TODO:
@@ -370,40 +372,70 @@ export default {
         },
         /////////////////接口
         // 查询图形信息
-        queryGraph() {
-            if (!this.curCategory.code) {
-                // return;
+        async queryGraph() {
+            if (!this.folderId) {
+                return false;
             }
             this.cardLoading = true;
             this.selectCard = [];
-            const pa = {
-                filters: `categoryId=111`,
-                orders: `${this.selVal} desc`,
+            // createTime: "2020-12-02 20:05:51"
+            // id: "eba700e7ae7e452fb2341172d1350b77"
+            // lastUpdate: "2020-12-02 20:05:51"
+            // name: "能源系统"
+            // projectId: "Pj1101050029"
+            // statistics: {}
+            const postParams = {
+                filters: `folderId='${this.folderId}'`,
+                PageNumber: 1,
+                PageSize: 1000,
             };
             if (this.queryText) {
-                pa.filters += `;name contain "${this.queryText}"`;
+                postParams.filters += `;name contain "${this.queryText}"`;
             }
             /**
              * 已发布,未发布 1:已发布 0:未发布
              */
+            let res;
             if (this.isPub) {
-                pubPlanerQuery(pa).then((res) => {
-                    this.cardTree = res.content.map((t) => {
-                        t.checked = false;
-                        return t;
-                    });
-                    this.cardLoading = false;
-                });
+                res = await pubPlanerQuery(postParams);
             } else {
-                pa.filters += ";state=1";
-                planerQuery(pa).then((res) => {
-                    this.cardTree = res.content.map((t) => {
-                        t.checked = false;
-                        return t;
+                // state 1(草稿箱),state 4(回收站)
+                postParams.filters += ";state=1";
+                res = await planerQuery(postParams);
+            }
+            if (res.result !== "success") {
+                return false;
+            }
+            let cardTree = [],
+                cardList = [];
+            cardTree = res?.content?.map((building) => {
+                building?.floorList?.map((_floor) => {
+                    // TODO: 1111
+                    _floor?.floor?.map((card) => {
+                        card.checked = false;
+                        // 保存建筑,楼层,卡片信息
+                        cardList.push({
+                            _buildingId: building.id,
+                            _buildingLocalId: building.localId,
+                            _buildingName: building.name,
+                            _buildingLocalName: building.localName,
+                            _floorId: _floor.id,
+                            _floorLocalId: _floor.localId,
+                            _floorName: _floor.name,
+                            _floorLocalName: _floor.localName,
+                            ...card,
+                        });
+                        return card;
                     });
-                    this.cardLoading = false;
+                    return _floor;
                 });
-            }
+                return building;
+            });
+            this.cardTree = cardTree;
+            this.cardList = cardList;
+            console.log(this.cardList)
+            console.log(this.cardTree)
+            this.cardLoading = false;
         },
     },
     watch: {