ff9fb9168b
- 为 waybill-manage-page、transport-plan-page 等组件增加 routePathLocked 变量锁定路由路径 - 添加 isOwnedRouteActive 计算属性,防止缓存实例错误读取其它路由的 detailId 导致误请求 - watcher 和 openDetail 方法中添加路由守卫,避免多余的请求和误开详情标签 - 修改宿主视图绑定 detailId,避免直接绑定全局 $route.query 导致缓存污染 - 删除 router/views/index.js 中合同管理详情路由重复定义,防止内容区空白问题 - 优化 waybill-import-dialog 组件样式和结构,增加 section-card 包裹表单区域 - 调整相关组件 data、computed、watch 使用,确保第一次立即 watcher 正确读取路由数据 - 验证所有改动后相关页面 HTTP 200,标签页行为正常,解决「运单管理不存在」和合同详情空白问题
37 lines
1.1 KiB
Vue
37 lines
1.1 KiB
Vue
<template>
|
||
<!--
|
||
detailId 必须做路由守卫:本组件对应 /business/waybill-manage/detail,
|
||
而 $route 是全局响应式的。标签页 keep-alive 会缓存本实例,路由切到别的详情页后
|
||
实例仍会重渲染,若无守卫就会把「当前页面的 id」灌进子组件,导致它拿别的单据 id
|
||
去查运单 → 报「运单管理不存在」,并误生成一个又一个运单详情标签。
|
||
-->
|
||
<waybill-manage-page
|
||
:api="api"
|
||
:config="config"
|
||
:crud-option="option"
|
||
:detail-id="detailId"
|
||
:menu-width="250"
|
||
standalone-detail-page
|
||
/>
|
||
</template>
|
||
|
||
<script>
|
||
import WaybillManagePage from './components/waybill-manage-page.vue';
|
||
import * as api from '@/api/business/waybill-manage';
|
||
import { config, option } from '@/option/business/waybill-manage';
|
||
|
||
const detailRoutePath = '/business/waybill-manage/detail';
|
||
|
||
export default {
|
||
components: { WaybillManagePage },
|
||
data() {
|
||
return { api, config, option };
|
||
},
|
||
computed: {
|
||
detailId() {
|
||
return this.$route.path === detailRoutePath ? this.$route.query.id : '';
|
||
},
|
||
},
|
||
};
|
||
</script>
|