Browse Source

2026-02-03

标签变动记录页面增加导出功能
master
fengyuan_yang 8 months ago
parent
commit
328eaa62d6
  1. 2
      src/views/modules/schedule/order_schedule_expand.vue
  2. 64
      src/views/modules/warehouse/labelTransactionLog.vue

2
src/views/modules/schedule/order_schedule_expand.vue

@ -1805,7 +1805,7 @@ export default {
const exportParams = {
...this.pageData,
page: 1,
limit: -1 // -1表示查询所有数据
limit: 999999 // 使用大数字代替-1,SQL Server的FETCH子句不支持负数
}
excel.exportTable({

64
src/views/modules/warehouse/labelTransactionLog.vue

@ -240,6 +240,7 @@
<script>
import { labelTransactionLogList, labelTransactionLogRetry } from '@/api/warehouse/labelTransactionLog.js'
import { getSiteAndBuByUserName2 } from '@/api/qc/qc.js'
import excel from '@/utils/excel-util.js' // 导入导出工具类
export default {
data() {
@ -281,7 +282,32 @@ export default {
pageIndex: 1,
pageSize: 20,
totalPage: 0,
userBuList: []
userBuList: [],
// 导出列配置
exportColumnList: [
{ columnProp: 'buNo', columnLabel: 'BU', headerAlign: 'center', align: 'center', columnWidth: 80 },
{ columnProp: 'transactionId', columnLabel: '变动单号', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'documentType', columnLabel: '变动类型', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'documentNo', columnLabel: '通知单号', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'orderNo', columnLabel: '关联单号', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'orderLineNo', columnLabel: '关联单行号', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'rollNo', columnLabel: '标签条码', headerAlign: 'center', align: 'left', columnWidth: 180 },
{ columnProp: 'rollQty', columnLabel: '变动数量', headerAlign: 'center', align: 'right', columnWidth: 100 },
{ columnProp: 'batchNo', columnLabel: '合约号码', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'partNo', columnLabel: '物料编码', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'partDesc', columnLabel: '物料名称', headerAlign: 'center', align: 'left', columnWidth: 180 },
{ columnProp: 'spec', columnLabel: '规格型号', headerAlign: 'center', align: 'left', columnWidth: 120 },
{ columnProp: 'warehouseId', columnLabel: '仓库编码', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'warehouseName', columnLabel: '仓库名称', headerAlign: 'center', align: 'left', columnWidth: 120 },
{ columnProp: 'locationId', columnLabel: '库位编码', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'locationName', columnLabel: '库位名称', headerAlign: 'center', align: 'left', columnWidth: 120 },
{ columnProp: 'syncedFlag', columnLabel: '传输状态', headerAlign: 'center', align: 'center', columnWidth: 90 },
{ columnProp: 'syncedTime', columnLabel: '传输时间', headerAlign: 'center', align: 'center', columnWidth: 160 },
{ columnProp: 'syncedErrorMsg', columnLabel: '传输消息', headerAlign: 'center', align: 'left', columnWidth: 150 },
{ columnProp: 'bomItemNo', columnLabel: 'Bom行号', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'transactionBy', columnLabel: '操作员', headerAlign: 'center', align: 'center', columnWidth: 100 },
{ columnProp: 'transactionDate', columnLabel: '变动日期', headerAlign: 'center', align: 'center', columnWidth: 160 }
]
}
},
computed: {
@ -411,7 +437,41 @@ export default {
// 导出数据
exportData() {
this.$message.info('导出功能开发中...')
// 构造导出参数(与查询一致,但不分页)
const exportParams = {
buNo: this.searchData.buNo,
documentType: this.activeTab === 'all' ? this.searchData.documentType : this.activeTab,
rollNo: this.searchData.rollNo,
partNo: this.searchData.partNo,
partDesc: this.searchData.partDesc,
spec: this.searchData.spec,
startDate: this.searchData.startDate || '',
endDate: this.searchData.endDate || '',
transactionId: this.searchData.transactionId,
documentNo: this.searchData.documentNo,
orderNo: this.searchData.orderNo,
orderLineNo: this.searchData.orderLineNo,
syncedFlag: this.searchData.syncedFlag,
userName: this.$store.state.user.name,
page: 1,
limit: 999999 // 使用大数字代替-1,SQL Server的FETCH子句不支持负数
}
// 根据当前页签生成文件名
const tabName = this.activeTab === 'all' ? '全部' : this.activeTab
const fileName = `标签变动记录_${tabName}_${this.dayjs().format('YYYYMMDDHHmmss')}.xlsx`
// 使用excel工具类导出
excel.exportTable({
url: '/warehouse/labelTransactionLog/list', // 使用list接口,传limit=999999导出所有数据
columnMapping: this.exportColumnList, // 使用导出列配置
mergeSetting: [], // 需要合并的列
params: exportParams, // 查询参数
fileName: fileName, // 文件名
rowFetcher: res => res.data.page.list, // 数据提取路径
columnFormatter: [], // 列格式化
dropColumns: [] // 不需要剔除的列
})
},
// 每页数量变化

Loading…
Cancel
Save