cloud-web-corejs 1.1.0-dev.50 → 1.1.0-dev.52
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 +1 -1
- package/src/components/formDialog/index.vue +11 -8
- package/src/components/onlineTalk/mixins.js +3 -4
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +14 -0
- package/src/components/xform/mixins/scriptHttp.js +13 -13
- package/src/components/xform/utils/fixedQueryUtil.js +29 -4
- package/src/components/xform/utils/serviceNameCache.js +69 -0
- package/src/router/modules/customer.js +17 -2
- package/src/utils/resolveViewComponent.js +45 -90
- package/src/views/user/home/default.vue +10 -20
- package/src/views/user/home/default2.vue +10 -20
package/package.json
CHANGED
|
@@ -190,6 +190,7 @@
|
|
|
190
190
|
|
|
191
191
|
<script>
|
|
192
192
|
import { openComponentDialog } from "@base/utils/componentDialog";
|
|
193
|
+
import { getCachedServiceName } from "@base/components/xform/utils/serviceNameCache";
|
|
193
194
|
import {
|
|
194
195
|
resolveActionButtons,
|
|
195
196
|
hasButtonPermission,
|
|
@@ -561,14 +562,13 @@ export default {
|
|
|
561
562
|
}
|
|
562
563
|
const [formCode, scriptCode] = parts;
|
|
563
564
|
this.$set(this.optionsLoadingMap, field.prop, true);
|
|
564
|
-
this
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
method: "post",
|
|
568
|
-
data: { formCode, scriptCode },
|
|
565
|
+
getCachedServiceName(this, {
|
|
566
|
+
formCode,
|
|
567
|
+
scriptCode,
|
|
569
568
|
isLoading: false,
|
|
570
|
-
|
|
571
|
-
|
|
569
|
+
aes: true,
|
|
570
|
+
}).then(
|
|
571
|
+
(serviceName) => {
|
|
572
572
|
if (!serviceName) {
|
|
573
573
|
this.$set(this.optionsLoadingMap, field.prop, false);
|
|
574
574
|
this.$baseAlert("服务名不存在");
|
|
@@ -605,7 +605,10 @@ export default {
|
|
|
605
605
|
},
|
|
606
606
|
});
|
|
607
607
|
},
|
|
608
|
-
|
|
608
|
+
() => {
|
|
609
|
+
this.$set(this.optionsLoadingMap, field.prop, false);
|
|
610
|
+
}
|
|
611
|
+
);
|
|
609
612
|
},
|
|
610
613
|
// 搜索框默认禁止手输(值由选择回填),传 props: { editable: true } 可放开
|
|
611
614
|
searchReadonly(field) {
|
|
@@ -290,7 +290,7 @@ tmixins = {
|
|
|
290
290
|
method: `post`,
|
|
291
291
|
data: {operateTime: time},
|
|
292
292
|
modal: false,
|
|
293
|
-
...(silent ? {
|
|
293
|
+
...(silent ? { errorMsg: false } : {}),
|
|
294
294
|
success: res => {
|
|
295
295
|
let records = res.objx || [];
|
|
296
296
|
records.forEach(record => {
|
|
@@ -394,7 +394,7 @@ tmixins = {
|
|
|
394
394
|
direction: direction
|
|
395
395
|
},
|
|
396
396
|
modal: false,
|
|
397
|
-
...(silent ? {
|
|
397
|
+
...(silent ? { errorMsg: false } : {}),
|
|
398
398
|
success: res => {
|
|
399
399
|
let rows = res.objx || [];
|
|
400
400
|
if (rows.length) {
|
|
@@ -496,8 +496,7 @@ tmixins = {
|
|
|
496
496
|
method: `post`,
|
|
497
497
|
data: {},
|
|
498
498
|
modal: false,
|
|
499
|
-
|
|
500
|
-
ignore502: true,
|
|
499
|
+
errorMsg: false,
|
|
501
500
|
success: res => {
|
|
502
501
|
this.isExitsRead = res.objx === 1;
|
|
503
502
|
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
} from "@base/components/xform/utils/formula-util";
|
|
31
31
|
import * as formulajs from "@formulajs/formulajs";
|
|
32
32
|
import settingConfig from "@/settings.js";
|
|
33
|
+
import { isQueryTableConditionWidget } from "@base/components/xform/utils/fixedQueryUtil";
|
|
33
34
|
|
|
34
35
|
let modules = {};
|
|
35
36
|
const isDev = process.env.NODE_ENV === "development";
|
|
@@ -775,6 +776,17 @@ modules = {
|
|
|
775
776
|
}
|
|
776
777
|
this.initGloatOptionItems(true);
|
|
777
778
|
},
|
|
779
|
+
/**
|
|
780
|
+
* 查询表格条件区拉选项时不盖加载层。列组件(有 tableParam)和按钮区不走这里。
|
|
781
|
+
* @returns {Object}
|
|
782
|
+
*/
|
|
783
|
+
getQueryConditionHttpOption() {
|
|
784
|
+
if (this.tableParam) return {};
|
|
785
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
786
|
+
let widgetList = formRef && formRef.widgetList;
|
|
787
|
+
if (!isQueryTableConditionWidget(widgetList, this.field)) return {};
|
|
788
|
+
return { isLoading: false, modal: false };
|
|
789
|
+
},
|
|
778
790
|
initGloatOptionItems(initFlag) {
|
|
779
791
|
let t = this;
|
|
780
792
|
if (this.designState) {
|
|
@@ -812,6 +824,7 @@ modules = {
|
|
|
812
824
|
);
|
|
813
825
|
return this.formHttp({
|
|
814
826
|
scriptCode: scriptCode,
|
|
827
|
+
...this.getQueryConditionHttpOption(),
|
|
815
828
|
data: this.buildFormScriptData(reportTemplate, { ...accessParam }),
|
|
816
829
|
callback: (res) => {
|
|
817
830
|
let rows = res.objx?.records || res.objx || [];
|
|
@@ -961,6 +974,7 @@ modules = {
|
|
|
961
974
|
);
|
|
962
975
|
return this.formHttp({
|
|
963
976
|
scriptCode: scriptCode,
|
|
977
|
+
...this.getQueryConditionHttpOption(),
|
|
964
978
|
data: this.buildFormScriptData(reportTemplate, { ...accessParam }),
|
|
965
979
|
callback: (res) => {
|
|
966
980
|
let rows = res.objx || [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { initWf } from "../../../components/wf/wfUtil";
|
|
2
2
|
import { getReportGlobalMap } from "../../../components/xform/utils/util";
|
|
3
|
+
import { getCachedServiceName } from "../../../components/xform/utils/serviceNameCache";
|
|
3
4
|
import { decrypt } from "@base/utils/aes";
|
|
4
5
|
|
|
5
6
|
let modules = {};
|
|
@@ -78,26 +79,25 @@ modules = {
|
|
|
78
79
|
|
|
79
80
|
let getServiceName = (callback) => {
|
|
80
81
|
if (formCode && formCode !== reportTemplate.formCode) {
|
|
81
|
-
this.getHttpTarget()
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
method: `post`,
|
|
85
|
-
data: {
|
|
86
|
-
formCode,
|
|
87
|
-
scriptCode,
|
|
88
|
-
},
|
|
82
|
+
getCachedServiceName(this.getHttpTarget(), {
|
|
83
|
+
formCode,
|
|
84
|
+
scriptCode,
|
|
89
85
|
isLoading,
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
// 调用方关掉 modal 时,查服务名这一跳也别再盖遮罩
|
|
87
|
+
modal: opts.modal,
|
|
88
|
+
aes: true,
|
|
89
|
+
}).then(
|
|
90
|
+
(serviceName) => {
|
|
94
91
|
if (serviceName) {
|
|
95
92
|
callback(serviceName);
|
|
96
93
|
} else {
|
|
97
94
|
this.$baseAlert("服务名不存在");
|
|
98
95
|
}
|
|
99
96
|
},
|
|
100
|
-
|
|
97
|
+
() => {
|
|
98
|
+
// 失败提示由请求层处理,不继续请求脚本
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
101
|
} else {
|
|
102
102
|
callback(reportTemplate.serviceName);
|
|
103
103
|
}
|
|
@@ -63,13 +63,14 @@ export function isLockedSearchColumn(column) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @param {Array} widgetList
|
|
66
|
+
* 字段是否落在某个数据表格的查询区(data-table 的 widgetList 分支,不含 buttons、
|
|
67
|
+
* 不含表格列组件)。
|
|
68
|
+
* @param {Array} widgetList 表单顶层组件列表
|
|
69
69
|
* @param {Object} widget 待判定的字段组件
|
|
70
|
+
* @param {Function} [acceptTable] 额外过滤数据表格节点,返回 false 则跳过该表
|
|
70
71
|
* @returns {Boolean}
|
|
71
72
|
*/
|
|
72
|
-
|
|
73
|
+
function isInDataTableQueryArea(widgetList, widget, acceptTable) {
|
|
73
74
|
if (!widget || !widget.id || !Array.isArray(widgetList)) return false;
|
|
74
75
|
let inQueryArea = false;
|
|
75
76
|
widgetList.forEach((item) => {
|
|
@@ -79,6 +80,7 @@ export function isQueryAreaWidget(widgetList, widget) {
|
|
|
79
80
|
node.category !== "container"
|
|
80
81
|
|| node.type !== "data-table"
|
|
81
82
|
|| !Array.isArray(node.widgetList)
|
|
83
|
+
|| (acceptTable && !acceptTable(node))
|
|
82
84
|
) {
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
@@ -91,3 +93,26 @@ export function isQueryAreaWidget(widgetList, widget) {
|
|
|
91
93
|
});
|
|
92
94
|
return inQueryArea;
|
|
93
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 组件是否位于某个数据表格的查询区。属性面板据此决定要不要显示「固定查询条件」开关。
|
|
99
|
+
* @param {Array} widgetList 表单顶层组件列表(designer.widgetList)
|
|
100
|
+
* @param {Object} widget 待判定的字段组件
|
|
101
|
+
* @returns {Boolean}
|
|
102
|
+
*/
|
|
103
|
+
export function isQueryAreaWidget(widgetList, widget) {
|
|
104
|
+
return isInDataTableQueryArea(widgetList, widget);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 字段是否位于「查询表格」的查询条件区:数据表格已打开 isQueryTable,且字段在其
|
|
109
|
+
* widgetList 里(含栅格等容器嵌套)。按钮区、表格列、主表单字段都不算。
|
|
110
|
+
* @param {Array} widgetList 表单顶层组件列表
|
|
111
|
+
* @param {Object} widget 待判定的字段组件
|
|
112
|
+
* @returns {Boolean}
|
|
113
|
+
*/
|
|
114
|
+
export function isQueryTableConditionWidget(widgetList, widget) {
|
|
115
|
+
return isInDataTableQueryArea(widgetList, widget, (node) => {
|
|
116
|
+
return !!(node.options && node.options.isQueryTable);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { findScope, getScopeParams } from "@base/views/bd/project/core/branchContext";
|
|
2
|
+
|
|
3
|
+
/** 会话内服务名。刷新页面即失效,不落本地存储。 */
|
|
4
|
+
const cache = new Map();
|
|
5
|
+
/** 同一键进行中的请求,避免并发时各自打一次接口。 */
|
|
6
|
+
const pending = new Map();
|
|
7
|
+
|
|
8
|
+
function cacheKey(formCode, scriptCode, scopeParams, aes) {
|
|
9
|
+
const branchFlag =
|
|
10
|
+
scopeParams && scopeParams.branchFlag != null ? String(scopeParams.branchFlag) : "";
|
|
11
|
+
const branchCode =
|
|
12
|
+
scopeParams && scopeParams.branchCode ? String(scopeParams.branchCode) : "";
|
|
13
|
+
return [formCode, scriptCode, branchFlag, branchCode, aes ? "1" : "0"].join("\0");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 查询表单脚本所属服务名。
|
|
18
|
+
* 命中内存缓存直接返回;同一 formCode + scriptCode + 分支 + aes 的并发请求合并为一次。
|
|
19
|
+
* 只缓存成功且有服务名的结果。
|
|
20
|
+
*
|
|
21
|
+
* @param {Vue} vm 发起 $http 的实例,分支作用域沿它的父链查找
|
|
22
|
+
* @param {{formCode: string, scriptCode: string, isLoading?: boolean, modal?: boolean, aes?: boolean}} opts
|
|
23
|
+
* @returns {Promise<string>} 有服务名时 resolve 服务名;成功但没有服务名时 resolve 空字符串;请求失败 reject
|
|
24
|
+
*/
|
|
25
|
+
export function getCachedServiceName(vm, opts) {
|
|
26
|
+
const formCode = opts.formCode;
|
|
27
|
+
const scriptCode = opts.scriptCode;
|
|
28
|
+
const aes = !!opts.aes;
|
|
29
|
+
const scopeParams = getScopeParams(findScope(vm));
|
|
30
|
+
const key = cacheKey(formCode, scriptCode, scopeParams, aes);
|
|
31
|
+
|
|
32
|
+
if (cache.has(key)) {
|
|
33
|
+
return Promise.resolve(cache.get(key));
|
|
34
|
+
}
|
|
35
|
+
const inflight = pending.get(key);
|
|
36
|
+
if (inflight) {
|
|
37
|
+
return inflight;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const task = vm
|
|
41
|
+
.$http({
|
|
42
|
+
...(aes ? { aes: true } : {}),
|
|
43
|
+
url: USER_PREFIX + "/formScript/getServiceName",
|
|
44
|
+
method: "post",
|
|
45
|
+
data: {
|
|
46
|
+
formCode,
|
|
47
|
+
scriptCode,
|
|
48
|
+
},
|
|
49
|
+
isLoading: opts.isLoading,
|
|
50
|
+
modal: opts.modal,
|
|
51
|
+
})
|
|
52
|
+
.then((res) => {
|
|
53
|
+
if (!res || res.type !== "success") {
|
|
54
|
+
return Promise.reject(res);
|
|
55
|
+
}
|
|
56
|
+
const serviceName = res.objx;
|
|
57
|
+
if (serviceName) {
|
|
58
|
+
cache.set(key, serviceName);
|
|
59
|
+
return serviceName;
|
|
60
|
+
}
|
|
61
|
+
return "";
|
|
62
|
+
})
|
|
63
|
+
.finally(() => {
|
|
64
|
+
pending.delete(key);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
pending.set(key, task);
|
|
68
|
+
return task;
|
|
69
|
+
}
|
|
@@ -72,5 +72,20 @@ export const constantRoutes = [
|
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
|
-
},*/
|
|
76
|
-
|
|
75
|
+
},*/
|
|
76
|
+
{
|
|
77
|
+
path: "",
|
|
78
|
+
component: () => import("@/layout/index"),
|
|
79
|
+
children: [
|
|
80
|
+
{
|
|
81
|
+
path: "/haier/system/salesman/list",
|
|
82
|
+
component: () => import("@/views/haier/system/salesman/list.vue"),
|
|
83
|
+
name: "haierSalesmanPilot",
|
|
84
|
+
meta: {
|
|
85
|
+
title: "业务员",
|
|
86
|
+
icon: "user",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
@@ -1,37 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动态详情页组件解析(qiankun 微前端兼容)。
|
|
3
|
-
*
|
|
4
|
-
* 全库有一批「用运行时字符串 require 视图组件、就地渲染详情页」的站点
|
|
5
|
-
* (wf 单据详情、消息通知、外链单页、表单文件引用…),历史上各自散着
|
|
6
|
-
* 4 套前缀判断(白名单 / @base·@/ 前缀嗅探 / form 硬分叉 / 裸拼)。本文件
|
|
7
|
-
* 把解析逻辑收敛到一处,并让它在微前端下正确区分组件归属。
|
|
8
|
-
*
|
|
9
|
-
* 归属三类(对齐 docs/qiankun接入协议.md 的命名空间语义):
|
|
10
|
-
* ① base —— 组件在 cloud-web-corejs 包内(@base/views),任何应用都有
|
|
11
|
-
* ② localPrivate —— 渲染方自己的私有视图(@/views)
|
|
12
|
-
* ③ remote —— 归属别的子应用的私有视图;组件不在当前 bundle,
|
|
13
|
-
* 不能本地 require,交调用方走 micro-view-host 装载或兜底
|
|
14
|
-
* (详见 docs/qiankun动态详情页承载方案.md 第 5 节)
|
|
15
|
-
*
|
|
16
|
-
* 核心归属/剥前缀/base 命名空间的判断复用 menuAdapter.resolveComponentPath,
|
|
17
|
-
* 本文件只在其上加:白名单、.vue 归一、remote 判定、require 落地、缺文件兜底。
|
|
18
|
-
* 因此无需注册表——归属靠访问路径结构 + 本应用 appCode 比较即可;独立运行 /
|
|
19
|
-
* 主应用态(appCode 为空、无 /micro/ 前缀)会自动退化为与历史一致的本地解析。
|
|
20
|
-
*
|
|
21
|
-
* webpack 硬约束:@base/views 与 @/views
|
|
22
|
-
* 不可把前缀变量化,否则 webpack 无法收集 context。包被消费时 @base 指向包内
|
|
23
|
-
* views、@/ 指向消费应用 views——这正是 base / localPrivate 的语义来源。
|
|
24
|
-
*
|
|
25
|
-
* 2026-08 改造:这两条从同步 require 改为 import()(mode:"lazy")。原先同步 context
|
|
26
|
-
* 把两仓 2300+ 个视图全部焊进入口 chunk——app.js 20MB、全站只有 53 个 chunk,
|
|
27
|
-
* 路由里的 () => import(...) 全部作废。三条不变量:
|
|
28
|
-
* ① 本文件是两仓中**唯一**允许书写「视图路径拼接 import」的地方。ContextModule 的
|
|
29
|
-
* 同一性由 mode/regExp/include/exclude/chunkName/namespaceObject 共同决定,别处再写
|
|
30
|
-
* 一条(magic comment 不一致、或写在 CJS 模块里)就会分叉出第二条 context,
|
|
31
|
-
* 同一批视图产出约 2300 个重复 chunk。其余调用点一律走 loadViewComponentAsync。
|
|
32
|
-
* ② 每条 context root 全有全无:任何一处残留的同步 require("@/views" + x) 都会让
|
|
33
|
-
* 整条 root 退回 mode:"sync" 并重新焊回入口包,且无报错无日志。
|
|
34
|
-
* ③ resolveViewPath 保持纯同步——tests/unit/utils/resolveViewComponent.spec.js 只测它。
|
|
1
|
+
/**
|
|
2
|
+
* 动态详情页组件解析(qiankun 微前端兼容)。
|
|
3
|
+
*
|
|
4
|
+
* 全库有一批「用运行时字符串 require 视图组件、就地渲染详情页」的站点
|
|
5
|
+
* (wf 单据详情、消息通知、外链单页、表单文件引用…),历史上各自散着
|
|
6
|
+
* 4 套前缀判断(白名单 / @base·@/ 前缀嗅探 / form 硬分叉 / 裸拼)。本文件
|
|
7
|
+
* 把解析逻辑收敛到一处,并让它在微前端下正确区分组件归属。
|
|
8
|
+
*
|
|
9
|
+
* 归属三类(对齐 docs/qiankun接入协议.md 的命名空间语义):
|
|
10
|
+
* ① base —— 组件在 cloud-web-corejs 包内(@base/views),任何应用都有
|
|
11
|
+
* ② localPrivate —— 渲染方自己的私有视图(@/views)
|
|
12
|
+
* ③ remote —— 归属别的子应用的私有视图;组件不在当前 bundle,
|
|
13
|
+
* 不能本地 require,交调用方走 micro-view-host 装载或兜底
|
|
14
|
+
* (详见 docs/qiankun动态详情页承载方案.md 第 5 节)
|
|
15
|
+
*
|
|
16
|
+
* 核心归属/剥前缀/base 命名空间的判断复用 menuAdapter.resolveComponentPath,
|
|
17
|
+
* 本文件只在其上加:白名单、.vue 归一、remote 判定、require 落地、缺文件兜底。
|
|
18
|
+
* 因此无需注册表——归属靠访问路径结构 + 本应用 appCode 比较即可;独立运行 /
|
|
19
|
+
* 主应用态(appCode 为空、无 /micro/ 前缀)会自动退化为与历史一致的本地解析。
|
|
20
|
+
*
|
|
21
|
+
* webpack 硬约束:@base/views 与 @/views 两条 require 必须保留字面前缀,
|
|
22
|
+
* 不可把前缀变量化,否则 webpack 无法收集 context。包被消费时 @base 指向包内
|
|
23
|
+
* views、@/ 指向消费应用 views——这正是 base / localPrivate 的语义来源。
|
|
35
24
|
*/
|
|
36
25
|
import {
|
|
37
26
|
getOwnerSegment,
|
|
@@ -147,54 +136,24 @@ export function resolveViewPath(rawUrl, options = {}) {
|
|
|
147
136
|
return { kind: "localPrivate", base: false, rel: ensureVue(ensureLeadingSlash(path)) };
|
|
148
137
|
}
|
|
149
138
|
|
|
150
|
-
// ———
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// 生产端不会因这一行建出 mode:"sync" 的 ContextModule —— 已用构建数字实测:
|
|
169
|
-
// 加这个分支前后 chunk 数与 app.js 字节数完全一致)。
|
|
170
|
-
// dev 侧行为与改造前一模一样:同步 context、HMR 速度不变,收益也测不出来
|
|
171
|
-
// (量化只能用 build:prod)。try/catch 是为了把同步抛错转成 reject,
|
|
172
|
-
// 好让下面 importViewCandidates 的候选链在 dev 下同样生效。
|
|
173
|
-
//
|
|
174
|
-
// 见文件头不变量 ①:全仓只有这两个函数可以写视图路径拼接的 import / require。
|
|
175
|
-
function importBaseView(rel) {
|
|
176
|
-
if (process.env.NODE_ENV === "development") {
|
|
177
|
-
try {
|
|
178
|
-
return Promise.resolve(require("@base/views" + rel));
|
|
179
|
-
} catch (e) {
|
|
180
|
-
return Promise.reject(e);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return import(/* webpackInclude: /\.vue$/ */ `@base/views${rel}`);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function importAppView(rel) {
|
|
187
|
-
if (process.env.NODE_ENV === "development") {
|
|
188
|
-
try {
|
|
189
|
-
return Promise.resolve(require("@/views" + rel));
|
|
190
|
-
} catch (e) {
|
|
191
|
-
return Promise.reject(e);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return import(/* webpackInclude: /\.vue$/ */ `@/views${rel}`);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** 已解析视图的 Promise 缓存:同一详情页重复打开不重复拉 chunk */
|
|
139
|
+
// ——— 以下为组件落地层(依赖 webpack context,不进纯函数单测) ———
|
|
140
|
+
|
|
141
|
+
function importBaseView(rel) {
|
|
142
|
+
try {
|
|
143
|
+
return Promise.resolve(require("@base/views" + rel));
|
|
144
|
+
} catch (e) {
|
|
145
|
+
return Promise.reject(e);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function importAppView(rel) {
|
|
150
|
+
try {
|
|
151
|
+
return Promise.resolve(require("@/views" + rel));
|
|
152
|
+
} catch (e) {
|
|
153
|
+
return Promise.reject(e);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
198
157
|
const viewModuleCache = new Map();
|
|
199
158
|
|
|
200
159
|
/**
|
|
@@ -228,11 +187,7 @@ function getViewModule(base, rel) {
|
|
|
228
187
|
}
|
|
229
188
|
|
|
230
189
|
/**
|
|
231
|
-
*
|
|
232
|
-
* 视图改按需加载后多出一类以前不可能发生的故障:chunk 404(发版后旧标签页哈希失效)、
|
|
233
|
-
* 超时、或被网关截断(截断表现为 chunk 内 SyntaxError,不是网络错误)。这类错误若沿用
|
|
234
|
-
* webpack 的 "Cannot find module" 文案会把排查引向「菜单配错路径」的错误方向,故在此改写
|
|
235
|
-
* 提示语;原始错误挂 .cause 供排查,.viewChunkLoadFailed 供调用方判定是否值得提示刷新。
|
|
190
|
+
* 保留原始缺文件错误;其它加载异常沿用统一提示。
|
|
236
191
|
*/
|
|
237
192
|
function normalizeViewError(e) {
|
|
238
193
|
if (e && e.code === "MODULE_NOT_FOUND") return e;
|
|
@@ -270,12 +225,12 @@ function getRendererAppCode() {
|
|
|
270
225
|
* 解析并加载详情页组件。resolveViewPath 的运行时外壳。
|
|
271
226
|
*
|
|
272
227
|
* 异步:必须 await 之后再置显隐标志 / 调 $openEditView,否则弹窗会先开出空壳
|
|
273
|
-
* ($openEditView
|
|
228
|
+
* ($openEditView 有定时放行逻辑)。
|
|
274
229
|
*
|
|
275
230
|
* @param {string} rawUrl 同 resolveViewPath
|
|
276
231
|
* @param {object} [options] 同 resolveViewPath;appCode 缺省时从 store 读取
|
|
277
232
|
* @returns {Promise<object>} resolveViewPath 的结果,附加 component 字段:
|
|
278
|
-
* - base / localPrivate:component
|
|
233
|
+
* - base / localPrivate:component 为组件对象(加载失败时为 null,附 error)
|
|
279
234
|
* - remote / empty / unknown:component 为 null,由调用方决定后续(装载子应用 / 兜底提示)
|
|
280
235
|
*/
|
|
281
236
|
export async function loadViewComponentAsync(rawUrl, options = {}) {
|
|
@@ -297,7 +252,7 @@ export async function loadViewComponentAsync(rawUrl, options = {}) {
|
|
|
297
252
|
/**
|
|
298
253
|
* 便捷封装:直接拿组件对象(或 null)。
|
|
299
254
|
* 供 components/wf/wf.js、mobile wfModifyDialogMixin.js 的 requireView 使用。
|
|
300
|
-
* remote / 缺文件 /
|
|
255
|
+
* remote / 缺文件 / 加载失败时返回 null(不抛错崩溃)。
|
|
301
256
|
*/
|
|
302
257
|
export function requireViewAsync(rawUrl, options = {}) {
|
|
303
258
|
return loadViewComponentAsync(rawUrl, options).then((r) => r.component);
|
|
@@ -339,8 +339,8 @@ export default {
|
|
|
339
339
|
if (!this.activating) {
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
|
-
this.getWfInfoList(isLoading);
|
|
343
|
-
this.getUnreadMessageNum(isLoading);
|
|
342
|
+
this.getWfInfoList(isLoading, true);
|
|
343
|
+
this.getUnreadMessageNum(isLoading, true);
|
|
344
344
|
this.$emit("timerHandle");
|
|
345
345
|
},
|
|
346
346
|
clearTimer() {
|
|
@@ -621,7 +621,7 @@ export default {
|
|
|
621
621
|
},
|
|
622
622
|
});
|
|
623
623
|
},
|
|
624
|
-
getWfInfoList(isLoading) {
|
|
624
|
+
getWfInfoList(isLoading, silent = false) {
|
|
625
625
|
if (!this.activating) {
|
|
626
626
|
return;
|
|
627
627
|
}
|
|
@@ -636,17 +636,12 @@ export default {
|
|
|
636
636
|
this.unDoWfRows =
|
|
637
637
|
res.objx && res.objx.records ? res.objx.records : [];
|
|
638
638
|
},
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
fail: (res, response) => {
|
|
643
|
-
if (response && response.status == 200) {
|
|
644
|
-
this.$errorMsg(res);
|
|
645
|
-
}
|
|
646
|
-
},
|
|
639
|
+
...(silent
|
|
640
|
+
? { errorMsg: false }
|
|
641
|
+
: { ignoreNetworkError: true, ignore502: true }),
|
|
647
642
|
});
|
|
648
643
|
},
|
|
649
|
-
getUnreadMessageNum(isLoading) {
|
|
644
|
+
getUnreadMessageNum(isLoading, silent = false) {
|
|
650
645
|
if (!this.activating) {
|
|
651
646
|
return;
|
|
652
647
|
}
|
|
@@ -660,14 +655,9 @@ export default {
|
|
|
660
655
|
success: (res) => {
|
|
661
656
|
this.unreadMessageNum = res.objx || 0;
|
|
662
657
|
},
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
fail: (res, response) => {
|
|
667
|
-
if (response && response.status == 200) {
|
|
668
|
-
this.$errorMsg(res);
|
|
669
|
-
}
|
|
670
|
-
},
|
|
658
|
+
...(silent
|
|
659
|
+
? { errorMsg: false }
|
|
660
|
+
: { ignoreNetworkError: true, ignore502: true }),
|
|
671
661
|
});
|
|
672
662
|
},
|
|
673
663
|
wfhandleCallback(flag) {
|
|
@@ -578,8 +578,8 @@ export default {
|
|
|
578
578
|
if (!this.activating) {
|
|
579
579
|
return;
|
|
580
580
|
}
|
|
581
|
-
this.getWfInfoList(isLoading);
|
|
582
|
-
this.getUnreadMessageNum(isLoading);
|
|
581
|
+
this.getWfInfoList(isLoading, true);
|
|
582
|
+
this.getUnreadMessageNum(isLoading, true);
|
|
583
583
|
this.$emit("timerHandle");
|
|
584
584
|
},
|
|
585
585
|
clearTimer() {
|
|
@@ -862,7 +862,7 @@ export default {
|
|
|
862
862
|
},
|
|
863
863
|
});
|
|
864
864
|
},
|
|
865
|
-
getWfInfoList(isLoading) {
|
|
865
|
+
getWfInfoList(isLoading, silent = false) {
|
|
866
866
|
if (!this.activating) {
|
|
867
867
|
return;
|
|
868
868
|
}
|
|
@@ -877,17 +877,12 @@ export default {
|
|
|
877
877
|
this.unDoWfRows =
|
|
878
878
|
res.objx && res.objx.records ? res.objx.records : [];
|
|
879
879
|
},
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
fail: (res, response) => {
|
|
884
|
-
if (response && response.status === 200) {
|
|
885
|
-
this.$errorMsg(res);
|
|
886
|
-
}
|
|
887
|
-
},
|
|
880
|
+
...(silent
|
|
881
|
+
? { errorMsg: false }
|
|
882
|
+
: { ignoreNetworkError: true, ignore502: true }),
|
|
888
883
|
});
|
|
889
884
|
},
|
|
890
|
-
getUnreadMessageNum(isLoading) {
|
|
885
|
+
getUnreadMessageNum(isLoading, silent = false) {
|
|
891
886
|
if (!this.activating) {
|
|
892
887
|
return;
|
|
893
888
|
}
|
|
@@ -901,14 +896,9 @@ export default {
|
|
|
901
896
|
success: (res) => {
|
|
902
897
|
this.unreadMessageNum = res.objx || 0;
|
|
903
898
|
},
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
fail: (res, response) => {
|
|
908
|
-
if (response && response.status === 200) {
|
|
909
|
-
this.$errorMsg(res);
|
|
910
|
-
}
|
|
911
|
-
},
|
|
899
|
+
...(silent
|
|
900
|
+
? { errorMsg: false }
|
|
901
|
+
: { ignoreNetworkError: true, ignore502: true }),
|
|
912
902
|
});
|
|
913
903
|
},
|
|
914
904
|
wfhandleCallback(flag) {
|