增加产线错误日志打印,分析问题

This commit is contained in:
syruan 2025-10-30 10:49:56 +08:00
parent 0bde50e6fa
commit 15e6e5c85b
2 changed files with 387 additions and 1 deletions

View File

@ -292,5 +292,50 @@ export function viewRepairCodeApi(query) {
})
}
// 查询历史报表列表(按年月)
export function getHistoryReportList(query) {
return request({
url: '/material/slt_agreement_info/getHistoryReportList',
method: 'get',
params: query
})
}
// 查询历史租赁费用详情
export function getHistoryLeaseCostDetails(query) {
return request({
url: '/material/slt_agreement_info/getHistoryLeaseCostDetails',
method: 'get',
params: query
})
}
// 查询历史维修费用详情
export function getHistoryRepairCostDetails(query) {
return request({
url: '/material/slt_agreement_info/getHistoryRepairCostDetails',
method: 'get',
params: query
})
}
// 查询历史丢失费用详情
export function getHistoryLoseCostDetails(query) {
return request({
url: '/material/slt_agreement_info/getHistoryLoseCostDetails',
method: 'get',
params: query
})
}
// 查询历史报废费用详情
export function getHistoryScrapCostDetails(query) {
return request({
url: '/material/slt_agreement_info/getHistoryScrapCostDetails',
method: 'get',
params: query
})
}

View File

@ -27,6 +27,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button>
<el-button type="success" icon="el-icon-download" size="mini" @click="exportExcel" :disabled="tableList.length === 0">导出Excel</el-button>
<el-button type="success" icon="el-icon-download" size="mini" @click="exportZip" :disabled="tableList.length === 0">批量导出ZIP</el-button>
<el-button type="info" icon="el-icon-document-copy" size="mini" @click="showHistoryReportDialog">查看历史报表</el-button>
</el-form-item>
</el-form>
@ -330,6 +331,209 @@
<el-button @click="costDetailVisible = false">关闭</el-button>
</div>
</el-dialog>
<!-- 历史报表选择弹窗 -->
<el-dialog
title="查看历史报表"
:visible.sync="historyReportDialogVisible"
width="50%"
top="5vh"
:close-on-click-modal="false">
<el-form :model="historyReportParams" size="small" label-width="100px">
<el-form-item label="选择年月">
<el-date-picker
v-model="historyReportParams.yearMonth"
type="month"
placeholder="选择年月"
format="yyyy年MM月"
value-format="yyyy-MM"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="queryHistoryReport">查询</el-button>
<el-button @click="historyReportDialogVisible = false">关闭</el-button>
</div>
</el-dialog>
<!-- 历史报表列表弹窗 -->
<el-dialog
:title="historyReportTitle"
:visible.sync="historyReportListVisible"
width="90%"
top="5vh"
:close-on-click-modal="false">
<el-table v-loading="historyReportLoading" :data="historyReportList" border stripe :max-height="600">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="协议号" align="center" prop="agreementCode" :show-overflow-tooltip="true"/>
<el-table-column label="结算单位" align="center" prop="unitName" />
<el-table-column label="结算工程" align="center" prop="projectName" />
<el-table-column label="结算类型" align="center" prop="settlementType" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.settlementType === 1" effect="plain">工器具</el-tag>
<el-tag type="warning" v-if="scope.row.settlementType === 2" effect="plain">安全工器具</el-tag>
<el-tag v-if="scope.row.settlementType == null || scope.row.settlementType === 0" effect="plain">总费用</el-tag>
</template>
</el-table-column>
<el-table-column label="租赁费用" align="center" prop="leaseCost" width="100">
<template slot-scope="scope">
<el-button
type="text"
@click="showHistoryCostDetail(scope.row, 'lease')"
:style="{color: scope.row.leaseCost > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.leaseCost > 0)">
{{ scope.row.leaseCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="维修费用" align="center" prop="repairCost" width="100">
<template slot-scope="scope">
<el-button
type="text"
@click="showHistoryCostDetail(scope.row, 'repair')"
:style="{color: scope.row.repairCost > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.repairCost > 0)">
{{ scope.row.repairCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="丢失费用" align="center" prop="loseCost" width="100">
<template slot-scope="scope">
<el-button
type="text"
@click="showHistoryCostDetail(scope.row, 'lose')"
:style="{color: scope.row.loseCost > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.loseCost > 0)">
{{ scope.row.loseCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="报废费用" align="center" prop="scrapCost" width="100">
<template slot-scope="scope">
<el-button
type="text"
@click="showHistoryCostDetail(scope.row, 'scrap')"
:style="{color: scope.row.scrapCost > 0 ? '#409EFF' : '#606266'}"
:disabled="!(scope.row.scrapCost > 0)">
{{ scope.row.scrapCost || 0 }}
</el-button>
</template>
</el-table-column>
<el-table-column label="合计费用(元)" align="center" prop="costs" width="120">
<template slot-scope="scope">
<span>{{ calculateTotalCost(scope.row).toFixed(2) }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="historyReportListVisible = false">关闭</el-button>
</div>
</el-dialog>
<!-- 历史费用详情弹窗 -->
<el-dialog
:title="historyCostDetailTitle"
:visible.sync="historyCostDetailVisible"
width="80%"
top="5vh"
:close-on-click-modal="false">
<!-- 历史租赁费用详情表格 -->
<el-table
v-if="historyCostDetailType === 'lease'"
v-loading="historyCostDetailLoading"
:data="historyCostDetailList"
border
stripe
height="500">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="单价(元)" align="center" prop="unitPrice" width="100" />
<el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" />
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" />
<el-table-column label="退还日期" align="center" prop="returnDate" width="120" />
<el-table-column label="天数" align="center" prop="days" width="80" />
<el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
</template>
</el-table-column>
</el-table>
<!-- 历史维修费用详情表格 -->
<el-table
v-if="historyCostDetailType === 'repair'"
v-loading="historyCostDetailLoading"
:data="historyCostDetailList"
border
stripe
height="500">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="机具名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="维修数量" align="center" prop="repairQuantity" width="100" />
<el-table-column label="是否收费" align="center" prop="partType" width="100">
<template slot-scope="scope">
<span v-if="scope.row.partType === '收费'">收费</span>
<span v-else-if="scope.row.partType === '不收费'">不收费</span>
<span v-else>{{ scope.row.partType || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修费用(元)" align="center" prop="cost" width="120">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
</template>
</el-table-column>
</el-table>
<!-- 历史丢失费用详情表格 -->
<el-table
v-if="historyCostDetailType === 'lose'"
v-loading="historyCostDetailLoading"
:data="historyCostDetailList"
border
stripe
height="500">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="机具名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="丢失数量" align="center" prop="loseQuantity" width="100" />
<el-table-column label="丢失费用(元)" align="center" prop="cost" width="120">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
</template>
</el-table-column>
</el-table>
<!-- 历史报废费用详情表格 -->
<el-table
v-if="historyCostDetailType === 'scrap'"
v-loading="historyCostDetailLoading"
:data="historyCostDetailList"
border
stripe
height="500">
<el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="机具名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="机具规格" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="报废数量" align="center" prop="scrapQuantity" width="100" />
<el-table-column label="报废费用(元)" align="center" prop="cost" width="120">
<template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="historyCostDetailVisible = false">关闭</el-button>
</div>
</el-dialog>
</div>
</template>
@ -339,7 +543,7 @@ import {
getUnitList,
getAgreementInfoById, getUnitListFilterTeam,
} from '@/api/back/index.js'
import {getSltList, costExamine, getSltReportedList, getSltReportList} from '@/api/cost/cost'
import {getSltList, costExamine, getSltReportedList, getSltReportList, getHistoryReportList, getHistoryLeaseCostDetails, getHistoryRepairCostDetails, getHistoryLoseCostDetails, getHistoryScrapCostDetails} from '@/api/cost/cost'
import { toChineseAmount } from '@/utils/bonus.js'
import vueEasyPrint from "vue-easy-print";
import Treeselect from "@riophae/vue-treeselect";
@ -421,6 +625,22 @@ export default {
costDetailTitle: '',
costDetailList: [],
costDetailType: '', //
//
historyReportDialogVisible: false,
historyReportListVisible: false,
historyReportLoading: false,
historyReportTitle: '',
historyReportList: [],
historyReportParams: {
yearMonth: null,
},
//
historyCostDetailVisible: false,
historyCostDetailLoading: false,
historyCostDetailTitle: '',
historyCostDetailList: [],
historyCostDetailType: '', //
currentHistoryRow: {}, //
}
},
created() {
@ -1018,6 +1238,127 @@ export default {
return leaseCost + repairCost + loseCost + scrapCost - reductionCost;
},
//
showHistoryReportDialog() {
this.historyReportParams.yearMonth = null;
this.historyReportDialogVisible = true;
},
//
queryHistoryReport() {
if (!this.historyReportParams.yearMonth) {
this.$message.error('请选择年月');
return;
}
this.historyReportLoading = true;
const params = {
yearMonth: this.historyReportParams.yearMonth
};
getHistoryReportList(params).then((response) => {
this.historyReportList = response.rows || [];
this.historyReportTitle = `${this.historyReportParams.yearMonth}历史报表`;
this.historyReportDialogVisible = false;
this.historyReportListVisible = true;
this.historyReportLoading = false;
}).catch(() => {
this.historyReportLoading = false;
});
},
//
showHistoryCostDetail(row, costType) {
this.currentHistoryRow = row;
const costTypeMap = {
'lease': '租赁费用',
'repair': '维修费用',
'lose': '丢失费用',
'scrap': '报废费用'
};
this.historyCostDetailTitle = `${costTypeMap[costType]}详情 - ${row.agreementCode}`;
this.historyCostDetailType = costType;
this.historyCostDetailVisible = true;
this.historyCostDetailLoading = true;
this.historyCostDetailList = [];
//
const params = {
agreementId: row.agreementId,
yearMonth: this.historyReportParams.yearMonth
};
let apiCall;
switch (costType) {
case 'lease':
apiCall = getHistoryLeaseCostDetails(params);
break;
case 'repair':
apiCall = getHistoryRepairCostDetails(params);
break;
case 'lose':
apiCall = getHistoryLoseCostDetails(params);
break;
case 'scrap':
apiCall = getHistoryScrapCostDetails(params);
break;
default:
this.historyCostDetailLoading = false;
return;
}
apiCall.then((response) => {
const sourceList = response.rows || [];
//
this.historyCostDetailList = sourceList.map(item => {
const baseData = {
name: item.typeName || '',
model: item.modelName || '',
unit: item.mtUnitName || '',
cost: item.costs || 0,
costType: costType
};
//
if (costType === 'lease') {
return {
...baseData,
unitPrice: item.leasePrice || 0,
quantity: item.num || 0,
returnQuantity: item.backNum || 0,
leaseDate: item.startTime || '',
returnDate: item.endTime || '',
days: item.leaseDays || 0
};
} else if (costType === 'repair') {
return {
...baseData,
repairQuantity: item.num || 0,
partType: item.partType
};
} else if (costType === 'lose') {
return {
...baseData,
loseQuantity: item.num || 0
};
} else if (costType === 'scrap') {
return {
...baseData,
scrapQuantity: item.num || 0
};
}
return baseData;
});
this.historyCostDetailLoading = false;
}).catch(() => {
this.historyCostDetailLoading = false;
});
},
},
}
</script>