Ver Fonte

地图点位

Shannon_mu há 3 anos atrás
pai
commit
d8c690a699

+ 54 - 21
operationSupport/src/views/deviceManagement/popups/poptreeSelect.vue

@@ -1,6 +1,15 @@
 <template>
     <el-scrollbar class="el-scrollbar-byself thisColor" style="width: 100%">
-        <el-tree class="" :data="tenantsTree" @node-click="treeClick" node-key="value" :props="treedefaultProps" ref="tenantstree">
+        <el-tree
+            :data="tenantsTree"
+            show-checkbox
+            node-key="value"
+            :props="treedefaultProps"
+            check-strictly
+            :default-checked-keys="defaultcheckedkeys"
+            ref="tenantstree"
+            @check="checkChange"
+        >
         </el-tree>
     </el-scrollbar>
 </template>
@@ -14,6 +23,7 @@ export default {
                 children: 'children',
                 label: 'name'
             },
+            defaultcheckedkeys: [],
             unitPa: {
                 buildingId: '',
                 buildingName: '',
@@ -29,26 +39,23 @@ export default {
     mounted() {},
     methods: {
         submit() {
-            debugger;
-            if (this.unitPa.type === 'room') {
+            if (this.$refs.tenantstree.getCheckedNodes().length) {
+                let thisRoom = this.$refs.tenantstree.getCheckedNodes()[0];
+                let thisObj = this.$refs.tenantstree.getNode(thisRoom);
+                this.unitPa.type = thisRoom.type;
+                let newValueIds = thisRoom.id.split('-');
+                if (thisRoom.type == 'room') {
+                    this.unitPa.buildingName = newValueIds.length == 4 ? thisObj.parent.parent.data.name : thisObj.parent.data.name;
+                    this.unitPa.buildingId = newValueIds.length == 4 ? thisObj.parent.parent.data.value : thisObj.parent.data.value;
+                    this.unitPa.unitName = newValueIds.length == 4 ? thisObj.parent.data.name : '';
+                    this.unitPa.unitId = newValueIds.length == 4 ? thisObj.parent.data.value : '';
+                    this.unitPa.houseName = thisRoom.name;
+                    this.unitPa.houseId = thisRoom.value;
+                }
                 this.params.callback && this.params.callback(this.unitPa);
                 this.$emit('close');
             } else {
-                this.$message.error('请先选择到房间');
-                return;
-            }
-        },
-        treeClick(e) {
-            this.unitPa.type = e.type;
-            let newValueIds = e.id.split('-');
-            let thisObj = this.$refs.tenantstree.getNode(e);
-            if (e.type == 'room') {
-                this.unitPa.buildingName = newValueIds.length == 4 ? thisObj.parent.parent.data.name : thisObj.parent.data.name;
-                this.unitPa.buildingId = newValueIds.length == 4 ? thisObj.parent.parent.data.value : thisObj.parent.data.value;
-                this.unitPa.unitName = newValueIds.length == 4 ? thisObj.parent.data.name : '';
-                this.unitPa.unitId = newValueIds.length == 4 ? thisObj.parent.data.value : '';
-                this.unitPa.houseName = e.name;
-                this.unitPa.houseId = e.value;
+                this.$message.error('请选择房间或取消');
             }
         },
         dimension(arr) {
@@ -63,6 +70,18 @@ export default {
                 }
             });
         },
+        checkChange(data, checked) {
+            if (checked) {
+                if (this.$refs.tenantstree.getCheckedNodes().length > 1) {
+                    this.$message({
+                        message: '只能选择一个房间!',
+                        type: 'error',
+                        showClose: true
+                    });
+                    this.$refs.tenantstree.setChecked(data, false);
+                }
+            }
+        },
         CheckChinese(val, name) {
             var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
             let newVal = val;
@@ -70,16 +89,30 @@ export default {
                 newVal = val + name;
             }
             return newVal;
+        },
+        filterTreeData(trData) {
+            trData.map((item, index) => {
+                if (this.isNotEmpty(item.children)) {
+                    item.disabled = true;
+                    this.filterTreeData(item.children);
+                } else {
+                    item.disabled = false;
+                }
+            });
+        },
+        isNotEmpty(arr) {
+            return arr && Array.isArray(arr) && arr.length > 0;
         }
     },
     created() {
         this.dimension(this.params.tenantsTree);
+        this.filterTreeData(this.params.tenantsTree);
         this.tenantsTree = this.params.tenantsTree;
     }
 };
 </script>
 <style lang="scss" scoped>
-.thisColor /deep/ .el-tree .is-current {
-    color: #56c6ff;
-}
+// .thisColor /deep/ .el-tree .is-current {
+//     color: #56c6ff;
+// }
 </style>

+ 6 - 5
operationSupport/src/views/patrolManagement/popups/addPoint.vue

@@ -109,12 +109,13 @@ export default {
                     width: '500px',
                     height: '500px',
                     props: {
-                        callback: resolve
+                        callback: resolve,
+                        location: this.initDot
                     },
                     title: title
                 });
             }).then((e) => {
-                this.initDot = `${e.lat},${e.lng}`;
+                this.initDot = `${e.lng},${e.lat}`;
                 this.formData.latitude = e.lat;
                 this.formData.longitude = e.lng;
             });
@@ -192,8 +193,8 @@ export default {
         },
         initDotTggle() {
             let logPoint = this.initDot.split(',');
-            this.formData.latitude = logPoint[0];
-            this.formData.longitude = logPoint[1];
+            this.formData.latitude = logPoint[1];
+            this.formData.longitude = logPoint[0];
         }
     },
     created() {
@@ -204,7 +205,7 @@ export default {
             this.formData = newData;
             this.nestedLoop(this.communityTre, 'building', 'buildingArr', newData.communityId);
             this.nestedLoop(this.buildingArr, 'unit', 'unitArr', newData.buildingId);
-            this.initDot = `${newData.latitude},${newData.longitude}`;
+            this.initDot = `${newData.longitude},${newData.latitude}`;
         }
     }
 };

+ 20 - 8
operationSupport/src/views/patrolManagement/popups/popMap.vue

@@ -26,7 +26,8 @@ export default {
             placeSearch: '',
             marker: '',
             addressName: '', //地址查询名称
-            poisArray: []
+            poisArray: [],
+            thisMapPot: {}
         };
     },
     methods: {
@@ -36,6 +37,12 @@ export default {
                 resizeEnable: true, //是否监控地图容器尺寸变化
                 zoom: 11 //初始化地图层级
             });
+            this.map.on('complete', () => {
+                if (!!_this.params.location) {
+                    let arr = this.params.location.split(',');
+                    this.addIcon({ lng: arr[0], lat: arr[1] });
+                }
+            });
 
             this.map.on('click', this.mapClick);
             this.placeSearch = new AMap.PlaceSearch({
@@ -49,16 +56,21 @@ export default {
             this.addIcon(e.location);
         },
         addIcon(e) {
-            // if (this.marker !== '') {
-            //     this.map.remove(this.marker);
-            // }
-            let loc = [e.lat, e.lng];
+            if (!!this.marker) {
+                this.map.remove(this.marker);
+                this.marker = '';
+            }
+            this.thisMapPot = e;
+            let loc = [e.lng, e.lat];
             this.marker = new AMap.Marker({
                 icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
-                position: loc
+                position: loc,
+                map: this.map
             });
-            this.map.add(this.marker);
-            this.params.callback && this.params.callback(e);
+            this.map.setFitView();
+        },
+        submit() {
+            this.params.callback && this.params.callback(this.thisMapPot);
             this.$emit('close');
         },
         togglePlaceSearch(val, resolve) {

+ 6 - 6
operationSupport/vue.config.js

@@ -34,8 +34,8 @@ module.exports = {
                 viewportWidth: 1920,//传参
             })
         // 配置每次打包浏览器缓存文件名的随机性
-        const filename = path.posix.join('js', `${new Date().getTime()}_[name].js`);
-        config.mode('production').devtool(false).output.filename(filename).chunkFilename(filename)
+        // const filename = path.posix.join('js', `${new Date().getTime()}_[name].js`);
+        // config.mode('production').devtool(false).output.filename(filename).chunkFilename(filename)
     },
     // 配置全局样式变量
     css: {
@@ -59,10 +59,10 @@ module.exports = {
             //     }
             // })
         },
-        extract: { // 打包后css文件名称添加时间戳
-            filename: `css/[name].${new Date().getTime()}.css`,
-            chunkFilename: `css/chunk.[id].${new Date().getTime()}.css`,
-        }
+        // extract: { // 打包后css文件名称添加时间戳
+        //     filename: `css/[name].${new Date().getTime()}.css`,
+        //     chunkFilename: `css/chunk.[id].${new Date().getTime()}.css`,
+        // }
     },
     configureWebpack: {
         externals: {