vue2-client 1.20.66 → 1.20.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -584,8 +584,14 @@ export default {
|
|
|
584
584
|
* @param mixinData 需要混入得数据
|
|
585
585
|
* @param outEnv 其他传递给打开窗口的数据
|
|
586
586
|
* @param attr 传递给Modal弹框用的信息
|
|
587
|
+
* @param manageScope 管理快捷键作用域
|
|
587
588
|
*/
|
|
588
|
-
openDialog
|
|
589
|
+
openDialog(configName, selectedId, mixinData, outEnv = {}, attr = {}, showButtons = true, manageScope = false) {
|
|
590
|
+
if (manageScope) {
|
|
591
|
+
this.openDialogWithScope(configName, selectedId, mixinData, outEnv, attr, showButtons)
|
|
592
|
+
return
|
|
593
|
+
}
|
|
594
|
+
|
|
589
595
|
this.$refs.xAddReport.init({
|
|
590
596
|
configName: configName,
|
|
591
597
|
selectedId: selectedId,
|
|
@@ -595,6 +601,33 @@ export default {
|
|
|
595
601
|
showButtons: showButtons
|
|
596
602
|
})
|
|
597
603
|
},
|
|
604
|
+
// 打开弹窗(带快捷键作用域管理)
|
|
605
|
+
openDialogWithScope(configName, selectedId, mixinData, outEnv = {}, attr = {}, showButtons = true) {
|
|
606
|
+
const savedScopes = new Map()
|
|
607
|
+
if (shortcutManager.isEnabled) {
|
|
608
|
+
shortcutManager.scopeActive.forEach((active, scopeId) => {
|
|
609
|
+
savedScopes.set(scopeId, active)
|
|
610
|
+
shortcutManager.setScopeActive(scopeId, false)
|
|
611
|
+
})
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
const xAddReport = this.$refs.xAddReport
|
|
615
|
+
if (xAddReport && !xAddReport._shortcutPatched) {
|
|
616
|
+
xAddReport._shortcutPatched = true
|
|
617
|
+
const originalClose = xAddReport.close.bind(xAddReport)
|
|
618
|
+
xAddReport.close = () => {
|
|
619
|
+
if (shortcutManager.isEnabled && savedScopes.size > 0) {
|
|
620
|
+
savedScopes.forEach((wasActive, scopeId) => {
|
|
621
|
+
if (wasActive) shortcutManager.setScopeActive(scopeId, true)
|
|
622
|
+
})
|
|
623
|
+
}
|
|
624
|
+
originalClose()
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
xAddReport.init({ configName, selectedId, mixinData, outEnv, attr, showButtons })
|
|
629
|
+
},
|
|
630
|
+
|
|
598
631
|
openDrawer (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
|
|
599
632
|
this.$refs.xReportDrawer.init({
|
|
600
633
|
configName,
|
|
@@ -340,8 +340,8 @@ export default {
|
|
|
340
340
|
// 3. 检查组件是否有 realQueryConfig(如 XFormTable)
|
|
341
341
|
const tab = this.config.data[index]
|
|
342
342
|
const isFormTableType = tab?.slotType === 'x-form-table' ||
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
tab?.slotType === 'XFormTable' ||
|
|
344
|
+
tab?.slotType?.toLowerCase() === 'xformtable'
|
|
345
345
|
if (isFormTableType && component.realQueryConfig === undefined && !component.loadError) {
|
|
346
346
|
if (attempts < maxAttempts) {
|
|
347
347
|
setTimeout(checkReady, checkInterval)
|
|
@@ -484,7 +484,85 @@ export default {
|
|
|
484
484
|
},
|
|
485
485
|
// 确保页签已加载,如果未加载则先加载,返回 Promise 等待组件渲染完成
|
|
486
486
|
ensureTabLoaded (index, options = {}) {
|
|
487
|
-
return Promise
|
|
487
|
+
return new Promise((resolve, reject) => {
|
|
488
|
+
const numIndex = Number(index)
|
|
489
|
+
const innerRefs = Array.isArray(options.innerRefs) ? options.innerRefs : []
|
|
490
|
+
const allowSwitch = options.allowSwitch !== false
|
|
491
|
+
// 验证索引有效性
|
|
492
|
+
if (isNaN(numIndex) || numIndex < 0) {
|
|
493
|
+
reject(new Error(`无效的页签索引: ${index}`))
|
|
494
|
+
return
|
|
495
|
+
}
|
|
496
|
+
if (!this.config || !this.config.data || !this.config.data[numIndex]) {
|
|
497
|
+
reject(new Error(`页签索引 ${index} 不存在`))
|
|
498
|
+
return
|
|
499
|
+
}
|
|
500
|
+
// 如果已经加载,直接返回组件实例
|
|
501
|
+
if (this.isTabLoaded(numIndex)) {
|
|
502
|
+
const component = this.getTabComponent(numIndex)
|
|
503
|
+
if (component) {
|
|
504
|
+
if (innerRefs.length === 0) {
|
|
505
|
+
resolve(component)
|
|
506
|
+
} else {
|
|
507
|
+
this.waitForInnerRefs(component, innerRefs, resolve, reject)
|
|
508
|
+
}
|
|
509
|
+
} else {
|
|
510
|
+
// 已标记但组件可能还在渲染中,等待一下
|
|
511
|
+
this.$nextTick(() => {
|
|
512
|
+
const comp = this.getTabComponent(numIndex)
|
|
513
|
+
if (comp) {
|
|
514
|
+
if (innerRefs.length === 0) {
|
|
515
|
+
resolve(comp)
|
|
516
|
+
} else {
|
|
517
|
+
this.waitForInnerRefs(comp, innerRefs, resolve, reject)
|
|
518
|
+
}
|
|
519
|
+
} else {
|
|
520
|
+
// 等待组件mounted
|
|
521
|
+
this.waitForComponent(numIndex, (c) => {
|
|
522
|
+
if (innerRefs.length === 0) {
|
|
523
|
+
resolve(c)
|
|
524
|
+
} else {
|
|
525
|
+
this.waitForInnerRefs(c, innerRefs, resolve, reject)
|
|
526
|
+
}
|
|
527
|
+
}, reject)
|
|
528
|
+
}
|
|
529
|
+
})
|
|
530
|
+
}
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
// 标记为已加载,触发渲染
|
|
534
|
+
this.markTabAsLoaded(numIndex)
|
|
535
|
+
// 优先尝试在不切换页签的情况下获取组件
|
|
536
|
+
this.$nextTick(() => {
|
|
537
|
+
const comp = this.getTabComponent(numIndex)
|
|
538
|
+
if (comp) {
|
|
539
|
+
if (innerRefs.length === 0) resolve(comp)
|
|
540
|
+
else this.waitForInnerRefs(comp, innerRefs, resolve, reject)
|
|
541
|
+
return
|
|
542
|
+
}
|
|
543
|
+
// 若仍未渲染,且允许临时切换,则进行一次激活-恢复回退
|
|
544
|
+
if (!allowSwitch) {
|
|
545
|
+
// 不允许切换则进入常规等待(可能更慢)
|
|
546
|
+
this.waitForComponent(numIndex, (c) => {
|
|
547
|
+
if (innerRefs.length === 0) resolve(c)
|
|
548
|
+
else this.waitForInnerRefs(c, innerRefs, resolve, reject)
|
|
549
|
+
}, reject)
|
|
550
|
+
return
|
|
551
|
+
}
|
|
552
|
+
const prevActive = this.activeKey
|
|
553
|
+
this.activeKey = numIndex
|
|
554
|
+
this.$nextTick(() => {
|
|
555
|
+
this.waitForComponent(numIndex, (c) => {
|
|
556
|
+
// 组件到位后再恢复原激活页签
|
|
557
|
+
if (prevActive !== numIndex) {
|
|
558
|
+
this.$nextTick(() => { this.activeKey = prevActive })
|
|
559
|
+
}
|
|
560
|
+
if (innerRefs.length === 0) resolve(c)
|
|
561
|
+
else this.waitForInnerRefs(c, innerRefs, resolve, reject)
|
|
562
|
+
}, reject)
|
|
563
|
+
})
|
|
564
|
+
})
|
|
565
|
+
})
|
|
488
566
|
},
|
|
489
567
|
// 等待组件渲染完成
|
|
490
568
|
waitForComponent (index, resolve, reject) {
|
|
@@ -341,8 +341,12 @@ export default {
|
|
|
341
341
|
// 检查下一个节点是否为分支退出节点
|
|
342
342
|
const nextStep = this.stepsDefine.find(step => step.id === this.nextBtnTo)
|
|
343
343
|
|
|
344
|
-
//
|
|
345
|
-
if (!nextStep
|
|
344
|
+
// 如果下一个节点 没有有等待节点 waitStepIds, 说明不是分支的最后一个节点
|
|
345
|
+
if (!nextStep
|
|
346
|
+
|| !(Object.prototype.hasOwnProperty.call(nextStep.properties, 'waitStepIds') &&
|
|
347
|
+
Array.isArray(nextStep.properties?.waitStepIds) &&
|
|
348
|
+
nextStep.properties?.waitStepIds.length > 0)
|
|
349
|
+
) {
|
|
346
350
|
return defaultResult
|
|
347
351
|
}
|
|
348
352
|
|