From b6a27b9ca71d636a1598751f8114c36a5d7007fe Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期一, 15 四月 2024 16:52:36 +0800 Subject: [PATCH] 修改 --- src/views/warehouse/stockAnalyse.vue | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/views/warehouse/stockAnalyse.vue b/src/views/warehouse/stockAnalyse.vue index 7ab0b52..b4b21f5 100644 --- a/src/views/warehouse/stockAnalyse.vue +++ b/src/views/warehouse/stockAnalyse.vue @@ -1,7 +1,7 @@ <template> <div class="app-container"> <div class="filter-container"> - <div style="display: block;"> + <div style="display: block;" v-show="disable == false"> <!-- <div class="basic_search">--> <!-- <span>区域:</span>--> <!-- <el-select v-model="listQuery.province" clearable filterable @change="changeArea('province')">--> @@ -67,7 +67,7 @@ <el-table-column label="库区" prop="reserveName" align="center"> <template slot-scope="scope"> <span v-if="scope.row.reserveName =='合计'">{{scope.row.reserveName}}</span> - <el-link v-else type="primary" @click="openStock('edit',scope.row)">{{scope.row.reserveName}}</el-link> + <el-link v-else type="primary" @click="openStock('view',scope.row)">{{scope.row.reserveName}}</el-link> </template> </el-table-column> <el-table-column label="库区总库存" prop="gName" align="center"></el-table-column> @@ -150,14 +150,16 @@ }, created() { const t = this - t.getList() - t.getProvince() const roles = JSON.parse(Cookies.get('roles')) if(roles.find(i=>i.name == '管理员'|| i.name == '监管部门')){ this.disable = false + t.listQuery.enterpriseName = '' }else{ this.disable = true + t.listQuery.enterpriseName = Cookies.get('company') } + t.getList() + t.getProvince() }, mounted() { }, @@ -180,14 +182,21 @@ content['gName'] = item.enterpriseName // 重点!赋值合并的行数数值,只需要取子循环的第一个数赋值待合并的行数即可 if(subIndex == 0){ - content['gNum'] = item.reserves.length + let gNum = 0 + for(let i of item.reserves){ + if(i.storehouse && i.storehouse.warehouses && Array.isArray(i.storehouse.warehouses)){ + gNum= gNum + i.storehouse.warehouses.length + 1 + }else{ + gNum = gNum + 0 + } + } + content['gNum'] = gNum } gData.push(content) }) } }) } - if(Array.isArray(gData)){ gData.map(item=>{ if(Array.isArray(item.storehouse.warehouses) && item.storehouse.whTotal){ @@ -215,6 +224,7 @@ content2['gId'] = item.gId content2['ggId'] = item.enterpriseId content2['gStock'] = item.gStock + content2['enterpriseName'] = item.enteripriseName content2['gName'] = item.gName content2['gNum'] = item.gNum || null content2['topId'] = item.reserveId @@ -262,7 +272,6 @@ } this.stateStockData.push(totalObj) } - console.log(this.stateStockData,'G') }else{ this.$message({ type:'warning', @@ -376,8 +385,8 @@ // columnIndex 代表列数,从0开始计数,我们要合并的字段属于第一列,取0 if(columnIndex ==0 || columnIndex ==1){ return { - rowspan: row.gNum * row.rowNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示 - colspan: row.gNum>0?1:0 // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示 + rowspan: row.gNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示 + colspan: row.rowNum>0?1:0 // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示 }; } if(columnIndex >1 && columnIndex < 7){ -- Gitblit v1.9.2