1、调整导入运单

2、调整对账
This commit is contained in:
2026-09-09 14:43:38 +08:00
parent 6d4961f404
commit f78e61b433
7 changed files with 639 additions and 69 deletions
@@ -316,6 +316,25 @@
empty-text="暂无货物信息"
>
<el-table-column type="index" label="序号" width="70" align="center" fixed="left" />
<el-table-column min-width="220" align="center">
<template #header>
<span class="transport-plan-page__required-column">货物类型</span>
</template>
<template #default="{ row }">
<el-cascader
v-model="row.cargoTypePath"
:options="transportCargoTypeOptions"
:props="transportCargoTypeCascaderProps"
:placeholder="row.cargoType || '请选择'"
clearable
filterable
:disabled="dialogReadonly"
:filter-method="filterBillingCargoType"
@visible-change="visible => visible && ensureBillingCargoTypeOptions()"
@change="value => handleTransportCargoTypeChange(row, value)"
/>
</template>
</el-table-column>
<el-table-column label="货物名称" min-width="240" align="center">
<template #default="{ row }">
<el-autocomplete
@@ -334,31 +353,11 @@
<template #default="{ item }">
<div class="transport-plan-page__cargo-autocomplete-item">
<span>{{ formatBillingCargoTypeLabel(item) }}</span>
<small v-if="item.cargoCode">{{ item.cargoCode }}</small>
</div>
</template>
</el-autocomplete>
</template>
</el-table-column>
<el-table-column min-width="220" align="center">
<template #header>
<span class="transport-plan-page__required-column">货物类型</span>
</template>
<template #default="{ row }">
<el-cascader
v-model="row.cargoTypePath"
:options="transportCargoTypeOptions"
:props="transportCargoTypeCascaderProps"
:placeholder="row.cargoType || '请选择'"
clearable
filterable
:disabled="dialogReadonly"
:filter-method="filterBillingCargoType"
@visible-change="visible => visible && ensureBillingCargoTypeOptions()"
@change="value => handleTransportCargoTypeChange(row, value)"
/>
</template>
</el-table-column>
<el-table-column label="数量" min-width="120" align="center">
<template #default="{ row }">
<el-input
@@ -1494,10 +1493,12 @@
v-model="dispatchItemForm.departureName"
:placeholder="dispatchStationNamePlaceholder"
:suffix-icon="dispatchStationMode ? Search : undefined"
disabled
/>
<el-input
v-model="dispatchItemForm.departureAddress"
:placeholder="dispatchAddressDetailPlaceholder"
disabled
>
<template v-if="!dispatchStationMode" #suffix>
<el-link
@@ -1509,9 +1510,9 @@
</template>
</el-input>
<span class="transport-plan-page__route-label">联系人</span>
<el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" />
<el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" disabled />
<span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" />
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" disabled />
</div>
</el-form-item>
<el-form-item label="收货地址" required>
@@ -1520,10 +1521,12 @@
v-model="dispatchItemForm.arrivalName"
:placeholder="dispatchStationNamePlaceholder"
:suffix-icon="dispatchStationMode ? Search : undefined"
disabled
/>
<el-input
v-model="dispatchItemForm.arrivalAddress"
:placeholder="dispatchAddressDetailPlaceholder"
disabled
>
<template v-if="!dispatchStationMode" #suffix>
<el-link
@@ -1535,9 +1538,9 @@
</template>
</el-input>
<span class="transport-plan-page__route-label">联系人</span>
<el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" />
<el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" disabled />
<span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" />
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" disabled />
</div>
</el-form-item>
</div>
@@ -4849,10 +4852,7 @@ export default {
fetchTaskCargoSuggestions(queryString, callback, path = []) {
const keyword = String(queryString || '').trim();
const normalizedPath = this.normalizeBillingCargoTypePath(path);
if (!keyword && !normalizedPath.length) {
callback([]);
return;
}
//
let loadingKey = '';
this.ensureBillingCargoTypeOptions()
.then(() => {
@@ -4884,11 +4884,42 @@ export default {
if (loadingKey) this.setTaskCargoLoadingByKey(loadingKey, false);
});
},
handleTaskCargoRowSelect(row, item = {}) {
async handleTaskCargoRowSelect(row, item = {}) {
const value = this.formatBillingCargoTypeLabel(item);
row.cargoName = value;
row.specification = item.specification || item.spec || row.specification || '';
row.model = item.model || item.modelName || row.model || '';
//
try {
await this.ensureBillingCargoTypeOptions();
} catch (error) {
console.warn('货物类型树加载失败', error);
this.syncTransportCargoJson();
return;
}
//
const matchedCargoType = this.findBillingCargoTypeOption(item);
if (matchedCargoType?.path?.length) {
//
const fullPath = this.normalizeBillingCargoTypePath(matchedCargoType.path);
row.cargoTypePath = fullPath;
row.cargoType = matchedCargoType.cargoName || row.cargoType || '';
row.cargoTypeCode =
matchedCargoType.cargoCode || matchedCargoType.code || matchedCargoType.id || '';
console.log('货物名称选择后反选货物类型:', {
cargoName: row.cargoName,
cargoType: row.cargoType,
cargoTypePath: row.cargoTypePath,
matchedCargoType: matchedCargoType,
});
} else {
console.warn('未找到匹配的货物类型,item数据:', item);
}
this.syncTransportCargoJson();
},
loadTaskQuantityUnitOptions() {
@@ -6179,6 +6210,49 @@ export default {
null
);
},
findBillingCargoTypeOption(row = {}) {
const path = this.normalizeBillingCargoTypePath(row.cargoTypePath);
if (path.length) {
const pathKey = path.join('/');
const pathMatch = this.billingCargoTypeFlatOptions.find(item => item.path?.join('/') === pathKey);
if (pathMatch) return pathMatch;
}
//
if (row.secondCargoTypeCode) {
const secondMatch = this.billingCargoTypeFlatOptions.find(
item => String(item.cargoCode || item.code || '').trim() === String(row.secondCargoTypeCode).trim()
);
if (secondMatch) {
console.log('通过 secondCargoTypeCode 找到货物类型:', secondMatch);
return secondMatch;
}
}
//
const codeCandidates = [row.cargoTypeCode, row.firstCargoTypeCode]
.map(value => String(value || '').trim())
.filter(Boolean);
const nameCandidates = [
row.secondCargoTypeName,
row.cargoType,
row.goodsType,
row.firstCargoTypeName,
]
.map(value => String(value || '').trim())
.filter(Boolean);
return (
this.billingCargoTypeFlatOptions.find(item =>
codeCandidates.some(
code => code === String(item.cargoCode || item.code || item.id || '').trim()
)
) ||
this.billingCargoTypeFlatOptions.find(item =>
nameCandidates.some(name => name === String(item.cargoName || '').trim())
)
);
},
resolveCommonCargoTypePath(row = {}) {
const path = this.normalizeBillingCargoTypePath(row.cargoTypePath);
if (path.length) return path;