问题修复

This commit is contained in:
hongchao 2025-10-20 19:59:45 +08:00
parent 033771ff6c
commit 1f73f483e0
3 changed files with 320 additions and 34 deletions

View File

@ -102,7 +102,6 @@
<span v-if="row.pushStatus == 0">未推送</span>
<span v-else-if="row.pushStatus == 1">已推送</span>
<span v-else-if="row.pushStatus == 2">已退回</span>
<span v-else-if="row.pushStatus == 3">进行中</span>
</template>
</el-table-column>
<!-- 操作 -->
@ -160,7 +159,7 @@ import { getProjectList, getUnitList, getAgreementInfoById } from '@/api/back/in
import { getConsumPushCheckList, getConsumPushCheckListCount, submitPushSafetyConsumeCosts,getConsumeDetailsListApi } from '@/api/costPush/costPush'
import TreeSelect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import ExcelJS from 'exceljs';
export default {
components: { TreeSelect },
data() {
@ -189,13 +188,12 @@ export default {
{ label: '未推送', value: '0' },
{ label: '已推送', value: '1' },
{ label: '已退回', value: '2' },
{ label: '进行中', value: '3' }
], //
total: 0, //
//
tableColumns: [
{ label: '协议编号', prop: 'agreementCode' },
{ label: '单位名称', prop: 'unitName' },
{ label: 'i8工程编号', prop: 'pc_no' },
{ label: '工程名称', prop: 'projectName' },
{ label: '推送月份', prop: 'month' },
{ label: '消耗品费用', prop: 'leaseMoney' },
@ -359,18 +357,151 @@ export default {
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`
},
//
handleExport() {
try {
let fileName = `安全工器具费用推送_${this.formatTime(new Date())}.xLsx`
let url = '/material/backstage/costPush/exportConsPushCheck'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
},
/** 外层导出 */
async handleExport() {
if (!this.tableList || this.tableList.length === 0) {
this.$modal.msgWarning('没有可导出的数据');
return;
}
try {
// 簿
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('消耗性费用推送审核记录');
//
const columns = [
{ header: '序号', key: 'index', width: 8 },
{ header: '协议编号', key: 'agreementCode', width: 18 },
{ header: '单位名称', key: 'unitName', width: 20 },
{ header: '工程名称', key: 'projectName', width: 20 },
{ header: '推送月份', key: 'month', width: 12 },
{ header: '消耗品费用(元)', key: 'leaseMoney', width: 12 },
{ header: '推送状态', key: 'pushStatus', width: 12 },
{ header: '推送备注', key: 'pushRemark', width: 12 },
];
worksheet.columns = columns;
//
const headerStyle = {
font: { bold: true, color: { argb: 'FFFFFFFF' }, size: 11 },
fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF4472C4' } },
alignment: { horizontal: 'center', vertical: 'center', wrapText: true },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
const dataStyle = {
alignment: { horizontal: 'center', vertical: 'center' },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
const totalStyle = {
font: { bold: true, size: 11 },
fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFF8F8F9' } },
alignment: { horizontal: 'center', vertical: 'center' },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
worksheet.getRow(1).eachCell((cell) => {
cell.style = headerStyle;
});
//
const dataRows = this.tableList;
dataRows.forEach((row, index) => {
const dataRow = {
index: index + 1,
agreementCode: row.agreementCode || '',
unitName: row.unitName || '',
projectName: row.projectName || '',
month: this.originalMonthTrue || row.month || '',
leaseMoney: row.leaseMoney ? parseFloat(row.leaseMoney) : 0,
pushStatus: row.pushStatus == 1 ? '已推送' : row.pushStatus == 0 ? '未推送' : '已退回',
pushRemark: row.pushRemark || '',
};
const newRow = worksheet.addRow(dataRow);
//
newRow.eachCell((cell) => {
cell.style = dataStyle;
});
// 2
newRow.getCell(6).numFmt = '0.00'; //
});
//
const totalRow = this.tableList[this.tableList.length - 1];
const totalDataRow = {
index: '合计',
agreementCode: '',
unitName: '',
projectName: '',
month: '',
leaseMoney: this.totalCost ? parseFloat(this.totalCost) : 0,
pushStatus: '',
pushRemark: ''
};
const newTotalRow = worksheet.addRow(totalDataRow);
//
newTotalRow.eachCell((cell) => {
cell.style = totalStyle;
});
//
newTotalRow.getCell(6).numFmt = '0.00'; //
//
const fileName = `消耗性费用推送审核记录_${new Date().toISOString().slice(0, 10)}.xlsx`;
// Excel
const buffer = await workbook.xlsx.writeBuffer();
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
//
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', fileName);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// URL
URL.revokeObjectURL(url);
this.$modal.msgSuccess('Excel导出成功');
} catch (error) {
console.error('导出Excel失败:', error);
this.$modal.msgError('导出Excel失败请稍后重试');
}
},
submit() {
this.ids = this.ids.filter(id => id != null)
console.log("xxxxxxxxxxxxxxx",this.ids)

View File

@ -109,7 +109,6 @@
<span v-if="row.pushStatus == 0">未推送</span>
<span v-else-if="row.pushStatus == 1">已推送</span>
<span v-else-if="row.pushStatus == 2">已退回</span>
<span v-else-if="row.pushStatus == 3">进行中</span>
</template>
</el-table-column>
<!-- 操作 -->
@ -190,7 +189,7 @@ import { getProjectList, getUnitList, getAgreementInfoById } from '@/api/back/in
import { getCostPushCheckList, getCostPushCheckListCount, submitPushSafetyCosts,getCostPushLeaseListApi } from '@/api/costPush/costPush'
import TreeSelect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import ExcelJS from 'exceljs';
export default {
components: { TreeSelect },
data() {
@ -219,13 +218,12 @@ export default {
{ label: '未推送', value: '0' },
{ label: '已推送', value: '1' },
{ label: '已退回', value: '2' },
{ label: '进行中', value: '3' }
], //
total: 0, //
//
tableColumns: [
{ label: '协议编号', prop: 'agreementCode' },
{ label: '单位名称', prop: 'unitName' },
{ label: 'i8工程编号', prop: 'pc_no' },
{ label: '工程名称', prop: 'projectName' },
{ label: '推送月份', prop: 'month' },
{ label: '租赁费用', prop: 'leaseMoney' },
@ -439,17 +437,171 @@ export default {
return `${year}${month}${day}_${hours}${minutes}${seconds}`
},
//
handleExport() {
try {
let fileName = `机具费用推送_${this.formatTime(new Date())}.xLsx`
let url = '/material/backstage/costPush/exportPushCheck'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
},
// handleExport() {
// try {
// let fileName = `_${this.formatTime(new Date())}.xLsx`
// let url = '/material/backstage/costPush/exportPushCheck'
// const params = { ...this.queryParams }
// console.log('🚀 ~ ~ params:', params)
// this.download(url, params, fileName)
// } catch (error) {
// console.log('', error)
// }
// },
/** 外层导出 */
async handleExport() {
if (!this.tableList || this.tableList.length === 0) {
this.$modal.msgWarning('没有可导出的数据');
return;
}
try {
// 簿
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('消耗性费用推送审核记录');
//
const columns = [
{ header: '序号', key: 'index', width: 8 },
{ header: '协议编号', key: 'agreementCode', width: 18 },
{ header: '单位名称', key: 'unitName', width: 20 },
{ header: '工程名称', key: 'projectName', width: 20 },
{ header: '推送月份', key: 'month', width: 12 },
{ header: '租赁费用(元)', key: 'leaseMoney', width: 18 },
{ header: '报废费用(元)', key: 'scrapMoney', width: 18 },
{ header: '丢失费用(元)', key: 'lostMoney', width: 18 },
{ header: '合计费用(元)', key: 'money', width: 18 },
{ header: '推送状态', key: 'pushStatus', width: 12 },
{ header: '推送备注', key: 'pushRemark', width: 12 },
];
worksheet.columns = columns;
//
const headerStyle = {
font: { bold: true, color: { argb: 'FFFFFFFF' }, size: 11 },
fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FF4472C4' } },
alignment: { horizontal: 'center', vertical: 'center', wrapText: true },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
const dataStyle = {
alignment: { horizontal: 'center', vertical: 'center' },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
const totalStyle = {
font: { bold: true, size: 11 },
fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFF8F8F9' } },
alignment: { horizontal: 'center', vertical: 'center' },
border: {
top: { style: 'thin', color: { argb: 'FF000000' } },
bottom: { style: 'thin', color: { argb: 'FF000000' } },
left: { style: 'thin', color: { argb: 'FF000000' } },
right: { style: 'thin', color: { argb: 'FF000000' } }
}
};
//
worksheet.getRow(1).eachCell((cell) => {
cell.style = headerStyle;
});
//
const dataRows = this.tableList;
dataRows.forEach((row, index) => {
const dataRow = {
index: index + 1,
agreementCode: row.agreementCode || '',
unitName: row.unitName || '',
projectName: row.projectName || '',
month: this.originalMonthTrue || row.month || '',
leaseMoney: row.leaseMoney ? parseFloat(row.leaseMoney) : 0,
scrapMoney: row.scrapMoney? parseFloat(row.scrapMoney) : 0,
lostMoney: row.lostMoney? parseFloat(row.lostMoney) : 0,
money: row.money? parseFloat(row.money) : 0,
pushStatus: row.pushStatus == 1 ? '已推送' : row.pushStatus == 0 ? '未推送' : '已退回',
pushRemark: row.pushRemark || '',
};
const newRow = worksheet.addRow(dataRow);
//
newRow.eachCell((cell) => {
cell.style = dataStyle;
});
// 2
newRow.getCell(6).numFmt = '0.00'; //
});
//
const totalDataRow = {
index: '合计',
agreementCode: '',
unitName: '',
projectName: '',
month: '',
leaseMoney: this.totalData.leaseMoney? parseFloat(this.totalData.leaseMoney) : 0,
scrapMoney: this.totalData.scrapMoney? parseFloat(this.totalData.scrapMoney) : 0,
lostMoney: this.totalData.lostMoney? parseFloat(this.totalData.lostMoney) : 0,
money: this.totalData.money ? parseFloat(this.totalData.money) : 0,
pushStatus: '',
pushRemark: ''
};
const newTotalRow = worksheet.addRow(totalDataRow);
//
newTotalRow.eachCell((cell) => {
cell.style = totalStyle;
});
//
newTotalRow.getCell(6).numFmt = '0.00'; //
//
const fileName = `租赁费用推送审核记录_${new Date().toISOString().slice(0, 10)}.xlsx`;
// Excel
const buffer = await workbook.xlsx.writeBuffer();
const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
//
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', fileName);
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// URL
URL.revokeObjectURL(url);
this.$modal.msgSuccess('Excel导出成功');
} catch (error) {
console.error('导出Excel失败:', error);
this.$modal.msgError('导出Excel失败请稍后重试');
}
},
submit() {
this.ids = this.ids.filter(id => id != null)
console.log("xxxxxxxxxxxxxxx",this.ids)

View File

@ -960,7 +960,8 @@ export default {
{ header: '丢失费用(元)', key: 'lostMoney', width: 18 },
{ header: '合计费用(元)', key: 'money', width: 18 },
{ header: '是否结算', key: 'isSettlement', width: 12 },
{ header: '是否审核', key: 'checkStatus', width: 12 }
{ header: '推送状态', key: 'pushStatus', width: 12 },
{ header: '推送备注', key: 'pushRemark', width: 12 },
];
worksheet.columns = columns;
@ -1023,7 +1024,8 @@ export default {
lostMoney: row.lostMoney ? parseFloat(row.lostMoney) : 0,
money: row.money ? parseFloat(row.money) : 0,
isSettlement: row.isSettlement === 1 || row.isSettlement === 2 ? '已结算' : '未结算',
checkStatus: row.checkStatus === 1 ? '已审核' : '未审核'
pushStatus: row.pushStatus == 1 ? '已推送' : row.pushStatus == 0 ? '未推送' : '已退回',
pushRemark: row.pushRemark || '',
};
const newRow = worksheet.addRow(dataRow);
@ -1056,7 +1058,8 @@ export default {
lostMoney: totalRow.lostMoney ? parseFloat(totalRow.lostMoney) : 0,
money: totalRow.money ? parseFloat(totalRow.money) : 0,
isSettlement: '',
checkStatus: ''
pushStatus: '',
pushRemark: ''
};
const newTotalRow = worksheet.addRow(totalDataRow);