guoxiaohuan 4 years ago
parent
commit
566487fc51

+ 7 - 15
src/components/Legend/src/legend.vue

@@ -19,7 +19,7 @@
                 </div>
             </el-collapse-transition>
             <!-- 图例编辑状态组件 -->
-            <el-collapse-transition @isShow2='isShow2'>
+            <el-collapse-transition>
                 <div v-if='showView===2'>
                     <lengend-edit
                         @handleSwich2='handleSwich2'
@@ -112,8 +112,6 @@ export default {
                 '<p>主要设备房包括:冷源机房,热源机房,开闭站,配变电所(室),发电机房,消防水泵房,消防高位水箱间,生活水泵房,慧云机房,垃圾房</p>',
             text2: '<p>图例后×的数字,代表此位置的数量</p>',
             text2: '',
-            show: true,
-            show2: false,
             loading: true,
             loading1: true,
             viewTable: [],
@@ -259,14 +257,10 @@ export default {
             } else {
                 this.$store.commit('SETSHOWVIEW', 0)
             }
-            // this.showView = !this.showView
             this.queryView(false)
-            // if (this.showView) {
-            //     this.show2 = false
-            // }
         },
         cance() {
-            this.show2 = false
+            // this.show2 = false
         },
         // 编辑图例
         editTl() {
@@ -275,8 +269,6 @@ export default {
             } else {
                 this.$store.commit('SETSHOWVIEW', 0)
             }
-            // this.show = false
-            // this.show2 = true
             this.queryEditNum(true)
         },
         /**
@@ -314,6 +306,7 @@ export default {
         handleSwich(val) {
             this.queryView(!val)
         },
+        // 默认隐藏为0的项目
         handleSwich2(val) {
             this.editSwitch = val
             this.queryEditNum(!this.editSwitch)
@@ -378,9 +371,8 @@ export default {
                         message: '操作成功',
                         type: 'success'
                     })
-                    this.queryEditNum(this.editSwitch)
-                    this.show2 = false
-                    this.show = true
+                    this.$store.commit('SETSHOWVIEW', 1)
+                    // this.queryEditNum(this.editSwitch)
                 } else {
                     this.$message({
                         message: '操作失败',
@@ -395,9 +387,9 @@ export default {
                     element.Modify = element.IsModify
                 })
                 this.queryEdit(val)
-                this.isShow2()
+                // this.isShow2()
             } else {
-                this.show2 = false
+                // this.show2 = false
                 // this.isShow2()
                 // this.queryEditNum(true)
             }

+ 84 - 50
src/components/editLengend.vue

@@ -116,6 +116,8 @@
     </div>
 </template>
 <script>
+import { updateStatis } from '@/api/public.js'
+
 export default {
     props: ['editTable', 'loading'],
     data() {
@@ -131,64 +133,96 @@ export default {
         handleSelectionChange(val) {
             this.multipleSelection = val
         },
+        // 编辑图例取消
         cancel() {
-            this.save()
-            // this.$emit('cance')
+            if (this.editNum.length > 0) {
+                this.$confirm('图例中的数据发生变化, 是否需要保存?', {
+                    confirmButtonText: '保存',
+                    cancelButtonText: '放弃修改',
+                    type: 'warning'
+                })
+                    .then(() => {
+                        this.$emit('saveNum', this.editNum)
+                    })
+                    .catch(() => {
+                        this.$message({
+                            type: 'info',
+                            message: '已放弃修改'
+                        })
+                        this.editNum = []
+                        this.$emit('saveNum', this.editNum)
+                        this.$store.commit('SETSHOWVIEW', 1)
+                    })
+            } else {
+                this.$store.commit('SETSHOWVIEW', 1)
+            }
+        },
+        // 编辑图里保存
+        save() {
+            this.queryEdit(this.editNum)
+        },
+        // 编辑数量
+        queryEdit(val) {
+            let params = {
+                postParams: {
+                    Content: val
+                }
+            }
+            updateStatis(params).then(res => {
+                if (res.Result == 'success') {
+                    this.$message({
+                        message: '操作成功',
+                        type: 'success'
+                    })
+                    this.$store.commit('SETSHOWVIEW', 1)
+                } else {
+                    this.$message({
+                        message: '操作失败',
+                        type: 'error'
+                    })
+                }
+            })
         },
+        // 修改图例数量
         changeTable(val) {
             this.editNum.push(val)
-            var obj = {}
-            this.editNum = this.editNum.reduce(function(item, next) {
-                obj[next.key] ? '' : (obj[next.key] = true && item.push(next))
-                return item
-            }, [])
+            let result = [],
+                obj = {}
+            for (var i = 0; i < this.editNum.length; i++) {
+                if (!obj[this.editNum[i].GraphElementId]) {
+                    result.push(this.editNum[i])
+                    obj[this.editNum[i].GraphElementId] = true
+                }
+            }
         },
+        // 修改隐藏为0的项目的开关
         changeSwitch(val) {
             this.$emit('handleSwich2', val)
-        },
-        save() {
-            this.$emit('saveNum', this.editNum)
-            // this.$confirm('图例中的数据发生变化, 是否需要保存?', {
-            //     confirmButtonText: '保存',
-            //     cancelButtonText: '放弃修改',
-            //     type: 'warning'
-            // })
-            //     .then(() => {
-            //         this.$emit('saveNum', this.editNum)
-            //     })
-            //     .catch(() => {
-            //         this.$message({
-            //             type: 'info',
-            //             message: '已放弃修改'
-            //         })
-            //         this.editNum = []
-            //         this.$emit('saveNum', this.editNum)
-            //     })
-        },
-        init() {
-            this.tbData1 = []
-            this.tbData2 = []
-            this.tbData3 = []
-            if (this.editTable.length > 0) {
-                this.tbData1 = this.editTable
-                // 以下不要动 不要删
-                // let len = this.tableData.length
-                // if (len <= 10) {
-                //     this.tbData1 = this.tableData
-                // } else if (len > 10 && len <= 20) {
-                //     this.tbData1 = this.tableData.slice(0, 10)
-                //     this.tbData2 = this.tableData.slice(10, len)
-                // } else if (len > 10 && len <= 30) {
-                //     this.tbData1 = this.tableData.slice(0, 10)
-                //     this.tbData2 = this.tableData.slice(10, 20)
-                //     this.tbData3 = this.tableData.slice(20, len)
-                // } else {
-                //     this.tbData1 = this.tableData.slice(0, parseInt(len / 3))
-                //     this.tbData2 = this.tableData.slice(parseInt(len / 3), parseInt(len / 3) * 2)
-                //     this.tbData3 = this.tableData.slice(parseInt(len / 3) * 2, len)
-                // }
-            }
         }
+        // init() {
+        // this.tbData1 = []
+        // this.tbData2 = []
+        // this.tbData3 = []
+        // if (this.editTable.length > 0) {
+        //     this.tbData1 = this.editTable
+        // 以下不要动 不要删
+        // let len = this.tableData.length
+        // if (len <= 10) {
+        //     this.tbData1 = this.tableData
+        // } else if (len > 10 && len <= 20) {
+        //     this.tbData1 = this.tableData.slice(0, 10)
+        //     this.tbData2 = this.tableData.slice(10, len)
+        // } else if (len > 10 && len <= 30) {
+        //     this.tbData1 = this.tableData.slice(0, 10)
+        //     this.tbData2 = this.tableData.slice(10, 20)
+        //     this.tbData3 = this.tableData.slice(20, len)
+        // } else {
+        //     this.tbData1 = this.tableData.slice(0, parseInt(len / 3))
+        //     this.tbData2 = this.tableData.slice(parseInt(len / 3), parseInt(len / 3) * 2)
+        //     this.tbData3 = this.tableData.slice(parseInt(len / 3) * 2, len)
+        // }
+        // }
+        // }
     },
     mounted() {}
 }

+ 1 - 0
src/components/floorList.vue

@@ -173,6 +173,7 @@ export default {
          * @param {Number} 楼层信息在floorsArr数组中的位置
          */
         tabFloor(item, index) {
+            this.$store.commit('SETSHOWVIEW', 1)
             this.currentFloorId = this.floorIdArr[index]
             this.handleCookie()
             this.handlePosition(1, index, this.floorIdArr.length)

+ 6 - 2
src/components/viewLengend.vue

@@ -15,12 +15,16 @@
             >
                 <el-table-column prop label='说明'>
                     <template slot-scope='{row}'>
-                        <span>{{(row.Properties && row.Properties.ItemExplain)?row.Properties.ItemExplain:'--'}}</span>
+                        <span v-if='row.Properties && row.Properties.ItemExplain'>{{row.Properties.ItemExplain}}</span>
                     </template>
                 </el-table-column>
                 <el-table-column prop label='图例' width='60' align='center'>
                     <template slot-scope='{row}'>
-                        <div class='scpz-img' :style='`background:${row.Properties.FillColor};border:1px solid ${row.Properties.StrokeColor}`'></div>
+                        <div
+                            class='scpz-img'
+                            v-if='row.Properties && row.Properties.ItemExplain'
+                            :style='`background:${row.Properties.FillColor};border:1px solid ${row.Properties.StrokeColor}`'
+                        ></div>
                     </template>
                 </el-table-column>
             </el-table>

+ 15 - 19
src/store/index.js

@@ -1,13 +1,7 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
-import {
-    login,
-    queryFloor,
-    queryfmapID
-} from '@/api/login.js'
-import {
-    queryBrand
-} from '@/api/public.js'
+import { login, queryFloor, queryfmapID } from '@/api/login.js'
+import { queryBrand } from '@/api/public.js'
 import axios from 'axios'
 import router from '../router'
 
@@ -38,7 +32,8 @@ export default new Vuex.Store({
         remarksText: '', //备注
         bunkObj: {}, // 铺位名称
         currentFloor: {}, //当前选中的楼层信息
-        accessLevel:0, // 
+        accessLevel: 0, //
+        showView: 1,
     },
     getters: {
         isPreview: (state) => state.isPreview,
@@ -58,6 +53,9 @@ export default new Vuex.Store({
         showView: (state) => state.showView,
     },
     mutations: {
+        SETSHOWVIEW(state, data) {
+            state.showView = data
+        },
         SETISPREVIEW(state, data) {
             state.isPreview = data
         },
@@ -117,21 +115,19 @@ export default new Vuex.Store({
         SETCURRENTFLOOR(state, data) {
             state.currentFloor = data
         },
-        STOREACCESSLEVEL(state, data) {
-            state.accessLevel = data.level
-        }
+        STOREACCESSLEVEL(state, data) {
+            state.accessLevel = data.level
+        },
     },
     actions: {
         // 获取项目列表、userId
-        async getUserInfo({
-            commit
-        }, palyload) {
+        async getUserInfo({ commit }, palyload) {
             await login({}).then((res) => {
                 if (res.result == 'success') {
-                    commit('STOREACCESSLEVEL', res)
+                    commit('STOREACCESSLEVEL', res)
                 }
-                    // token校验成功 拿到权限
-                    //commit("SETISREQUESTtAUTH", true)
+                // token校验成功 拿到权限
+                //commit("SETISREQUESTtAUTH", true)
                 //     if (res.permissions.length == 0) {
                 //         router.push('/404')
                 //     }
@@ -177,4 +173,4 @@ export default new Vuex.Store({
         },
     },
     modules: {},
-})
+})

+ 0 - 2
src/views/equipment/index.vue

@@ -28,7 +28,6 @@
                             <Legend :systemName='systemName' :floors='floorsArr' type='1' :editTips='`编辑${floorInfo.code}层${systemName}平面图`'></Legend>
                         </div>
                         <floorMap ref='floorMap' :id='"equip"' :loadName='loadName' :type='"system"'></floorMap>
-                        <!--  -->
                         <div class='additional-box' v-if='fqPic.length>0'>
                             <div class='additional2' @click='additionalColl' v-if='showView===3'>
                                 <img src='../../assets/imgs/bg2.png' alt />
@@ -79,7 +78,6 @@ export default {
             dialogInfo: {},
             brand: [], //品牌
             manufacturer: [],
-            show: false,
             fqPic: [],
             loadName: '',
             type: '',

+ 1 - 0
src/views/equipment/table/djspTable.vue

@@ -137,6 +137,7 @@ export default {
         }
     },
     mounted() {
+        this.floor = this.$cookie.get('floorMapId')
         this.getList()
     }
 }