Browse Source

Merge branch 'apiupdate' of git.sagacloud.cn:web/ibms into apiupdate-zy

zhangyu 5 years ago
parent
commit
2ed0187d04

+ 7 - 7
src/api/scan/request.js

@@ -896,7 +896,7 @@ export function deleteEquip(param, success) {
     http.postJson(url, param, success)
 }
 
-//设备清单 - 查询系统关联专业
+//设备清单 - 查询系统关联专业 - 查询系统信息 - 查询系统所属专业类型
 export function queryLinkSys(param, success) {
     let url = `${baseUrl}/datacenter/general—system/query`;
     http.postJson(url, param, success)
@@ -939,12 +939,6 @@ export function updateProperty(param, success) {
     http.postJson(url, param, success)
 }
 
-//查询系统信息
-export function queryGeneralSys(param, success) {
-    let url = `${baseUrl}/datacenter/general—system/query`;
-    http.postJson(url, param, success)
-}
-
 //更新系统信息
 export function updateGeneralSys(param, success) {
     let url = `${baseUrl}/datacenter/general—system/update`;
@@ -963,6 +957,12 @@ export function createGeneralSys(param, success) {
     http.postJson(url, param, success)
 }
 
+//根据条件查询统计数量
+export function countGeneralSys(param, success) {
+    let url = `${baseUrl}/datacenter/general—system/count`;
+    http.postJson(url, param, success)
+}
+
 //动态数据关联-冲突选择确认
 export function dynamicClashConfirm(param, success) {
     let url = `${baseUrl}/pointconfig/dynamic/clashconfirm`;

+ 8 - 10
src/components/ledger/handsontables/system.vue

@@ -34,7 +34,7 @@
     <!-- 新增系统 -->
     <el-dialog title="确定新增系统的类型" :visible.sync="myDialog.addDevice" width="30%">
       <el-row>
-        <my-cascader ref="cascader" @change="changeAddType"></my-cascader>
+        <my-cascader ref="cascader" @change="changeAddType" :all="true"></my-cascader>
       </el-row>
       <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="toAddDevice">下 一 步</el-button>
@@ -50,7 +50,7 @@ import {
   BeatchQueryParam,
   delBatchList,
   getDataDictionary,
-  queryGeneralSys,
+  queryLinkSys,
   updateGeneralSys,
   deleteGeneralSys
 } from "@/api/scan/request"
@@ -193,7 +193,7 @@ export default {
         } else if (this.mess.buildId && this.mess.buildId != "all") {
           param.Filters += `;buildingId='${this.mess.buildId}'`
         }
-        queryGeneralSys(param, res => {
+        queryLinkSys(param, res => {
           this.loading = false;
           _this.tableData = res.Content;
           _this.copyMain = tools.deepCopy(res.Content);
@@ -237,7 +237,7 @@ export default {
     },
     //下一步
     toAddDevice() {
-      if (this.addData.deviceId) {
+      if (this.addData.Category) {
         this.$router.push({
           path: "/system/addsystem",
           query: this.addData
@@ -246,10 +246,8 @@ export default {
     },
     //选择设备类型-添加设备
     changeAddType(val) {
-      console.log(1111111111)
-      console.log(val)
-      this.addData.deviceId = val.code;
-      this.addData.name = val.facility;
+      this.addData.Category = val.Category;
+      this.addData.CategoryName = val.CategoryName;
     },
     //格式化表头
     formatHeaderData(list) {
@@ -269,7 +267,7 @@ export default {
           readOnly: true
         },
         {
-          data: "count",
+          data: "Count",
           renderer: tools.num,
           readOnly: true
         }
@@ -496,7 +494,7 @@ export default {
           }
           break;
         //包含的部件字段
-        case 'count':
+        case 'Count':
           if (!this.onlyRead) {
             this.myDialog.relevance = true
           }

+ 43 - 69
src/components/ledger/lib/system.vue

@@ -1,54 +1,50 @@
 <template>
   <div id="cascaderMap">
     <span class="buildFloor" style="padding-right: 12px;">所属专业系统类型</span>
-    <el-cascader
-      placeholder="请选择"
-      :options="options"
-      v-model="value"
-      :props="props"
-      filterable
-      :style="isWidth ? '' : 'width:160px;'"
-      size="small"
-      @change="changeVal"
-      change-on-select
-    ></el-cascader>
+    <el-cascader placeholder="请选择" :options="options" v-model="value" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small"
+      @change="changeVal" change-on-select></el-cascader>
   </div>
 </template>
 <script>
-import {mapGetters} from 'vuex';
-import { getEqCode } from "@/api/scan/request";
+import { mapGetters } from 'vuex';
+import { queryLinkSys, getEqCode } from "@/api/scan/request";
 export default {
   name: "getCode",
   props: {
     isWidth: {
       type: Boolean,
       default: true
+    },
+    all:{
+      default:false
     }
   },
-        computed: {
-        ...mapGetters("layout", [
-            "projectId",
-        ])
+  computed: {
+    ...mapGetters("layout", ["projectId"])
   },
   data() {
     return {
       value: [],
       options: [],
       props: {
-        value: "code",
-        label: "facility"
-      },
-      falg: true,
-      content: []
+        value: "Category",
+        label: "CategoryName"
+      }
     };
   },
   created() {
-    this.getData();
+    if(this.all){
+      //物理世界所有系统
+      this.getAllData();
+    }else{
+      //当前项目下已有的系统
+      this.getData();
+    }
   },
-      watch: {
-      projectId() {
-          this.value = ['']
-      }
+  watch: {
+    projectId() {
+      this.value = ['']
+    }
   },
   methods: {
     setValue(val) {
@@ -58,7 +54,7 @@ export default {
     changeVal(val) {
       let value = {}
       this.options.map(item => {
-        if (item.code == val) {
+        if (item.Category == val) {
           value = item
         }
       })
@@ -66,58 +62,36 @@ export default {
       this.$emit("change", value)
     },
     getData() {
-      getEqCode().then(res => {
-        console.log(res.data)
-        this.options = this.changeArr(res.data.Content);
-        if (!!this.value && this.value.length) {
-          let value = {}
-          this.options.map(item => {
-            if (item.code == this.value[0]) {
-              value = item
-            }
-          })
-          this.$emit("change", value)
-        }
-        if (!this.falg) {
-          this.changeList()
+      let param = {
+        Distinct: true,
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "Category", "CategoryName"
+        ]
+      }
+      queryLinkSys(param, res => {
+        this.options = res.Content;
+        if (this.value) {
+          this.changeVal(this.value)
         }
-      });
+      })
+    },
+    getAllData(){
+      getEqCode().then(res => {
+        this.options = this.changeArr(res.data.Content)
+      })
     },
     changeArr(arr) {
       let data = [];
       arr.map(item => {
         if (item.content && item.content.length) {
           return item.content.map(children => {
-            data.push({ code: children.code, facility: children.system });
+            data.push({ Category: children.code, CategoryName: children.system });
           });
         }
       });
       return data;
-    },
-    //上级页面传入content
-    pushData(content) {
-      this.content = content
-      if (this.options.length) {
-        this.falg = true
-        this.changeList()
-      } else {
-        this.falg = false
-      }
-    },
-
-    //修改list
-    changeList() {
-      this.options = this.options.filter(item => {
-        if (this.content.indexOf(item.code) > -1) {
-          return item
-        }
-        // item.disabled = true
-        // this.content.map(child => {
-        //   if (item.code == child) {
-        //     item.disabled = false
-        //   }
-        // })
-      })
     }
   }
 };

+ 5 - 5
src/views/ledger/system/addsystem.vue

@@ -4,14 +4,14 @@
       <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
         <i class="el-icon-fa  el-icon-fa-compass"></i>
       </span>
-      <span style="float:left;">当前选择的系统类型:{{category.name}}</span>
+      <span style="float:left;">当前选择的系统类型:{{category.CategoryName}}</span>
       <div style="width:200px;display:inline-block;text-align:left;color:gray;">
         <span>隐藏自动填充的信息</span>
         <el-checkbox v-model="showTypeFlag" @change="getTableHeader"></el-checkbox>
       </div>
       <span>增加</span>
       <el-input v-model="addNum" style="width:40px;" size="small"></el-input>
-      <span>个{{category.name}}</span>
+      <span>个{{category.CategoryName}}</span>
       <el-button @click="handleAddTableRow">增加</el-button>
     </el-row>
     <div class="tableBox">
@@ -173,7 +173,7 @@ export default {
           PageNumber: 1,
           PageSize: 500
         },
-        type: this.category.deviceId
+        type: this.category.Category
       };
       await getDataDictionary(params, res => {
         this.tableHeader = res.Content;
@@ -208,7 +208,7 @@ export default {
         if (item.flowBuild) {
           item.BuildingId = item.flowBuild
         }
-        item.Category = this.category.deviceId
+        item.Category = this.category.Category
       })
       if (flag) {
         this.$message.info("存在系统的本地名称为空,请检查")
@@ -217,7 +217,7 @@ export default {
       createGeneralSys(newData, res => {
         this.$router.push({
           path: "/system/list",
-          query: { deviceId: this.category.deviceId }
+          query: { deviceId: this.category.Category }
         });
         session.remove("systemAddData")
       })

+ 15 - 68
src/views/ledger/system/index.vue

@@ -24,7 +24,7 @@ import {
   mapGetters,
   mapActions
 } from "vuex";
-import { getAllbusiness, getFamilyList, getSpaceName } from "@/api/scan/request"
+import { countGeneralSys, getSpaceName } from "@/api/scan/request"
 import Handsontable from "handsontable-pro"
 import 'handsontable-pro/dist/handsontable.full.css'
 import zhCN from 'handsontable-pro/languages/zh-CN';
@@ -63,7 +63,7 @@ export default {
   created() {
     this.param.ProjId = this.projectId
     this.param.secret = this.secret
-    this.getProjName()
+    this.countGeneralSys()
 
     let deviceId = this.$route.query.deviceId;
     if (deviceId) {
@@ -76,73 +76,27 @@ export default {
     projectId() {
       this.param.ProjId = this.projectId
       this.param.secret = this.secret
-      this.getProjName()
+      this.countGeneralSys()
     }
   },
   methods: {
-    getProjName() {
-      let param = {
-        list: [{ id: this.param.ProjId }],
-        perjectId: this.param.ProjId,
-        secret: this.param.secret,
-      }
-      getSpaceName(param).then(res => {
-        if (res.data.Result == "success") {
-          this.mess.perjectName = res.data.Content[0].infos.ProjLocalName
-          this.getAllbusiness()
-        } else {
-          this.$message.error("请求失败:" + res.data.ResultMsg)
-        }
-      }).catch(_ => {
-        this.$message.error("请求失败")
-      })
-    },
-    getFamilyList() {
-      let param = {
-        ProjId: this.param.ProjId,
-        secret: this.param.secret,
-        data: { type: "Sy" }
-      }
-      getFamilyList(param, res => {
-        if (this.$refs.cascader) {
-          this.$refs.cascader.pushData(res.Content)
-        }
-      })
-    },
     close(val) {
-      this.getProjName()
-      console.log(val)
-      if (!!val && !!val.code) {
+      this.countGeneralSys()
+      if (!!val && !!val.Category) {
         if (this.$refs.cascader)
-          this.$refs.cascader.changeVal([val.code])
+          this.$refs.cascader.changeVal([val.Category])
       }
+      this.$refs.cascader.getData()
     },
-
-    //获取header的list
-    getAllbusiness() {
-      let param = {
-        ProjId: this.param.ProjId,
-        secret: this.param.secret,
-        data: {
-          criteria: {
-            type: ["Sy"]
-          },
-          returnInfos: ["SystemID"]
-        }
-      }
-      getAllbusiness(param).then(res => {
-        if (res.data.Result == "success") {
-          this.mess.name[0].num = res.data.Count
-          this.getFamilyList()
-        } else {
-          this.$message.error("请求失败" + res.data.resultMsg)
-        }
-      }).catch(res => { this.$message.error("请求失败") })
+    //获取系统统计信息
+    countGeneralSys(){
+      let param = {}
+      countGeneralSys(param, res => {
+        this.mess.name[0].num = res.Count
+      })
     },
-
     //修改楼层
     changeFloor(value) {
-      console.log(this.param);
       if (value[0]) {
         this.param.buildId = value[0]
       }
@@ -154,22 +108,15 @@ export default {
       if (!!this.param.deviceId) {
         if (this.$refs.tableMain)
           this.$refs.tableMain.getHeaderData(this.param);
-      } else {
-        return;
       }
     },
-
     //修改设备族
     changeDevice(value) {
-      console.log(value)
-      this.param.deviceId = value.code
-      if (!!value) {
+      this.param.deviceId = value.Category
+      if (value) {
         if (this.$refs.tableMain)
           this.$refs.tableMain.getHeaderData(this.param);
-      } else {
-        return;
       }
-
     }
   }
 };