更新库存查询和仓储汇总页面

This commit is contained in:
Developer
2026-06-04 08:36:53 +08:00
parent 197603483d
commit 833cd016ff
2 changed files with 131 additions and 17 deletions

View File

@@ -63,7 +63,10 @@
</el-row>
</div>
<div style="margin-top: 20px">
<h3 style="margin-bottom: 10px">{{ currentDetail }}详情</h3>
<div style="display: flex; align-items: center; margin-bottom: 10px">
<h3 style="margin: 0">{{ currentDetail }}详情</h3>
<el-button v-if="currentDetail === '生产中'" type="primary" size="mini" style="margin-left: 15px" @click="exportProductionDetail">导出</el-button>
</div>
<el-table
v-loading="loading"
:data="detailData"
@@ -99,6 +102,8 @@
<script>
import { mapGetters } from 'vuex'
import XLSX from 'xlsx'
import FileSaver from 'file-saver'
export default {
data() {
@@ -576,6 +581,46 @@ export default {
]
this.loading = false
})
},
// 导出生产中详情
exportProductionDetail() {
if (!this.生产中全部数据 || this.生产中全部数据.length === 0) {
this.$message.warning('暂无数据可导出')
return
}
var header = ['补货单号', '物料名称', '补货数量', '入库数', '状态', '补货日期', '补货期限', '期限状态', '超期时间(天)']
var data = this.生产中全部数据.map(item => {
return [
item.补货单号 || '',
item.名称 || '',
item.补货数 || '',
item.入库数 || '',
item.状态 || '',
item.补货日期 || '',
item.补货期限 || '',
item.期限状态 || '',
item.超期时间 || ''
]
})
// 添加空行和统计汇总
data.push([])
data.push(['统计汇总', '', '', '', '', '', '', '', ''])
data.push(['正常', this.生产中统计.正常, '', '', '', '', '', '', ''])
data.push(['临期', this.生产中统计.临期, '', '', '', '', '', '', ''])
data.push(['超期', this.生产中统计.超期, '', '', '', '', '', '', ''])
data.push(['总计', this.statistics.生产中, '', '', '', '', '', '', ''])
data.unshift(header)
var ws = XLSX.utils.aoa_to_sheet(data)
// 设置列宽
ws['!cols'] = [
{ wch: 15 }, { wch: 20 }, { wch: 10 }, { wch: 10 },
{ wch: 10 }, { wch: 15 }, { wch: 15 }, { wch: 10 }, { wch: 12 }
]
var wb = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(wb, ws, '生产中详情')
var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: false, type: 'array' })
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '生产中详情.xlsx')
}
}
}