ソースを参照

wanda-adm:feat > 修改功能分区编码

shaun-sheep 3 年 前
コミット
55a0d59c10

+ 52 - 30
src/api/datacenter.ts

@@ -6,139 +6,161 @@ const baseApi = "/datacenter";
 
 // 创建项目
 export function projectCreate(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/project/create`, postParams);
+    return httputils.postJson(`${ baseApi }/object/project/create`, postParams);
 }
 
 // 查询项目信息
 export function projectQuery(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/project/query`, postParams);
+    return httputils.postJson(`${ baseApi }/object/project/query`, postParams);
 }
 
 // 更新项目信息
 export function projectUpdate(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/project/update`, postParams);
+    return httputils.postJson(`${ baseApi }/object/project/update`, postParams);
 }
 
 // 查询建筑信息
 export function buildingQuery(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/building/query`, postParams);
+    return httputils.postJson(`${ baseApi }/object/building/query`, postParams);
 }
 
 // 查询建筑信息
 export function floorQuery(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/floor/query`, postParams);
+    return httputils.postJson(`${ baseApi }/object/floor/query`, postParams);
 }
 
 // 字典查询
 export function dictCategoryQuery(postParams: any): any {
-    return httputils.postJson(`${baseApi}/dict/category`, postParams);
+    return httputils.postJson(`${ baseApi }/dict/category`, postParams);
 }
 
 // 查询项目下类型的信息点-->编辑器 空间功能类型 列表-->自己转成树
 export function dictQuery(postParams: any): any {
     // postParams:{
     // "filters": "code='roomFuncType'",
-    // "type": "GeneralZone"
+    // "type": "FunctionZone"
     // }
-    return httputils.postJson(`${baseApi}/dict/query`, postParams);
+    return httputils.postJson(`${ baseApi }/dict/query`, postParams);
 }
 
 // 查询空间实例
 export function PartiInstancQuery(postParams: any): any {
     // postParams:{
     // "filters": "code='roomFuncType'",
-    // "type": "GeneralZone"
+    // "type": "FunctionZone"
     // }
-    return httputils.postJson(`${baseApi}/object/zone/query`, postParams);
+    return httputils.postJson(`${ baseApi }/object/zone/query`, postParams);
 }
 
 // 查询设备信息
 export function queryEquip(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/equip/query`, postParams)
+    return httputils.postJson(`${ baseApi }/object/equip/query`, postParams)
 }
 
 // 创建设备信息
 export function createEquip(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/equip/create`, postParams)
+    return httputils.postJson(`${ baseApi }/object/equip/create`, postParams)
 }
 
 // 更新设备信息
 export function updateEquip(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/equip/update`, postParams)
+    return httputils.postJson(`${ baseApi }/object/equip/update`, postParams)
 }
 
 // 查询系统信息
 export function querySystem(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/system/query`, postParams)
+    return httputils.postJson(`${ baseApi }/object/system/query`, postParams)
 }
+
 // 查询空间信息
 export function queryZone(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/zone/query`, postParams)
+    return httputils.postJson(`${ baseApi }/object/zone/query`, postParams)
 }
 
 // 查询元空间信息
 export function queryIspace(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/ispace/query`, postParams)
+    return httputils.postJson(`${ baseApi }/object/ispace/query`, postParams)
 }
 
 // 创建空间
 export function createZone(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/zone/create`, postParams)
+    return httputils.postJson(`${ baseApi }/object/zone/create`, postParams)
 }
 
 // 更新空间
 export function updateZone(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/zone/update`, postParams)
+    return httputils.postJson(`${ baseApi }/object/zone/update`, postParams)
 }
 
 // 查询设备统计
 export function queryCount(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/equip/count`, postParams)
+    return httputils.postJson(`${ baseApi }/object/equip/count`, postParams)
 }
 
 // 查询系统统计
 export function queryCountSystem(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/system/count`, postParams)
+    return httputils.postJson(`${ baseApi }/object/system/count`, postParams)
 }
 
 // 创建系统信息
 export function createSystem(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/system/create`, postParams)
+    return httputils.postJson(`${ baseApi }/object/system/create`, postParams)
 }
 
 // 更新系统信息
 export function updateSystem(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/system/update`, postParams)
+    return httputils.postJson(`${ baseApi }/object/system/update`, postParams)
 }
 
 // 查询空间统计
 export function queryCountSpace(postParams: any): any {
-    return httputils.postJson(`${baseApi}/object/zone/count`, postParams)
+    return httputils.postJson(`${ baseApi }/object/zone/count`, postParams)
 }
 
 // 查询关系总览
 export function relationshipOverview(postParams: any): any {
-    return httputils.postJson(`${baseApi}/rel/graphic/overview`, postParams)
+    return httputils.postJson(`${ baseApi }/rel/graphic/overview`, postParams)
 }
 
 // 查询关系数量
 export function relationshipCount(postParams: any): any {
-    return httputils.postJson(`${baseApi}/rel/graphic/query/count`, postParams)
+    return httputils.postJson(`${ baseApi }/rel/graphic/query/count`, postParams)
 }
+
 // 查看关系相关的数据类型
 export function relToType(getParams: any) {
-    return httputils.getJson(`${baseApi}/rel/graphic/relToType`, getParams)
+    return httputils.getJson(`${ baseApi }/rel/graphic/relToType`, getParams)
 }
+
 // 查询关系数据
 export function relManualQuery(postParams: any) {
-    return httputils.postJson(`${baseApi}/rel/manual/query`, postParams)
+    return httputils.postJson(`${ baseApi }/rel/manual/query`, postParams)
 }
+
 // 添加关系数据
 export function relAdd(postParams: any) {
-    return httputils.postJson(`${baseApi}/rel/manual/add`, postParams)
+    return httputils.postJson(`${ baseApi }/rel/manual/add`, postParams)
 }
 
 // 删除关系数据
 export function relDel(postParams: any) {
-    return httputils.postJson(`${baseApi}/rel/manual/del`, postParams)
-}
+    return httputils.postJson(`${ baseApi }/rel/manual/del`, postParams)
+}
+
+// 关系计算
+export function relationCalc(postParams: any) {
+    let url = "";
+    const { zoneType, relationType } = postParams
+    if (zoneType) {
+        url = `${ baseApi }/relation-calc/${ relationType }?objectTypes=${ zoneType }`
+    } else {
+        url = `${ baseApi }/relation-calc/${ relationType }?relationType=${ relationType }`
+    }
+    return httputils.postJson(url, {})
+}
+
+// 更新计算时间
+export function updateCalcTime(getParams: any) {
+    const url = `${ baseApi }/rel/graphic/updateCalcTime?graphCode=${ getParams.graphCode }&relType=${ getParams.relType }&computingTime=${ getParams.computingTime }`
+    return httputils.getJson(url, {})
+}

+ 32 - 5
src/views/maintain/relationship/index.vue

@@ -52,6 +52,8 @@
                                     }}</span>
                                 <span v-else-if="relation.times">最后一次计算时间 {{ relation.times }}</span>
                                 <span style="float: right">
+
+<!--  todo  启动计算  :disabled="relation.manual === 1" 解决演示使用 -->
                                 <el-tooltip
                                     content="启动计算"
                                     placement="top">
@@ -59,6 +61,7 @@
                                         style="margin-bottom: 4px;"
                                         :is-dot="relation.computationalState === 2 || relation.computationalState === 5">
                                         <el-button
+                                            :disabled="relation.manual === 1"
                                             @click="computed(relation)"
                                             circle
                                             type=""
@@ -84,22 +87,20 @@
 
                                 </el-tooltip>
                                 </span>
-
                             </article>
                         </el-card>
                     </el-col>
-
                 </el-row>
             </section>
-
         </template>
     </div>
 </template>
 
 <script lang="ts">
 import { Component, Vue } from "vue-property-decorator";
-import { relationshipCount, relationshipOverview } from "@/api/datacenter"
+import { relationCalc, relationshipCount, relationshipOverview, updateCalcTime } from "@/api/datacenter"
 import moment from "moment";
+import { UserModule } from "@/store/modules/user";
 @Component({
     name: "relationShip"
 })
@@ -107,6 +108,13 @@ export default class extends Vue {
     loading = false
     content = []
 
+    get projectId(): string {
+        return UserModule.projectId;
+    }
+
+    get group(): string {
+        return UserModule.group
+    }
 
     created() {
         this.init()
@@ -159,8 +167,27 @@ export default class extends Vue {
         });
     }
 
-    computed(relation) {
+    computed(relation: object) {
         this.$set(relation, 'times', moment(Date.now()).format("YYYY-MM-DD HH:mm:ss"))
+        console.log(relation.relationType, relation.zoneType)
+        if (relation.enableCalc == 0) { // 0 不可计算
+            let param = {
+                graphCode: relation.graphicType,
+                relType: relation.relationType,
+                computedTime: moment(Date.now()).format("YYYY-MM-DD HH:mm:ss")
+            }
+            updateCalcTime(param).then(res => {
+                console.log(res)
+            })
+        } else {
+            let param = {
+                relationType: relation.relationType,
+                zoneType: relation.zoneType,
+            }
+            relationCalc(param).then(res => {
+                console.log(res)
+            })
+        }
     }
 
     manual(relation) {

+ 4 - 4
src/views/maintain/space/index.vue

@@ -89,7 +89,7 @@ export default class spaceIndex extends Vue {
     activeName = "table";
     building = ["all"];
 
-    zoneTypeVal = ["GeneralZone"];
+    zoneTypeVal = ["FunctionZone"];
     // 分页
     private paginationList = {
         page: 1,
@@ -101,7 +101,7 @@ export default class spaceIndex extends Vue {
     graphOptions = [];
     zoneTypeOption = [
         {
-            value: "GeneralZone",
+            value: "FunctionZone",
             label: "功能分区",
         },
         {
@@ -281,7 +281,7 @@ export default class spaceIndex extends Vue {
         if (this.building.length > 0) {
             this.loading = true;
             let param = {
-                type: "GeneralZone",
+                type: "FunctionZone",
                 orders: "sort asc, name desc",
                 pageNumber: 1,
                 pageSize: 1000,
@@ -292,7 +292,7 @@ export default class spaceIndex extends Vue {
                     { name: "building" },
                     { name: "floor", orders: "floorSequenceId desc" },
                 ],
-                zoneType: "GeneralZone",
+                zoneType: "FunctionZone",
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime asc, localName asc, localId desc, id asc",

+ 11 - 7
src/views/scene/tiepoint/components/equipTab/index.vue

@@ -9,7 +9,7 @@
                 @change="handleChangeDevice"
                 class="item"
             ></el-cascader>
-            <admSearch @SearchValue="searchValue" class="item" />
+            <admSearch @SearchValue="searchValue" class="item"/>
         </div>
         <div v-loading="loading" style="height: calc(100% - 100px); padding: 0 12px; position: relative">
             <template style="height: 100%" v-if="tableData.length">
@@ -28,7 +28,7 @@
                 />
             </template>
             <div v-else class="void align">
-                <svg-icon name="void" :width="String(120)" :height="String(123)" />
+                <svg-icon name="void" :width="String(120)" :height="String(123)"/>
                 <p class="void-title">暂无内容</p>
                 <p class="void-tips">可点击左上角筛选</p>
             </div>
@@ -119,14 +119,14 @@ export default class EquipTab extends Vue {
                 category: this.deviceType,
             };
             let param2 = {
-                filters: `classCode='${this.deviceType}'`,
+                filters: `classCode='${ this.deviceType }'`,
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, id asc",
                 projectId: this.projectId,
             };
             if (this.keyWord != "") {
-                param2.filters += `;codeName contain '${this.keyWord}' or systemCategory contain '${this.keyWord}' or bimTypeId contain '${this.keyWord}' or localId contain '${this.keyWord}'`;
+                param2.filters += `;codeName contain '${ this.keyWord }' or systemCategory contain '${ this.keyWord }' or bimTypeId contain '${ this.keyWord }' or localId contain '${ this.keyWord }'`;
             }
             let promise = new Promise((resolve) => {
                 dictInfo(param).then((res: any) => {
@@ -160,19 +160,20 @@ export default class EquipTab extends Vue {
         if (this.deviceType) {
             this.loading = true;
             let params = {
-                filters: `classCode='${this.deviceType}'`,
+                filters: `classCode='${ this.deviceType }'`,
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, id asc",
                 projectId: this.projectId,
             };
             if (this.keyWord != "") {
-                params.filters += `;codeName contain '${this.keyWord}' or systemCategory contain '${this.keyWord}' or bimTypeId contain '${this.keyWord}' or localId contain '${this.keyWord}'`;
+                params.filters += `;codeName contain '${ this.keyWord }' or systemCategory contain '${ this.keyWord }' or bimTypeId contain '${ this.keyWord }' or localId contain '${ this.keyWord }'`;
             }
             const res = await queryEquip(params);
             if (res.result === "success") {
                 this.tableData = res?.content ? res.content : []; // 主体数据
                 this.paginationList.total = res?.total ? res.total : 0;
+
                 this.loading = false;
             }
         } else {
@@ -264,15 +265,18 @@ export default class EquipTab extends Vue {
 
     .search {
         padding: 12px;
+
         & > .item {
             margin-right: 12px;
         }
     }
 }
+
 // 数据暂未
 .void {
     margin-top: 200px;
 }
+
 .align {
     display: flex;
     align-items: center;
@@ -280,4 +284,4 @@ export default class EquipTab extends Vue {
     flex-direction: column;
     flex-wrap: wrap;
 }
-</style>
+</style>