Browse Source

replace scan report datacenter interface

haojianlong 5 years ago
parent
commit
022ebc9e4b

+ 24 - 48
src/views/data_admin/buildAssets/Station.vue

@@ -13,9 +13,9 @@
 
 <script>
 import {
-    createPost, //新建岗位
-    upDateTableMain, //关联资产
-    createComponent //新建岗位(部件)
+    createEquip, //数据中心创建设备
+    createPart, //数据中心创建部件
+    updateProperty, //数据中心更新资产
 } from '@/api/scan/request'
 import { mapGetters } from 'vuex'
 export default {
@@ -43,35 +43,22 @@ export default {
         },
         save() {
             if (this.value) {
-                let param = {
-                    BuildId: this.itemObj.BuildId,
-                    category: this.value,
-                    secret: this.secret,
-                    perjectId: this.projectId,
-                    BIMID: this.itemObj.FloorId,
-                    BIMLocation: (this.itemObj.X || 0) + ',' + (this.itemObj.Y || 0) + ',' + (this.itemObj.Z || 0)
+                let pa = {
+                    Content:[{
+                        BuildingId: this.itemObj.BuildingId,
+                        Category: this.value,
+                        BIMID: this.itemObj.BIMID || '',
+                        BIMLocation: this.itemObj.BIMLocation || '',
+                        FloorId: this.itemObj.FloorId || ''
+                    }]
                 }
-                if (param.category.length == 6) {
-                    createComponent(param).then(res => {
-                        if (res.data.Result == 'success') {
-                            this.upDateTableMain(res.data.id)
-                        } else {
-                            this.$message({
-                                message: res.data.ResultMsg,
-                                type: 'warning'
-                            })
-                        }
+                if (pa.Content[0].Category.length == 6) {
+                    createPart(pa, res => {
+                        this.upDateTableMain(res.EntityList[0].EquipID)
                     })
                 } else {
-                    createPost(param).then(res => {
-                        if (res.data.Result == 'success') {
-                            this.upDateTableMain(res.data.id)
-                        } else {
-                            this.$message({
-                                message: res.data.ResultMsg,
-                                type: 'warning'
-                            })
-                        }
+                    createEquip(pa, res => {
+                        this.upDateTableMain(res.EntityList[0].EquipID)
                     })
                 }
             } else {
@@ -83,25 +70,14 @@ export default {
         },
         //关联资产
         upDateTableMain(id) {
-            let param = {
-                    ProjId: this.projectId,
-                    UserId: this.userId
-                },
-                paramList = {}
-            paramList.EquipmentId = id
-            paramList.FmId = this.itemObj.FmId
-            paramList.Family = this.itemObj.Family
-            upDateTableMain(param, [paramList]).then(res => {
-                if (res.data.Result == 'success') {
-                    this.$message({
-                        message: '保存成功',
-                        type: 'success'
-                    })
-                    this.dialogVisible = false
-                    this.$emit('refresh')
-                } else {
-                    this.$message.error('请求失败')
-                }
+            let pa = {
+                Content:[this.itemObj]
+            };
+            let that = this
+            pa.Content[0].EquipmentId = id
+            updateProperty(pa, res => {
+                that.dialogVisible = false;
+                that.$emit('refresh')
             })
         }
     },

+ 5 - 2
src/views/data_admin/buildAssets/assetsList.vue

@@ -143,6 +143,7 @@ export default {
     //获取列表
     getTableData() {
       if (this.buildingId) {
+        this.loading = true
         this.tableData = []
         let param = {
           Filters: `BuildingId='${this.buildingId}';${this.filter[this.active]}`,
@@ -150,7 +151,6 @@ export default {
           PageNumber: this.page.pageNumber,
           PageSize: this.page.pageSize
         }
-        this.loading = true
         queryProperty(param, res => {
           this.tableData = res.Content
           this.page.total = res.Total
@@ -215,7 +215,10 @@ export default {
       return this.allFamilyObj[family]
     },
     //刷新
-    refresh() { },
+    refresh() {
+      this.page.pageNumber = 1;
+      this.getTableData()
+     },
     //添加岗位
     add(row) {
       this.options = this.alloptions[row.Family]