Browse Source

合并冲突

YaolongHan 3 years ago
parent
commit
4cf809ab47

+ 22 - 17
public/index.html

@@ -7,31 +7,36 @@
     <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <link rel="stylesheet" href="//at.alicdn.com/t/font_2327510_7jj0x1gmztq.css"/>
+    <meta http-equiv="Cache" content="no-cache">
+    <meta http-equiv="Pragma" content="no-cache"/>
+    <meta http-equiv="Expires" content="0"/>
     <title><%= htmlWebpackPlugin.options.title %></title>
 </head>
 <body>
 <noscript>
-  <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
-    Please enable it to continue.</strong>
+    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
+        Please enable it to continue.</strong>
 </noscript>
 <div id="app"></div>
 <!-- built files will be auto injected -->
 </body>
 <style>
-  html {
-    height: 100%;
-  }
-  ::-webkit-scrollbar {
-      width: 8px;
-      height: 8px;
-  }
-  ::-webkit-scrollbar-thumb {
-      height: 50px;
-      outline-offset: -2px;
-      outline: 2px solid #dddee0;
-      border: 2px solid #dddee0;
-      background-color: #dddee0;
-      border-radius: 4px;
-  }
+    html {
+        height: 100%;
+    }
+
+    ::-webkit-scrollbar {
+        width: 8px;
+        height: 8px;
+    }
+
+    ::-webkit-scrollbar-thumb {
+        height: 50px;
+        outline-offset: -2px;
+        outline: 2px solid #dddee0;
+        border: 2px solid #dddee0;
+        background-color: #dddee0;
+        border-radius: 4px;
+    }
 </style>
 </html>

+ 105 - 2
src/utils/graph/DivideFloorScene.ts

@@ -7,12 +7,13 @@ import { ShadeItem } from "./ShadeItem";
 // @ts-ignore
 import { intersect, polygon, segments, combine, selectIntersect, selectUnion, selectDifference, selectDifferenceRev, difference } from "polybooljs";
 import { DrawZoneItem } from "./DrawZoneItem";
-import { SItemStatus } from "@persagy-web/big/lib";
+import { SItemStatus, unzip } from "@persagy-web/big/lib";
 import { Wall } from "@persagy-web/big/lib/types/floor/Wall";
 import { CustomWall } from "./CustomWall";
 import { SGraphItem, SGraphStyleItem } from "@persagy-web/graph/lib";
-import { remove } from "js-cookie";
 import { SWallItem } from "@persagy-web/big/lib/items/floor/SWallItem";
+// @ts-ignore
+import pako from "pako";
 
 export class DivideFloorScene extends FloorScene {
     /** 划分item  */
@@ -561,4 +562,106 @@ export class DivideFloorScene extends FloorScene {
     clearCmdStatus() {
         this.drawCmd = ''
     }
+
+    /**
+     * 生成txt文件流
+     * 
+     * @param fName 文件名
+    */
+    generateFile(fName: string) {
+        if (this.json) {
+            // const zip = new JSZip();
+            // // // // // // 名称-文件内容
+            // zip.file(fName, this.json)
+            // // console.log(zip);
+            // zip.generateAsync({ type: "blob", compression: "DEFLATE" }).then(blob => {
+            //     // console.log(blob);
+            //     unzip(blob);
+            //     // this.upload('testmap4.jsonz', blob)
+            //     // let url = URL.createObjectURL(blob);
+            //     // SNetUtil.downLoad('12312312', url);
+            //     let xxx = new JSZip()
+            //     xxx.loadAsync(blob).then(res => {
+            //         // console.log(res.files)
+            //         // for(let i in res.files) {
+            //         //     console.log(res.files[i]);
+            //         //     res.files[i].async('nodebuffer').then(con => {
+            //         //         console.log(con);
+
+            //         //     })
+            //         // }
+            //         xxx.file('1').async("string").then(resp => {
+            //             // console.log(resp)
+            //         })
+            //     });
+            // }, err => {
+            //     console.log(err)
+            // });
+            //
+            const json = this.getMapObject()
+            // 生成压缩的字符串
+            const bl = this.zip(json);
+            // const blob = new File([bl], '1')
+            // 生成blob对象
+            const blob = new Blob([bl], { type: 'application/octet-stream' })
+            // let url = URL.createObjectURL(new Blob([bl]))
+            // SNetUtil.downLoad('12312312', url)
+            // 测试能否正常解压
+            // unzip(blob);
+            // console.log(blob)
+            // const file = new File([bl], '111')
+            this.upload(fName, blob)
+        }
+    }
+
+    /**
+     * 上传
+     * 
+     * @param key 当前显示的楼层平面图的key
+     * @param blob 上传的blob对象
+    */
+    upload(key: string, blob: Blob) {
+        let reader = new FileReader();
+        reader.onloadstart = function () {
+            // 这个事件在读取开始时触发
+            console.log('start');
+        };
+        reader.onprogress = function (p) {
+            // 这个事件在读取进行中定时触发
+            console.log('onprogress--------', p);
+        };
+        reader.onload = function () {
+            // 这个事件在读取成功结束后触发
+            console.log('onload');
+        };
+        reader.onloadend = function () {
+            var xhr = new XMLHttpRequest();
+            xhr.open(
+                "POST",
+                `/image-service/common/file_upload?systemId=revit&secret=63afbef6906c342b&overwrite=true&key=${key}`
+            );
+            xhr.send(reader.result);
+            xhr.onreadystatechange = function () {
+                if (xhr.readyState == 4) {
+                    console.log(xhr)
+                    if (xhr.status == 200) {
+                        console.log(324234);
+                    } else {
+                    }
+                }
+            };
+        }
+        reader.readAsArrayBuffer(blob);
+    }
+
+    /**
+     * 压缩文件
+     * 
+     * @param str 要压缩的字符串
+     */
+    zip(str: string): string {
+        var binaryString = pako.deflate(str)
+        // var binaryString = pako.gzip(escape(str), { to: 'string' });
+        return binaryString;
+    }
 }

+ 9 - 9
src/views/maintain/relationship/components/tableHeader.ts

@@ -1,12 +1,12 @@
 const tableHeader = {
-    '设备所在建筑': [['建筑', 'objectInfo-localName'], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
-    '设备所在楼层': [['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
-    '设备所在功能空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
-    '设备服务功能空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
-    '设备所在供电空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
-    '空间所在建筑': [['建筑', 'objectInfo-localName'], ['空间本地名称', "localName"], ['空间本地编码', "localId"], ['楼层','floorName']],
-    '空间所在楼层': [['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['空间本地名称', "localName"], ['空间本地编码', "localId"]],
-    '空间服务空间': [['空间本地名称', "localName"], ['空间本地编码', "localId"], ['建筑', 'objectInfo-localName'], ['楼层','floorName'], ['空间本地名称', "localName"], ['空间本地编码', "localId"], ['楼层','floorName']],
-    '系统下的设备': [['系统分类','systemCategory'], ['系统名称',''], ['系统编码',''], ['BIM构件名称', 'bimTypeId'], ['系统分类','systemCategory'], ['设备类型名称','codeName'], ['设备本地编码', "localId"]],
+    '设备所在建筑': [['建筑', 'objectInfo-localName'], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
+    '设备所在楼层': [['建筑', 'objectInfo-buildingName'], ['楼层', 'objectInfo-localName'], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
+    '设备所在功能空间': [['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"], ['建筑', 'objectInfo-localName'], ['楼层', 'objectInfo-floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
+    '设备服务功能空间': [['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"], ['建筑', 'objectInfo-localName'], ['楼层', 'objectInfo-floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
+    '设备所在供电空间': [['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"], ['建筑', 'objectInfo-localName'], ['楼层', 'objectInfo-floorName'], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
+    '空间所在建筑': [['建筑', 'localName'], ['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"], ['楼层', 'objectInfo-floorName']],
+    '空间所在楼层': [['建筑', 'buildingName'], ['楼层', 'localName'], ['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"]],
+    '空间服务空间': [['空间本地名称', "buildingName"], ['空间本地编码', "localId"], ['建筑', 'buildingName'], ['楼层', 'floorName'], ['空间本地名称', "objectInfo-localName"], ['空间本地编码', "objectInfo-localId"], ['楼层', 'objectInfo-floorName']],
+    '系统下的设备': [['系统分类', 'systemCategory'], ['系统名称', ''], ['系统编码', ''], ['BIM构件名称', 'bimTypeId'], ['系统分类', 'systemCategory'], ['设备类型名称', 'codeName'], ['设备本地编码', "localId"]],
 }
 export default tableHeader

+ 1 - 1
src/views/maintain/relationship/relation/index.vue

@@ -265,7 +265,7 @@ export default class extends Vue {
     }
 
     //下拉框数据去重
-    dataReduce(arr: []) {
+    dataReduce(arr: []): [] {
         let obj = {}, setArr = []
         setArr = arr.reduce((item, next) => {
             obj[next.classCode] ? '' : obj[next.classCode] = true && item.push(next)

+ 0 - 1
src/views/maintain/space/components/spaceGraph.vue

@@ -201,7 +201,6 @@ export default class spaceGraph extends Vue {
         this.canvasLoading = true;
         this.clearGraphy();
         this.scene = null;
-        console.log(this.floorKey);
         scene.loadUrl(this.mapBaseUrl + this.floorKey).then((res) => {
             if (this.view) {
                 this.view.scene = scene;