🐛 修复正式结算旧路径空白,按单号跳转付款/收款列表

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-30 11:40:32 +08:00
parent 083d954765
commit fe4255c59b
5 changed files with 91 additions and 8 deletions
+16
View File
@@ -104,6 +104,22 @@ export default [
},
],
},
{
// 兼容旧菜单路径:按 detailNo 解析应付/应收后跳转到拆分后的列表页
path: '/settlement/formal-settlement',
component: Layout,
children: [
{
path: '',
name: '正式结算单兼容跳转',
meta: {
keepAlive: false,
activeMenu: '/settlement/payment-settlement',
},
component: loadView(() => import('@/views/settlement/formal-settlement-redirect.vue')),
},
],
},
{
path: '/settlement/formal-settlement/form',
component: Layout,
@@ -0,0 +1,42 @@
<template>
<div v-loading="true" class="formal-settlement-redirect" />
</template>
<script>
import * as api from '@/api/settlement/formalSettlement';
import { settlementListPath } from '@/utils/settlement-menu';
/**
* 菜单拆分为付款/收款结算单后,旧路径 /settlement/formal-settlement 已无菜单路由。
* 本页按结算单号解析类型后 replace 到对应列表页,并保留 query(含 detailNo)。
*/
export default {
name: 'FormalSettlementRedirect',
async created() {
const detailNo = String(this.$route.query.detailNo || '').trim();
let settlementType = '';
if (detailNo) {
try {
const response = await api.getList(1, 10, { formalSettlementNo: detailNo });
const body = response?.data || response || {};
const data = body?.data || body;
const row = (data.records || []).find(item => item.formalSettlementNo === detailNo);
settlementType = row?.settlementType || '';
} catch (error) {
settlementType = '';
}
}
const path = settlementListPath(settlementType);
await this.$router.replace({
path,
query: { ...this.$route.query },
});
},
};
</script>
<style scoped>
.formal-settlement-redirect {
min-height: 240px;
}
</style>
+24 -3
View File
@@ -152,6 +152,8 @@ export default {
form: { appliedAmount: 0, remark: '' },
},
mkEnabled: false,
// keep-alive 多标签下仅激活实例响应 detailNo,避免缓存页重复弹窗
isPageActive: true,
};
},
computed: {
@@ -222,11 +224,10 @@ export default {
},
},
created() {
// 标签机制按 fullPath 缓存同页多实例:仅当前路由实例应响应 detailNo 跳转,防止缓存旧实例也弹窗
this.ownFullPath = this.$route.fullPath;
this.loadOrganizationOptions();
},
mounted() {
this.isPageActive = true;
this.openRouteDetail();
loadMkEnabled()
.then(enabled => {
@@ -237,10 +238,18 @@ export default {
});
},
activated() {
this.isPageActive = true;
if (sessionStorage.getItem('formal-settlement-list-refresh') === '1') {
sessionStorage.removeItem('formal-settlement-list-refresh');
this.onLoad(this.page);
}
// 从其他页带 detailNo 跳回时,激活态补开详情
if (this.$route.query.detailNo) {
this.openRouteDetail();
}
},
deactivated() {
this.isPageActive = false;
},
methods: {
hasPermission(actionOrCode) {
@@ -320,7 +329,7 @@ export default {
},
async openRouteDetail(detailNo = this.$route.query.detailNo) {
const formalSettlementNo = String(detailNo || '').trim();
if (!formalSettlementNo || this.ownFullPath !== this.$route.fullPath) return;
if (!formalSettlementNo || !this.isPageActive) return;
const response = await api.getList(1, 10, { formalSettlementNo });
const data = this.unwrapData(response);
const row = (data.records || []).find(item => item.formalSettlementNo === formalSettlementNo);
@@ -328,6 +337,18 @@ export default {
this.$message.warning(`未找到对应的${this.billLabel}`);
return;
}
// 锁定菜单(付款/收款)下若单号属于另一类型,跳到对应列表页再打开
if (
this.lockedSettlementType &&
row.settlementType &&
row.settlementType !== this.lockedSettlementType
) {
await this.$router.replace({
path: settlementListPath(row.settlementType),
query: { detailNo: formalSettlementNo },
});
return;
}
if (!this.lockedSettlementType) {
this.activeSettlementType = row.settlementType || this.activeSettlementType;
}
@@ -1914,7 +1914,7 @@ export default {
return;
}
if (this.settlementType === 'payable' && column.prop === 'formalSettlementNo') {
this.openSettlementDetail('/settlement/formal-settlement', row.formalSettlementNo);
this.openSettlementDetail('/settlement/payment-settlement', row.formalSettlementNo);
return;
}
this.openDetailDialog(row);
@@ -185,6 +185,7 @@ import { kingdeeSyncStatusOptions } from '@/option/settlement/formalSettlementSe
import SettlementAdjustmentEditor from './components/settlement-adjustment-editor.vue';
import SettlementTableTools from './components/settlement-table-tools.vue';
import { isAdministrator } from '@/utils/auth';
import { settlementListPath } from '@/utils/settlement-menu';
const emptyQuery = () => ({
adjustmentNo: '',
@@ -285,20 +286,23 @@ export default {
openView(row) {
this.editor = { visible: true, id: row.id, readonly: true };
},
// 单据号→本单查看弹窗;结算单号→跳正式结算列表页并自动打开该单详情(页面支持 ?detailNo=)
// 单据号→本单查看弹窗;结算单号→跳付款/收款结算列表页并自动打开该单详情(页面支持 ?detailNo=)
handleTableLink(row, column) {
if (column.prop === 'formalSettlementNo') {
this.openSettlementDetail(row.formalSettlementNo);
this.openSettlementDetail(row.formalSettlementNo, row.settlementType);
return;
}
this.openView(row);
},
openSettlementDetail(detailNo) {
openSettlementDetail(detailNo, settlementType) {
if (!detailNo) {
this.$message.info('当前记录未关联结算单详情');
return;
}
this.$router.push({ path: '/settlement/formal-settlement', query: { detailNo } });
this.$router.push({
path: settlementListPath(settlementType),
query: { detailNo },
});
},
isEditable(row) {
return ['draft', 'returned'].includes(row.approvalStatus);