Pārlūkot izejas kodu

优化:无法打点问题

shaun-sheep 4 gadi atpakaļ
vecāks
revīzija
5538511268

+ 109 - 110
src/components/ledger/handsontables/device.vue

@@ -134,7 +134,7 @@
     </div>
 </template>
 <script>
-import {
+  import {
     BeatchQueryParam,
     deleteEquip,
     getDataDictionary,
@@ -143,62 +143,62 @@ import {
     queryEquip,
     queryUpdate,
     updateEquip,
-} from '@/api/scan/request'
+  } from '@/api/scan/request'
 
-import tools from '@/utils/scan/tools'
-import handsonUtils from '@/utils/hasontableUtils'
-import showTools from '@/utils/handsontable/notShow'
-import text from '@/utils/handsontable/mainText'
-import myCascader from '@/components/ledger/lib/cascader'
-import buildFloor from '@/utils/handsontable/buildFloorData'
+  import tools from '@/utils/scan/tools'
+  import handsonUtils from '@/utils/hasontableUtils'
+  import showTools from '@/utils/handsontable/notShow'
+  import text from '@/utils/handsontable/mainText'
+  import myCascader from '@/components/ledger/lib/cascader'
+  import buildFloor from '@/utils/handsontable/buildFloorData'
 
-import qrcode from '@/components/ledger/lib/qrcode'
-import bimDialog from '@/components/ledger/lib/bimDialog'
-import firm from '@/components/dialogs/list/firm'
-import supplyDialog from '@/components/dialogs/list/supplyDialog'
-import supplierDialog from '@/components/dialogs/list/supplierDialog'
-import maintainerDialog from '@/components/dialogs/list/maintainerDialog'
-import insurerDialog from '@/components/dialogs/list/insurerDialog'
-import guaranteeDialog from '@/components/dialogs/list/guaranteeDialog'
-import uploadFilesDialog from '@/components/dialogs/list/filesDialog'
-import uploadImgDialog from '@/components/dialogs/list/uploadImgDialog'
-import picDialog from '@/components/dialogs/list/picDialog'
-import batchDialog from '../../dialogs/list/batchDialog'
-import systemType from '@/components/dialogs/list/systemType'
-import myPagination from '@/components/ledger/lib/myPagination'
-import detailsDialog from '@/components/ledger/lib/detailsDia'
-import changeRea from '@/components/dialogs/changeRea'
-import { mapGetters } from 'vuex'
-//图片查看
-import lookPic from '@/components/ledger/lib/lookImages'
-import Handsontable from 'handsontable-pro'
-import 'handsontable-pro/dist/handsontable.full.css'
-import lStorage from '@/utils/localStorage'
-//下拉插件
-// import "@/assets/js/chosen.jquery.min";
-// import "@/assets/js/handsontable-chosen-editor";
+  import qrcode from '@/components/ledger/lib/qrcode'
+  import bimDialog from '@/components/ledger/lib/bimDialog'
+  import firm from '@/components/dialogs/list/firm'
+  import supplyDialog from '@/components/dialogs/list/supplyDialog'
+  import supplierDialog from '@/components/dialogs/list/supplierDialog'
+  import maintainerDialog from '@/components/dialogs/list/maintainerDialog'
+  import insurerDialog from '@/components/dialogs/list/insurerDialog'
+  import guaranteeDialog from '@/components/dialogs/list/guaranteeDialog'
+  import uploadFilesDialog from '@/components/dialogs/list/filesDialog'
+  import uploadImgDialog from '@/components/dialogs/list/uploadImgDialog'
+  import picDialog from '@/components/dialogs/list/picDialog'
+  import batchDialog from '../../dialogs/list/batchDialog'
+  import systemType from '@/components/dialogs/list/systemType'
+  import myPagination from '@/components/ledger/lib/myPagination'
+  import detailsDialog from '@/components/ledger/lib/detailsDia'
+  import changeRea from '@/components/dialogs/changeRea'
+  import {mapGetters} from 'vuex'
+  //图片查看
+  import lookPic from '@/components/ledger/lib/lookImages'
+  import Handsontable from 'handsontable-pro'
+  import 'handsontable-pro/dist/handsontable.full.css'
+  import lStorage from '@/utils/localStorage'
+  //下拉插件
+  // import "@/assets/js/chosen.jquery.min";
+  // import "@/assets/js/handsontable-chosen-editor";
 
-export default {
+  export default {
     props: ['myParam'],
     components: {
-        qrcode, //二维码页面
-        firm, //
-        supplyDialog,
-        supplierDialog,
-        guaranteeDialog,
-        uploadFilesDialog,
-        maintainerDialog,
-        insurerDialog,
-        uploadImgDialog,
-        picDialog,
-        myPagination,
-        systemType,
-        detailsDialog,
-        changeRea,
-        lookPic,
-        myCascader,
-        batchDialog,
-        bimDialog,
+      qrcode, //二维码页面
+      firm, //
+      supplyDialog,
+      supplierDialog,
+      guaranteeDialog,
+      uploadFilesDialog,
+      maintainerDialog,
+      insurerDialog,
+      uploadImgDialog,
+      picDialog,
+      myPagination,
+      systemType,
+      detailsDialog,
+      changeRea,
+      lookPic,
+      myCascader,
+      batchDialog,
+      bimDialog,
     },
     created() {
         buildFloor.getData(this.buildFloorData)
@@ -387,69 +387,68 @@ export default {
                     type: this.mess.deviceId,
                 }
                 getDataDictionary(params, (res) => {
-                    this.tableHeader = res.Content
-                    console.log(this.tableHeader)
-                    this.tableHeader.forEach((item) => {
-                        if (item.Path) {
-                            this.inputMap[item.Path] = item
-                        }
-                    })
-                    this.getTableData()
-                    this.getAllData()
-                    //  信息维护
-                    this.newEnclosure = res.Content.filter((i) => i.InputMode == 'F2')
+                  this.tableHeader = res.Content
+                  console.log(this.tableHeader)
+                  this.tableHeader.forEach((item) => {
+                    if (item.Path) {
+                      this.inputMap[item.Path] = item
+                    }
+                  })
+                  this.getTableData()
+                  this.getAllData()
+                  //  信息维护
+                  this.newEnclosure = res.Content.filter((i) => i.InputMode == 'F2')
                 })
             }
         },
-        //关闭弹窗
-        closeBIM() {
-            // let vm = this
-            this.myDialog.bimcode = false
-            // setTimeout(() => {
-            //     vm.getTableData()
-            //     vm.getAllData()
-            // }, 10)
-        },
-        //获取主体数据
-        getTableData() {
-            this.loading = true
-            //type存在发送请求
-            if (!!this.mess.deviceId) {
-                let param = {
-                    PageSize: this.page.size,
-                    Orders: 'createTime desc,EquipID desc,EquipLocalID desc,EquipLocalName desc',
-                    PageNumber: this.page.currentPage,
-                    Filters: `category='${this.mess.deviceId}'`,
-                }
+      //关闭弹窗
+      closeBIM(val) {
+        this.myDialog.bimcode = false
+        if (val) {
+          this.getTableData()
+          this.getAllData()
+        }
+      },
+      //获取主体数据
+      getTableData() {
+        this.loading = true
+        //type存在发送请求
+        if (!!this.mess.deviceId) {
+          let param = {
+            PageSize: this.page.size,
+            Orders: 'createTime desc,EquipID desc,EquipLocalID desc,EquipLocalName desc',
+            PageNumber: this.page.currentPage,
+            Filters: `category='${this.mess.deviceId}'`,
+          }
 
-                if (this.mess.buildId == 'noKnow') {
-                    param.Filters += `;buildingId isNull`
-                } else if (this.mess.buildId && this.mess.buildId != 'all') {
-                    param.Filters += `;buildingId='${this.mess.buildId}'`
-                }
+          if (this.mess.buildId == 'noKnow') {
+            param.Filters += `;buildingId isNull`
+          } else if (this.mess.buildId && this.mess.buildId != 'all') {
+            param.Filters += `;buildingId='${this.mess.buildId}'`
+          }
 
-                if (this.mess.floorId == 'noKnow') {
-                    param.Filters += `;floorId isNull`
-                } else if (this.mess.floorId && this.mess.floorId != 'all') {
-                    param.Filters += `;floorId='${this.mess.floorId}'`
-                }
-                getEquipTableCon(param, (res) => {
-                    this.loading = false
-                    this.showParts = res.Message == '1' ? true : false // 判断是否显示包含的部件列
-                    this.tableData = res.Content.map((item) => {
-                        if (item.hasOwnProperty('BuildingId') && item.hasOwnProperty('FloorId')) {
-                            item.flowBuild = item.BuildingId + '-' + item.FloorId
-                        } else if (item.hasOwnProperty('BuildingId') && !item.hasOwnProperty('FloorId')) {
-                            item.flowBuild = item.BuildingId
-                        }
-                        return item
-                    })
-                    this.copyMain = tools.deepCopy(this.tableData)
-                    this.page.total = res.Total
-                    if (this.tableData && this.tableData.length) {
-                        if (this.onlyRead) {
-                            this.getBatch(this.tableData)
-                        }
+          if (this.mess.floorId == 'noKnow') {
+            param.Filters += `;floorId isNull`
+          } else if (this.mess.floorId && this.mess.floorId != 'all') {
+            param.Filters += `;floorId='${this.mess.floorId}'`
+          }
+          getEquipTableCon(param, (res) => {
+            this.loading = false
+            this.showParts = res.Message == '1' ? true : false // 判断是否显示包含的部件列
+            this.tableData = res.Content.map((item) => {
+              if (item.hasOwnProperty('BuildingId') && item.hasOwnProperty('FloorId')) {
+                item.flowBuild = item.BuildingId + '-' + item.FloorId
+              } else if (item.hasOwnProperty('BuildingId') && !item.hasOwnProperty('FloorId')) {
+                item.flowBuild = item.BuildingId
+              }
+              return item
+            })
+            this.copyMain = tools.deepCopy(this.tableData)
+            this.page.total = res.Total
+            if (this.tableData && this.tableData.length) {
+              if (this.onlyRead) {
+                this.getBatch(this.tableData)
+              }
                         this.initTable()
                     }
                 })

+ 93 - 87
src/components/ledger/lib/bimDialog.vue

@@ -118,33 +118,35 @@
         },
         // 获取底图成功
         getGraphtSuc(res) {
-            this.canvasLoading = false
-            if (res == 'error') {
-                this.FloorMap = ''
-                this.$message.warning('数据解析异常')
-                return
-            }
-            if (res.Result == 'failure') {
-                this.showTools = false
-                this.$message.warning(res.Message)
-                return
-            }
-            this.view.scene = this.drawMainScene
+          this.canvasLoading = false
+          if (res == 'error') {
+            this.FloorMap = ''
+            this.$message.warning('数据解析异常')
+            return
+          }
+          if (res.Result == 'failure') {
+            this.showTools = false
+            this.$message.warning(res.Message)
+            return
+          }
+          this.view.scene = this.drawMainScene
+          if (this.bimcodeobj.LocationJson) {
             let obj = {
-                X: this.bimcodeobj.LocationJson.X,
-                Y: -this.bimcodeobj.LocationJson.Y,
+              X: this.bimcodeobj.LocationJson.X,
+              Y: -this.bimcodeobj.LocationJson.Y,
             }
             //回写编辑
             this.drawMainScene.addMarker(obj)
-            this.view.fitSceneToView()
-            this.drawMainScene.isSpaceSelectable = false
-            this.drawMainScene.spaceClick(this, this.canvasClick)
-            if (this.floorData.Outline && this.floorData.Outline.length) {
-                let newArr = this.floorData.Outline.map((t) => {
-                    return new SPoint(t.X, t.Y)
-                })
-                this.drawMainScene.addSceneMark(newArr)
-            }
+          }
+          this.view.fitSceneToView()
+          this.drawMainScene.isSpaceSelectable = false
+          this.drawMainScene.spaceClick(this, this.canvasClick) //锚点触发
+          if (this.floorData.Outline && this.floorData.Outline.length) {
+            let newArr = this.floorData.Outline.map((t) => {
+              return new SPoint(t.X, t.Y)
+            })
+            this.drawMainScene.addSceneMark(newArr)
+          }
         },
         //获取楼层数据
         getFloorData() {
@@ -153,77 +155,81 @@
                 this.isdata = true
                 let floorMap = this.floorData.StructureInfo.FloorMap
                 if (floorMap.split('.')[1].toString() == 'png' || floorMap.split('.')[1].toString() == 'jpg') {
-                    this.initGraphy(floorMap, 3)
+                  this.initGraphy(floorMap, 3)
                 } else {
-                    this.initGraphy(floorMap, 2)
+                  this.initGraphy(floorMap, 2)
                 }
             } else {
-                //暂无数据
-                this.isdata = false
-                this.clearGraphy()
-            }
-        },
-        //关闭弹窗
-        handleClose() {
-            this.view = ''
-            this.drawMainScene = ''
-            this.$emit('closeBIM')
-        },
-        //保存事件
-        save() {
-            if (this.drawMainScene) {
-                if (this.drawMainScene.markerList.length) {
-                    let obj = this.drawMainScene.markerList[0]
-                    console.log(obj)
-                    let param = {
-                        Content: [
-                            {
-                                EquipID: this.bimcodeobj.EquipID,
-                                BuildingId: this.Buildfloor[0],
-                                FloorId: this.Buildfloor[1],
-                                BIMLocation: `${obj.x.toFixed(2)},${(obj.y * -1).toFixed(2)},${this.bimcodeobj.BIMLocation.split(',')[2]}`,
-                            },
-                        ],
-                        Projection: ['BIMLocation', 'BuildingId', 'FloorId'],
-                    }
-                    updateEquip(param, (res) => {
-                        console.log(res)
-                        if (res.Result == 'success') {
-                            this.$message.success('保存成功')
-                            this.handleClose()
-                        }
-                    })
-                }
+              //暂无数据
+              this.isdata = false
+              this.clearGraphy()
             }
         },
-        // 清空平面图
-        clearGraphy() {
-            if (this.view) {
-                this.view.scene = null
-                return
+      //关闭弹窗
+      handleClose(val) {
+        this.view = ''
+        this.drawMainScene = ''
+        this.$emit('closeBIM', val)
+      },
+      //保存事件
+      save() {
+        if (this.drawMainScene) {
+          if (this.drawMainScene.markerList.length) {
+            let obj = this.drawMainScene.markerList[0], BIMLocation;
+
+            if (this.bimcodeobj.BIMLocation.split(',')[2]) {
+              BIMLocation = `${obj.x.toFixed(2)},${(obj.y * -1).toFixed(2)},${this.bimcodeobj.BIMLocation.split(',')[2]}`
+            } else {
+              BIMLocation = `${obj.x.toFixed(2)},${(obj.y * -1).toFixed(2)},0`
             }
-            let id = `floorCanvas${this.id}`
-            this.view = new FloorView(id)
-        },
-        //得到floormap
-        getFloorMap(val) {
-            this.floorToMap = val
-            this.floorData = this.floorToMap[this.bimcodeobj.FloorId]
-            this.getFloorData()
-        },
-        // canvas点击事件
-        canvasClick(item, event) {
-            if (item instanceof SGraphyItem) {
-                this.clearMark()
-                let obj = {
-                    X: event[0].x,
-                    Y: event[0].y,
-                }
-              this.drawMainScene.addMarker(obj)
-              this.view.fitSceneToView()
+            let param = {
+              Content: [
+                {
+                  EquipID: this.bimcodeobj.EquipID,
+                  BuildingId: this.Buildfloor[0],
+                  FloorId: this.Buildfloor[1],
+                  BIMLocation
+                },
+              ],
+              Projection: ['BIMLocation', 'BuildingId', 'FloorId'],
             }
-        },
-        //清空标记
+            updateEquip(param, (res) => {
+              if (res.Result == 'success') {
+                this.$message.success('保存成功')
+                this.handleClose('update')
+              }
+            })
+          }
+        }
+      },
+      // 清空平面图
+      clearGraphy() {
+        if (this.view) {
+          this.view.scene = null
+          return
+        }
+        let id = `floorCanvas${this.id}`
+        this.view = new FloorView(id)
+      },
+      //得到floormap
+      getFloorMap(val) {
+        this.floorToMap = val
+        this.floorData = this.floorToMap[this.bimcodeobj.FloorId]
+        this.getFloorData()
+      },
+      // canvas点击事件
+      canvasClick(item, event) {
+        if (item instanceof SGraphyItem) {
+          this.clearMark()
+          let obj = {
+            X: event[0].x,
+            Y: event[0].y,
+          }
+          this.drawMainScene.addMarker(obj)
+          this.view.fitSceneToView()
+        }
+      },
+      //清空标记
         clearMark() {
             if (this.drawMainScene) {
                 this.drawMainScene.markerList.forEach((t) => {