From 998aeac196a90d16ce4810927586de8f890cd79d Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Tue, 4 Nov 2025 17:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=85=A8=E9=83=A8=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=EF=BC=8C=E7=BB=93=E7=AE=97=E6=9D=83=E9=99=90=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/countersign/countersign.js | 42 +++ .../business/businessHandling/directApply.vue | 11 +- .../cost/component/lostReportHome.vue | 110 ++------ .../cost/component/repairReportHome.vue | 111 ++------ .../cost/component/scrapReportHome.vue | 110 ++------ .../material/cost/component/unreportHome.vue | 118 ++------- src/views/material/costConfig/index.vue | 243 ++++++++++++++++++ 7 files changed, 370 insertions(+), 375 deletions(-) create mode 100644 src/views/material/costConfig/index.vue diff --git a/src/api/countersign/countersign.js b/src/api/countersign/countersign.js index 55442419..8ee89f94 100644 --- a/src/api/countersign/countersign.js +++ b/src/api/countersign/countersign.js @@ -114,3 +114,45 @@ export function delConfig(id) { method: 'post' }) } + +/** + * + ***************************************************************************************************************************************************** + * + */ + +// 结算人员配置列表接口 +export function getCostConfigListApi(query) { + return request({ + url: '/material/sysWorkflowType/costConfigList', + method: 'get', + params: query + }) +} + +// 人员信息列表接口 +export function getCostConfigUserListApi(query) { + return request({ + url: '/material/sysWorkflowType/costConfigUserList', + method: 'get', + params: query + }) +} + +// 结算人员配置--修改 +export function editCostConfigApi(data) { + return request({ + url: '/material/sysWorkflowType/updateCostConfig', + method: 'post', + data: data + }) +} + +// 结算人员配置--删除 +export function deleteCostConfigApi(data) { + return request({ + url: '/material/sysWorkflowType/deleteCostConfig', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/src/views/business/businessHandling/directApply.vue b/src/views/business/businessHandling/directApply.vue index ddd440e8..35120bdf 100644 --- a/src/views/business/businessHandling/directApply.vue +++ b/src/views/business/businessHandling/directApply.vue @@ -864,6 +864,7 @@ export default { findLeaf(this.lessUniteList) if (leafNodes.length === 1) { this.maForm.leaseUnitId = leafNodes[0].id || leafNodes[0].value + console.log("kkkkkkkkkkkkkkkk",this.maForm.leaseUnitId) await this.getLeaseAgreementId() } } catch (e) { @@ -1043,10 +1044,12 @@ export default { }, async getLeaseAgreementId() { try { + console.log("xxxxxxxxxxxxxxxx222yyyyyyyyyyyyyy",this.maForm) const params = { unitId: this.maForm.leaseUnitId, projectId: this.maForm.leaseProId } + console.log("zzzzzzzzzyyyyyyyyyy",params) const res = await getAgreement(params) console.log('🚀 ~ getAgreementId ~ res:', res) this.maForm.leaseAgreementId = res.data.agreementId @@ -1093,7 +1096,9 @@ export default { // this.maForm.backProId = null // }) // }, 500) - this.getAgreementId() + setTimeout(() => { + this.getAgreementId() + }, 500); }, projectChange(val) { setTimeout(() => { @@ -1116,7 +1121,9 @@ export default { // getListUnite({}).then(res => { // this.leaseUniteList = res.data // }) - this.getLeaseAgreementId() + setTimeout(() => { + this.getLeaseAgreementId(); + }, 500); // }, 500) }, //获取任务详情--- 编辑回显数据 diff --git a/src/views/material/cost/component/lostReportHome.vue b/src/views/material/cost/component/lostReportHome.vue index 6b20a7b3..dc9835cf 100644 --- a/src/views/material/cost/component/lostReportHome.vue +++ b/src/views/material/cost/component/lostReportHome.vue @@ -64,7 +64,7 @@ @@ -276,98 +276,24 @@ export default { return; } - try { - // 定义Excel列配置 - const columns = [ - { key: 'index', title: '序号' }, - { key: 'agreementCode', title: '协议号' }, - { key: 'unitName', title: '结算单位' }, - { key: 'projectName', title: '结算工程' }, - { key: 'typeName', title: '机具名称' }, - { key: 'modelName', title: '规格型号' }, - { key: 'mtUnitName', title: '单位' }, - { key: 'num', title: '丢失数量' }, - { key: 'buyPrice', title: '单价(元)' }, - { key: 'cost', title: '丢失费用(元)' } - ]; + const formatTime = (date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}${month}${day}_${hours}${minutes}${seconds}`; + }; - // 准备Excel数据 - const excelData = []; - - // 添加表头 - const headerRow = columns.map(col => col.title); - excelData.push(headerRow); - - // 添加数据行 - this.tableList.forEach((row, index) => { - const dataRow = columns.map(col => { - if (col.key === 'index') { - return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1; - } else if (col.key === 'buyPrice') { - // 处理单价字段格式 - return row.buyPrice ? parseFloat(row.buyPrice.toFixed(2)) : 0.00; - } else if (col.key === 'cost') { - // 处理丢失费用字段格式,计算buyPrice * num - const cost = (row.buyPrice || 0) * (row.num || 0); - return parseFloat(cost.toFixed(3)); - } else { - return row[col.key] || ''; - } - }); - excelData.push(dataRow); - }); - - // 创建工作簿和工作表 - const workbook = XLSX.utils.book_new(); - const worksheet = XLSX.utils.aoa_to_sheet(excelData); - - // 设置列宽 - const columnWidths = [ - { wch: 8 }, // 序号 - { wch: 20 }, // 协议号 - { wch: 15 }, // 结算单位 - { wch: 20 }, // 结算工程 - { wch: 20 }, // 机具名称 - { wch: 15 }, // 规格型号 - { wch: 8 }, // 单位 - { wch: 10 }, // 丢失数量 - { wch: 12 }, // 单价 - { wch: 15 } // 丢失费用 - ]; - worksheet['!cols'] = columnWidths; - - // 添加工作表到工作簿 - XLSX.utils.book_append_sheet(workbook, worksheet, '丢失费用报表'); - - // 生成文件名(包含日期范围) - let fileName = '丢失费用报表'; - if (this.queryParams.startTime && this.queryParams.endTime) { - fileName += `_${this.queryParams.startTime}_至_${this.queryParams.endTime}`; - } - fileName += `_${new Date().toISOString().slice(0, 10)}.xlsx`; - - // 生成Excel文件并下载 - const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); - const blob = new Blob([excelBuffer], { 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失败,请稍后重试'); - } + const currentTime = formatTime(new Date()); + this.download( + '/material/slt_agreement_info/exportLostList', + { + ...this.queryParams, + }, + `丢失费用报表_${currentTime}.xlsx` + ) }, }, } diff --git a/src/views/material/cost/component/repairReportHome.vue b/src/views/material/cost/component/repairReportHome.vue index a71b6197..5392f152 100644 --- a/src/views/material/cost/component/repairReportHome.vue +++ b/src/views/material/cost/component/repairReportHome.vue @@ -57,14 +57,13 @@ - + - { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}${month}${day}_${hours}${minutes}${seconds}`; + }; - try { - // 定义Excel列配置 - const columns = [ - { key: 'index', title: '序号' }, - { key: 'agreementCode', title: '协议号' }, - { key: 'unitName', title: '结算单位' }, - { key: 'projectName', title: '结算工程' }, - { key: 'typeName', title: '机具名称' }, - { key: 'modelName', title: '规格型号' }, - { key: 'mtUnitName', title: '单位' }, - { key: 'num', title: '维修数量' }, - { key: 'costs', title: '维修费用(元)' }, - { key: 'repairType', title: '维修方式' }, - { key: 'partType', title: '费用类型' }, - { key: 'remark', title: '备注' } - ]; + const currentTime = formatTime(new Date()); + this.download( + '/material/slt_agreement_info/exportRepairList', + { + ...this.queryParams, + }, + `维修费用报表_${currentTime}.xlsx` + ) - // 准备Excel数据 - const excelData = []; - - // 添加表头 - const headerRow = columns.map(col => col.title); - excelData.push(headerRow); - - // 添加数据行 - this.tableList.forEach((row, index) => { - const dataRow = columns.map(col => { - if (col.key === 'index') { - return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1; - } else if (col.key === 'costs') { - // 处理费用字段格式 - return row.costs ? parseFloat(row.costs.toFixed(2)) : 0.00; - } else { - return row[col.key] || ''; - } - }); - excelData.push(dataRow); - }); - - // 创建工作簿和工作表 - const workbook = XLSX.utils.book_new(); - const worksheet = XLSX.utils.aoa_to_sheet(excelData); - - // 设置列宽 - const columnWidths = [ - { wch: 8 }, // 序号 - { wch: 20 }, // 协议号 - { wch: 15 }, // 结算单位 - { wch: 20 }, // 结算工程 - { wch: 20 }, // 机具名称 - { wch: 15 }, // 规格型号 - { wch: 8 }, // 单位 - { wch: 10 }, // 维修数量 - { wch: 15 }, // 维修费用 - { wch: 12 }, // 维修方式 - { wch: 12 }, // 费用类型 - { wch: 20 } // 备注 - ]; - worksheet['!cols'] = columnWidths; - - // 添加工作表到工作簿 - XLSX.utils.book_append_sheet(workbook, worksheet, '维修费用报表'); - - // 生成文件名(包含日期范围) - let fileName = '维修费用报表'; - if (this.queryParams.startTime && this.queryParams.endTime) { - fileName += `_${this.queryParams.startTime}_至_${this.queryParams.endTime}`; - } - fileName += `_${new Date().toISOString().slice(0, 10)}.xlsx`; - - // 生成Excel文件并下载 - const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); - const blob = new Blob([excelBuffer], { 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失败,请稍后重试'); - } }, }, } diff --git a/src/views/material/cost/component/scrapReportHome.vue b/src/views/material/cost/component/scrapReportHome.vue index 1eb0ecb9..08e12547 100644 --- a/src/views/material/cost/component/scrapReportHome.vue +++ b/src/views/material/cost/component/scrapReportHome.vue @@ -57,12 +57,11 @@ - + - { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}${month}${day}_${hours}${minutes}${seconds}`; + }; - try { - // 定义Excel列配置 - const columns = [ - { key: 'index', title: '序号' }, - { key: 'agreementCode', title: '协议号' }, - { key: 'unitName', title: '结算单位' }, - { key: 'projectName', title: '结算工程' }, - { key: 'typeName', title: '机具名称' }, - { key: 'modelName', title: '机具规格' }, - { key: 'mtUnitName', title: '单位' }, - { key: 'num', title: '报废数量' }, - { key: 'cost', title: '报废费用(元)' }, - { key: 'remark', title: '备注' } - ]; - - // 准备Excel数据 - const excelData = []; - - // 添加表头 - const headerRow = columns.map(col => col.title); - excelData.push(headerRow); - - // 添加数据行 - this.tableList.forEach((row, index) => { - const dataRow = columns.map(col => { - if (col.key === 'index') { - return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1; - } else if (col.key === 'cost') { - // 处理费用字段格式 - return row.cost ? parseFloat(row.cost.toFixed(2)) : 0.00; - } else { - return row[col.key] || ''; - } - }); - excelData.push(dataRow); - }); - - // 创建工作簿和工作表 - const workbook = XLSX.utils.book_new(); - const worksheet = XLSX.utils.aoa_to_sheet(excelData); - - // 设置列宽 - const columnWidths = [ - { wch: 8 }, // 序号 - { wch: 20 }, // 协议号 - { wch: 15 }, // 结算单位 - { wch: 20 }, // 结算工程 - { wch: 20 }, // 机具名称 - { wch: 15 }, // 机具规格 - { wch: 8 }, // 单位 - { wch: 10 }, // 报废数量 - { wch: 15 }, // 报废费用 - { wch: 20 } // 备注 - ]; - worksheet['!cols'] = columnWidths; - - // 添加工作表到工作簿 - XLSX.utils.book_append_sheet(workbook, worksheet, '报废费用报表'); - - // 生成文件名(包含日期范围) - let fileName = '报废费用报表'; - if (this.queryParams.startTime && this.queryParams.endTime) { - fileName += `_${this.queryParams.startTime}_至_${this.queryParams.endTime}`; - } - fileName += `_${new Date().toISOString().slice(0, 10)}.xlsx`; - - // 生成Excel文件并下载 - const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }); - const blob = new Blob([excelBuffer], { 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失败,请稍后重试'); - } + const currentTime = formatTime(new Date()); + this.download( + '/material/slt_agreement_info/exportScrapList', + { + ...this.queryParams, + }, + `报废费用报表_${currentTime}.xlsx` + ) }, }, } diff --git a/src/views/material/cost/component/unreportHome.vue b/src/views/material/cost/component/unreportHome.vue index dc319dd5..9bc7e99d 100644 --- a/src/views/material/cost/component/unreportHome.vue +++ b/src/views/material/cost/component/unreportHome.vue @@ -110,9 +110,9 @@ - +