⚡ 优化区划国家入口、计划-1展示、路线地图点选与对账导出

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-27 23:16:18 +08:00
parent f3a33b1a04
commit b92625528c
7 changed files with 275 additions and 337 deletions
+13
View File
@@ -738,6 +738,19 @@ export const option = {
span: 6,
order: 870,
minWidth: 150,
formatter: row => {
const value = row?.planName;
if (
value === undefined ||
value === null ||
value === '' ||
String(value) === '-1' ||
Number(value) === -1
) {
return '';
}
return value;
},
},
{
label: '货物类型',
+12 -3
View File
@@ -26,6 +26,7 @@
</el-form-item>
<el-form-item label="区域层级">
<el-select v-model="searchForm.regionLevel" clearable placeholder="请选择" style="width: 200px;">
<el-option label="国家" :value="0" />
<el-option label="省份" :value="1" />
<el-option label="省市" :value="2" />
<el-option label="区县" :value="3" />
@@ -42,6 +43,13 @@
</section-card>
<el-button-group>
<el-button
v-if="permission.region_add"
type="primary"
icon="el-icon-plus"
@click="addCountry"
>新增国家
</el-button>
<el-button
v-if="permission.region_add"
type="primary"
@@ -253,9 +261,10 @@ export default {
dicUrl: '/blade-system/dict/dictionary?code=region',
dicFormatter: response => {
const list = Array.isArray(response) ? response : response?.data;
return (Array.isArray(list) ? list : [])
.filter(item => Number(item.dictKey) !== 0)
.map(item => ({ ...item, dictKey: Number(item.dictKey) }));
return (Array.isArray(list) ? list : []).map(item => ({
...item,
dictKey: Number(item.dictKey),
}));
},
props: {
label: 'dictValue',
@@ -2909,14 +2909,15 @@
原:{{ row.originalDepartureAddress || '-' }}
</div>
<el-input
v-model="row.departureAddress"
placeholder="请选择或输入地址"
@input="updateWaybillRouteChangeNodes"
:model-value="row.departureAddress"
readonly
placeholder="请点击地图选点"
@click="openWaybillRouteChangeMapDialog(row, 'departure')"
>
<template #suffix>
<el-icon
class="business-crud-page__route-change-location"
@click="openWaybillCommonAddressDialog(row, 'departure')"
@click.stop="openWaybillRouteChangeMapDialog(row, 'departure')"
>
<Location />
</el-icon>
@@ -2930,14 +2931,15 @@
原:{{ row.originalArrivalAddress || '-' }}
</div>
<el-input
v-model="row.arrivalAddress"
placeholder="请选择或输入地址"
@input="updateWaybillRouteChangeNodes"
:model-value="row.arrivalAddress"
readonly
placeholder="请点击地图选点"
@click="openWaybillRouteChangeMapDialog(row, 'arrival')"
>
<template #suffix>
<el-icon
class="business-crud-page__route-change-location"
@click="openWaybillCommonAddressDialog(row, 'arrival')"
@click.stop="openWaybillRouteChangeMapDialog(row, 'arrival')"
>
<Location />
</el-icon>
@@ -2993,49 +2995,6 @@
</template>
</el-dialog>
<el-dialog
v-model="waybillCommonAddressBox"
title="选择常用地址"
append-to-body
width="900px"
class="business-crud-page__common-address-dialog"
>
<div class="business-crud-page__common-address-toolbar">
<el-input
v-model="waybillCommonAddressQuery.addressName"
clearable
placeholder="请输入地址名称"
@keyup.enter="loadWaybillCommonAddresses"
/>
<el-button type="primary" @click="loadWaybillCommonAddresses">查询</el-button>
</div>
<el-table
v-loading="waybillCommonAddressLoading"
:data="waybillCommonAddressRows"
border
@row-dblclick="selectWaybillCommonAddress"
>
<el-table-column prop="addressName" label="地址名称" min-width="180" />
<el-table-column prop="regionName" label="区域" min-width="180" />
<el-table-column prop="detailAddress" label="详细地址" min-width="260" />
<el-table-column label="操作" width="90">
<template #default="{ row }">
<el-link type="primary" @click="selectWaybillCommonAddress(row)">选择</el-link>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-pagination
v-model:current-page="waybillCommonAddressPage.currentPage"
v-model:page-size="waybillCommonAddressPage.pageSize"
layout="total, prev, pager, next"
:total="waybillCommonAddressPage.total"
@current-change="loadWaybillCommonAddresses"
/>
<el-button @click="waybillCommonAddressBox = false">关闭</el-button>
</template>
</el-dialog>
<el-dialog
v-if="config.enableTransportPlanImport"
v-model="transportPlanImportBox"
@@ -4982,6 +4941,7 @@
v-model="transportMapBox"
width="920px"
@opened="initTransportAmap"
@closed="waybillRouteChangeMapTarget = null"
>
<div class="business-crud-page__map-toolbar">
<el-input
@@ -5010,7 +4970,7 @@
>
</div>
<template #footer>
<el-button @click="transportMapBox = false">取消</el-button>
<el-button @click="closeTransportMapDialog">取消</el-button>
<el-button
type="primary"
:disabled="!transportMapSelected.longitude"
@@ -5633,18 +5593,7 @@ export default {
},
],
},
waybillCommonAddressBox: false,
waybillCommonAddressLoading: false,
waybillCommonAddressQuery: {
addressName: '',
},
waybillCommonAddressRows: [],
waybillCommonAddressTarget: null,
waybillCommonAddressPage: {
pageSize: 10,
currentPage: 1,
total: 0,
},
waybillRouteChangeMapTarget: null,
transportPlanImportBox: false,
transportPlanImportLoading: false,
transportPlanImportFiles: [],
@@ -7440,43 +7389,22 @@ export default {
updateWaybillRouteChangeNodes() {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
},
openWaybillCommonAddressDialog(row, field) {
this.waybillCommonAddressTarget = { row, field };
this.waybillCommonAddressQuery = { addressName: '' };
this.waybillCommonAddressPage.currentPage = 1;
this.waybillCommonAddressBox = true;
this.loadWaybillCommonAddresses();
},
loadWaybillCommonAddresses() {
this.waybillCommonAddressLoading = true;
getCommonAddressList(
this.waybillCommonAddressPage.currentPage,
this.waybillCommonAddressPage.pageSize,
{
...this.waybillCommonAddressQuery,
allDept: 0,
}
)
.then(res => {
const data = res.data?.data || {};
this.waybillCommonAddressRows = data.records || [];
this.waybillCommonAddressPage.total = data.total || 0;
})
.finally(() => {
this.waybillCommonAddressLoading = false;
});
},
selectWaybillCommonAddress(address) {
const target = this.waybillCommonAddressTarget;
if (!target) return;
target.row[`${target.field}Address`] =
[address.regionName, address.detailAddress || address.addressName]
.filter(Boolean)
.join('') ||
address.addressName ||
'';
this.updateWaybillRouteChangeNodes();
this.waybillCommonAddressBox = false;
openWaybillRouteChangeMapDialog(row, field) {
if (!row || !field) return;
this.waybillRouteChangeMapTarget = { row, field };
this.transportMapTarget = field;
this.transportMapKeyword = row[`${field}Address`] || row[`${field}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({
lng: row[`${field}Longitude`],
lat: row[`${field}Latitude`],
address: row[`${field}Address`],
regionName: row[`${field}Name`],
regionCode: row[`${field}RegionCode`],
});
this.transportMapStatus = this.transportMapSelected.longitude
? '已加载当前选点,可重新选点'
: '可搜索地址或点击地图选点';
this.transportMapBox = true;
},
async confirmWaybillRouteChange() {
const row = this.waybillRouteChangeRows[0] || {};
@@ -10201,10 +10129,15 @@ export default {
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
});
},
closeTransportMapDialog() {
this.transportMapBox = false;
this.waybillRouteChangeMapTarget = null;
},
openTransportMapDialog(target) {
if (this.dialogReadonly) return;
if (!this.ensureTransportTypeBeforeAddress()) return;
const prefix = target === 'departure' ? 'departure' : 'arrival';
this.waybillRouteChangeMapTarget = null;
this.transportMapTarget = prefix;
this.transportMapKeyword = this.form[`${prefix}Address`] || this.form[`${prefix}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({
@@ -10363,6 +10296,23 @@ export default {
this.$message.warning('请先搜索或点击地图完成选点');
return;
}
if (this.waybillRouteChangeMapTarget) {
const { row, field } = this.waybillRouteChangeMapTarget;
row[`${field}Address`] =
this.transportMapSelected.detailAddress || row[`${field}Address`] || '';
if (this.transportMapSelected.regionName) {
row[`${field}Name`] = this.transportMapSelected.regionName;
}
row[`${field}Longitude`] = this.transportMapSelected.longitude;
row[`${field}Latitude`] = this.transportMapSelected.latitude;
if (this.transportMapSelected.regionCode) {
row[`${field}RegionCode`] = this.transportMapSelected.regionCode;
}
this.updateWaybillRouteChangeNodes();
this.waybillRouteChangeMapTarget = null;
this.transportMapBox = false;
return;
}
const prefix = this.transportMapTarget;
this.form[`${prefix}Address`] =
this.transportMapSelected.detailAddress || this.form[`${prefix}Address`];
@@ -15914,16 +15864,6 @@ export default {
white-space: pre-wrap;
}
&__common-address-toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px;
.el-input {
width: 260px;
}
}
@media (max-width: 1200px) {
&__waybill-summary-grid {
grid-template-columns: repeat(4, minmax(130px, 1fr));
@@ -1212,7 +1212,11 @@ const fillEditForm = async row => {
carrierIds: [],
});
const plan = plans.value.find(item => String(item.id) === String(snapshot.planId));
if (plan) form.planId = plan.id;
// 接口数字 null 会序列化为 -1,未选计划时回填为空
form.planId =
plan && Number(plan.id) !== -1 && Number(plan.id) > 0
? plan.id
: normalizeOptionalPlanId(snapshot.planId) || '';
const contract = contracts.value.find(item => String(item.id) === String(snapshot.contractId));
form.contractId = contract?.id || '';
form.carrierType = snapshot.carrierType || '承运商';
@@ -1677,10 +1681,18 @@ const normalizeImportRow = row => ({
row['*运输方式']
),
});
const normalizeOptionalPlanId = value => {
if (value === undefined || value === null || value === '') return null;
return Number(value) === -1 || Number(value) <= 0 ? null : value;
};
const buildImportPayload = (status = form.status, rowList = rows.value, extra = {}) => {
const { file, ...batch } = form;
const planId = normalizeOptionalPlanId(batch.planId);
return {
...batch,
planId,
// 未选计划时不带占位名称,避免落库/回显 -1
planName: planId ? batch.planName || undefined : null,
status,
rows: rowList.map(normalizeImportRow).map(stripInternalRowFields),
...extra,
@@ -1789,14 +1789,14 @@
:class="{ 'is-plan': item[0] === 'planName' }"
>
<span class="waybill-manage-page__waybill-label">{{ item[1] }}</span>
<el-link
<span
v-if="canOpenWaybillDetailSummaryLink(item[0])"
type="primary"
class="waybill-manage-page__waybill-value is-link"
role="link"
@click="handleWaybillDetailSummaryClick(item[0])"
>
{{ formatDetailValue(detailRow, item[0]) }}
</el-link>
</span>
<span
v-else
:class="['waybill-manage-page__waybill-value', { 'is-link': item[2] }]"
@@ -2413,14 +2413,15 @@
原:{{ row.originalDepartureAddress || '-' }}
</div>
<el-input
v-model="row.departureAddress"
placeholder="请选择或输入地址"
@input="updateWaybillRouteChangeNodes"
:model-value="row.departureAddress"
readonly
placeholder="请点击地图选点"
@click="openWaybillRouteChangeMapDialog(row, 'departure')"
>
<template #suffix>
<el-icon
class="waybill-manage-page__route-change-location"
@click="openWaybillCommonAddressDialog(row, 'departure')"
@click.stop="openWaybillRouteChangeMapDialog(row, 'departure')"
>
<Location />
</el-icon>
@@ -2434,14 +2435,15 @@
原:{{ row.originalArrivalAddress || '-' }}
</div>
<el-input
v-model="row.arrivalAddress"
placeholder="请选择或输入地址"
@input="updateWaybillRouteChangeNodes"
:model-value="row.arrivalAddress"
readonly
placeholder="请点击地图选点"
@click="openWaybillRouteChangeMapDialog(row, 'arrival')"
>
<template #suffix>
<el-icon
class="waybill-manage-page__route-change-location"
@click="openWaybillCommonAddressDialog(row, 'arrival')"
@click.stop="openWaybillRouteChangeMapDialog(row, 'arrival')"
>
<Location />
</el-icon>
@@ -2497,49 +2499,6 @@
</template>
</el-dialog>
<el-dialog
v-model="waybillCommonAddressBox"
title="选择常用地址"
append-to-body
width="900px"
class="waybill-manage-page__common-address-dialog"
>
<div class="waybill-manage-page__common-address-toolbar">
<el-input
v-model="waybillCommonAddressQuery.addressName"
clearable
placeholder="请输入地址名称"
@keyup.enter="loadWaybillCommonAddresses"
/>
<el-button type="primary" @click="loadWaybillCommonAddresses">查询</el-button>
</div>
<el-table
v-loading="waybillCommonAddressLoading"
:data="waybillCommonAddressRows"
border
@row-dblclick="selectWaybillCommonAddress"
>
<el-table-column prop="addressName" label="地址名称" min-width="180" />
<el-table-column prop="regionName" label="区域" min-width="180" />
<el-table-column prop="detailAddress" label="详细地址" min-width="260" />
<el-table-column label="操作" width="90">
<template #default="{ row }">
<el-link type="primary" @click="selectWaybillCommonAddress(row)">选择</el-link>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-pagination
v-model:current-page="waybillCommonAddressPage.currentPage"
v-model:page-size="waybillCommonAddressPage.pageSize"
layout="total, prev, pager, next"
:total="waybillCommonAddressPage.total"
@current-change="loadWaybillCommonAddresses"
/>
<el-button @click="waybillCommonAddressBox = false">关闭</el-button>
</template>
</el-dialog>
<flow-design
v-if="website.design.designMode"
is-dialog
@@ -2850,6 +2809,7 @@
v-model="transportMapBox"
width="920px"
@opened="initTransportAmap"
@closed="waybillRouteChangeMapTarget = null"
>
<div class="waybill-manage-page__map-toolbar">
<el-input
@@ -2878,7 +2838,7 @@
>
</div>
<template #footer>
<el-button @click="transportMapBox = false">取消</el-button>
<el-button @click="closeTransportMapDialog">取消</el-button>
<el-button
type="primary"
:disabled="!transportMapSelected.longitude"
@@ -3467,18 +3427,7 @@ export default {
},
],
},
waybillCommonAddressBox: false,
waybillCommonAddressLoading: false,
waybillCommonAddressQuery: {
addressName: '',
},
waybillCommonAddressRows: [],
waybillCommonAddressTarget: null,
waybillCommonAddressPage: {
pageSize: 10,
currentPage: 1,
total: 0,
},
waybillRouteChangeMapTarget: null,
draftSaveLoading: false,
crudDialogType: '',
defaultDialogButtons: null,
@@ -4051,7 +4000,7 @@ export default {
this.attachmentDocumentPreviewVisible = false;
this.attachmentImagePreviewVisible = false;
this.waybillRouteChangeBox = false;
this.waybillCommonAddressBox = false;
this.waybillRouteChangeMapTarget = null;
this.flowBox = false;
this.transportRouteBox = false;
this.transportAddressBox = false;
@@ -4518,6 +4467,20 @@ export default {
if (prop === 'feeGenerationMode') {
return row[prop] === 'manual' ? '账单导入生成' : '系统生成';
}
// 计划未选时接口可能回传 planId=-1 / planName=-1,详情统一显示为空
if (prop === 'planName' || prop === 'planId') {
const planName = row.planName;
if (
planName === undefined ||
planName === null ||
planName === '' ||
String(planName) === '-1' ||
Number(planName) === -1
) {
return '-';
}
return planName;
}
const column = this.findColumn(this.option.column, prop);
if (column?.formatter) return column.formatter(row, {}, row[prop]);
if (column?.dicData) {
@@ -4525,6 +4488,15 @@ export default {
if (item) return item.label;
}
const value = row[prop];
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return '-';
}
if (value && typeof value === 'object') return JSON.stringify(value);
if (typeof value === 'string' && /^[\[{]/.test(value.trim())) {
try {
@@ -4534,7 +4506,7 @@ export default {
// 非 JSON 文本按原值展示。
}
}
return value === undefined || value === null || value === '' ? '-' : value;
return value;
},
waybillTransportMode(row = {}) {
return (
@@ -5029,43 +5001,22 @@ export default {
updateWaybillRouteChangeNodes() {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
},
openWaybillCommonAddressDialog(row, field) {
this.waybillCommonAddressTarget = { row, field };
this.waybillCommonAddressQuery = { addressName: '' };
this.waybillCommonAddressPage.currentPage = 1;
this.waybillCommonAddressBox = true;
this.loadWaybillCommonAddresses();
},
loadWaybillCommonAddresses() {
this.waybillCommonAddressLoading = true;
getCommonAddressList(
this.waybillCommonAddressPage.currentPage,
this.waybillCommonAddressPage.pageSize,
{
...this.waybillCommonAddressQuery,
allDept: 0,
}
)
.then(res => {
const data = res.data?.data || {};
this.waybillCommonAddressRows = data.records || [];
this.waybillCommonAddressPage.total = data.total || 0;
})
.finally(() => {
this.waybillCommonAddressLoading = false;
});
},
selectWaybillCommonAddress(address) {
const target = this.waybillCommonAddressTarget;
if (!target) return;
target.row[`${target.field}Address`] =
[address.regionName, address.detailAddress || address.addressName]
.filter(Boolean)
.join('') ||
address.addressName ||
'';
this.updateWaybillRouteChangeNodes();
this.waybillCommonAddressBox = false;
openWaybillRouteChangeMapDialog(row, field) {
if (!row || !field) return;
this.waybillRouteChangeMapTarget = { row, field };
this.transportMapTarget = field;
this.transportMapKeyword = row[`${field}Address`] || row[`${field}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({
lng: row[`${field}Longitude`],
lat: row[`${field}Latitude`],
address: row[`${field}Address`],
regionName: row[`${field}Name`],
regionCode: row[`${field}RegionCode`],
});
this.transportMapStatus = this.transportMapSelected.longitude
? '已加载当前选点,可重新选点'
: '可搜索地址或点击地图选点';
this.transportMapBox = true;
},
async confirmWaybillRouteChange() {
const row = this.waybillRouteChangeRows[0] || {};
@@ -5475,6 +5426,26 @@ export default {
submitRow[key] = submitRow[key].trim();
}
});
// 未选计划时清空 -1 占位,避免落库后编辑/查看回显 -1
if (
submitRow.planId === undefined ||
submitRow.planId === null ||
submitRow.planId === '' ||
Number(submitRow.planId) === -1 ||
Number(submitRow.planId) <= 0
) {
submitRow.planId = null;
if (
!submitRow.planName ||
String(submitRow.planName) === '-1' ||
Number(submitRow.planName) === -1
) {
submitRow.planName = null;
}
}
if (String(submitRow.planName) === '-1' || Number(submitRow.planName) === -1) {
submitRow.planName = null;
}
return submitRow;
},
validateMobileFields(fields = []) {
@@ -7909,10 +7880,15 @@ export default {
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
});
},
closeTransportMapDialog() {
this.transportMapBox = false;
this.waybillRouteChangeMapTarget = null;
},
openTransportMapDialog(target) {
if (this.dialogReadonly) return;
if (!this.ensureTransportTypeBeforeAddress()) return;
const prefix = target === 'departure' ? 'departure' : 'arrival';
this.waybillRouteChangeMapTarget = null;
this.transportMapTarget = prefix;
this.transportMapKeyword = this.form[`${prefix}Address`] || this.form[`${prefix}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({
@@ -8071,6 +8047,23 @@ export default {
this.$message.warning('请先搜索或点击地图完成选点');
return;
}
if (this.waybillRouteChangeMapTarget) {
const { row, field } = this.waybillRouteChangeMapTarget;
row[`${field}Address`] =
this.transportMapSelected.detailAddress || row[`${field}Address`] || '';
if (this.transportMapSelected.regionName) {
row[`${field}Name`] = this.transportMapSelected.regionName;
}
row[`${field}Longitude`] = this.transportMapSelected.longitude;
row[`${field}Latitude`] = this.transportMapSelected.latitude;
if (this.transportMapSelected.regionCode) {
row[`${field}RegionCode`] = this.transportMapSelected.regionCode;
}
this.updateWaybillRouteChangeNodes();
this.waybillRouteChangeMapTarget = null;
this.transportMapBox = false;
return;
}
const prefix = this.transportMapTarget;
this.form[`${prefix}Address`] =
this.transportMapSelected.detailAddress || this.form[`${prefix}Address`];
@@ -10161,6 +10154,10 @@ export default {
font-weight: 500;
vertical-align: baseline;
}
&.is-link[role='link'] {
cursor: pointer;
}
}
&__waybill-route {
+18 -116
View File
@@ -588,7 +588,12 @@
label="运单号"
min-width="150"
><template #default="{ row }"
><el-link type="primary">{{ row.waybillNo || '-' }}</el-link></template
><el-link
v-if="row.waybillNo"
type="primary"
@click="openWaybillDetail(row)"
>{{ row.waybillNo }}</el-link
><span v-else>-</span></template
></el-table-column
><el-table-column label="配载单号" min-width="150"
><template #default>{{ dialogForm.loadingNo || '-' }}</template></el-table-column
@@ -1522,10 +1527,11 @@
</div>
<div class="loading-route-change-dialog__address-row">
<el-input
v-model="row.departureAddress"
placeholder="请选择或输入地址"
:model-value="row.departureAddress"
readonly
placeholder="请点击地图选点"
:disabled="isWaybillCompleted(row)"
@input="updateRouteChangeNodes"
@click="openRouteChangeMapDialog(row, 'departure')"
><template v-if="!isWaybillCompleted(row)" #suffix
><el-icon
class="loading-route-change-dialog__location"
@@ -1533,13 +1539,6 @@
><Location /></el-icon
></template>
</el-input>
<el-link
v-if="!isWaybillCompleted(row)"
type="primary"
:underline="false"
@click="openCommonAddressDialog(row, 'departure')"
>常用</el-link
>
</div></template
></el-table-column>
<el-table-column label="到货地" min-width="360"
@@ -1549,10 +1548,11 @@
</div>
<div class="loading-route-change-dialog__address-row">
<el-input
v-model="row.arrivalAddress"
placeholder="请选择或输入地址"
:model-value="row.arrivalAddress"
readonly
placeholder="请点击地图选点"
:disabled="isWaybillCompleted(row)"
@input="updateRouteChangeNodes"
@click="openRouteChangeMapDialog(row, 'arrival')"
><template v-if="!isWaybillCompleted(row)" #suffix
><el-icon
class="loading-route-change-dialog__location"
@@ -1560,13 +1560,6 @@
><Location /></el-icon
></template>
</el-input>
<el-link
v-if="!isWaybillCompleted(row)"
type="primary"
:underline="false"
@click="openCommonAddressDialog(row, 'arrival')"
>常用</el-link
>
</div></template
></el-table-column>
</el-table>
@@ -1642,48 +1635,6 @@
></template
>
</el-dialog>
<el-dialog
v-model="commonAddressVisible"
title="选择常用地址"
append-to-body
width="900px"
class="loading-common-address-dialog"
>
<div class="loading-common-address-dialog__toolbar">
<el-input
v-model="commonAddressQuery.addressName"
clearable
placeholder="请输入地址名称"
@keyup.enter="loadCommonAddresses"
/><el-button type="primary" @click="loadCommonAddresses">查询</el-button>
</div>
<el-table
v-loading="commonAddressLoading"
:data="commonAddressRows"
border
@row-dblclick="selectCommonAddress"
><el-table-column prop="addressName" label="地址名称" min-width="180" /><el-table-column
prop="regionName"
label="区域"
min-width="180"
/><el-table-column prop="detailAddress" label="详细地址" min-width="260" /><el-table-column
label="操作"
width="90"
><template #default="{ row }"
><el-link type="primary" @click="selectCommonAddress(row)">选择</el-link></template
></el-table-column
></el-table
>
<template #footer
><el-pagination
v-model:current-page="commonAddressPage.currentPage"
v-model:page-size="commonAddressPage.pageSize"
layout="total, prev, pager, next"
:total="commonAddressPage.total"
@current-change="loadCommonAddresses"
/><el-button @click="commonAddressVisible = false">关闭</el-button></template
>
</el-dialog>
<el-dialog
v-model="routeChangeMapVisible"
title="地图选择地址"
@@ -1765,7 +1716,6 @@ import {
getVoucherImages as getProcessConfigVoucherImages,
} from '@/api/business/process-config';
import VoucherExecutionDetail from './components/voucher-execution-detail.vue';
import { getList as getCommonAddressList } from '@/api/base/common-address';
import {
carrierTypeOptions,
loadingManageConfig,
@@ -2062,12 +2012,6 @@ export default {
routeChangeDragIndex: -1,
routeChangeOriginalAddresses: [],
routeChangeOrderDirty: false,
commonAddressVisible: false,
commonAddressLoading: false,
commonAddressRows: [],
commonAddressQuery: { addressName: '' },
commonAddressPage: { currentPage: 1, pageSize: 10, total: 0 },
commonAddressTarget: null,
routeChangeMapVisible: false,
routeChangeMapLoading: false,
routeChangeMapKeyword: '',
@@ -2630,7 +2574,10 @@ export default {
ElMessage.info('当前子运单暂无详情数据');
return;
}
this.$router.push({ path: '/business/waybill-manage/detail', query: { id } });
this.$router.push({
path: '/business/waybill-manage/detail',
query: { id, name: '运单详情' },
});
},
formatRouteAddress(row, type) {
const prefix =
@@ -3014,7 +2961,6 @@ export default {
// 离开本页(标签缓存/卸载)时收起页内子弹窗,避免 append-to-body 的弹窗 DOM 残留在 body 上
closeInnerDialogs() {
this.routeChangeVisible = false;
this.commonAddressVisible = false;
this.routeChangeMapVisible = false;
this.candidateSearchVisible = false;
},
@@ -3371,14 +3317,6 @@ export default {
return { ...node, locked };
});
},
openCommonAddressDialog(row, field) {
if (this.isWaybillCompleted(row)) return;
this.commonAddressTarget = { row, field };
this.commonAddressQuery = { addressName: '' };
this.commonAddressPage.currentPage = 1;
this.commonAddressVisible = true;
this.loadCommonAddresses();
},
openRouteChangeMapDialog(row, field) {
if (this.isWaybillCompleted(row)) return;
this.routeChangeMapTarget = { row, field };
@@ -3541,34 +3479,6 @@ export default {
this.updateRouteChangeNodes();
this.routeChangeMapVisible = false;
},
async loadCommonAddresses() {
this.commonAddressLoading = true;
try {
const page = unwrapPage(
await getCommonAddressList(
this.commonAddressPage.currentPage,
this.commonAddressPage.pageSize,
{ ...this.commonAddressQuery, allDept: 0 }
)
);
this.commonAddressRows = page.records;
this.commonAddressPage.total = page.total;
} finally {
this.commonAddressLoading = false;
}
},
selectCommonAddress(address) {
const target = this.commonAddressTarget;
if (!target) return;
target.row[`${target.field}Address`] =
[address.regionName, address.detailAddress || address.addressName]
.filter(Boolean)
.join('') ||
address.addressName ||
'';
this.updateRouteChangeNodes();
this.commonAddressVisible = false;
},
async confirmRouteChange() {
const changeRows = this.routeChangeRows.filter(
row =>
@@ -5167,14 +5077,6 @@ export default {
color: #606266;
}
}
.loading-common-address-dialog__toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px;
}
.loading-common-address-dialog__toolbar .el-input {
flex: 1;
}
:global(.loading-manage-form-page) {
width: 100%;
min-height: 100%;
@@ -127,6 +127,13 @@
</div>
<el-button @click="resetInternalQuery">重置</el-button>
<el-button type="primary" @click="internalFilterTick++">查询</el-button>
<el-button
type="primary"
plain
:disabled="!filteredInternalRows.length"
@click="exportInternalDetails"
>导出</el-button
>
</div>
<el-table
:data="filteredInternalRows"
@@ -616,6 +623,7 @@
<script>
import { mapGetters } from 'vuex';
import * as XLSX from 'xlsx';
import * as api from '@/api/settlement/transportReconciliation';
import * as formalSettlementApi from '@/api/settlement/formalSettlement';
import { getDictionary } from '@/api/system/dictbiz';
@@ -1807,6 +1815,63 @@ export default {
formatNumber(value) {
return Number(value || 0).toFixed(2);
},
formatExportMoney(value) {
if (value === null || value === undefined || value === '' || Number(value) === -1) {
return '';
}
return Number(value || 0).toFixed(2);
},
formatInternalExportCell(row, column) {
if (column.prop === 'matchResult') return this.matchName(row.matchResult);
if (column.prop === 'updateResult') return this.updateName(row.updateResult);
if (column.prop === 'matchedExternalLineNo') {
return this.hasMatchedExternal(row)
? this.formatMatchedExternalLineNo(row.matchedExternalLineNo)
: '';
}
if (column.prop === 'transportType') return this.transportTypeLabel(row.transportType);
if (column.prop === 'transportQuantity') {
return row.transportQuantity === null ||
row.transportQuantity === undefined ||
row.transportQuantity === ''
? ''
: Number(row.transportQuantity || 0).toFixed(2);
}
if (column.feeItemName) {
return this.formatExportMoney(this.getFeeItemAmount(row, column.feeItemName));
}
if (column.prop === 'mileage') {
return Number(row.mileage) === -1 ? '' : this.formatExportMoney(row.mileage);
}
if (column.prop === 'actualDepartureTime' || column.prop === 'actualCompletionTime') {
const text = this.formatDate(row[column.prop]);
return text === '-' ? '' : text;
}
if (column.money || column.number) return this.formatExportMoney(row[column.prop]);
const value = row[column.prop];
return value === null || value === undefined || value === '' ? '' : value;
},
exportInternalDetails() {
if (!this.filteredInternalRows.length) {
this.$message.warning('暂无可导出的内部账单明细');
return;
}
const rows = this.filteredInternalRows.map((row, index) => {
const result = { 序号: index + 1 };
this.internalTableColumns.forEach(column => {
result[column.label] = this.formatInternalExportCell(row, column);
});
return result;
});
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, XLSX.utils.json_to_sheet(rows), '内部账单明细');
XLSX.writeFile(
workbook,
`${this.form.reconciliationNo || '运输对账'}内部账单明细${this.$dayjs().format(
'YYYY-MM-DD HH-mm-ss'
)}.xlsx`
);
},
},
};
</script>