运单详情已完成隐藏变更路线并移除路线编辑

已完成运单不再展示变更运输路线入口,变更弹窗去掉拖拽路线编辑区。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-23 14:49:09 +08:00
parent e2e2eb9a2f
commit 5352d799af
2 changed files with 128 additions and 117 deletions
@@ -2478,7 +2478,7 @@
{{ formatTransportPlanDetailTransportType(waybillTransportMode(detailRow)) }}
</span>
<el-link
v-if="detailRow.id"
v-if="detailRow.id && canChangeWaybillRoute(detailRow)"
class="business-crud-page__waybill-route-change-link"
type="primary"
@click="openWaybillRouteChangeDialog"
@@ -2947,35 +2947,6 @@
</el-table-column>
</el-table>
</section-card>
<section-card title="路线编辑">
<template #extra>
<span class="business-crud-page__route-change-hint">拖拽调整顺序</span>
</template>
<div
v-if="waybillRouteChangeNodes.length"
class="business-crud-page__route-change-list"
>
<div
v-for="(node, index) in waybillRouteChangeNodes"
:key="node.key || index"
class="business-crud-page__route-change-item"
draggable="true"
@dragstart="handleWaybillRouteChangeDragStart(index)"
@dragover.prevent
@drop="handleWaybillRouteChangeDrop(index)"
>
<span class="business-crud-page__route-change-type">
{{ waybillRouteChangeTypeText(index) }}
</span>
<span>{{ node.address }}</span>
<span class="business-crud-page__route-change-tags">
<el-tag v-for="tag in node.tags || []" :key="tag" size="small">{{ tag }}</el-tag>
</span>
<el-icon><Rank /></el-icon>
</div>
</div>
<el-empty v-else description="暂无路线" :image-size="60" />
</section-card>
<el-form label-width="auto">
<el-form-item label="变更备注" style="margin-top: 8px">
<el-input
@@ -5311,7 +5282,7 @@ import { openImportDialog } from '@/utils/import-excel';
import { applyTableMenuWidth } from '@/utils/table-menu';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { Location, OfficeBuilding, Rank, Search } from '@element-plus/icons-vue';
import { Location, OfficeBuilding, Search } from '@element-plus/icons-vue';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
import {
@@ -5574,7 +5545,6 @@ export default {
components: {
BillingPlanEditor,
PageAvueForm,
Rank,
ElImageViewer,
OpenFileViewer,
},
@@ -5637,7 +5607,6 @@ export default {
waybillRouteChangeNodes: [],
waybillRouteChangeRemark: '',
waybillRouteChangeRecords: [],
waybillRouteChangeDragIndex: -1,
waybillRouteChangeSaving: false,
mileageDialog: {
visible: false,
@@ -7438,7 +7407,7 @@ export default {
: [];
},
openWaybillRouteChangeDialog() {
if (!this.detailRow.id) return;
if (!this.detailRow.id || !this.canChangeWaybillRoute(this.detailRow)) return;
this.restoreWaybillRouteChangeRecords();
this.waybillRouteChangeTab = 'change';
this.waybillRouteChangeRemark = '';
@@ -7455,22 +7424,11 @@ export default {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
this.waybillRouteChangeBox = true;
},
waybillRouteChangeTypeText(index) {
if (index === 0) return '';
if (index === this.waybillRouteChangeNodes.length - 1) return '终';
return '';
},
handleWaybillRouteChangeDragStart(index) {
this.waybillRouteChangeDragIndex = index;
},
handleWaybillRouteChangeDrop(index) {
if (this.waybillRouteChangeDragIndex < 0 || this.waybillRouteChangeDragIndex === index)
return;
const nodes = [...this.waybillRouteChangeNodes];
const [node] = nodes.splice(this.waybillRouteChangeDragIndex, 1);
nodes.splice(index, 0, node);
this.waybillRouteChangeNodes = nodes;
this.waybillRouteChangeDragIndex = -1;
canChangeWaybillRoute(row = {}) {
const status = String(this.statusValue(row) || row.businessStatus || row.status || '');
if (status === 'completed') return false;
const statusName = String(row.businessStatusName || row.statusName || '');
return !statusName.includes('已完成');
},
updateWaybillRouteChangeNodes() {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
@@ -7519,9 +7477,8 @@ export default {
row.departureAddress !== row.originalDepartureAddress ||
row.arrivalAddress !== row.originalArrivalAddress;
const routeJson = JSON.stringify(this.waybillRouteChangeNodes);
const originalRouteJson = this.detailRow.routeJson || '';
if (!changed && routeJson === originalRouteJson && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址、调整路线或填写变更备注');
if (!changed && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址或填写变更备注');
return;
}
if (typeof this.api.changeRoute !== 'function') {
@@ -7529,11 +7486,9 @@ export default {
return;
}
const content = changed
? `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'}${
const content = `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'}${
row.departureAddress || '-'
}到货地 ${row.originalArrivalAddress || '-'} ${row.arrivalAddress || '-'}`
: '调整运输路线顺序';
}到货地 ${row.originalArrivalAddress || '-'} ${row.arrivalAddress || '-'}`;
const records = [
{
changeTime: this.$dayjs().format('YYYY-MM-DD HH:mm:ss'),
@@ -1786,7 +1786,7 @@
}}
</el-tag>
<el-link
v-if="detailRow.id"
v-if="detailRow.id && canChangeWaybillRoute(detailRow)"
class="waybill-manage-page__waybill-route-change-link"
type="primary"
@click="openWaybillRouteChangeDialog"
@@ -1802,7 +1802,18 @@
:class="{ 'is-plan': item[0] === 'planName' }"
>
<span class="waybill-manage-page__waybill-label">{{ item[1] }}</span>
<span :class="['waybill-manage-page__waybill-value', { 'is-link': item[2] }]">
<el-link
v-if="canOpenWaybillDetailSummaryLink(item[0])"
type="primary"
class="waybill-manage-page__waybill-value is-link"
@click="handleWaybillDetailSummaryClick(item[0])"
>
{{ formatDetailValue(detailRow, item[0]) }}
</el-link>
<span
v-else
:class="['waybill-manage-page__waybill-value', { 'is-link': item[2] }]"
>
{{ formatDetailValue(detailRow, item[0]) }}
</span>
</div>
@@ -2423,35 +2434,6 @@
</el-table-column>
</el-table>
</section-card>
<section-card title="路线编辑">
<template #extra>
<span class="waybill-manage-page__route-change-hint">拖拽调整顺序</span>
</template>
<div
v-if="waybillRouteChangeNodes.length"
class="waybill-manage-page__route-change-list"
>
<div
v-for="(node, index) in waybillRouteChangeNodes"
:key="node.key || index"
class="waybill-manage-page__route-change-item"
draggable="true"
@dragstart="handleWaybillRouteChangeDragStart(index)"
@dragover.prevent
@drop="handleWaybillRouteChangeDrop(index)"
>
<span class="waybill-manage-page__route-change-type">
{{ waybillRouteChangeTypeText(index) }}
</span>
<span>{{ node.address }}</span>
<span class="waybill-manage-page__route-change-tags">
<el-tag v-for="tag in node.tags || []" :key="tag" size="small">{{ tag }}</el-tag>
</span>
<el-icon><Rank /></el-icon>
</div>
</div>
<el-empty v-else description="暂无路线" :image-size="60" />
</section-card>
<el-form label-width="auto">
<el-form-item label="变更备注" style="margin-top: 8px">
<el-input
@@ -3116,6 +3098,7 @@ import {
getList as getProjectList,
} from '@/api/business/project-apply';
import { getList as getLoadingList } from '@/api/business/loading-manage';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { getList as getCommonRouteList } from '@/api/business/common-route';
import {
getDetail as getShippingPlanDetail,
@@ -3140,7 +3123,7 @@ import { openImportDialog } from '@/utils/import-excel';
import { applyTableMenuWidth } from '@/utils/table-menu';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { InfoFilled, Location, OfficeBuilding, Rank, Search, WarnTriangleFilled } from '@element-plus/icons-vue';
import { InfoFilled, Location, OfficeBuilding, Search, WarnTriangleFilled } from '@element-plus/icons-vue';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
import {
@@ -3316,7 +3299,6 @@ export default {
PageDetail,
InfoFilled,
WarnTriangleFilled,
Rank,
ElImageViewer,
OpenFileViewer,
},
@@ -3389,7 +3371,6 @@ export default {
waybillRouteChangeNodes: [],
waybillRouteChangeRemark: '',
waybillRouteChangeRecords: [],
waybillRouteChangeDragIndex: -1,
waybillRouteChangeSaving: false,
waybillLocateLoading: false,
waybillLocateInfo: null,
@@ -4684,6 +4665,90 @@ export default {
query: { id, name: '配载单详情' },
});
},
waybillDetailCustomerLabel(row = {}) {
return row.customer || row.fullName || row.shortName || row.customerName || row.customerCode || '';
},
waybillDetailCustomerId(row = {}) {
return row.id || row.customerId || '';
},
canOpenWaybillDetailSummaryLink(prop) {
if (this.isPublicWaybillView) return false;
const row = this.detailRow || {};
const value = this.formatDetailValue(row, prop);
if (!value || value === '-') return false;
if (prop === 'customerName') return Boolean(row.customerName);
if (prop === 'contractNo') return Boolean(row.contractId);
if (prop === 'projectName') return Boolean(row.projectId);
return false;
},
handleWaybillDetailSummaryClick(prop) {
if (prop === 'customerName') return this.openWaybillDetailCustomer();
if (prop === 'contractNo') return this.openWaybillDetailContract();
if (prop === 'projectName') return this.openWaybillDetailProject();
},
async resolveWaybillDetailCustomerId() {
const row = this.detailRow || {};
if (row.customerId) return row.customerId;
const name = String(row.customerName || '').trim();
if (!name) return '';
if (row.projectId) {
try {
const res = await getProjectDetail(row.projectId);
const customers = this.parseJsonArray(res.data?.data?.customerJson);
const matched =
customers.find(item => this.waybillDetailCustomerLabel(item) === name) ||
customers.find(item => {
const label = this.waybillDetailCustomerLabel(item);
return label && (name.includes(label) || label.includes(name));
});
const id = this.waybillDetailCustomerId(matched);
if (id) return id;
} catch (error) {
// 退
}
}
try {
const res = await getCustomerArchiveList(1, 20, { fullName: name });
const records = res.data?.data?.records || [];
const exact =
records.find(item => item.fullName === name || item.shortName === name) || records[0];
return exact?.id || '';
} catch (error) {
return '';
}
},
async openWaybillDetailCustomer() {
if (!this.detailRow?.customerName) return;
const customerId = await this.resolveWaybillDetailCustomerId();
if (!customerId) {
this.$message.warning('未找到对应客商档案,无法打开');
return;
}
this.$router.push({
path: '/vehicle/customer-archive/form',
query: { id: String(customerId), name: '查看客商档案', view: '1' },
});
},
openWaybillDetailContract() {
if (!this.detailRow?.contractId) {
this.$message.warning('合同信息缺失,无法打开');
return;
}
this.$router.push({
path: '/business/contract-manage/detail',
query: { id: this.detailRow.contractId, name: '合同详情' },
});
},
openWaybillDetailProject() {
if (!this.detailRow?.projectId) {
this.$message.warning('项目信息缺失,无法打开');
return;
}
this.$router.push({
path: '/business/project-apply/form',
query: { mode: 'view', id: this.detailRow.projectId, name: '查看项目管理' },
});
},
loadWaybillDetailProcessNodes(projectId) {
this.waybillDetailProcessNodes = [];
if (!projectId) return Promise.resolve([]);
@@ -4854,7 +4919,7 @@ export default {
: [];
},
openWaybillRouteChangeDialog() {
if (!this.detailRow.id) return;
if (!this.detailRow.id || !this.canChangeWaybillRoute(this.detailRow)) return;
this.restoreWaybillRouteChangeRecords();
this.waybillRouteChangeTab = 'change';
this.waybillRouteChangeRemark = '';
@@ -4871,22 +4936,11 @@ export default {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
this.waybillRouteChangeBox = true;
},
waybillRouteChangeTypeText(index) {
if (index === 0) return '';
if (index === this.waybillRouteChangeNodes.length - 1) return '终';
return '';
},
handleWaybillRouteChangeDragStart(index) {
this.waybillRouteChangeDragIndex = index;
},
handleWaybillRouteChangeDrop(index) {
if (this.waybillRouteChangeDragIndex < 0 || this.waybillRouteChangeDragIndex === index)
return;
const nodes = [...this.waybillRouteChangeNodes];
const [node] = nodes.splice(this.waybillRouteChangeDragIndex, 1);
nodes.splice(index, 0, node);
this.waybillRouteChangeNodes = nodes;
this.waybillRouteChangeDragIndex = -1;
canChangeWaybillRoute(row = {}) {
const status = String(this.statusValue(row) || row.businessStatus || row.status || '');
if (status === 'completed') return false;
const statusName = String(row.businessStatusName || row.statusName || '');
return !statusName.includes('已完成');
},
updateWaybillRouteChangeNodes() {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
@@ -4935,9 +4989,8 @@ export default {
row.departureAddress !== row.originalDepartureAddress ||
row.arrivalAddress !== row.originalArrivalAddress;
const routeJson = JSON.stringify(this.waybillRouteChangeNodes);
const originalRouteJson = this.detailRow.routeJson || '';
if (!changed && routeJson === originalRouteJson && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址、调整路线或填写变更备注');
if (!changed && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址或填写变更备注');
return;
}
if (typeof this.api.changeRoute !== 'function') {
@@ -4945,11 +4998,9 @@ export default {
return;
}
const content = changed
? `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'}${
const content = `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'}${
row.departureAddress || '-'
}到货地 ${row.originalArrivalAddress || '-'} ${row.arrivalAddress || '-'}`
: '调整运输路线顺序';
}到货地 ${row.originalArrivalAddress || '-'} ${row.arrivalAddress || '-'}`;
const records = [
{
changeTime: this.$dayjs().format('YYYY-MM-DD HH:mm:ss'),
@@ -9814,7 +9865,12 @@ export default {
white-space: nowrap;
&.is-link {
display: inline;
justify-content: flex-start;
max-width: 100%;
color: #409eff;
font-weight: 500;
vertical-align: baseline;
}
}