This commit is contained in:
xuyuncong 2025-11-14 17:58:09 +08:00
parent caa20e195e
commit acebf9911d
3 changed files with 131 additions and 13 deletions

View File

@ -107,6 +107,7 @@
<el-table-column type="selection" width="80" align="center"/>
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="配件添加人" align="center" prop="addUserName" width="180"/>
<el-table-column label="售价" align="center" prop="salePrice" width="180"/>
<el-table-column label="领料数量" v-if="type" align="center" prop="waresCount" width="180">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"

View File

@ -315,6 +315,7 @@
<el-button
size="mini"
type="text"
:class="{ 'gray-text': scope.row.ifBilled == '1' }"
icon="el-icon-tickets"
@click="scope.row.ifBilled == '1' ? showBilled(scope.row) : unbilled(scope.row)"
>
@ -1176,6 +1177,11 @@ export default {
</script>
<style scoped lang="scss">
/* 已开票按钮文字置灰样式 */
.gray-text {
color: #909399 !important;
}
.item {
.item__input {
display: none;

View File

@ -13,6 +13,16 @@
<div slot="header" class="clearfix">
<i class="el-icon-plus" />
<span>工单信息</span>
<!-- A/B单切换控件仅在存在B单时显示 -->
<el-switch
v-if="hasBOrder"
style="float: right; padding: 3px 0"
v-model="showABMode"
active-text="显示A+B单"
inactive-text="仅显示A单"
@change="handleModeChange"
>
</el-switch>
</div>
<!-- 卡片内容 -->
<div>
@ -208,6 +218,9 @@
<div slot="header" class="clearfix">
<i class="el-icon-plus" />
<span>合计</span>
<span v-if="hasBOrder && showABMode" style="float: right; color: #409EFF; font-size: 14px;">
包含A+B单
</span>
</div>
<div>
<el-descriptions
@ -267,12 +280,12 @@
<div class="button-container">
<PrintButton
ref="printButton"
print-title="打印结算单"
print-title="结算单"
@click="handlePrint"
>
<template #printContent>
<div class="print-content">
<h1 style="text-align: center">打印结算单</h1>
<h1 style="text-align: center">结算单</h1>
<h2>工单信息</h2>
<table
class="print-table"
@ -693,7 +706,13 @@ export default {
totalCount: 0,
totalMoney: 0,
otherInfo: {},
loading: false //
loading: false, //
// A/B
showABMode: false, // AB
hasBOrder: false, // B
bprojects: [], // B
bwares: [], // B
bother: [] // B
};
},
methods: {
@ -705,13 +724,21 @@ export default {
this.reset();
this.loading = true; //
getTicketsById(row.id).then(res => {
this.allList = res.data.items;
this.computed();
this.projects = this.allList.filter((item) => item.project);
this.wares = this.allList.filter((item) => item.ware);
this.others = this.allList.filter((item) => item.other);
// A
this.allList = res.data.items || [];
this.info = row;
this.otherInfo = res.data;
// BAPIB
const bItems = res.data.bitems || [];
this.hasBOrder = bItems && bItems.length > 0;
this.bprojects = bItems.filter((item) => item.project);
this.bwares = bItems.filter((item) => item.ware);
this.bother = bItems.filter((item) => item.other);
//
this.updateDisplayData();
this.dialogVisible = true;
this.loading = false; //
resolve();
@ -726,22 +753,106 @@ export default {
await updateShow(this.info.id, this.info.partShow);
} catch {}
},
// A/B
handleModeChange() {
//
this.updateDisplayData();
},
// B
updateDisplayData() {
// A
let displayProjects = this.allList.filter((item) => item.project);
let displayWares = this.allList.filter((item) => item.ware);
let displayOthers = this.allList.filter((item) => item.other);
// ABB
if (this.showABMode) {
// B
if (this.bprojects && this.bprojects.length > 0) {
displayProjects = [...displayProjects, ...this.bprojects];
}
// B
if (this.bwares && this.bwares.length > 0) {
displayWares = [...displayWares, ...this.bwares];
}
// B
if (this.bother && this.bother.length > 0) {
displayOthers = [...displayOthers, ...this.bother];
}
}
//
this.projects = displayProjects;
this.wares = displayWares;
this.others = displayOthers;
//
this.computed();
},
reset() {
this.info = {};
this.projects = [];
this.wares = [];
this.others = [];
this.allList = [];
this.showABMode = false;
this.hasBOrder = false;
this.bprojects = [];
this.bwares = [];
this.bother = [];
},
computed() {
this.totalCount = 0;
this.totalMoney = 0;
if (this.allList && this.allList.length > 0) {
this.totalCount = this.allList.reduce((acc, cur) => {
return acc + cur.itemCount;
// 使
let itemsToCalculate = [...this.allList];
// ABB
if (this.showABMode) {
// B
if (this.bprojects && this.bprojects.length > 0) {
this.bprojects.forEach(project => {
itemsToCalculate.push({
...project,
itemCount: project.itemCount || 0,
itemMoney: project.itemMoney || 0
});
});
}
// B
if (this.bwares && this.bwares.length > 0) {
this.bwares.forEach(ware => {
itemsToCalculate.push({
...ware,
itemCount: ware.itemCount || 0,
itemMoney: ware.itemMoney || 0
});
});
}
// B
if (this.bother && this.bother.length > 0) {
this.bother.forEach(other => {
itemsToCalculate.push({
...other,
itemCount: other.itemCount || 0,
itemMoney: other.itemMoney || 0
});
});
}
}
//
if (itemsToCalculate && itemsToCalculate.length > 0) {
this.totalCount = itemsToCalculate.reduce((acc, cur) => {
return acc + (cur.itemCount || 0);
}, 0);
this.totalMoney = this.allList.reduce((acc, cur) => {
return acc + cur.itemMoney;
this.totalMoney = itemsToCalculate.reduce((acc, cur) => {
return acc + (cur.itemMoney || 0);
}, 0);
}
},