瀏覽代碼

查询未发布,接口上传字段修改

yunxing 4 年之前
父節點
當前提交
1c2915a187
共有 3 個文件被更改,包括 80 次插入69 次删除
  1. 5 0
      src/api/labsl.ts
  2. 70 67
      src/components/editview/leftToolBar/addEquipmentDialog.vue
  3. 5 2
      src/views/home.vue

+ 5 - 0
src/api/labsl.ts

@@ -66,3 +66,8 @@ export function pubPlanerRecycle(postParams: any): any {
 export function pubPlanerUpdate(postParams: any): any {
     return httputils.postJson(`${baseApi}/planar/graph/pub/update`, postParams);
 }
+
+// 平面图-规则
+export function ruleCreate(postParams: any): any {
+    return httputils.postJson(`${baseApi}/planar/rule/create`, postParams);
+}

+ 70 - 67
src/components/editview/leftToolBar/addEquipmentDialog.vue

@@ -1,6 +1,4 @@
-/**
- * 添加显示实例(设备)
- */
+<!-- 添加显示实例(设备) -->
 <template>
     <el-dialog
         custom-class="equipment-detail-dialog"
@@ -34,26 +32,10 @@
                 :choseArea="true"
                 :data="dataTree1"
                 @change="treeChange1"
-                @focusChange="focusChange1"
             />
             <span class="text2">选择空间:</span>
-            <!-- 空间分区类型 树 -->
-            <!-- <TreeSelect
-                title="已选项"
-                unit="个"
-                placeholder="请选择"
-                :width="240"
-                :height="300"
-                :caption="'分区类型:'"
-                :notNull="true"
-                :returnParentNode="false"
-                :isShowAllChoice="true"
-                :selectedIds="selectedIds2"
-                :choseArea="true"
-                :data="dataTree2"
-                @change="treeChange2"
-                @focusChange="focusChange2"
-            /> -->
+            <!-- 空间分区类型 菜单 -->
+
             <Select
                 width="220"
                 tipPlace="top"
@@ -92,7 +74,6 @@
                 :disabled="!spacePartitionType.length"
                 :data="dataTree3"
                 @change="treeChange3"
-                @focusChange="focusChange3"
             />
         </div>
         <!-- 表格 -->
@@ -133,6 +114,7 @@
 import editInfoPoint from "./editInfoPoint";
 import { Select, TreeSelect } from "meri-design";
 import { cloneDeep } from "lodash";
+import { ruleCreate } from "@/api/labsl";
 import { dictCategoryQuery, dictQuery, PartiInstancQuery } from "@/api/datacenter";
 import { categoryQuery, typeQuery, equipQuery } from "@/api/equipcomponent";
 import { array2Tree, mapTree } from "@/utils/utils";
@@ -226,13 +208,36 @@ export default {
                 this.initModal();
             }
         },
+        /**
+         * 监听分区类型变化(点击下拉框删除按钮,触发表格数据查询)
+         */
+        spacePartitionType: {
+            handler(newV, oldV) {
+                if (!newV.length && oldV.length) {
+                    this.spacePartitionInstance = [];
+                    // this.getTableData();
+                }
+            },
+            deep: true,
+        },
+        /**
+         * 监听分区下实例变化(点击下拉框删除按钮,触发表格数据查询)
+         */
+        spacePartitionInstance: {
+            handler(newV, oldV) {
+                if (!newV.length && oldV.length) {
+                    this.getTableData();
+                }
+            },
+            deep: true,
+        },
     },
     created() {},
     mounted() {
         // window.vm = this;
-        setTimeout(() => {
+        /*   setTimeout(() => {
             this.showPopover = true;
-        }, 2000);
+        }, 2000); */
     },
     methods: {
         /**
@@ -248,39 +253,25 @@ export default {
             // 查询设备列表
             this.curentSelectTree1.length && this.getTableData();
         },
-        focusChange1(status) {
-            // console.log("focusChange", status);
-        },
         /**
          * 空间 分区类型树
          */
-        /*  treeChange2(data, dataObj) {
-            // 清空选中的分区下的实例
-            this.spacePartitionInstance = [];
-            if (!dataObj) {
-                this.curentSelectTree2 = [];
-            } else {
-                // 筛选树的最后一级,按照组件返回数组的name中/的个数
-                this.curentSelectTree2 = dataObj.filter((v) => v.name.split("/").length === 2).map((v) => v.id);
-            }
-        }, */
         spacePartitionTypeConfirm(data) {
             // 查询分区下实例列表
             if (this.spacePartitionType.length) {
                 this.getPartiInstance();
             }
+            // 查询表格
+            this.getTableData();
         },
         /**
          * 空间 分区下实例
          */
         selectConfirm(data) {
-            console.log("selectConfirm");
-            console.log(data);
-            console.log(this.spacePartitionInstance);
-        },
-        focusChange2(status) {
-            // console.log("focusChange", status);
+            // 查询表格
+            this.getTableData();
         },
+
         /**
          * 空间功能类型
          */
@@ -291,9 +282,8 @@ export default {
                 // 筛选树的最后一级,按照组件返回数组的name中/的个数
                 this.curentSelectTree3 = dataObj.filter((v) => v.name.split("/").length === 3).map((v) => v.id);
             }
-        },
-        focusChange3(status) {
-            // console.log("focusChange", status);
+            // 查询表格
+            this.getTableData();
         },
         /**
          * 显示弹窗时的处理
@@ -313,7 +303,9 @@ export default {
             console.log(res);
             let tree = res?.content || [];
             // 遍历tree,使其id属性变为为_id属性, code属性变成id属性
+            console.time(1);
             this.dataTree1 = mapTree(tree, "id->_id", "code->id");
+            console.timeEnd(1);
         },
         /**
          * 空间分区类型 列表
@@ -362,12 +354,13 @@ export default {
             this.dataTree3 = array2Tree(data, "parentCode");
         },
         async getTableData() {
+            // console.trace("getTableData");
             // 东坝地上二层
             let postParams = {
                 equipTypes: this.curentSelectTree1, //设备类型  //["FFFSSN"],
-                zoneTypes: [], //空间类型
-                spaceIds: [], //空间实例id
-                funcTypes: [], //空间功能区类型
+                zoneTypes: this.spacePartitionType, //空间类型
+                spaceIds: this.spacePartitionInstance, //空间实例id
+                funcTypes: this.curentSelectTree3, //空间功能区类型
                 floorId: "Fl11010500296bc7ca3a0d5d41419cf95c5b45116400",
                 buildingId: "Bd1101050029cb77fbd1846611eaac87cd1cd6a961c6",
             };
@@ -387,7 +380,7 @@ export default {
                 }
             });
             let tableData = Object.values(map);
-            tableData.unshift({ codeName: "实例总数量: " + data.length });
+            tableData.length && tableData.unshift({ codeName: "实例总数量: " + data.length });
             this.tableData = tableData;
         },
         /**
@@ -432,28 +425,38 @@ export default {
             // dialogTableVisible
             this.dialogTableVisible = false;
             this.showPopover = false;
-            clearTimeout(this.timer);
+            // clearTimeout(this.timer);
             this.$emit("closeModal");
         },
         /**
          * 点击弹窗确定,提交接口
          */
-        confirm() {
-            /**
-             * 设备实例范围:
-             * []
-             * 空间
-             * 分区类型
-             * []
-             * 分区下实例
-             * id
-             * 空间功能类型
-             * []
-             *
-             */
-            this.dialogTableVisible = false;
-            this.showPopover = false;
-            clearTimeout(this.timer);
+        async confirm() {
+            let postParams = {
+                id: "48598fc65edd4f2f8402202f0b793972",
+                graphId: "806a12663cb147cebefb393d49fc0357",
+                returnType: "equip", // 返回类型(equip: 设备, equipGroup: 设备组, zone: 空间)
+                commond: "query", // 命令类型(query: 查询, delete: 删除)
+                params: {
+                    equipTypes: this.curentSelectTree1, //设备类型  //["FFFSSN"],
+                    zoneTypes: this.spacePartitionType, //空间类型
+                    spaceIds: this.spacePartitionInstance, //空间实例id
+                    funcTypes: this.curentSelectTree3, //空间功能区类型
+                },
+                note: "",
+            };
+            console.log(postParams);
+            let res = await ruleCreate(postParams);
+            console.log("===============");
+            console.log(res);
+            if (res.result === "success") {
+                this.$message.success("添加成功");
+                this.dialogTableVisible = false;
+                this.showPopover = false;
+            } else {
+                this.$message.error(res.message || "添加失败");
+            }
+            // clearTimeout(this.timer);
         },
     },
 };

+ 5 - 2
src/views/home.vue

@@ -431,11 +431,14 @@ export default {
             if (this.isPub) {
                 res = await pubPlanerQuery(postParams);
             } else {
-                // state 1(草稿箱),state 4(回收站)
-                postParams.filters += ";state=1";
+                // state Draft(未发布),state Recyle(回收站)
+                postParams.filters += ";state='Draft'";
                 res = await planerQuery(postParams);
             }
             if (res.result !== "success") {
+                this.cardTree = [];
+                this.cardList = [];
+                this.cardLoading = false;
                 return false;
             }
             let cardTree = [],