问题修复
This commit is contained in:
parent
033771ff6c
commit
1f73f483e0
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue