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
@@ -4,10 +4,12 @@
'waybill-manage-page',
{
'waybill-manage-page--form-page': isStandaloneWaybillFormPage,
'waybill-manage-page--detail-page': isStandaloneWaybillDetailPage,
},
]"
>
<component
v-if="!isStandaloneWaybillDetailPage"
:is="crudContainer"
:option="pageFormOption"
:form-page-title="isStandaloneWaybillFormPage ? formPageTitle : undefined"
@@ -381,7 +383,7 @@
>
<span>货物信息</span>
<div v-if="!dialogReadonly" class="waybill-manage-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>
@@ -1514,7 +1516,7 @@
v-model="attachmentRows"
:readonly="dialogReadonly"
:file-types="attachmentFileTypes"
:max-size="500"
:max-size="50"
:show-file-list="false"
button-text="上传附件"
@change="handleAttachmentChange"
@@ -1653,24 +1655,29 @@
</el-dialog>
<empty-pagination
v-show="!isStandaloneWaybillFormPage"
v-show="!isStandaloneWaybillFormPage && !isStandaloneWaybillDetailPage"
:page="page"
@size-change="sizeChange"
@current-change="currentChange"
@load="onLoad(page, query)"
/>
<el-dialog
<component
:is="detailContainer"
v-model="detailBox"
:title="`${config.title}详情`"
append-to-body
:append-to-body="!isStandaloneWaybillDetailPage"
top="10px"
width="96%"
show-close
:class="['waybill-manage-page__detail-dialog', $attrs.option?.dialogCustomClass]"
:class="[
'waybill-manage-page__detail-dialog',
{ 'waybill-manage-page__detail-page': isStandaloneWaybillDetailPage },
$attrs.option?.dialogCustomClass,
]"
>
<div v-loading="detailLoading" class="waybill-manage-page__detail-content">
<template v-if="detailBox">
<template v-if="detailBox || isStandaloneWaybillDetailPage">
<section-card class="waybill-manage-page__waybill-detail-summary">
<div class="waybill-manage-page__waybill-heading">
<strong>运单详情</strong>
@@ -1775,7 +1782,6 @@
transportCargoRows.length ? transportCargoRows : parseJsonArray(detailRow.goodsJson)
"
border
height="220"
>
<el-table-column type="index" label="序号" width="70" />
<el-table-column prop="cargoName" label="货物名称" min-width="150" />
@@ -1982,10 +1988,13 @@
</div>
</template>
</div>
<template #footer>
<el-button type="primary" @click="detailBox = false">关闭</el-button>
<div v-if="isStandaloneWaybillDetailPage" class="waybill-manage-page__detail-footer">
<el-button type="primary" @click="closeDetail">关闭</el-button>
</div>
<template v-if="!isStandaloneWaybillDetailPage" #footer>
<el-button type="primary" @click="closeDetail">关闭</el-button>
</template>
</el-dialog>
</component>
<el-dialog
v-model="attachmentDocumentPreviewVisible"
@@ -2527,7 +2536,10 @@
搜索
</el-button>
</div>
<div ref="transportAmap" class="waybill-manage-page__map"></div>
<div class="map-picker-content">
<map-search-results :results="transportMapSearchResults" @select="selectTransportMapSearchResult" />
<div ref="transportAmap" class="waybill-manage-page__map"></div>
</div>
<div class="waybill-manage-page__map-info">
<span>{{ transportMapStatus }}</span>
<span v-if="transportMapSelected.regionName"
@@ -2815,6 +2827,7 @@ const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
let amapLoader;
const standaloneWaybillFormRoute = '/business/waybill-manage/form';
const standaloneWaybillFormPaths = ['/business/waybill-manage', standaloneWaybillFormRoute];
const standaloneWaybillDetailRoute = '/business/waybill-manage/detail';
const loadingCreateWaybillsStorageKey = 'loading-manage-create-waybills';
const attachmentViewerPlugins = [
@@ -2870,6 +2883,16 @@ const PageAvueForm = {
},
};
const PageDetail = {
inheritAttrs: false,
render() {
return h('div', { class: this.$attrs.class }, [
...(this.$slots.default?.() || []),
...(this.$slots.footer?.() || []),
]);
},
};
const estimateMenuButtonCount = config => {
const rowActions = (config.actions || []).filter(action => action !== 'batchComplete');
return 3 + rowActions.length + (config.operations || []).length;
@@ -2905,7 +2928,7 @@ const defaultTransportCargo = () => ({
remark: '',
});
const taskCarrierTypes = ['承运商', '自运', '网货平台'];
const taskCarrierTypes = ['承运商', '自运'];
// Avue 使
// avue-form
@@ -2955,6 +2978,7 @@ const getPlainAvueForm = avueForm => {
export default {
components: {
PageAvueForm,
PageDetail,
InfoFilled,
Rank,
ElImageViewer,
@@ -2991,6 +3015,10 @@ export default {
type: Boolean,
default: false,
},
standaloneDetailPage: {
type: Boolean,
default: false,
},
},
data() {
return {
@@ -3144,6 +3172,7 @@ export default {
transportMapKeyword: '',
transportMapStatus: '可搜索地址或点击地图选点',
transportMapSelected: {},
transportMapSearchResults: [],
transportAmap: null,
transportAmapMarker: null,
transportAmapGeocoder: null,
@@ -3250,6 +3279,12 @@ export default {
isStandaloneWaybillFormPage() {
return this.isStandaloneWaybillPage && ['add', 'edit'].includes(this.$route.query.mode);
},
isStandaloneWaybillDetailPage() {
return this.standaloneDetailPage && this.$route.path === standaloneWaybillDetailRoute;
},
detailContainer() {
return this.isStandaloneWaybillDetailPage ? 'PageDetail' : 'el-dialog';
},
formPageTitle() {
if (this.isStandaloneWaybillFormPage) {
return (
@@ -3338,7 +3373,7 @@ export default {
return this.taskCarrierTypes;
},
taskCarrierLabel() {
return this.form.carrierType === '网货平台' ? '承运方' : '承运商';
return '承运商';
},
taskCarrierValue: {
get() {
@@ -3533,10 +3568,16 @@ export default {
if (!this.isStandaloneWaybillFormPage) return;
const mode = this.$route.query.mode === 'edit' ? 'edit' : 'add';
const id = this.$route.query.id || '';
const key = `${mode}:${id}`;
const copyId = this.$route.query.copyId || '';
const key = `${mode}:${id}:${copyId}`;
if (this.standaloneFormKey === key) return;
this.standaloneFormKey = key;
if (mode === 'edit') this.form = { id };
if (mode === 'edit') {
this.form = { id };
} else if (mode === 'add' && copyId) {
//
this.form = { id: copyId };
}
this.beforeOpen(() => {}, mode);
},
buildFormGroupOption(option) {
@@ -4034,7 +4075,8 @@ export default {
waybillUnitPrice(row = {}) {
const price = row.unitPrice || row.price || '';
const unit = row.priceUnit || row.billingUnit || '';
return price === '' ? '' : unit ? `${price}(${unit})` : price;
if (price === '' || Number(price) === -1) return '';
return unit ? `${price}(${unit})` : price;
},
waybillCurrencyRemark(row = {}) {
const freight = this.parseJsonObject(row.freightJson);
@@ -4066,6 +4108,10 @@ export default {
return { value: `${this.waybillCurrencyRemark(row)}${value}` };
},
openDetail(row) {
if (!this.isStandaloneWaybillDetailPage) {
this.$router.push({ path: standaloneWaybillDetailRoute, query: { id: row.id } });
return;
}
this.detailBox = true;
this.detailLoading = true;
this.detailRow = { ...row };
@@ -4088,6 +4134,8 @@ export default {
this.detailRow = {
...detail,
contractNo: contract.contractNo || detail.contractNo || detail.contractName || '',
customerName:
contract.partyA || contract.customerName || detail.customerName || '',
};
this.applyFormDetail(this.detailRow);
return this.loadWaybillDetailProcessNodes(this.detailRow.projectId);
@@ -4108,6 +4156,14 @@ export default {
this.detailLoading = false;
});
},
closeDetail() {
if (this.isStandaloneWaybillDetailPage) {
this.$router.$avueRouter?.closeTag?.();
this.$router.push({ path: '/business/waybill-manage', query: {} });
return;
}
this.detailBox = false;
},
async openLoadingDetail(row = {}) {
let id = row.loadingId || row.loadingManageId || '';
if (!id && row.loadingNo) {
@@ -4744,6 +4800,30 @@ export default {
beforeOpen(done, type) {
this.crudDialogType = type;
this.dialogReadonly = type === 'view';
const copyId = this.$route.query.copyId || '';
// ID
if (type === 'add' && copyId) {
this.api.getDetail(copyId).then(res => {
const sourceData = res.data.data || {};
//
delete sourceData.id;
delete sourceData.code;
delete sourceData.waybillStatus;
delete sourceData.createTime;
delete sourceData.updateTime;
delete sourceData.createUser;
delete sourceData.updateUser;
delete sourceData.createDept;
this.applyFormDetail(sourceData);
//
this.form.dataSource = '手工创建';
done();
});
return;
}
if (type === 'add') {
this.form = {
...(this.config.defaultForm || {}),
@@ -4998,7 +5078,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.syncTaskFreightCurrencyFromContract(contract);
this.fillSelfOperatedCarrierFromContract(contract);
this.$refs.crud?.validateField?.('contractName');
@@ -5409,7 +5493,7 @@ export default {
this.form.carrierId = '';
},
isTaskCarrierRequired(carrierType) {
return ['承运商', '网货平台'].includes(String(carrierType || '').trim());
return String(carrierType || '').trim() === '承运商';
},
taskCarrierOptionValue(item = {}) {
if (this.form.carrierType !== '自运') {
@@ -5986,7 +6070,7 @@ export default {
['vehicleNo', this.transportVehicleNoLabel],
];
if (this.isTaskCarrierRequired(row.carrierType)) {
requiredFields.push(['carrierName', row.carrierType === '网货平台' ? '承运方' : '承运商']);
requiredFields.push(['carrierName', '承运商']);
}
if (row.carrierType === '承运商') {
requiredFields.push(['carrierContractId', '承运商合同']);
@@ -6805,6 +6889,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 = '未找到匹配地址';
@@ -6825,6 +6915,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);
@@ -7559,6 +7654,18 @@ export default {
openImportDialog(this, this.config.title, () => this.onLoad(this.page, this.query));
},
handleCopy(row) {
if (this.isStandaloneWaybillPage) {
this.$router.push({
path: standaloneWaybillFormRoute,
query: {
mode: 'add',
copyId: row.id,
name: `复制${this.config.title || ''}`,
},
});
return;
}
// 使
this.$confirm(`确定复制该${this.config.title}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -8629,6 +8736,17 @@ export default {
}
}
&__detail-page {
padding: 12px;
background: #f5f6fa;
}
&__detail-footer {
display: flex;
justify-content: flex-end;
padding-top: 12px;
}
&__waybill-detail-summary {
:deep(.el-card__body) {
padding: 18px 22px;
@@ -8835,10 +8953,6 @@ export default {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
.section-card {
min-height: 300px;
}
}
&__waybill-map-empty {