guoxiaohuan преди 4 години
родител
ревизия
c206e5deb2
променени са 6 файла, в които са добавени 120 реда и са изтрити 103 реда
  1. 60 43
      src/components/Legend/src/legend.vue
  2. 13 21
      src/components/floorMap/index.vue
  3. 12 7
      src/components/legendremarks.vue
  4. 18 9
      src/components/viewLengend.vue
  5. 5 0
      src/store/index.js
  6. 12 23
      src/views/room/index.vue

+ 60 - 43
src/components/Legend/src/legend.vue

@@ -11,26 +11,10 @@
             <el-collapse-transition v-if='(type==1 || floors.length>0)&& isMessage'>
                 <div class='legend-tab' v-if='show'>
                     <div class='legend-table2' v-if='systemName=="土建系统"'>
-                        <lengend-view
-                            v-if='viewTable.length>=0'
-                            :loading='loading'
-                            :viewTable='viewTable'
-                            @changeSwitch='handleSwich'
-                            :remarksText='remarksText'
-                            ref='viewLengend'
-                            :systemName='systemName'
-                        ></lengend-view>
+                        <lengend-view @changeSwitch='handleSwich' :remarksText='remarksText' ref='viewLengend' :systemName='systemName'></lengend-view>
                     </div>
                     <div class='legend-table' v-else>
-                        <lengend-view
-                            v-if='viewTable.length>=0'
-                            :loading='loading'
-                            :viewTable='viewTable'
-                            @changeSwitch='handleSwich'
-                            :remarksText='remarksText'
-                            ref='viewLengend'
-                            :systemName='systemName'
-                        ></lengend-view>
+                        <lengend-view @changeSwitch='handleSwich' :remarksText='remarksText' ref='viewLengend' :systemName='systemName'></lengend-view>
                     </div>
                 </div>
             </el-collapse-transition>
@@ -105,6 +89,7 @@ import lengendView from '@/components/viewLengend'
 import legendRemarks from '@/components/legendremarks'
 import lengendEdit from '@/components/editLengend'
 import { mapGetters } from 'vuex'
+import bus from '@/utils/bus.js'
 import { queryStatis, updateStatis, queryRead } from '@/api/public.js'
 
 export default {
@@ -114,7 +99,7 @@ export default {
             remarksText: '', //查询出来的备注
             text1:
                 '<p>1.主要设备房包括:冷源机房,热源机房,开闭站,配变电所(室),发电机房,消防水泵房,消防高位水箱间,生活水泵房,慧云机房,垃圾房。</p>',
-            // text2: '<p>2.图例后×的数字,代表此位置的数量。</p>',
+            text2: '<p>2.图例后×的数字,代表此位置的数量。</p>',
             text2: '',
             show: true,
             show2: false,
@@ -176,7 +161,7 @@ export default {
         testClick(data) {},
         // 编辑备注
         legendClik() {
-            this.$refs.EditdMarks.showModal(this.remarksText)
+            this.$refs.EditdMarks.showModal()
         },
         // 查询备注
         queryMarks() {
@@ -184,29 +169,29 @@ export default {
                 categoryId: this.categoryId ? this.categoryId : this.$cookie.get('categoryId'),
                 projectId: this.$store.state.plazaId,
                 BuildingID: '1',
+                Pub: true,
                 FloorID: this.$cookie.get('floorNow')
             }
             let data = {}
             queryRead({ data, postParams }).then(res => {
+                let remarksText = ''
                 if (res.data.Data && res.data.Data[0].Note) {
-                    let note = res.data.Data[0].Note
-                    if (this.planNum > 0) {
-                        this.remarksText = `${this.text1}${note}`
-                    }
-                    if (this.typeNum > 1) {
-                        this.remarksText = `${this.text2}${note}`
-                    }
-                    if (note.search(this.text1) != -1 && note.search(this.text2) != -1) {
-                        this.remarksText = `${note}`
-                    } else if (note.search(this.text1) != -1) {
-                        this.remarksText = `${this.text2}${note}`
-                    } else if (note.search(this.text2) != -1) {
-                        this.remarksText = `${this.text1}${note}`
+                    let Res = res.data ? res.data.Data[0].Note : ''
+                    if (Res) {
+                        // 返回有备注
+                        remarksText = Res
                     } else {
-                        this.remarksText = `${this.text1}${this.text2}${note}`
+                        if (this.planNum > 0 && this.typeNum > 1) {
+                            remarksText = `${this.text1}${this.text2}${Res}`
+                        } else if (this.planNum > 0) {
+                            remarksText = `${this.text1}${Res}`
+                        } else if (this.typeNum > 1) {
+                            remarksText = `${this.text2}${Res}`
+                        } else {
+                            remarksText = ''
+                        }
                     }
-                } else {
-                    this.remarksText = `${this.text1}${this.text2}`
+                    this.$store.commit('SETREMARKSTEXT', remarksText)
                 }
             })
         },
@@ -259,6 +244,7 @@ export default {
             this.editSwitch = val
             this.queryEditNum(!this.editSwitch)
         },
+        queryViewMethods() {},
         // 查询图例
         queryView(flag) {
             let postParams = {}
@@ -269,14 +255,18 @@ export default {
             }
             queryStatis({ data, postParams }).then(res => {
                 this.loading = false
-                //console.log('图例', res)
-                this.viewTable = res.data.Data ? res.data.Data : []
-                if (this.viewTable.length > 0) {
-                    this.viewTable.forEach(el => {
-                        console.log(el)
+                let viewTable = []
+                viewTable = res.data.Data ? res.data.Data : []
+                this.$store.commit('SETLEGENDTABLE', viewTable)
+
+                if (viewTable.length > 0) {
+                    viewTable.forEach(el => {
                         if (el.Name == '主要设备房') {
                             this.planNum = el.Num
                         }
+                        if (el.type == 'Image') {
+                            this.typeNum = el.Num
+                        }
                     })
                 }
                 this.$nextTick(() => {
@@ -285,7 +275,6 @@ export default {
                     }
                 })
             })
-            this.queryMarks()
         },
         // 查询编辑状态图例
         queryEditNum(flag) {
@@ -347,9 +336,37 @@ export default {
         determine() {
             this.isFloor = false
             this.goToEditer()
+        },
+        queryRemarksMethods() {},
+        init() {
+            // 图例
+            bus.$on('queryViewMethods', () => {
+                this.queryView(false)
+            })
+            // 备注
+            bus.$on('queryRemarksMethods', res => {
+                let remarksText = ''
+                if (res) {
+                    // 返回有备注
+                    remarksText = res
+                } else {
+                    if (this.planNum > 0 && this.typeNum > 1) {
+                        remarksText = `${this.text1}${this.text2}${res}`
+                    } else if (this.planNum > 0) {
+                        remarksText = `${this.text1}${res}`
+                    } else if (this.typeNum > 1) {
+                        remarksText = `${this.text2}${res}`
+                    } else {
+                        remarksText = ''
+                    }
+                }
+                this.$store.commit('SETREMARKSTEXT', remarksText)
+            })
         }
     },
-    mounted() {}
+    mounted() {
+        this.init()
+    }
 }
 </script>
 <style lang="less" scoped>

+ 13 - 21
src/components/floorMap/index.vue

@@ -135,18 +135,25 @@ export default {
                 if (!(data.Data && data.Data.length)) {
                     return false
                 }
+                // 请求回来的备注
+                if (data.Data && data.Data[0].Note) {
+                    let note = data.Data[0].Note
+                    bus.$emit('queryRemarksMethods', note)
+                } else {
+                    bus.$emit('queryRemarksMethods', '')
+                }
+                //土建系统的图例展示
                 if (this.$cookie.get('categoryId') == 'SCPZ') {
                     let scpzTable = []
                     scpzTable = data.Data[0].Elements.Nodes || []
                     this.$store.commit('SETSCPZTABLE', scpzTable)
                 }
-                //
-                //
-
                 // 放到后边 $cookie graphId
                 this.$cookie.set('graphId', data.Data[0].ID, 3)
                 if (this.$cookie.get('graphId')) {
-                    this.queryView()
+                    // 得到graphId 就请求图例
+                    // 除土建系统之外的图例展示 包括楼层功能
+                    bus.$emit('queryViewMethods')
                 }
                 this.topologyParser = new STopologyParser(null)
                 this.topologyParser.parseData(data.Data[0].Elements)
@@ -178,22 +185,6 @@ export default {
                 this.view.fitSceneToView()
             })
         },
-        // 查询图例
-        queryView() {
-            let postParams = {}
-            let data = {
-                graphId: this.$cookie.get('graphId'),
-                projectId: this.plazaId,
-                flag: false
-            }
-            queryStatis({ data, postParams }).then(res => {
-                this.loading = false
-                console.log('图例图例图例图例', res)
-                let viewTable = []
-                viewTable = res.data.Data ? res.data.Data : []
-                this.$store.commit('SETLEGENDTABLE', viewTable)
-            })
-        },
         clearGraphy() {
             if (this.view) {
                 this.view.scene = null
@@ -246,7 +237,8 @@ export default {
                 BuildingID: '1',
                 FloorID: FloorID,
                 categoryId: this.categoryId ? this.categoryId : this.$cookie.get('categoryId'),
-                projectId: this.urlMsg.ProjectID
+                projectId: this.urlMsg.ProjectID,
+                Pub: true
             }
             return readGroup(data)
         },

+ 12 - 7
src/components/legendremarks.vue

@@ -8,7 +8,7 @@
         <a-modal v-model='visible' :title='title' @ok='handleOk' ok-text='保存' cancel-text='取消' :maskClosable='false' :width='648'>
             <div class='edit_container' style='width:600px;height:156px'>
                 <quill-editor
-                    v-model='remarksText'
+                    v-model='remarksTexts'
                     :options='editorOption'
                     @blur='onEditorBlur($event)'
                     @focus='onEditorFocus($event)'
@@ -22,12 +22,13 @@
 </template>
 <script>
 import { updateRead } from '@/api/public.js'
+import { mapGetters } from 'vuex'
 export default {
     name: 'EditdMarks',
     data() {
         return {
             valLen: 0, //输入字数限制
-            remarksText: '', //展示的备注
+            remarksTexts: '', //展示的备注
             editorOption: {
                 modules: {
                     toolbar: [['bold', 'underline'], [{ color: [] }]]
@@ -39,14 +40,18 @@ export default {
             visible: false
         }
     },
+    computed: {
+        ...mapGetters(['remarksText'])
+    },
     methods: {
         // val为传过来的备注
-        showModal(val) {
+        showModal() {
             this.visible = true
-            this.remarksText = val
+            this.remarksTexts = this.remarksText
         },
         // 更新底图备注
         markUpdate(val) {
+            console.log(val)
             let params = {
                 postParams: {
                     graphId: this.$cookie.get('graphId'),
@@ -67,20 +72,20 @@ export default {
         },
         // 点击保存
         handleOk() {
-            this.markUpdate(this.remarksText)
+            this.markUpdate(this.remarksTexts)
         },
         onEditorReady(editor) {},
         onEditorBlur(val) {},
         onEditorFocus(val) {},
         onEditorChange(val) {
             val.quill.deleteText(200, 6)
-            if (this.remarksText === '') {
+            if (this.remarksTexts === '') {
                 this.valLen = 0
             } else {
                 this.valLen = val.quill.getLength() - 1
             }
             if (val.html) {
-                this.remarksText = val.html
+                this.remarksTexts = val.html
             }
         }
     },

+ 18 - 9
src/components/viewLengend.vue

@@ -28,8 +28,8 @@
         <div v-else>
             <el-table
                 ref='dataTable'
-                v-if='legendTable.length>=0||viewTable.length>=0'
-                :data='legendTable ||viewTable'
+                v-if='legendTable.length>=0'
+                :data='legendTable'
                 tooltip-effect='dark'
                 style='width:100%;'
                 @selection-change='handleSelectionChange'
@@ -63,7 +63,7 @@
             </div>
             <div class='remark' v-if='remarksText'>
                 <span class='remark-title'>注:</span>
-                <div v-html='remarksText' class='remark-text'></div>
+                <div :key='key' v-html='remarksText' class='remark-text'></div>
             </div>
         </div>
     </div>
@@ -72,11 +72,12 @@
 import bus from '@/utils/bus.js'
 import { mapGetters } from 'vuex'
 export default {
-    props: ['viewTable', 'loading', 'remarksText', 'systemName'],
+    props: ['loading', 'systemName'],
     data() {
         return {
             swich: true,
-            multipleSelection: []
+            multipleSelection: [],
+            key: 0
         }
     },
     methods: {
@@ -91,16 +92,24 @@ export default {
             this.$emit('changeSwitch', val)
         },
         setSelected() {
-            this.viewTable.forEach(t => {
+            this.legendTable.forEach(t => {
                 this.$refs.dataTable.toggleRowSelection(t, true)
             })
         }
     },
     computed: {
-        ...mapGetters(['scpzTable', 'legendTable'])
+        ...mapGetters(['scpzTable', 'legendTable', 'remarksText'])
     },
-    mounted() {
-        console.log(this.legendTable)
+    mounted() {},
+    watch: {
+        '$store.state.remarksText': {
+            handler(oVal, nVal) {
+                if (oVal != nVal) {
+                    this.key++
+                }
+            },
+            deep: true
+        }
     }
 }
 </script>

+ 5 - 0
src/store/index.js

@@ -21,6 +21,7 @@ export default new Vuex.Store({
         isMessage: true, //是否有发布的图
         scpzTable: [], //土建系统图例展示
         legendTable: [], //除土建系统图例展示
+        remarksText: '', //备注
     },
     getters: {
         floorsArr: (state) => state.floorsArr,
@@ -32,6 +33,7 @@ export default new Vuex.Store({
         isMessage: (state) => state.isMessage,
         scpzTable: (state) => state.scpzTable,
         legendTable: (state) => state.legendTable,
+        remarksText: (state) => state.remarksText,
     },
     mutations: {
         // 设置是否登陆校验
@@ -74,6 +76,9 @@ export default new Vuex.Store({
         SETLEGENDTABLE(state, data) {
             state.legendTable = data
         },
+        SETREMARKSTEXT(state, data) {
+            state.remarksText = data
+        },
     },
     actions: {
         // 获取项目列表、userId

+ 12 - 23
src/views/room/index.vue

@@ -491,7 +491,7 @@ export default {
             rwwcrq: '',
             ycgdtbsj: '',
             ycgdyssj: '',
-            smsxtArr: []
+            smsxtArr: { smsx: '1001' }
         }
     },
     components: {
@@ -538,9 +538,12 @@ export default {
                 //判断有没有图片,有图片默认显示按钮是第一个tab,没有图片显示的是第二个tab
                 if (this.tableImg.length > 0) {
                     this.activeName = '1'
-                } else {
+                } else if (this.systemName == '配电室机房') {
                     this.activeName = '2'
                     this.Index1()
+                } else {
+                    this.activeName = '3'
+                    this.Index2()
                 }
             })
         },
@@ -589,6 +592,8 @@ export default {
                     this.total1 = res.count
                     this.table2 = res.data ? res.data : []
                     //console.log('明细表', res)
+                    if (this.table2.length == 0) {
+                    }
                 }
             })
         },
@@ -651,7 +656,6 @@ export default {
         Index3() {
             let getParams = {
                 location: '1890',
-                // plazaId: '1001145',
                 plazaId: this.plazaId,
                 page: this.page3,
                 size: this.size3,
@@ -825,8 +829,7 @@ export default {
                 }
             }
             querySystem(params).then(res => {
-                this.smsxtArr = res.data[0]
-                console.log(this.smsxtArr)
+                this.smsxtArr = res.data ? res.data[0] : {}
                 this.Index(this.smsxtArr.smsxt)
                 this.content = `查看${this.$cookie.get('floorNow')}层${this.smsxtArr.smsxtname}分布图`
             })
@@ -840,11 +843,11 @@ export default {
             } else if (name.type == 'system') {
                 let floor = this.$cookie.get('floorNow')
                 this.content = `查看${floor}层楼层功能图`
+                this.init()
             }
         },
         // 机房右上角的跳转 如果是在楼层功能打开的机房则要跳转到设备设施对应的系统\楼层 反之亦然
         jumpFloor() {
-            console.log(this.smsxtArr.smsxt)
             if (this.smsxtArr.smsxt) {
                 if (location.pathname.split('/')[3] == 'equipment') {
                     this.$router.push({ path: '/home/floorFunc' })
@@ -854,21 +857,7 @@ export default {
             }
         }
     },
-    mounted() {
-        this.Index()
-        if (this.tableImg.length == 0) {
-            this.Index1()
-            if (this.table2.length == 0) {
-                this.Index2()
-                if (this.table3.length == 0) {
-                    this.Index3()
-                    if (this.table4.length == 0) {
-                        this.Index4()
-                    }
-                }
-            }
-        }
-    }
+    mounted() {}
 }
 </script>
 <style lang="less" scoped>
@@ -1015,10 +1004,10 @@ export default {
             border: 1px solid rgba(195, 199, 203, 1);
         }
         /deep/ .el-tabs__item:last-child {
-                border-radius: 0px 4px 4px 0px;
+            border-radius: 0px 4px 4px 0px;
         }
         /deep/ .el-tabs__item:nth-child(2) {
-                border-radius: 4px 0px 0px 4px;
+            border-radius: 4px 0px 0px 4px;
         }
         .el-tabs,
         .el-tabs__content {