🐛 总单列表悬浮气泡展示完整地址、创建时间只保留日期

This commit is contained in:
2026-10-15 14:45:00 +08:00
parent a19097d1be
commit 7997089b16
+29 -7
View File
@@ -79,7 +79,7 @@
<p>{{ timeRange(row) }}</p> <p>{{ timeRange(row) }}</p>
<p>{{ goodsSummary(row) }}</p> <p>{{ goodsSummary(row) }}</p>
<p>创建人:{{ row.createUserName || '-' }}</p> <p>创建人:{{ row.createUserName || '-' }}</p>
<p>创建时间:{{ row.createTime || '-' }}</p> <p>创建时间:{{ formatDate(row.createTime) }}</p>
</section> </section>
<section class="route-progress"> <section class="route-progress">
<div class="route-track"> <div class="route-track">
@@ -155,6 +155,7 @@
<script> <script>
import * as api from '@/api/business/master-order'; import * as api from '@/api/business/master-order';
import { splitRegionTokens } from '@/utils/region-address';
import TableHeaderTools from '@/components/table-header-tools/main.vue'; import TableHeaderTools from '@/components/table-header-tools/main.vue';
import MasterOrderEditor from './components/master-order-editor.vue'; import MasterOrderEditor from './components/master-order-editor.vue';
import MasterOrderDispatch from './components/master-order-dispatch.vue'; import MasterOrderDispatch from './components/master-order-dispatch.vue';
@@ -332,6 +333,10 @@ export default {
? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}` ? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}`
: '-'; : '-';
}, },
// 创建时间只展示日期。
formatDate(value) {
return value ? String(value).slice(0, 10) : '-';
},
goodsSummary(row) { goodsSummary(row) {
const item = (row.goods || [])[0] || {}; const item = (row.goods || [])[0] || {};
if (!item.cargoName && !item.cargoType) return '-'; if (!item.cargoName && !item.cargoType) return '-';
@@ -391,6 +396,26 @@ export default {
}`; }`;
return `${city} ${district}`; return `${city} ${district}`;
}, },
// 悬停气泡里的地址:起讫点若只保存了名称或详细地址的一半,气泡就会显示成
// “柳南区”“安徽”这类残缺地址,故把两个字段互为补充后展示。
completeAddress(name, address) {
const rawName = String(name || '').trim();
const rawAddress = String(address || '').trim();
if (!rawName) return rawAddress;
if (!rawAddress) return rawName;
// 详细地址已含省市,本身就是完整地址,不再拼接名称,避免重复卡片上已有的站点名。
if (/(?:省|自治区|特别行政区|市)/.test(rawAddress)) return rawAddress;
const normalizedName = rawName.replace(/\s+/g, '');
const normalizedAddress = rawAddress.replace(/\s+/g, '');
if (normalizedAddress.includes(normalizedName)) return rawAddress;
if (normalizedName.includes(normalizedAddress)) return rawName;
// “珠海1号港口”与“珠海港口1号”这类同字异序写法只保留一个。
if ([...normalizedName].sort().join('') === [...normalizedAddress].sort().join('')) {
return normalizedName.length >= normalizedAddress.length ? rawName : rawAddress;
}
// 区域在前、详细地址在后。
return splitRegionTokens(rawName) ? `${rawName}${rawAddress}` : `${rawAddress}${rawName}`;
},
routeNodeName(value, address, transportType, region = {}) { routeNodeName(value, address, transportType, region = {}) {
const text = String(value || '').trim(); const text = String(value || '').trim();
if (!text) return '-'; if (!text) return '-';
@@ -457,15 +482,12 @@ export default {
if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) { if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) {
return { return {
name: rawAddress, name: rawAddress,
address: rawName || regionText || rawAddress, address: this.completeAddress(rawName, rawAddress) || regionText || rawAddress,
}; };
} }
const displayName = rawName || rawAddress || '-'; const displayName = rawName || rawAddress || '-';
const tipAddress = const tipAddress =
(rawAddress && rawAddress !== displayName ? rawAddress : '') || this.completeAddress(rawName, rawAddress) || regionText || rawAddress || displayName;
regionText ||
rawAddress ||
displayName;
return { name: displayName, address: tipAddress }; return { name: displayName, address: tipAddress };
} }
return { return {
@@ -475,7 +497,7 @@ export default {
siteCode, siteCode,
nextTransportType, nextTransportType,
}), }),
address: rawAddress || rawName || regionText || '-', address: this.completeAddress(rawName, rawAddress) || regionText || '-',
}; };
}, },
routeNodes(row = {}) { routeNodes(row = {}) {