zhulizhen1111 4 년 전
부모
커밋
05b2d8e14a
3개의 변경된 파일56개의 추가작업 그리고 13개의 파일을 삭제
  1. 2 2
      src/api/equipmentList.js
  2. 1 1
      src/views/equipment/eqDialog.vue
  3. 53 10
      src/views/equipment/table/djspTable.vue

+ 2 - 2
src/api/equipmentList.js

@@ -41,10 +41,10 @@ export function queryRecord({ getParams }) {
 
 // 设备设施=查看图纸
 export function queryxxx({ getParams }) {
-    return httputils.getJson(`/data/xxX`, getParams)
+    return httputils.getJson(`/data/data/xxX`, getParams)
 }
 
 // 设备设施-楼层电井口(间)控制商铺范围清单
 export function queryShops({ getParams }) {
-    return httputils.getJson(`/data/v_glsms_shops/query`, getParams)
+    return httputils.getJson(`/data/data/v_glsms_shops/query`, getParams)
 }

+ 1 - 1
src/views/equipment/eqDialog.vue

@@ -23,7 +23,7 @@
                 <!-- 主要设备清单 标准设备表格 -->
                 <standTable v-else-if='dialogInfo.id.slice(2,4)=="QD"' :param='param' :major='dialogInfo.id'></standTable>
                 <!-- 电井商铺范围清单 -->
-                <djsp-table v-else-if='dialogInfo.id.slice(0,4)=="GJSP"'></djsp-table>
+                <djsp-table v-else-if='dialogInfo.id.slice(0,4)=="GJSP"' :param='param'></djsp-table>
                 <!-- 查看图纸 -->
                 <look-page v-else-if='dialogInfo.id.slice(2,4)=="TZ"' param major></look-page>
             </div>

+ 53 - 10
src/views/equipment/table/djspTable.vue

@@ -22,17 +22,17 @@
             ></el-input>
             <Select @change='getList' v-model='floor' width='120' tipPlace='top' caption='楼层 :' :selectdata='floorSelect'></Select>
         </div>
-        <el-table :data='tableData' style='width: 100%' @row-click='innerVisible = true'>
-            <el-table-column prop='floor' label='楼层' width='120'>
+        <el-table :data='tableData' :span-method='objectSpanMethod' border style='width: 100%' @row-click='innerVisible = true'>
+            <el-table-column prop='floor' label='楼层' width='200'>
                 <template slot-scope='{row}'>{{row.floor || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='welldes' label='电井间' width='160'>
+            <el-table-column prop='welldes' label='电井间'>
                 <template slot-scope='{row}'>{{row.welldes || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='meterbox' label='商铺电表数'>
+            <el-table-column prop='meterbox' label='商铺电表数' width='200'>
                 <template slot-scope='{row}'>{{row.meterbox || '--'}}</template>
             </el-table-column>
-            <el-table-column prop='shopsnum' label='商铺编号'>
+            <el-table-column prop='shopsnum' label='商铺编号' width='200'>
                 <template slot-scope='{row}'>{{row.shopsnum || '--'}}</template>
             </el-table-column>
         </el-table>
@@ -59,14 +59,32 @@ export default {
     computed: {
         ...mapGetters(['floorSelect'])
     },
-
+    props: ['param'],
     methods: {
+        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+            if (columnIndex === 0) {
+                if (row.col0count > 0) {
+                    return {
+                        rowspan: row.col0count,
+                        colspan: 1
+                    }
+                } else {
+                    return {
+                        rowspan: 0,
+                        colspan: 0
+                    }
+                }
+            }
+        },
         pageChanged(page) {
             this.currentPage = page
             this.getList()
         },
         getList() {
-            let getParams = {}
+            let getParams = {
+                page: 1,
+                size: 10
+            }
             if (this.floor) {
                 getParams.floor = this.floorSelect
             }
@@ -82,12 +100,37 @@ export default {
             }
             queryShops({ getParams }).then(res => {
                 console.log(res)
-                this.tableData = res.data.data
-                this.total = res.data.count
+                this.tableData = []
+                let floor = {}
+                res.data.forEach(i => {
+                    Object.keys(i).forEach(key => (floor[key] = 0)) // 初始化每一楼层个数为0
+                    Object.values(i).forEach(j => {
+                        Object.values(j).forEach(k => {
+                            this.tableData.push(...k)
+                        })
+                    })
+                })
+
+                this.tableData.map(n => {
+                    if (floor[n.floor] === 0) {
+                        const count = this.tableData.filter(m => m.floor === n.floor).length
+                        floor[n.floor] = count
+                        n.col0count = count
+                    } else {
+                        n.col0count = 0
+                    }
+                    return n
+                })
             })
         }
     },
-
+    watch: {
+        param(newV, oldV) {
+            if (newV !== oldV) {
+                this.getList()
+            }
+        }
+    },
     mounted() {
         this.getList()
     }