From 07a41ade45c962e93a9d449ce1be0eec52e66a6a Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 19 三月 2025 10:44:32 +0800 Subject: [PATCH] 内部单不能修改报告 --- src/components/view/b1-expenses.vue | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/components/view/b1-expenses.vue b/src/components/view/b1-expenses.vue index 92081fb..d444071 100644 --- a/src/components/view/b1-expenses.vue +++ b/src/components/view/b1-expenses.vue @@ -50,9 +50,9 @@ <div> <el-row class="title"> <el-col :span="12" style="padding-left: 20px;text-align: left;">璐圭敤缁熻</el-col> - <el-col :span="12" style="text-align: right;"> + <!-- <el-col :span="12" style="text-align: right;"> <el-button size="small" type="primary">OA鎺ㄩ��</el-button> - </el-col> + </el-col> --> </el-row> </div> <div class="search"> @@ -84,11 +84,12 @@ </div> <div class="search_thing" style="padding-left: 70px;">鎬讳环锛歿{total}}</div> <div class="search_thing" style="padding-left: 70px;"> - <el-button size="small" type="primary" @click="handleDown" :loading="outLoading">瀵煎嚭</el-button> + <el-button size="small" type="primary" @click="handleDown" :loading="outLoading" v-if="isExport">瀵煎嚭</el-button> </div> </div> <div class="table"> - <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics" :componentData="componentData" :key="upIndex" + <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics" + :componentData="componentData" :key="upIndex" @handleWeave="handleWeave" :column-min-width="'140'"/> </div> </div> @@ -104,11 +105,9 @@ <script> import ValueTable from '../tool/value-table.vue' - import Word from '../tool/word.vue' export default { components: { ValueTable, - Word, }, data() { return { @@ -199,7 +198,8 @@ }, selectField: {}, requiredAdd: [], - requiredUp: [] + requiredUp: [], + needSort: ['createTime', 'sample'], }, entityCopy: {}, upIndex: 0, @@ -218,7 +218,8 @@ current: -1, size: -1, }, - outLoading:false + outLoading:false, + isExport:false } }, mounted() { @@ -241,14 +242,35 @@ } ,responseType: "blob"}).then(res => { this.outLoading = false - this.$message.success('瀵煎嚭鎴愬姛') const blob = new Blob([res],{ type: 'application/octet-stream' }); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - let date = JSON.parse(entity.dates) - link.download = (entity.company?entity.company+' ':'')+date[0]+' - '+date[1]+'璐圭敤缁熻.xlsx'; - link.click(); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, 'utf-8'); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + let date = JSON.parse(entity.dates) + link.download = (entity.company?entity.company+' ':'')+date[0]+' - '+date[1]+'璐圭敤缁熻.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + let date = JSON.parse(entity.dates) + link.download = (entity.company?entity.company+' ':'')+date[0]+' - '+date[1]+'璐圭敤缁熻.xlsx'; + link.click(); + this.$message.success('瀵煎嚭鎴愬姛') + } + } }) }, getTotal(){ @@ -332,6 +354,10 @@ if (power[i].menuMethod == 'addInsOrder') { add = true } + // + if (power[i].menuMethod == 'export') { + this.isExport = true + } } if (!up) { this.componentData.do.splice(4, 1) -- Gitblit v1.9.3