1、调整凭证

2、调整运单
This commit is contained in:
2026-09-08 17:50:34 +08:00
parent a7315b4491
commit cba2ad3b3b
43 changed files with 5730 additions and 1119 deletions
@@ -301,7 +301,7 @@
>
<span>货物信息</span>
<div v-if="!dialogReadonly" class="transport-plan-page__section-actions">
<el-link type="primary" @click="cargoImportBox = true">导入货物</el-link>
<!-- <el-link type="primary" @click="cargoImportBox = true">导入货物</el-link> -->
<el-link type="primary" @click="openCommonCargoDialog">常用货物</el-link>
</div>
</div>
@@ -526,7 +526,7 @@
v-model="attachmentRows"
:readonly="dialogReadonly"
:file-types="attachmentFileTypes"
:max-size="500"
:max-size="50"
:show-file-list="false"
button-text="上传附件"
@change="handleAttachmentChange"
@@ -681,10 +681,8 @@
<div class="transport-plan-page__transport-plan-detail-route-point">
<b class="is-start"></b>
<div>
<strong>{{
detailRow.departureName || detailRow.departureAddress || '-'
}}</strong>
<p>{{ formatTransportPlanProvinceCityDistrict(detailRow.departureAddress) }}</p>
<strong>{{ formatTransportPlanDetailRouteName('departure') }}</strong>
<p>{{ detailRow.departureAddress || '-' }}</p>
<p>
{{
[detailRow.departureContact, detailRow.departurePhone]
@@ -698,8 +696,8 @@
<div class="transport-plan-page__transport-plan-detail-route-point">
<b class="is-end"></b>
<div>
<strong>{{ detailRow.arrivalName || detailRow.arrivalAddress || '-' }}</strong>
<p>{{ formatTransportPlanProvinceCityDistrict(detailRow.arrivalAddress) }}</p>
<strong>{{ formatTransportPlanDetailRouteName('arrival') }}</strong>
<p>{{ detailRow.arrivalAddress || '-' }}</p>
<p>
{{
[detailRow.arrivalContact, detailRow.arrivalPhone]
@@ -1558,7 +1556,7 @@
>
<span>货物信息</span>
<div class="transport-plan-page__section-actions">
<el-link type="primary" @click="cargoImportBox = true">导入货物</el-link>
<!-- <el-link type="primary" @click="cargoImportBox = true">导入货物</el-link> -->
<el-link type="primary" @click="openCommonCargoDialog">常用货物</el-link>
</div>
</div>
@@ -2201,7 +2199,7 @@
<vehicle-attachment-upload
v-model="dispatchItemAttachmentRows"
:file-types="attachmentFileTypes"
:max-size="500"
:max-size="50"
:show-file-list="false"
button-text="上传附件"
@change="handleDispatchItemAttachmentChange"
@@ -2518,7 +2516,10 @@
搜索
</el-button>
</div>
<div ref="transportAmap" class="transport-plan-page__map"></div>
<div class="map-picker-content">
<map-search-results :results="transportMapSearchResults" @select="selectTransportMapSearchResult" />
<div ref="transportAmap" class="transport-plan-page__map"></div>
</div>
<div class="transport-plan-page__map-info">
<span>{{ transportMapStatus }}</span>
<span v-if="transportMapSelected.regionName"
@@ -2689,7 +2690,10 @@ import { getList as getCargoTypeList } from '@/api/base/cargo-type';
import { getList as getPortTerminalList } from '@/api/base/port-terminal';
import { getList as getRailwayStationList } from '@/api/base/railway-station';
import { getList as getCommonCargoList } from '@/api/business/common-cargo';
import { getList as getContractList } from '@/api/business/contract-manage';
import {
getDetail as getContractDetail,
getList as getContractList,
} from '@/api/business/contract-manage';
import {
getDetail as getProjectDetail,
getList as getProjectList,
@@ -2945,7 +2949,7 @@ const defaultDispatchRow = () => ({
remark: '',
});
const taskCarrierTypes = ['承运商', '自运', '网货平台'];
const taskCarrierTypes = ['承运商', '自运'];
export default {
components: {
@@ -3121,6 +3125,7 @@ export default {
transportMapKeyword: '',
transportMapStatus: '可搜索地址或点击地图选点',
transportMapSelected: {},
transportMapSearchResults: [],
transportAmap: null,
transportAmapMarker: null,
transportAmapGeocoder: null,
@@ -3446,7 +3451,7 @@ export default {
return this.isDispatchCarrierRequired(this.dispatchItemForm.carrierType);
},
dispatchCarrierLabel() {
return this.dispatchItemForm.carrierType === '网货平台' ? '承运方' : '承运商';
return '承运商';
},
dispatchCarrierSelection: {
get() {
@@ -3790,6 +3795,34 @@ export default {
const cityMatch = text.match(/市/);
return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
},
formatTransportPlanRoadCityDistrict(value) {
const text = String(value || '').trim();
if (!text) return '-';
const cityMatch = text.match(/市/);
if (!cityMatch) return this.formatTransportPlanProvinceCityDistrict(text);
const cityEnd = cityMatch.index + 1;
const cityWithProvince = text.slice(0, cityEnd);
const city =
cityWithProvince.match(/(?:省|自治区|特别行政区)([^省]+市)$/)?.[1] || cityWithProvince;
const districtText = text.slice(cityEnd);
const districtMatch = districtText.match(
/^(?:.*(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗))/
);
if (!districtMatch) return city;
const district = districtMatch[0];
return district ? `${city} ${district}` : city;
},
formatTransportPlanDetailRouteName(type) {
const nameProp = type === 'departure' ? 'departureName' : 'arrivalName';
const addressProp = type === 'departure' ? 'departureAddress' : 'arrivalAddress';
const name = this.detailRow[nameProp] || this.detailRow[addressProp];
const transportMode = this.resolveTransportMode(this.detailRow.transportType);
return transportMode === 'road'
? this.formatTransportPlanRoadCityDistrict(name)
: name || '-';
},
hasPermission(code) {
return this.isAdmin || this.validData(this.permission && this.permission[code], false);
},
@@ -3988,7 +4021,7 @@ export default {
this.$message.info('当前运单暂无详情数据');
return;
}
this.$router.push({ path: '/business/waybill-manage', query: { detailId: row.id } });
this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } });
},
transportPlanWaybillIndex(index) {
return (
@@ -4054,10 +4087,28 @@ export default {
request
.then(res => {
const detail = res?.data?.data || res?.data || row;
this.detailRow = detail;
this.ensureTransportPlanDetailTransportTypeName(detail);
this.applyFormDetail(detail);
return null;
if (!detail.contractId) {
this.detailRow = detail;
this.ensureTransportPlanDetailTransportTypeName(detail);
this.applyFormDetail(detail);
return null;
}
return getContractDetail(detail.contractId)
.then(contractRes => {
const contract = contractRes?.data?.data || contractRes?.data || {};
this.detailRow = {
...detail,
customerName:
contract.partyA || contract.customerName || detail.customerName || '',
};
this.ensureTransportPlanDetailTransportTypeName(this.detailRow);
this.applyFormDetail(this.detailRow);
})
.catch(() => {
this.detailRow = detail;
this.ensureTransportPlanDetailTransportTypeName(detail);
this.applyFormDetail(detail);
});
})
.finally(() => {
this.detailLoading = false;
@@ -4610,7 +4661,11 @@ export default {
this.form.settlementCurrency =
contract.settlementCurrency || contract.settlementCurrencyCode || contract.currency || '';
this.form.customerName =
contract.customerName || contract.customerNames || this.form.customerName || '';
contract.partyA ||
contract.customerName ||
contract.customerNames ||
this.form.customerName ||
'';
this.$refs.crud?.validateField?.('contractName');
},
loadDispatchContractCurrency(plan = {}) {
@@ -5505,6 +5560,12 @@ export default {
this.ensureTransportAmapGeocoder()
.then(() => this.runAmapGeocode('location', keyword))
.then(result => {
this.transportMapSearchResults = (result.geocodes || []).map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || keyword,
address: item.formattedAddress || keyword,
location: item.location,
}));
const point = this.resolveMapPoint(result);
if (!point) {
this.transportMapStatus = '未找到匹配地址';
@@ -5525,6 +5586,11 @@ export default {
this.$message.error('高德地图组件加载失败,请稍后重试或重新打开弹窗');
});
},
selectTransportMapSearchResult(item) {
if (item && item.location) {
this.pickTransportMapPoint(item.location, item.address || item.name || '');
}
},
pickTransportMapPoint(lnglat, keyword) {
const longitude = this.getPointLng(lnglat);
const latitude = this.getPointLat(lnglat);
@@ -6246,8 +6312,7 @@ export default {
},
handleImport() {
if (this.config.enableTransportPlanImport) {
this.transportPlanImportBox = true;
this.loadProjectOptions();
this.$router.push('/business/transport-plan/import');
return;
}
this.$message.warning('运输计划导入接口未配置');
@@ -6637,33 +6702,13 @@ export default {
this.$message.warning('运输计划数据异常,无法调度');
return;
}
this.dispatchRow = { ...row };
this.dispatchCarrierOptions = [];
this.dispatchCarrierContractOptions = [];
this.dispatchCarrierRequestId += 1;
this.dispatchBox = true;
this.dispatchLoading = true;
this.dispatchRows = [];
this.loadDispatchTransportTypeOptions();
const request =
this.api && typeof this.api.getDetail === 'function'
? this.api.getDetail(row.id)
: Promise.resolve({ data: { data: row } });
request
.then(res => {
const detail = {
...row,
...(res?.data?.data || {}),
};
this.dispatchRow = detail;
this.dispatchRows = this.buildDispatchRows(detail);
return this.loadDispatchContractCurrency(detail).then(() => {
this.loadDispatchCarrierOptions(detail);
});
})
.finally(() => {
this.dispatchLoading = false;
});
//
this.$router.push({
path: '/business/transport-plan-dispatch',
query: {
planId: row.id,
},
});
},
loadDispatchTransportTypeOptions() {
if (this.dispatchTransportTypeOptions.length || this.dispatchTransportTypeLoading) {
@@ -7308,7 +7353,7 @@ export default {
this.loadDispatchCarrierOptions(this.dispatchRow);
},
isDispatchCarrierRequired(carrierType) {
return ['承运商', '网货平台'].includes(String(carrierType || '').trim());
return String(carrierType || '').trim() === '承运商';
},
getProjectCarrierOptions(project = {}) {
const rows = this.parseJsonArray(project.carrierJson);
@@ -7748,7 +7793,7 @@ export default {
],
];
if (this.isDispatchCarrierRequired(row.carrierType)) {
requiredFields.push(['carrierName', row.carrierType === '网货平台' ? '承运方' : '承运商']);
requiredFields.push(['carrierName', '承运商']);
}
if (row.carrierType === '承运商') {
requiredFields.push(['carrierContractId', '承运商合同']);