From 34ec919649adfefeecd0418284dd7b02e9ed49b8 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期三, 23 四月 2025 15:42:17 +0800 Subject: [PATCH] 添加批发仓库监测预警 --- src/views/warehouse/stockAnalyse.vue | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/views/warehouse/stockAnalyse.vue b/src/views/warehouse/stockAnalyse.vue index 9cc28ed..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> @@ -106,7 +106,7 @@ <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right"> <template slot-scope="scope" v-if="scope.row.storehouseName !== '本库区合计' && scope.row.storehouseName !== '合计'"> <el-button type="text" @click="showEnterprises(scope.row)">查看详情</el-button> - <el-button type="text" @click="delData(scope.row)">删除</el-button> +<!-- <el-button type="text" @click="delData(scope.row)">删除</el-button>--> </template> </el-table-column> </el-table> @@ -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) }) } }) } - console.log(gData,'gData') if(Array.isArray(gData)){ gData.map(item=>{ if(Array.isArray(item.storehouse.warehouses) && item.storehouse.whTotal){ @@ -212,8 +221,10 @@ item.storehouse.warehouses.map((subRes, subIndex)=>{ let content2 = {} content2 = subRes - content2['gId'] = item.enterpriseId + 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 @@ -237,6 +248,7 @@ topId: null, reserveName: total.name, gId: null, + ggId: null, gName: total.name, gStock: total.enterpriseTotalStock, storehouseName: total.name, @@ -281,7 +293,7 @@ showEnterprises(row){ const t = this - t.$refs.enterStock.open(row) + t.$refs.enterStock.open(row,'汇总') }, openStock(type,data){ @@ -373,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