|
|
@@ -115,6 +115,12 @@
|
|
|
tableList: [],
|
|
|
type: 'add',
|
|
|
cacheKeyUrl: 'eom-addDoc-main',
|
|
|
+ // 懒渲染模式(表格行内大量挂载本组件):created 阶段不请求列配置。
|
|
|
+ // 否则每挂载一个实例就会打一次 getByTableId,表格里挂 N 行就是 N 次请求洪水,
|
|
|
+ // 会把浏览器同源连接池打满(实测发货单 50 行 → 150 次请求,单请求耗时从 0.4s 堆到 20s)。
|
|
|
+ // 改为真正 open() 弹框时才取一次。
|
|
|
+ // 非懒渲染场景保持原行为(created 即取列配置)。
|
|
|
+ tabMixinsInit: !this.lazyRender,
|
|
|
columns: [
|
|
|
{
|
|
|
label: '编码',
|
|
|
@@ -185,18 +191,35 @@
|
|
|
]
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ // 列配置加载的 promise 守卫(非响应式,避免把 Promise 塞进 data)
|
|
|
+ this.tabColumnsPromise = null;
|
|
|
+ },
|
|
|
|
|
|
methods: {
|
|
|
- open(fileId, type) {
|
|
|
+ async open(fileId, type) {
|
|
|
//查看详情:view 新增:add
|
|
|
this.showEditFlag = true;
|
|
|
this.fileId = fileId || [];
|
|
|
if (type) {
|
|
|
this.type = type;
|
|
|
}
|
|
|
+ // 懒渲染模式:created 阶段没取列配置,这里真正打开时补取一次
|
|
|
+ if (this.lazyRender) {
|
|
|
+ await this.ensureTabColumns();
|
|
|
+ }
|
|
|
this.init();
|
|
|
},
|
|
|
+ // 懒渲染模式下按需加载列配置:同一实例只请求一次,并发调用共享同一个 promise
|
|
|
+ async ensureTabColumns() {
|
|
|
+ if (!this.lazyRender) return;
|
|
|
+ if (!this.tabColumnsPromise) {
|
|
|
+ this.tabColumnsPromise = this.getTabColumns().catch((e) => {
|
|
|
+ console.warn('[addDoc] 获取列配置失败:', e);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ await this.tabColumnsPromise;
|
|
|
+ },
|
|
|
openFileList(type) {
|
|
|
if (this.disabled) return;
|
|
|
this.fileShow = true;
|