🐛 总单列表悬浮气泡展示完整地址、创建时间只保留日期
This commit is contained in:
@@ -79,7 +79,7 @@
|
||||
<p>{{ timeRange(row) }}</p>
|
||||
<p>{{ goodsSummary(row) }}</p>
|
||||
<p>创建人:{{ row.createUserName || '-' }}</p>
|
||||
<p>创建时间:{{ row.createTime || '-' }}</p>
|
||||
<p>创建时间:{{ formatDate(row.createTime) }}</p>
|
||||
</section>
|
||||
<section class="route-progress">
|
||||
<div class="route-track">
|
||||
@@ -155,6 +155,7 @@
|
||||
|
||||
<script>
|
||||
import * as api from '@/api/business/master-order';
|
||||
import { splitRegionTokens } from '@/utils/region-address';
|
||||
import TableHeaderTools from '@/components/table-header-tools/main.vue';
|
||||
import MasterOrderEditor from './components/master-order-editor.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)}`
|
||||
: '-';
|
||||
},
|
||||
// 创建时间只展示日期。
|
||||
formatDate(value) {
|
||||
return value ? String(value).slice(0, 10) : '-';
|
||||
},
|
||||
goodsSummary(row) {
|
||||
const item = (row.goods || [])[0] || {};
|
||||
if (!item.cargoName && !item.cargoType) return '-';
|
||||
@@ -391,6 +396,26 @@ export default {
|
||||
}`;
|
||||
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 = {}) {
|
||||
const text = String(value || '').trim();
|
||||
if (!text) return '-';
|
||||
@@ -457,15 +482,12 @@ export default {
|
||||
if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) {
|
||||
return {
|
||||
name: rawAddress,
|
||||
address: rawName || regionText || rawAddress,
|
||||
address: this.completeAddress(rawName, rawAddress) || regionText || rawAddress,
|
||||
};
|
||||
}
|
||||
const displayName = rawName || rawAddress || '-';
|
||||
const tipAddress =
|
||||
(rawAddress && rawAddress !== displayName ? rawAddress : '') ||
|
||||
regionText ||
|
||||
rawAddress ||
|
||||
displayName;
|
||||
this.completeAddress(rawName, rawAddress) || regionText || rawAddress || displayName;
|
||||
return { name: displayName, address: tipAddress };
|
||||
}
|
||||
return {
|
||||
@@ -475,7 +497,7 @@ export default {
|
||||
siteCode,
|
||||
nextTransportType,
|
||||
}),
|
||||
address: rawAddress || rawName || regionText || '-',
|
||||
address: this.completeAddress(rawName, rawAddress) || regionText || '-',
|
||||
};
|
||||
},
|
||||
routeNodes(row = {}) {
|
||||
|
||||
Reference in New Issue
Block a user