| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <template>
- <div class="main-box">
- <div class="saga-build-mess">
- <el-button @click="queryZone">导入业务空间BIMLocation</el-button>
- </div>
- </div>
- </template>
- <script>
- import {
- queryZone,
- updateZone,
- } from "@/api/scan/request";
- import { mapGetters } from "vuex";
- import pako from '@/assets/pako/pako'
- import axios from "axios";
- export default {
- data() {
- return {
- options: [],
- tabsList: [
- {
- "Code": "GeneralZone",
- "Name": "默认分区",
- "Rel_type": "99"
- },
- {
- "Name": "供电分区",
- "Rel_type": "1",
- "Code": "PowerSupplyZone"
- },
- {
- "Name": "照明分区",
- "Rel_type": "2",
- "Code": "LightingZone"
- },
- {
- "Name": "网络分区",
- "Rel_type": "3",
- "Code": "NetworkZone"
- },
- {
- "Code": "AirConditioningZone",
- "Name": "空调分区",
- "Rel_type": "4"
- },
- {
- "Name": "采暖分区",
- "Rel_type": "5",
- "Code": "HeatingZone"
- },
- {
- "Name": "洁净分区",
- "Rel_type": "6",
- "Code": "CleanZone"
- },
- {
- "Name": "生活给水分区",
- "Rel_type": "7",
- "Code": "DomesticWaterSupplyZone"
- },
- {
- "Code": "FireZone",
- "Name": "防火分区",
- "Rel_type": "8"
- },
- {
- "Name": "安防分区",
- "Rel_type": "9",
- "Code": "SecurityZone"
- },
- {
- "Name": "租户分区",
- "Rel_type": "10",
- "Code": "TenantZone"
- },
- {
- "Name": '功能分区',
- 'Rel_type': '11',
- "Code": 'FunctionZone'
- }
- ],
- }
- },
- computed: {
- ...mapGetters('layout', ['projectId', 'userId', 'secret'])
- },
- methods: {
- init() { },
- // 查询该项目下所有的业务空间
- queryZone() {
- this.tabsList.map(t => {
- this.getZone(t.Code, 1, t.Name);
- })
- },
- getZone(Code, PageNumber, Name) {
- let pa = {
- data: {
- PageNumber: PageNumber,
- PageSize: 1000,
- Orders: 'RoomID asc'
- },
- zone: Code
- }
- queryZone(pa, res => {
- if (res.Total > PageNumber * 1000) {
- let num = PageNumber + 1
- console.log(num)
- this.getZone(Code, num, Name)
- }
- let params = {
- data: {
- Content: [],
- Projection: ["BIMLocation"]
- },
- zone: Code
- }
- res.Content.map(t => {
- if (t.Outline && t.Outline[0]) {
- t.BIMLocation = this.getAverageVal(t.Outline);
- let obj = {
- RoomID: t.RoomID,
- BIMLocation: t.BIMLocation
- }
- params.data.Content.push(obj);
- }
- });
- if (params.data.Content.length) {
- updateZone(params, res => {
- console.log(`${this.projectId},${Name},${params.data.Content.length}条更新完成`);
- })
- }
- })
- },
- getAverageVal(Outline) {
- let X = 0, Y = 0, Z = 0, len = 0;
- Outline.map(t => {
- if (t[0]) {
- t[0].map(item => {
- X += item.X;
- Y += item.Y;
- Z += item.Z;
- })
- len += t[0].length
- }
- })
- X = (X / len).toFixed(2);
- Y = (Y / len).toFixed(2);
- Z = (Z / len).toFixed(2);
- return `${X},${Y},${Z}`
- },
- },
- created() {
- this.init()
- },
- watch: {
- projectId() {
- this.init()
- }
- }
- }
- </script>
|