调整基础数据、车船务、项目、合同

This commit is contained in:
2026-09-03 22:40:11 +08:00
parent 024e77801e
commit c63c7c3e33
43 changed files with 821 additions and 239 deletions
@@ -52,7 +52,7 @@
:value="item.value" /></el-select></el-form-item
></el-col>
<el-col :span="8"
><el-form-item label="默认方案"
><el-form-item
><el-checkbox v-model="draft.defaultPlan" :disabled="readonly">默认方案</el-checkbox
><el-tooltip content="同一运输方式仅支持配置一个默认计费方案" placement="top">
<el-icon class="billing-plan-editor__default-tip"
@@ -103,12 +103,28 @@
filterable
:disabled="!row.feeType"
:loading="feeItemLoadingMap[feeTypeKey(row)]"
@change="value => handleFeeItemChange(row, value)"
><el-option
v-for="item in feeItemOptions(row)"
:key="item.id || item.name || item.englishName"
:label="item.name || item.englishName"
:value="item.name || item.englishName" /></el-select></template
></el-table-column>
<el-table-column label="税率" width="180"
><template #default="{ row }"
><span v-if="readonly">{{ formatTaxRate(row.taxRate) }}</span
><el-input
v-else
v-model="row.taxRate"
inputmode="decimal"
maxlength="6"
clearable
placeholder="请输入"
@input="value => taxRateInput(row, value)"
><template #append>%</template></el-input
></template
></el-table-column
>
<el-table-column label="计费要素" width="170"
><template #default="{ row }"
><span v-if="readonly">{{ displayValue(row.billingElement) }}</span
@@ -372,6 +388,7 @@ const clone = value => JSON.parse(JSON.stringify(value));
const defaultRule = () => ({
feeType: '',
feeItem: '',
taxRate: '',
billingElement: '',
billingType: '',
billingUnit: '',
@@ -467,7 +484,6 @@ export default {
label: 'cargoName',
value: 'id',
children: 'children',
disabled: (data, node) => node.level === 1,
leaf: 'leaf',
checkStrictly: true,
emitPath: true,
@@ -622,27 +638,64 @@ export default {
feeItemOptions(row) {
return this.feeItems[this.feeTypeKey(row)] || [];
},
formatTaxRate(value) {
return value === undefined || value === null || value === '' ? '-' : `${value}%`;
},
loadRuleItems() {
(this.draft.rules || []).forEach(row => this.loadFeeItems(row.feeType));
},
loadFeeItems(value) {
const key = this.feeTypeKey({ feeType: value });
if (!key || this.feeItems[key]) return;
if (!key) return;
if (this.feeItems[key]) {
this.fillLoadedRuleTaxRates(key);
return;
}
this.feeItemLoadingMap[key] = true;
getFeeItemList(1, 9999, { feeCategory: key })
.then(res => {
const data = res?.data?.data || res?.data || {};
this.feeItems[key] = Array.isArray(data) ? data : data.records || [];
this.fillLoadedRuleTaxRates(key);
})
.finally(() => {
this.feeItemLoadingMap[key] = false;
});
},
fillLoadedRuleTaxRates(key) {
(this.draft.rules || [])
.filter(row => this.feeTypeKey(row) === key)
.forEach(row => this.fillRuleTaxRate(row));
},
handleFeeTypeChange(row, value) {
row.feeType = this.feeTypeKey({ feeType: value });
row.feeItem = '';
row.taxRate = '';
this.loadFeeItems(row.feeType);
},
handleFeeItemChange(row, value) {
row.feeItem = value;
const feeItem = this.feeItemOptions(row).find(
item => String(item.name || item.englishName || '') === String(value || '')
);
row.taxRate = this.hasTaxRate(feeItem?.taxRate) ? String(feeItem.taxRate) : '';
},
fillRuleTaxRate(row) {
if (this.hasTaxRate(row.taxRate) || !row.feeItem) return;
const feeItem = this.feeItemOptions(row).find(
item => String(item.name || item.englishName || '') === String(row.feeItem)
);
if (this.hasTaxRate(feeItem?.taxRate)) row.taxRate = String(feeItem.taxRate);
},
hasTaxRate(value) {
return value !== undefined && value !== null && String(value).trim() !== '';
},
taxRateInput(row, value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
row.taxRate =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
},
billingTypes(row) {
return this.typeMap[row.billingElement] || [];
},
@@ -771,6 +824,7 @@ export default {
const required = [
['feeType', '费用类型'],
['feeItem', '费用项'],
['taxRate', '税率'],
['billingElement', '计费要素'],
['billingType', '计费类型'],
['billingUnit', '计费单位'],
@@ -789,6 +843,13 @@ export default {
return false;
}
feeItemSet.add(feeItem);
if (this.hasTaxRate(row.taxRate)) {
const taxRate = Number(row.taxRate);
if (!/^\d+(\.\d{1,2})?$/.test(String(row.taxRate)) || taxRate < 0 || taxRate > 100) {
this.$message.warning(`第${i + 1}行税率必须在0到100之间且最多保留2位小数`);
return false;
}
}
if (
!this.usesRangeUnitPrice(row) &&
(row.unitPrice === undefined ||
@@ -803,8 +864,9 @@ export default {
return false;
}
if (!this.canEditLimit(row)) continue;
const key = row.billingElement;
groups[key] = groups[key] || [];
const billingElement = String(row.billingElement).trim();
const key = JSON.stringify([feeItem, billingElement]);
groups[key] = groups[key] || { feeItem, billingElement, ranges: [] };
for (const range of this.getRanges(row)) {
const lower = Number(range.lowerLimit);
const upper = Number(range.upperLimit);
@@ -830,22 +892,24 @@ export default {
this.$message.warning('计费要素下限不能大于上限');
return false;
}
groups[key].push({ lower, upper });
groups[key].ranges.push({ lower, upper });
}
}
return this.validateRangeGroups(groups);
},
validateRangeGroups(groups) {
const precision = 0.000001;
for (const [element, ranges] of Object.entries(groups)) {
for (const { feeItem, billingElement, ranges } of Object.values(groups)) {
const sorted = [...ranges].sort((a, b) => a.lower - b.lower || a.upper - b.upper);
for (let i = 1; i < sorted.length; i += 1) {
if (sorted[i].lower < sorted[i - 1].upper - precision) {
this.$message.warning(`${element}的计费要素区间不能重叠`);
this.$message.warning(`费用项“${feeItem}”${billingElement}的计费要素区间不能重叠`);
return false;
}
if (sorted[i].lower > sorted[i - 1].upper + precision) {
this.$message.warning(`${element}的计费要素区间必须连续,不能存在间隙`);
this.$message.warning(
`费用项“${feeItem}”${billingElement}的计费要素区间必须连续,不能存在间隙`
);
return false;
}
}
@@ -1078,25 +1142,27 @@ export default {
},
matchCargoChange(value) {
const path =
Array.isArray(value) && value.length >= 2
Array.isArray(value) && value.length
? value.slice(0, 2).map(item => String(item))
: [];
const item = this.cargoFlatOptions.find(
option => String(option.id) === String(path[1]) && option.path?.length >= 2
option =>
option.path?.length === path.length &&
option.path.every((itemValue, index) => String(itemValue) === path[index])
);
this.matchForm.cargoTypePath = path;
this.matchForm.cargoType = item ? this.cargoLabels(path).join('/') : '';
this.matchForm.cargoTypeCode = item ? item.cargoCode || item.code || item.id : '';
},
resolveCargoPath(condition) {
if (Array.isArray(condition.cargoTypePath) && condition.cargoTypePath.length >= 2)
return condition.cargoTypePath;
if (Array.isArray(condition.cargoTypePath) && condition.cargoTypePath.length)
return condition.cargoTypePath.slice(0, 2).map(item => String(item));
const item = this.cargoFlatOptions.find(
option =>
option.path?.length >= 2 &&
(String(option.cargoCode || option.code || option.id) ===
String(condition.cargoTypeCode) ||
option.cargoName === condition.cargoType)
option.cargoName === condition.cargoType ||
this.cargoLabels(option.path).join('/') === condition.cargoType)
);
return item?.path || [];
},
@@ -1089,7 +1089,7 @@
class="business-crud-page__freight-form business-crud-page__freight-form--road"
>
<template v-for="(cargo, index) in transportCargoRows" :key="index">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
v-model="cargo.unitPrice"
placeholder="请输入"
@@ -1115,7 +1115,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`">
<el-form-item label="数量合计">
<el-input :model-value="taskFullFreightQuantity(index)" disabled>
<template #append>
<el-select
@@ -1132,7 +1132,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`运费${index + 1}`">
<el-form-item label="运费">
<el-input
:model-value="taskFullFreightAmount(cargo)"
placeholder="请输入运费"
@@ -1674,7 +1674,7 @@
class="business-crud-page__freight-form business-crud-page__freight-form--road"
>
<template v-for="(row, index) in shippingTemplateFreight.freightItems" :key="index">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
v-model="row.unitPrice"
placeholder="请输入"
@@ -1701,7 +1701,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`">
<el-form-item label="数量合计">
<el-input :model-value="shippingTemplateRoadFreightQuantity(index)" disabled>
<template #append>
<el-select
@@ -1718,7 +1718,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`运费${index + 1}`">
<el-form-item label="运费">
<el-input :model-value="shippingTemplateRoadFreightAmount(row, index)" disabled>
<template #suffix>{{ shippingTemplateCurrencyLabel }}</template>
</el-input>
@@ -3799,7 +3799,7 @@
class="business-crud-page__dispatch-item-grid business-crud-page__dispatch-item-grid--full"
>
<template v-for="(cargo, index) in dispatchItemCargoRows" :key="cargo._key || index">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
v-model="cargo.unitPrice"
placeholder="请输入"
@@ -3819,12 +3819,12 @@
></template>
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`"
<el-form-item label="数量合计"
><el-input :model-value="formatDispatchQuantity(cargo.quantity)" disabled
><template #append>{{ cargo.quantityUnit || '吨' }}</template></el-input
></el-form-item
>
<el-form-item :label="`运费${index + 1}`"
<el-form-item label="运费"
><el-input :model-value="dispatchCargoFreightAmount(cargo)" disabled
><template #suffix>{{ dispatchItemFreightCurrencyLabel }}</template></el-input
></el-form-item
@@ -112,21 +112,21 @@
<el-form :model="route" label-position="right" label-width="auto" class="dispatch-form freight-form">
<el-row v-for="(group, index) in freightGroups(route)" :key="group.key" :gutter="16">
<el-col :span="6">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input :model-value="freightGroupUnitPrice(group)" inputmode="decimal" placeholder="请输入" @input="value => handleFreightGroupUnitPriceInput(group, value)" @clear="() => handleFreightGroupUnitPriceInput(group, '')">
<template #append><el-select :model-value="freightGroupPriceUnit(group)" class="freight-unit-select" @change="value => handleFreightGroupPriceUnitChange(group, value)"><el-option label="元/吨" value="元/吨" /><el-option label="元/件" value="元/件" /><el-option label="元/方" value="元/方" /></el-select></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="`数量${index + 1}`">
<el-form-item label="数量">
<el-input :model-value="formatQuantity(freightGroupQuantity(group))" readonly>
<template #append><el-select :model-value="group.quantityUnit" class="freight-unit-select" @change="value => handleFreightGroupQuantityUnitChange(route, group, value)"><el-option v-for="unit in quantityUnitOptions" :key="unit" :label="unit" :value="unit" /></el-select></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="`运费${index + 1}`">
<el-form-item label="运费">
<el-input :model-value="formatAmount(freightGroupAmount(group))" readonly><template #suffix>{{ currencyLabel(route.currency) }}</template></el-input>
</el-form-item>
</el-col>
@@ -366,7 +366,7 @@
v-for="(item, index) in shippingTemplateFreight.freightItems"
:key="item.quantityUnit || `empty-${index}`"
>
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
v-model="item.unitPrice"
:disabled="dialogReadonly"
@@ -387,7 +387,7 @@
></template>
</el-input>
</el-form-item>
<el-form-item :label="`运费${index + 1}`"
<el-form-item label="运费"
><el-input
:model-value="freightAmount(item)"
placeholder="请输入"
@@ -643,12 +643,12 @@
>
<template v-if="detailTransportMode === 'road'">
<template v-for="(item, index) in detailFreightItems" :key="item.quantityUnit || index">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input :model-value="item.unitPrice || '-'" disabled>
<template #append>{{ item.priceUnit || '-' }}</template>
</el-input>
</el-form-item>
<el-form-item :label="`运费${index + 1}`">
<el-form-item label="运费">
<el-input :model-value="item.freightAmount || '-'" disabled>
<template #append>{{ detailFreight.currency || '-' }}</template>
</el-input>
@@ -1544,15 +1544,10 @@
</el-form-item>
</div>
<div
class="dialog-section-title dialog-section-title--action"
style="display: flex; width: 100%; justify-content: space-between"
>
<span class="transport-plan-page__dispatch-task-title">任务信息</span>
<div class="transport-plan-page__dispatch-mode-switch">
<el-segmented
v-model="dispatchItemForm.taskEntryMode"
:options="dispatchTaskEntryModeOptions"
class="transport-plan-page__dispatch-entry-mode"
@change="handleDispatchTaskEntryModeChange"
/>
</div>
@@ -1709,7 +1704,7 @@
class="transport-plan-page__dispatch-item-grid transport-plan-page__dispatch-item-grid--full"
>
<template v-for="(group, index) in dispatchItemFreightGroups" :key="group.key">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
:model-value="dispatchFreightGroupUnitPrice(group)"
placeholder="请输入"
@@ -1731,12 +1726,12 @@
></template>
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`"
<el-form-item label="数量合计"
><el-input :model-value="dispatchFreightGroupQuantity(group)" disabled
><template #append>{{ group.quantityUnit || '吨' }}</template></el-input
></el-form-item
>
<el-form-item :label="`运费${index + 1}`"
<el-form-item label="运费"
><el-input :model-value="dispatchFreightGroupAmount(group)" disabled
><template #suffix>{{ dispatchItemFreightCurrencyLabel }}</template></el-input
></el-form-item
@@ -1758,6 +1753,9 @@
</div>
</template>
<template v-else>
<div class="dialog-section-title transport-plan-page__dispatch-task-content-title">
任务信息
</div>
<div
class="transport-plan-page__dispatch-item-grid transport-plan-page__dispatch-item-grid--compact"
>
@@ -1982,10 +1980,9 @@
<div
v-if="dispatchItemForm.taskEntryMode === 'full'"
class="dialog-section-title transport-plan-page__dispatch-carrier-title"
style="display: flex; width: 100%; margin-top: 16px"
class="dialog-section-title transport-plan-page__dispatch-task-content-title"
>
承运信息
任务信息
</div>
<div
v-if="dispatchItemForm.taskEntryMode === 'full'"
@@ -8224,15 +8221,13 @@ export default {
);
}
&__dispatch-carrier-title {
flex-basis: 100%;
&__dispatch-mode-switch {
display: flex;
justify-content: flex-start;
width: 100%;
margin-top: 16px;
}
&__dispatch-task-title {
margin-right: auto;
}
&__route-label {
color: #606266;
font-size: 14px;
@@ -153,6 +153,15 @@
<template v-if="config.enableProjectSelect" #projectName-label>项目</template>
<template #relationNo-label>
<span class="waybill-manage-page__label-with-info">
<span>关联单号</span>
<el-tooltip content="仅做关联标记,用于业务中子母单情况" placement="top">
<el-icon class="waybill-manage-page__info-icon"><InfoFilled /></el-icon>
</el-tooltip>
</span>
</template>
<template #projectName-form>
<el-select
v-model="selectedProjectId"
@@ -353,10 +362,7 @@
</template>
<template #taskInfoTitle-form>
<div
class="dialog-section-title dialog-section-title--action waybill-manage-page__task-title"
>
<span>任务信息</span>
<div class="waybill-manage-page__task-mode-switch">
<el-segmented
v-model="form.taskEntryMode"
:options="taskEntryModeOptions"
@@ -561,6 +567,7 @@
</el-table>
</div>
</div>
<div class="dialog-section-title waybill-manage-page__task-content-title">任务信息</div>
<el-form
:model="form"
label-position="right"
@@ -1033,7 +1040,12 @@
</el-form>
<div class="waybill-manage-page__subsection">
<div class="waybill-manage-page__subsection-head">
<span>运费信息</span>
<span class="waybill-manage-page__label-with-info">
<span>运费信息</span>
<el-tooltip content="可选填写,仅做记录,不影响应付结算" placement="top">
<el-icon class="waybill-manage-page__info-icon"><InfoFilled /></el-icon>
</el-tooltip>
</span>
</div>
<el-form
:model="form"
@@ -1042,7 +1054,7 @@
class="waybill-manage-page__freight-form waybill-manage-page__freight-form--road"
>
<template v-for="(group, index) in taskFreightGroups" :key="group.key">
<el-form-item :label="`单价${index + 1}`">
<el-form-item label="单价">
<el-input
:model-value="taskFullFreightGroupUnitPrice(group)"
placeholder="请输入"
@@ -1072,7 +1084,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`">
<el-form-item label="数量合计">
<el-input :model-value="taskFullFreightGroupQuantity(group)" disabled>
<template #append>
<el-select
@@ -1089,7 +1101,7 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="`运费${index + 1}`">
<el-form-item label="运费">
<el-input
:model-value="taskFullFreightGroupAmount(group)"
placeholder="请输入运费"
@@ -1120,8 +1132,14 @@
</el-form>
</div>
</div>
<div
v-if="!isTaskFullMode"
class="dialog-section-title waybill-manage-page__task-content-title"
>
任务信息
</div>
<el-form
v-else
v-if="!isTaskFullMode"
:model="form"
label-position="right"
label-width="auto"
@@ -2781,7 +2799,7 @@ import { openImportDialog } from '@/utils/import-excel';
import { applyTableMenuWidth } from '@/utils/table-menu';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { Location, OfficeBuilding, Rank, Search } from '@element-plus/icons-vue';
import { InfoFilled, Location, OfficeBuilding, Rank, Search } from '@element-plus/icons-vue';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
import {
@@ -2943,6 +2961,7 @@ export default {
components: {
WaybillImportDialog,
PageAvueForm,
InfoFilled,
Rank,
ElImageViewer,
OpenFileViewer,
@@ -7808,8 +7827,7 @@ export default {
}
&__shipping-title,
&__goods-title,
&__task-title {
&__goods-title {
min-width: 100%;
}
@@ -7833,6 +7851,20 @@ export default {
width: 100%;
}
&__task-mode-switch {
display: flex;
justify-content: flex-start;
width: 100%;
}
&__task-content-title {
margin-bottom: 16px;
}
&__task-full &__task-content-title {
margin-top: 16px;
}
&__task-form {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
@@ -7870,7 +7902,6 @@ export default {
&__task-form--full {
display: block;
margin-top: 16px;
}
&__task-row {
@@ -7909,6 +7940,18 @@ export default {
grid-column: span 1;
}
&__label-with-info {
display: inline-flex;
gap: 4px;
align-items: center;
white-space: nowrap;
}
&__info-icon {
color: #909399;
cursor: help;
}
&__task-carrier-type {
:deep(.el-form-item__content) {
flex: 0 1 260px;
@@ -7949,16 +7992,6 @@ export default {
}
}
// 运单独立表单的任务信息:标题靠左,短字段保持与里程输入框一致的宽度。
:global(.waybill-manage-page--form-page .waybill-manage-page__task-title) {
justify-content: flex-start !important;
text-align: left;
}
:global(.waybill-manage-page--form-page .waybill-manage-page__task-title > .el-segmented) {
margin-left: auto;
}
:global(
.waybill-manage-page--form-page
.waybill-manage-page__task-form