Kaynağa Gözat

替换资产新接口

zhangyu 5 yıl önce
ebeveyn
işleme
7e4cdeef62

+ 17 - 18
src/components/ledger/handsontables/assets.vue

@@ -49,7 +49,7 @@
   </div>
 </template>
 <script>
-import { getDataDictionary, queryProperty, updateProperty, upDateTableMain, delProperty, getEquipmentFamily } from "@/api/scan/request";
+import { getDataDictionary, queryProperty, updateProperty, deleteProperty, upDateTableMain, delProperty, getEquipmentFamily } from "@/api/scan/request";
 
 import tools from "@/utils/scan/tools"
 import handsonUtils from "@/utils/scan/hasontableUtils"
@@ -183,7 +183,6 @@ export default {
     },
     //获取主体数据
     getTableData() {
-      let _this = this
       this.loading = true
       //type存在发送请求
       if (!!this.mess.deviceId) {
@@ -205,19 +204,19 @@ export default {
           param.Filters += `;floorId='${this.mess.floorId}'`
         }
         queryProperty(param, res => {
-          this.loading = false;
-          _this.tableData = res.Content;
-          _this.copyMain = tools.deepCopy(res.Content);
-          _this.page.total = res.Total;
-          if (_this.hot) {
-            _this.hot.destroy();
-            _this.hot = null;
+          this.loading = false
+          this.tableData = res.Content
+          this.copyMain = tools.deepCopy(res.Content)
+          this.page.total = res.Total
+          if (this.hot) {
+            this.hot.destroy()
+            this.hot = null
           }
           if (res.Content && res.Content.length) {
             if (this.onlyRead) {
               this.getBatch(res.Content)
             }
-            _this.initTable();
+            this.initTable();
           }
         })
       }
@@ -325,14 +324,14 @@ export default {
     //格式化表头
     formatHeaderData(list) {
       let arr = tools.copyArr(list)
-      let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, this.showType, true)
+      let data = showTools.headerTextFilter(arr, 'property', this.onlyRead, this.showType, true)
       data.unshift("操作", "当前关联的设备")
       return data
     },
     //格式化表内容
     formatHeaderType(list) {
       let arr = tools.copyArr(list)
-      let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, this.showType, true)
+      let data = showTools.headerTypeFilter(arr, 'property', this.onlyRead, this.showType, true)
       data.unshift(
         {
           data: "caozuo",
@@ -350,7 +349,7 @@ export default {
       let winHeight = document.documentElement.clientHeight;
       this.hot = new Handsontable(container, {
         data: this.tableData,
-        fixedColumnsLeft: 6,
+        fixedColumnsLeft: 4,
         colHeaders: this.formatHeaderData(this.tableHeader), //表头文案
         columns: this.formatHeaderType(this.tableHeader), //数据显示格式
         filters: true,
@@ -462,7 +461,7 @@ export default {
     },
     // 删除资产
     async removeDevice(param) {
-      await deleteEquip(param, res => {
+      await deleteProperty(param, res => {
         this.$message.success("删除成功")
         this.$emit('close','')
         this.getTableData()
@@ -775,7 +774,7 @@ export default {
 <style lang="less">
 .hanson-bar {
   height: 40px;
-  padding: 5px 10px;
+  padding: 5px 0;
   font-size: 14px;
   overflow: hidden;
   margin-top: 0;
@@ -783,8 +782,8 @@ export default {
   .iconfont {
     font-size: 12px;
   }
-  // .el-button {
-    // margin-right: 10px;
-  // }
+}
+.cancelButtonClass {
+  width: 180px;
 }
 </style>

+ 1 - 1
src/components/ledger/lib/assets.vue

@@ -108,7 +108,7 @@ export default {
     },
     changeList() {
       this.options = this.options.filter(item => {
-        if (this.content.indexOf(item.code) > -1) {
+        if (this.content.find(value => value.Family == item.code)) {
           return item
         }
         // item.disabled = true

+ 42 - 27
src/components/ledger/lib/floorCascader.vue

@@ -54,12 +54,26 @@
         },
         methods: {
             //获取数据
-            async getData() {
-                let data, params = {
+            getData() {
+                let data, buildParams = {
                     PageNumber: 1,
-                    PageSize: 500
+                    PageSize: 500,
+                    Projection: [
+                        "BuildID",
+                        "BuildLocalName"
+                    ]
+                }, floorParams = {
+                    Orders: "FloorSequenceID desc",
+                    PageNumber: 1,
+                    PageSize: 500,
+                    Projection: [
+                        "BuildID",
+                        "FloorID",
+                        "FloorLocalName",
+                        "FloorSequenceID"
+                    ]
                 }
-                await buildingQuery(params, res => {
+                buildingQuery(buildParams, res => {
                     let builData = res.Content
                     data = builData.map(build => {
                         return {
@@ -74,32 +88,33 @@
                         value: "noKnow",
                         label: "未明确建筑的设备"
                     })
-                })
-                await floorQuery(params, res => {
-                    let floorData = tools.sortArr(res.Content, "FloorSequenceID", false) //对楼层排序
-                    data.forEach(build => {
-                        floorData.forEach(floor => {
-                            if (build.value == floor.BuildID && this.type == "yes") {
-                                if (build.children) {
-                                    build.children.push({
-                                        value: floor.FloorID,
-                                        label: floor.FloorLocalName,
-                                        FloorSequenceID: floor.FloorSequenceID
-                                    })
-                                } else {
-                                    build.children = []
-                                    build.children.push({
-                                        value: "all",
-                                        label: "全部"
-                                    },{
-                                        value: 'noKnow',
-                                        label: "未明确楼层的设备"
-                                    })
+                    floorQuery(floorParams, res => {
+                        // let floorData = tools.sortArr(res.Content, "FloorSequenceID", false) //对楼层排序
+                        let floorData = res.Content
+                        data.forEach(build => {
+                            floorData.forEach(floor => {
+                                if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
+                                    if (build.children) {
+                                        build.children.push({
+                                            value: floor.FloorID,
+                                            label: floor.FloorLocalName,
+                                            FloorSequenceID: floor.FloorSequenceID
+                                        })
+                                    } else {
+                                        build.children = []
+                                        build.children.push({
+                                            value: "all",
+                                            label: "全部"
+                                        },{
+                                            value: 'noKnow',
+                                            label: "未明确楼层的设备"
+                                        })
+                                    }
                                 }
-                            }
+                            })
                         })
+                        this.options = data
                     })
-                    this.options = data
                 })
             },
             //改变item

+ 3 - 1
src/utils/handsontable/fillterField.js

@@ -28,7 +28,9 @@ const data = {
     ]
   },
   property:{ //资产
-    onlyRead: [],
+    onlyRead: [
+      "BIMID"
+    ],
     edit: [
       "EquipID",
       "EquipName",

+ 6 - 0
src/utils/handsontable/notShow.js

@@ -879,6 +879,9 @@ const showTools = {
     headerTextFilter (arr, type, onlyRead, showType, taizhang = false) {
         let data = arr.map(item => {
             if (onlyRead) { //只读模式
+                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                    return undefined
+                }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
                     return showTools.isUnit(item)
                 } else if (showType == "all") { //显示全部
@@ -915,6 +918,9 @@ const showTools = {
     headerTypeFilter (arr, type, onlyRead, showType, taizhang = false) {
         let data = arr.map(item => {
             if (onlyRead) { //只读模式
+                if (!showTools.filterUnshow(onlyRead, type, item.InfoPointCode)) { //过滤固定不显示字段
+                    return undefined
+                }
                 if (showType == "Visible" && item.Visible) { //只看要采集的信息
                     return showTools.textFormat(item, onlyRead)
                 } else if (showType == "all") { //显示全部

+ 8 - 5
src/views/ledger/property/index.vue

@@ -21,7 +21,7 @@ import {
     mapGetters,
     mapActions
 } from "vuex";
-import { getNumber, getFamilyList, getSpaceName } from "@/api/scan/request"
+import { getNumber, queryProperty, getSpaceName } from "@/api/scan/request"
 import "./../index.scss"
 export default {
   components: {
@@ -95,11 +95,14 @@ export default {
     },
     getFamilyList() {
       let param = {
-        ProjId: this.param.ProjId,
-        secret: this.param.secret,
-        data: { type: "Pe" }
+        Distinct: true,
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "Family"
+        ]
       }
-      getFamilyList(param, res => {
+      queryProperty(param, res => {
         if (this.$refs.cascader) {
               this.$refs.cascader.pushData(res.Content)
           }