Quellcode durchsuchen

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

zhangyu vor 4 Jahren
Ursprung
Commit
a65d968d3f

+ 1 - 1
src/api/labsl.ts

@@ -44,7 +44,7 @@ export function planerQuery(postParams: any): any {
 }
 // 未发布 - 移至回收站
 export function planerRecycle(postParams: any): any {
-    return httputils.postJson(`${baseApi}/planar/graph/drafts/recycle`, postParams);
+    return httputils.postJson(`${baseApi}/planar/graph/drafts/recycle`, postParams);
 }
 // 未发布 - 更新平面图信息
 export function planerUpdate(postParams: any): any {

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

@@ -21,7 +21,7 @@ export default {
     components: {},
     data() {
         return {
-            dialogTableVisible: true,
+            dialogTableVisible: false,
             cascaderData1: [
                 {
                     title: "1",

+ 4 - 8
src/components/homeView/deleteDialog.vue

@@ -36,21 +36,17 @@ export default {
             if (!this.data.length) {
                 return;
             }
-            const pa = this.data.map(({ id, graphId }) => {
+            const postParams = this.data.map(({ id, graphId }) => {
                 return { id, graphId };
             });
+            let res;
             if (this.isPub) {
                 // 已发布
-                let res = pubPlanerRecycle(pa);
-                this.updateCall(res);
+                res = await pubPlanerRecycle(postParams);
             } else {
                 // 未发布
-                let res = planerRecycle(pa);
-                this.updateCall(res);
+                res = await planerRecycle(postParams);
             }
-        },
-        // 更新成功回调
-        updateCall(res) {
             if (res.result == "success") {
                 this.dialogVisible = false;
                 this.$emit("deleteSuc");

+ 10 - 18
src/components/homeView/move.vue

@@ -13,7 +13,6 @@
 </template>
 
 <script>
-import { queryCategoryGraph, updateDraftsGraph, updatePubGraph } from "@/api/home";
 import { folderQuery, planerUpdate, pubPlanerUpdate } from "@/api/labsl";
 export default {
     props: {
@@ -60,7 +59,7 @@ export default {
         },
     },
     mounted() {
-        this.init();
+        // this.init();
     },
     methods: {
         async init() {
@@ -93,37 +92,30 @@ export default {
             this.value = "";
         },
         // 确认修改
-        confirm() {
+        async confirm() {
             if (!this.value.length || !this.data.length) {
                 return;
             }
-            const categoryId = this.value[this.value.length - 1];
-            const pa = {
+            const postParams = {
                 content: [],
-                projection: ["categoryId"],
+                projection: ["folderId"],
             };
-            pa.content = this.data.map((t) => {
+            postParams.content = this.data.map((t) => {
                 return {
                     id: t.id,
                     graphId: t.graphId,
-                    categoryId: categoryId,
+                    folderId: this.value,
                 };
             });
+            let res;
             if (this.isPub) {
                 // 已发布
-                updatePubGraph(pa).then((res) => {
-                    this.updateCall(res);
-                });
+                res = await pubPlanerUpdate(postParams);
             } else {
                 // 未发布
-                updateDraftsGraph(pa).then((res) => {
-                    this.updateCall(res);
-                });
+                res = await planerUpdate(postParams);
             }
-        },
-        // 更新成功回调
-        updateCall(res) {
-            this.value = [];
+            this.value = '';
             if (res.result == "success") {
                 this.dialogVisible = false;
                 this.$message.success("移动成功");

+ 5 - 10
src/components/homeView/rename.vue

@@ -40,7 +40,7 @@ export default {
             if (!newName) {
                 return;
             }
-            const pa = {
+            const postParams = {
                 content: [
                     {
                         id: this.data.id,
@@ -50,23 +50,18 @@ export default {
                 ],
                 projection: ["name"],
             };
-            console.log(this.isPub);
+            let res;
             if (this.isPub) {
                 // 已发布
-                let res = await pubPlanerUpdate(pa);
-                this.updateCall(res);
+                res = await pubPlanerUpdate(postParams);
             } else {
                 // 未发布
-                let res = planerUpdate(pa);
-                this.updateCall(res);
+                res = await planerUpdate(postParams);
             }
-        },
-        // 更新成功回调
-        updateCall(res) {
             if (res.result == "success") {
                 this.dialogVisible = false;
-                this.$emit("updateSuc");
                 this.$message.success("更新成功");
+                this.$emit("updateSuc");
             } else {
                 this.$message(res.message);
             }

+ 1 - 1
src/components/homeView/tagDialog.vue

@@ -45,7 +45,7 @@ export default {
     methods: {
         showDialog(data) {
             this.dialogVisible = true;
-            this.dynamicTags = JSON.parse(JSON.stringify(data.label)) || [];
+            this.dynamicTags = JSON.parse(JSON.stringify(data.label || []));
             this.data = data;
         },
         handleClose(tag) {

+ 11 - 11
src/components/homeView/topoImageCard.vue

@@ -37,7 +37,7 @@
     </el-card>
 </template>
 <script>
-import { publishGraph } from "@/api/home";
+import { planerPublish } from "@/api/labsl";
 export default {
     props: {
         data: {
@@ -81,8 +81,8 @@ export default {
             this.$emit("changeCheck", this.data);
         },
         // 点击更多中的命令时
-        handleCommand(command) {
-            const pa = {
+        async handleCommand(command) {
+            const postParams = {
                 graphId: this.data.graphId,
                 id: this.data.id,
             };
@@ -101,14 +101,14 @@ export default {
                     this.$emit(command, this.data);
                     break;
                 case "publish":
-                    publishGraph(pa).then((res) => {
-                        if (res.result == "success") {
-                            this.$message.success("发布成功");
-                            this.$emit("publishSuc");
-                        } else {
-                            this.$message.success("发布失败");
-                        }
-                    });
+                    let res = await planerPublish(postParams);
+                    if (res.result == "success") {
+                        this.$message.success("发布成功");
+                        this.$emit("publishSuc");
+                    } else {
+                        this.$message.success("发布失败");
+                    }
+
                     break;
             }
         },

+ 39 - 39
src/views/home.vue

@@ -206,13 +206,29 @@ export default {
         },
         // 新建画布成功回调
         createPlanarCallback(folder) {
+            
+           /*  this.$router.push({
+                name: "Editer",
+                query: {
+                    graphId: folder.graphId,
+                    id: folder.id,
+                    // categoryName: encodeURI(this.categoryName),
+                    isPub: 0, //新建的是未发布的
+                },
+            });
+            // 不进行文件夹的定位
+            return true; */
             if (folder.folderId) {
                 // 是否新建文件夹
-                if (folder.folderName) {// 新建文件夹
+                if (folder.folderName) {
+                    // 新建文件夹
                     this.$refs.leftFolder.getFolderData(folder.folderId);
                 } else {
-                    this.$refs.leftFolder.handleCheckFolder(folder.folderId)
+                    this.$refs.leftFolder.handleCheckFolder(folder.folderId);
                 }
+                // 选中未发布,查询列表
+                this.isPub = 0;
+                this.queryGraph();
             }
         },
         // 批量新建画布
@@ -243,8 +259,8 @@ export default {
             console.log(val);
             let cardTree = [];
             cardTree = this.cardTree.map((building) => {
-                building.floorList.map((_floor) => {
-                    _floor.floor.map((card) => {
+                building?.floorList?.map((_floor) => {
+                    _floor?.planarGraphLis?.map((card) => {
                         card.checked = val;
                     });
                     return _floor;
@@ -313,35 +329,15 @@ export default {
          * 更改选中的文件夹
          */
         changeFolder(data) {
-            console.log(data);
+            // 如果没有文件夹数据,清空页面数据
+            if (!data) {
+                this.cardTree = [];
+                this.cardList = [];
+                this.folderId = "";
+                return true;
+            }
             this.folderId = data.id;
             this.queryGraph();
-            return true;
-            // TODO:
-            let { yfbMocKdata } = require("./mockData");
-            // console.log(yfbMocKdata);
-            let cardTree = [],
-                cardList = [];
-            cardTree = yfbMocKdata.content.map((building) => {
-                building.floorList.map((_floor) => {
-                    _floor.floor.map((card) => {
-                        card.checked = false;
-                        cardList.push({
-                            buildingId: building.buildingId,
-                            buildingName: building.buildingName,
-                            floorId: _floor.floorId,
-                            floorName: _floor.floorName,
-                            ...card,
-                        });
-                        return card;
-                    });
-                    return _floor;
-                });
-                return building;
-            });
-            this.cardTree = cardTree;
-            this.cardList = cardList;
-            this.cardLoading = false;
         },
         // 发布修改
         changePub() {
@@ -366,6 +362,8 @@ export default {
         },
         // 新建拓扑图成功
         toEdit(data) {
+            this.$message.warning("功能开发中");
+            return true;
             this.$router.push({
                 name: "Editer",
                 query: {
@@ -376,10 +374,12 @@ export default {
                 },
             });
         },
-        /////////////////接口
-        // 查询图形信息
-        async queryGraph() {
-            if (!this.folderId) {
+        /**
+         * 查询图形信息
+         * @param { string } floderId 传入的文件ID,新建画布成功之后,会调用该接口
+         */
+        async queryGraph(floderId) {
+            if (!(floderId || this.folderId)) {
                 return false;
             }
             this.cardLoading = true;
@@ -391,7 +391,7 @@ export default {
             // projectId: "Pj1101050029"
             // statistics: {}
             const postParams = {
-                filters: `folderId='${this.folderId}'`,
+                filters: `folderId='${floderId || this.folderId}'`,
                 PageNumber: 1,
                 PageSize: 1000,
             };
@@ -417,7 +417,7 @@ export default {
             cardTree = res?.content?.map((building) => {
                 building?.floorList?.map((_floor) => {
                     // TODO: 1111
-                    _floor?.floor?.map((card) => {
+                    _floor?.planarGraphLis?.map((card) => {
                         card.checked = false;
                         // 保存建筑,楼层,卡片信息
                         cardList.push({
@@ -439,8 +439,8 @@ export default {
             });
             this.cardTree = cardTree;
             this.cardList = cardList;
-            console.log(this.cardList)
-            console.log(this.cardTree)
+            console.log(this.cardList);
+            console.log(this.cardTree);
             this.cardLoading = false;
         },
     },