Quellcode durchsuchen

Merge branch 'master' of http://39.106.8.246:3003/web/wanda-adm

haojianlong vor 3 Jahren
Ursprung
Commit
2dbed7a056

+ 40 - 23
src/api/datacenter.ts

@@ -6,32 +6,32 @@ 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);
 }
 
 // 查询项目下类型的信息点-->编辑器 空间功能类型 列表-->自己转成树
@@ -40,7 +40,7 @@ export function dictQuery(postParams: any): any {
     // "filters": "code='roomFuncType'",
     // "type": "GeneralZone"
     // }
-    return httputils.postJson(`${ baseApi }/dict/query`, postParams);
+    return httputils.postJson(`${baseApi}/dict/query`, postParams);
 }
 
 // 查询空间实例
@@ -49,79 +49,96 @@ export function PartiInstancQuery(postParams: any): any {
     // "filters": "code='roomFuncType'",
     // "type": "GeneralZone"
     // }
-    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)
+}
+// 查询关系数据
+export function relManualQuery(postParams: any) {
+    return httputils.postJson(`${baseApi}/rel/manual/query`, postParams)
+}
+// 添加关系数据
+export function relAdd(postParams: any) {
+    return httputils.postJson(`${baseApi}/rel/manual/add`, postParams)
+}
+
+// 删除关系数据
+export function relDel(postParams: any) {
+    return httputils.postJson(`${baseApi}/rel/manual/del`, postParams)
+}

+ 9 - 9
src/views/maintain/relationship/components/tableHeader.ts

@@ -1,12 +1,12 @@
 const tableHeader = {
-    '设备所在建筑': ['建筑', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
-    '设备所在楼层': ['建筑', '楼层', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
-    '设备所在功能空间': ['空间本地名称', '空间本地编码', '建筑', '楼层', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
-    '设备服务功能空间': ['空间本地名称', '空间本地编码', '建筑', '楼层', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
-    '设备所在供电空间': ['空间本地名称', '空间本地编码', '建筑', '楼层', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
-    '空间所在建筑': ['建筑', '空间本地名称', '空间本地编码', '楼层'],
-    '空间所在楼层': ['建筑', '楼层', '空间本地名称', '空间本地编码'],
-    '空间服务空间': ['空间本地名称', '空间本地编码', '建筑', '楼层', '空间本地名称', '空间本地编码', '建筑', '楼层'],
-    '系统下的设备': ['系统分类', '分类名称', '系统编码', 'BIM构件名称', '系统分类', '设备类型名称', '设备本地编码'],
+    '设备所在建筑': [['建筑', 'objectInfo'], ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
+    '设备所在楼层': [['建筑', 'objectInfo'], '楼层', ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
+    '设备所在功能空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo'], '楼层', ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
+    '设备服务功能空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo'], '楼层', ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
+    '设备所在供电空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo'], '楼层', ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
+    '空间所在建筑': [['建筑', 'objectInfo'], ['空间本地名称', "localName"], ['空间本地编码', "localId"], '楼层'],
+    '空间所在楼层': [['建筑', 'objectInfo'], '楼层', ['空间本地名称', "localName"], ['空间本地编码', "localId"]],
+    '空间服务空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo'], '楼层', ['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo'], '楼层'],
+    '系统下的设备': ['系统分类', '分类名称', '系统编码', ['BIM构件名称', ''], '系统分类', '设备类型名称', ['设备本地编码', "localId"]],
 }
 export default tableHeader

+ 41 - 33
src/views/maintain/relationship/relation/components/addRelationDialog.vue

@@ -93,7 +93,7 @@
 </template>
 
 <script lang="ts">
-// import {relAdd} from "../../../../api/relation/api";
+import { relAdd } from "@/api/datacenter";
 import { Component, Prop, Vue, Watch, Emit } from "vue-property-decorator";
 let checkCode = (rule: any, value: any, callback: any) => {
   //TODO
@@ -119,14 +119,14 @@ export default class extends Vue {
   fromError = "";
   addShipDialog = false; //是否显示tooltip
   optionsCode = [
-    {
-      value: "cadId",
-      label: "CADID图纸编码",
-    },
-    {
-      value: "name",
-      label: "设备名称",
-    },
+    // {
+    //   value: "cadId",
+    //   label: "CADID图纸编码",
+    // },
+    // {
+    //   value: "name",
+    //   label: "设备名称",
+    // },
     {
       value: "id",
       label: "设备ID",
@@ -206,33 +206,41 @@ export default class extends Vue {
           }
         }
         let param = {
-          FromContent: arr,
-          MainContent: this.ruleForm.main,
-          RelType: localStorage.getItem("RelManualType"),
-          Type: this.codeValue,
+          fromContent: arr,
+          mainContent: this.ruleForm.main,
+          relType: this.$route.query.relationType,
+          type: this.codeValue,
+          graphicType: this.$route.query.graphicType,
+          zoneType: this.$route.query.zoneType
+            ? this.$route.query.zoneType
+            : "",
         };
         //清空添加value
         let that = this;
-        // relAdd(param).then(res => {
-        //   if (res.data.Result === "failure") {
-        //     if(res.data.ErrorType == 1) {
-        //       // this.mainError = res.data.Message
-        //       this.$nextTick(()=>{this.mainError = res.data.Message})
-        //     } else if(res.data.ErrorType == 2) {
-        //       this.$nextTick(()=>{this.fromError = res.data.Message})
-        //     } else {
-        //       this.$message.error(res.data.Message);
-        //     }
-
-        //   } else if (res.data.Result === "success") {
-        //     this.$message.success(res.data.Message);
-        //     this.$emit('update')
-        //     that.addShipDialog = false
-        //     that.codeValue = ''
-        //     that.ruleForm.codeList = [{value:''}]
-        //     that.ruleForm.main = ''
-        //   }
-        // })
+        relAdd(param).then((res) => {
+          console.log("resres", res);
+          if (res.result === "failure") {
+            if (res.ErrorType == 1) {
+              // this.mainError = res.data.Message
+              this.$nextTick(() => {
+                this.mainError = res.message;
+              });
+            } else if (res.ErrorType == 2) {
+              this.$nextTick(() => {
+                this.fromError = res.message;
+              });
+            } else {
+              this.$message.error(res.message);
+            }
+          } else if (res.result === "success") {
+            this.$message.success(res.message);
+            this.$emit("update");
+            this.closeDialog();
+            that.codeValue = "";
+            that.ruleForm.codeList = [{ value: "" }];
+            that.ruleForm.main = "";
+          }
+        });
       } else {
         console.log("error");
         return false;

+ 1 - 1
src/views/maintain/relationship/relation/components/table.vue

@@ -36,7 +36,7 @@ import { Component, Prop, Vue } from "vue-property-decorator";
 export default class extends Vue {
 
     @Prop({default:Array}) tableHeader?:[]
-    tableData = []
+    @Prop({default:Array}) tableData?:[]
 
     objectSpanMethod() {
 

+ 143 - 11
src/views/maintain/relationship/relation/index.vue

@@ -8,26 +8,47 @@
     <el-row class="content">
       <el-col :span="12" class="object">
         <p>主对象</p>
-        <span>类型:</span>
+        <span v-if="relTypeStatus == 1 || relTypeStatus == 3">类型:</span>
         <el-select
-          v-model="mainObject"
+          :clearable="true"
+          v-if="relTypeStatus == 1 || relTypeStatus == 3"
+          v-model="categoryFrom"
           placeholder="请选择"
+          @change="mainSelect"
           style="margin-right: 10px"
-        ></el-select>
-        <AdmSearch />
+        >
+          <el-option
+            v-for="item in mainOptions"
+            :key="item.classCode"
+            :label="item.className"
+            :value="item.classCode"
+          >
+          </el-option>
+        </el-select>
+        <AdmSearch @SearchValue="mainSerch" />
       </el-col>
       <el-col :span="12" class="object">
         <p>从对象</p>
-        <span>类型:</span>
+        <span v-if="relTypeStatus == 2 || relTypeStatus == 3">类型:</span>
         <el-select
-          v-model="mainObject"
+          v-if="relTypeStatus == 2 || relTypeStatus == 3"
+          v-model="categoryTo"
+          :clearable="true"
           placeholder="请选择"
           style="margin-right: 10px"
-        ></el-select>
-        <AdmSearch />
+        >
+          <el-option
+            v-for="item in minorOptions"
+            :key="item.classCode"
+            :label="item.className"
+            :value="item.classCode"
+          >
+          </el-option>
+        </el-select>
+        <AdmSearch @SearchValue="minorSearch" />
       </el-col>
     </el-row>
-    <relationTable :tableHeader="tableHeader" />
+    <relationTable :tableHeader="tableHeader" :tableData="tableData" />
     <addRelationDialog
       @closeAddRelation="addRelationValue = false"
       :addRelationValue="addRelationValue"
@@ -46,15 +67,29 @@ import tableHeader from "@/views/maintain/relationship/components/tableHeader";
 import addRelationDialog from "./components/addRelationDialog.vue";
 import editRelationDialog from "./components/editRelationDialog.vue";
 import excelDialog from "./components/excelDialog.vue";
+import { relToType, relManualQuery } from "@/api/datacenter";
 
 @Component({
   name: "relation",
-  components: { AdmSearch, relationTable, addRelationDialog, excelDialog,editRelationDialog },
+  components: {
+    AdmSearch,
+    relationTable,
+    addRelationDialog,
+    excelDialog,
+    editRelationDialog,
+  },
 })
 export default class extends Vue {
-  mainObject = "";
+  categoryFrom = ""; //主关系
+  mainOptions = []; //主关系选项
+  categoryTo = ""; //次关系
+  minorOptions = []; //次关系选项
+  vagueFrom = ""; //主关系模糊收索
+  vagueTo = ""; //次关系模糊收索
   //表头数据
   tableHeader = [];
+  //表格数据
+  tableData = [];
   // 是否添加关系
   addRelationValue: Boolean = false;
   // 传入tip需要得字段
@@ -82,6 +117,7 @@ export default class extends Vue {
     cancel: "取消",
     delete: "删除关系",
   };
+  relTypeStatus: any = 0; //关系相关类型主从 0 None 1主 2从 3主从
 
   /////////////////////////////////////////
   // 方法
@@ -100,14 +136,110 @@ export default class extends Vue {
   }
 
   /**
+   * 主关系下拉框选择
+   */
+  mainSelect(val: any) {
+    this.categoryFrom = val;
+    this.relManualQuery();
+    console.log("mainSelect", val);
+  }
+  /**
+   * 从关系下拉框选择
+   */
+  minorSelect(val: any) {
+    this.categoryTo = val;
+    this.relManualQuery();
+  }
+  // 主关系模糊搜索
+  mainSerch(val: string) {
+    this.vagueFrom = val;
+    this.relManualQuery();
+  }
+  // 从关系模糊搜索
+  minorSearch(val: string) {
+    this.vagueTo = val;
+    this.relManualQuery();
+  }
+
+  /**
    * 添加关系
    */
   addRelation() {
     this.addRelationValue = true;
   }
+
+  /**
+   * 获取主对象从对象关系
+   */
+  relToType() {
+    const urlData = this.$route.query;
+    if (this.relTypeStatus == 0) {
+      this.mainObject = ""; //主关系
+      this.mainOptions = []; //主关系选项
+      this.minorObject = ""; //次关系
+      this.minorOptions = []; //次关系选项
+      return;
+    }
+    // 获取主关系接口
+    if (this.relTypeStatus == 1 || this.relTypeStatus == 3) {
+      const data = {
+        zoneType: urlData.zoneType ? urlData.zoneType : "",
+        graphCode: urlData.graphicType,
+        type: urlData.relationType,
+        relType: urlData.relationType,
+        status: 1, // 1 为主关系;2 为从关系
+      };
+      relToType(data).then((res) => {
+        this.mainObject = ""; //主关系
+        this.mainOptions = res.content; //主关系选项
+      });
+    }
+
+    // 获取从关系接口
+    if (this.relTypeStatus == 2 || this.relTypeStatus == 3) {
+      const data = {
+        zoneType: urlData.zoneType ? urlData.zoneType : "",
+        graphCode: urlData.graphicType,
+        type: urlData.relationType,
+        relType: urlData.relationType,
+        status: 2, // 1 为主关系;2 为从关系
+      };
+      relToType(data).then((res) => {
+        this.minorObject = ""; //次关系
+        this.minorOptions = res.content; //次关系选项
+      });
+    }
+  }
+  /**
+   * 获取table列表
+   */
+  relManualQuery() {
+    // 获取table数据
+    const data = {
+      projectId: this.$route.query.projectId,
+      vagueTo: this.vagueTo, //主关系
+      vagueFrom: this.vagueFrom, //从关系
+      objectType: 1,
+      relType: this.$route.query.relationType,
+      pageSize: 50,
+      pageNumber: 1,
+      graphicType: this.$route.query.graphicType,
+      zoneType: this.$route.query.zoneType ? this.$route.query.zoneType : "",
+    };
+    relManualQuery(data).then((res) => {
+      console.log("this.tableHeader", this.tableHeader);
+      this.tableData = res.content;
+    });
+  }
+
   created() {
     let relationTypeName = this.$route.query.relationTypeName;
     this.tableHeader = tableHeader[relationTypeName];
+    this.relTypeStatus = this.$route.query.relTypeStatus;
+    // 获取主从对象下拉框数据
+    this.relToType();
+    // 获取table列表
+    this.relManualQuery();
   }
 }
 </script>