shaun-sheep 4 år sedan
förälder
incheckning
33addaf56a
2 ändrade filer med 68 tillägg och 48 borttagningar
  1. 57 35
      src/components/Legend/src/legend.vue
  2. 11 13
      src/components/viewLengend.vue

+ 57 - 35
src/components/Legend/src/legend.vue

@@ -147,7 +147,7 @@ export default {
         floors: {
             //原理图中有数据楼层
             default: () => {
-                []
+                ;[]
             },
             type: Array
         },
@@ -252,6 +252,7 @@ export default {
         },
         // 查询备注
         queryMarks() {
+            this.remarksText = ''
             let postParams = {
                 categoryId: this.categoryId ? this.categoryId : this.$cookie.get('categoryId'),
                 projectId: this.$store.state.plazaId,
@@ -261,24 +262,34 @@ export default {
             }
             let data = {}
             queryRead({ data, postParams }).then(res => {
-                let remarksText = ''
                 if (res.data.Data && res.data.Data[0].Note) {
                     let Res = res.data ? res.data.Data[0].Note : ''
                     if (Res) {
                         // 返回有备注
-                        remarksText = Res
+                        this.remarksText = Res
+                        let defaultCom = ''
+                        if (this.planNum && this.typeNum) {
+                            defaultCom = `${Res}<ol style="padding-left: 1.5em;"><li>${this.text1}</li><li>${this.text2}</li></ol>`
+                        } else if (this.planNum) {
+                            defaultCom = `${Res}<ol  style="padding-left: 1.5em;"><li>${this.text1}</li></ol>`
+                        } else if (this.typeNum) {
+                            defaultCom = `${Res}<ol   style="padding-left: 1.5em;" ><li>${this.text2}</li></ol>`
+                        } else {
+                            defaultCom = Res
+                        }
+                        this.$store.commit('SETDEFAULTCOMMENT', defaultCom)
                     } else {
                         if (this.planNum && this.typeNum) {
-                            remarksText = `<p>1.${this.text1}</p><p>2.${this.text2}</p>`
+                            this.remarksText = `<ol style="padding-left: 1.5em;"><li>${this.text1}</li><li>${this.text2}</li></ol>`
                         } else if (this.planNum) {
-                            remarksText = `<p>1.${this.text1}</p>`
+                            this.remarksText = `<ol  style="padding-left: 1.5em;"><li>${this.text1}</li></ol>`
                         } else if (this.typeNum) {
-                            remarksText = `<p>1.${this.text2}</p>`
+                            this.remarksText = `<ol   style="padding-left: 1.5em;" ><li>${this.text2}</li></ol>`
                         } else {
-                            remarksText = ''
+                            this.remarksText = ''
                         }
                     }
-                    this.$store.commit('SETREMARKSTEXT', remarksText)
+                    this.$store.commit('SETREMARKSTEXT', this.remarksText)
                 }
             })
         },
@@ -318,8 +329,8 @@ export default {
 
             let FloorID = this.floor ? this.floor : this.$cookie.get('floorMapId') || 'f1'
             let categoryId = this.categoryId ? this.categoryId : this.$cookie.get('categoryId')
-            const { conf } = window.__systemConf;
-            const editerUrl = conf[process.env.NODE_ENV+'_editerUrl'];
+            const { conf } = window.__systemConf
+            const editerUrl = conf[process.env.NODE_ENV + '_editerUrl']
             let floorName = this.floorName ? this.floorName : this.$cookie.get('floorNow')
             let seq = this.$cookie.get('currentFloorId')
             let data = `categoryId=${categoryId}&projectId=${this.plazaId}&BuildingID=1&FloorID=${FloorID}&FloorName=${floorName}&fmapID=${this.fmapID}&seq=${seq}&token=${this.ssoToken}`
@@ -374,17 +385,20 @@ export default {
                         }
                     })
                 }
-                let remarksText = ''
+                // let remarksText = ''
+                this.remarksText = ''
+                this.$store.commit('SETREMARKSTEXT', '')
+
                 if (this.planNum && this.typeNum) {
-                    remarksText = `<p>1.${this.text1}</p><p>2.${this.text2}</p>`
+                    this.remarksText = `<ol style="padding-left: 1.5em;"><li>${this.text1}</li><li>${this.text2}</li></ol>`
                 } else if (this.planNum) {
-                    remarksText = `<p>1.${this.text1}</p>`
+                    this.remarksText = `<ol  style="padding-left: 1.5em;"><li>${this.text1}</li></ol>`
                 } else if (this.typeNum) {
-                    remarksText = `<p>1.${this.text2}</p>`
+                    this.remarksText = `<ol   style="padding-left: 1.5em;" ><li>${this.text2}</li></ol>`
                 } else {
-                    remarksText = ''
+                    this.remarksText = ''
                 }
-                this.$store.commit('SETREMARKSTEXT', remarksText)
+                this.$store.commit('SETREMARKSTEXT', this.remarksText)
                 this.$nextTick(() => {
                     if (this.$refs.viewLengend) {
                         this.$refs.viewLengend.setSelected()
@@ -486,6 +500,7 @@ export default {
         },
         queryRemarksMethods() {},
         init() {
+            this.remarksText = ''
             // 图例
             bus.$off('queryViewMethods') //解决触发多次监听
             bus.$on('queryViewMethods', () => {
@@ -494,35 +509,43 @@ export default {
             // 备注
             bus.$off('queryRemarksMethods')
             bus.$on('queryRemarksMethods', res => {
-                let remarksText = ''
                 if (res) {
                     // 返回有备注
-                    remarksText = res
+                    this.remarksText = res
+                    let defaultCom = ''
+                    if (this.planNum && this.typeNum) {
+                        defaultCom = `${res}<ol style="padding-left: 1.5em;"><li>${this.text1}</li><li>${this.text2}</li></ol>`
+                    } else if (this.planNum) {
+                        defaultCom = `${res}<ol  style="padding-left: 1.5em;"><li>${this.text1}</li></ol>`
+                    } else if (this.typeNum) {
+                        defaultCom = `${res}<ol   style="padding-left: 1.5em;" ><li>${this.text2}</li></ol>`
+                    } else {
+                        defaultCom = res
+                    }
+                    this.$store.commit('SETDEFAULTCOMMENT', defaultCom)
                 } else {
                     if (this.planNum && this.typeNum) {
-                        remarksText = `${this.text1}${this.text2}${res}`
+                        this.remarksText = `<ol style="padding-left: 1.5em;"><li>${this.text1}</li><li>${this.text2}</li></ol>`
                     } else if (this.planNum) {
-                        remarksText = `${this.text1}${res}`
+                        this.remarksText = `<ol  style="padding-left: 1.5em;"><li>${this.text1}</li></ol>`
                     } else if (this.typeNum) {
-                        remarksText = `${this.text2}${res}`
+                        this.remarksText = `<ol   style="padding-left: 1.5em;" ><li>${this.text2}</li></ol>`
                     } else {
-                        remarksText = ''
+                        this.remarksText = ''
                     }
                 }
-                console.log(remarksText)
-                this.$store.commit('SETREMARKSTEXT', remarksText)
+                this.$store.commit('SETREMARKSTEXT', this.remarksText)
             })
         },
         // 设置图例整体高度
-        setLengedHeight(){
-           let dom = document.getElementsByClassName('legend-table')[0];
-           console.log('asdfasfd',window.screen.height,window.screen.width)
-           if(window.screen.height>1000){
-            dom.style.maxHeight="768px"
-           }else{
-            dom.style.maxHeight="534px"
-           }
-
+        setLengedHeight() {
+            let dom = document.getElementsByClassName('legend-table')[0]
+            console.log('asdfasfd', window.screen.height, window.screen.width)
+            if (window.screen.height > 1000) {
+                dom.style.maxHeight = '768px'
+            } else {
+                dom.style.maxHeight = '534px'
+            }
         }
     },
     mounted() {
@@ -583,11 +606,10 @@ export default {
         right: 47px;
         .legend-table {
             padding: 16px;
-            // max-height: 768px;
+            max-height: 768px;
             width: 385px;
             // width: 420px;
             overflow: auto;
-            overflow: hidden;
             overflow-y: auto;
             position: relative;
             background: rgba(255, 255, 255, 1);

+ 11 - 13
src/components/viewLengend.vue

@@ -62,9 +62,9 @@
                 <el-switch v-model='swich' @change='handleSwich(swich)'></el-switch>
                 <span>隐藏数量为0的项目</span>
             </div>
-            <div class='remark' v-if='remarksText'>
+            <div class='remark' v-if='initText'>
                 <span class='remark-title'>注:</span>
-                <div :key='key' v-html='remarksText' class='remark-text'></div>
+                <div :key='Date.now()' v-html='initText' class='remark-text'></div>
             </div>
         </div>
     </div>
@@ -107,19 +107,17 @@ export default {
         }
     },
     computed: {
-        ...mapGetters(['scpzTable', 'legendTable', 'remarksText'])
+        ...mapGetters(['scpzTable', 'legendTable', 'remarksText', 'defaultComment']),
+        initText() {
+            if (this.defaultComment) {
+                return this.defaultComment
+            } else {
+                return this.remarksText
+            }
+        }
     },
     mounted() {},
-    watch: {
-        '$store.state.remarksText': {
-            handler(oVal, nVal) {
-                if (oVal != nVal) {
-                    this.key++
-                }
-            },
-            deep: true
-        }
-    }
+    created() {}
 }
 </script>
 <style lang="less" scoped>