cloud-web-corejs 1.0.54-dev.781 → 1.0.54-dev.783
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/VabUpload/index.vue +242 -242
- package/src/components/VabUpload/mixins.js +1971 -1971
- package/src/components/VabUpload/privateProfileDialog.vue +2 -2
- package/src/components/hiprint/view/design/index.vue +7 -2
- package/src/components/obsUpload/index.vue +234 -234
- package/src/components/obsUpload/mixins.js +1542 -1542
- package/src/components/vb-tabs/x-tabs.vue +7 -3
- package/src/components/xform/docs//346/240/221/350/241/250rowField/346/224/266/346/225/233-/350/220/275/345/234/260/346/226/207/346/241/243.md +1427 -0
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +2 -2
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +2 -2
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +11 -2
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +369 -369
- package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +69 -23
- package/src/components/xform/form-render/container-item/data-table-item.vue +1 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +1469 -428
- package/src/components/xform/form-render/indexMixin.js +379 -263
- package/src/components/xform/mixins/defaultHandle.js +234 -28
- package/src/components/xform/mixins/scriptHttp.js +4 -4
- package/src/components/xform/utils/treeTableUtil.js +1265 -0
- package/src/components/xform/utils/util.js +29 -14
- package/src/microRouter/index.js +3 -0
- package/src/mixins/tableTree/index.js +77 -14
- package/src/store/config/index.js +28 -28
- package/src/utils/menuAdapter.js +277 -277
- package/src/utils/resolveViewComponent.js +203 -203
- package/src/utils/vab.js +6 -3
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +9 -2
- package/src/views/user/common_attribute/list.vue +1 -1
- package/src/views/user/form/vform/render.vue +17 -2
- package/src/views/user/form/view/list.vue +11 -10
- package/src/views/user/wf/wfReport/index.vue +625 -625
|
@@ -1,203 +1,203 @@
|
|
|
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 的语义来源。
|
|
24
|
-
*/
|
|
25
|
-
import {
|
|
26
|
-
getOwnerSegment,
|
|
27
|
-
resolveComponentPath,
|
|
28
|
-
MICRO_SEGMENT,
|
|
29
|
-
MICRO_DEBUG_SEGMENT,
|
|
30
|
-
} from "@base/utils/menuAdapter";
|
|
31
|
-
|
|
32
|
-
const BASE_VIEW_PREFIX = "@base/views";
|
|
33
|
-
const APP_VIEW_PREFIX = "@/views";
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 历史遗留的包内共享组件:以普通 /user/... 写法表达(未走 /base 命名空间),
|
|
37
|
-
* 必须落到 @base。微前端下的包内组件应改用 /base/... 或 @base/views 前缀,
|
|
38
|
-
* 由 resolveComponentPath 正确处理;本白名单只兜底存量写法。
|
|
39
|
-
*/
|
|
40
|
-
export const BASE_VIEW_WHITELIST = [
|
|
41
|
-
"/user/bill_setting/h5_view",
|
|
42
|
-
"/user/form/view/list",
|
|
43
|
-
"/user/form/view/edit",
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
function stripVue(p) {
|
|
47
|
-
return p.replace(/\.vue$/i, "");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function ensureVue(p) {
|
|
51
|
-
return /\.vue$/i.test(p) ? p : p + ".vue";
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function ensureLeadingSlash(p) {
|
|
55
|
-
if (!p) return p;
|
|
56
|
-
return p.charAt(0) === "/" ? p : "/" + p;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function firstSegment(p) {
|
|
60
|
-
return String(p || "").replace(/^\//, "").split("?")[0].split("/")[0];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function isMicroPath(p) {
|
|
64
|
-
const seg = firstSegment(p);
|
|
65
|
-
return seg === MICRO_SEGMENT || seg === MICRO_DEBUG_SEGMENT;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** 剥掉 /micro/<appCode> 或 /micro_debug/<appCode> 两段,得子应用内部路径 */
|
|
69
|
-
function stripMicroPrefix(p) {
|
|
70
|
-
const clean = ensureLeadingSlash(String(p || ""));
|
|
71
|
-
const parts = clean.split("/"); // ["", "micro", "appA", "user", ...]
|
|
72
|
-
return "/" + parts.slice(3).join("/");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 解析组件来源(纯函数,无 require、无副作用,可完整单测)。
|
|
77
|
-
*
|
|
78
|
-
* @param {string} rawUrl 组件来源路径:menu url / option.url / row.url /
|
|
79
|
-
* row.billUrl / row.mobileurl / defaultHomePage 等,
|
|
80
|
-
* 可带或不带 .vue 尾缀。
|
|
81
|
-
* @param {object} options
|
|
82
|
-
* @param {string} [options.route] 访问路径,用于归属判断(双字段写法下
|
|
83
|
-
* url 是组件来源、route 才带 /micro/ 归属段)
|
|
84
|
-
* @param {string} [options.appCode] 本应用(渲染方)appCode;主应用为空字符串
|
|
85
|
-
* @returns {object} 三态描述:
|
|
86
|
-
* { kind: 'empty' }
|
|
87
|
-
* { kind: 'base', base: true, rel: '/user/xxx.vue' }
|
|
88
|
-
* { kind: 'localPrivate', base: false, rel: '/user/xxx.vue' }
|
|
89
|
-
* { kind: 'remote', owner: 'appB', targetPath: '/user/xxx' }
|
|
90
|
-
* { kind: 'unknown', raw: '@other/xxx' } // 罕见的其它 @ 别名,调用方自行决定
|
|
91
|
-
*/
|
|
92
|
-
export function resolveViewPath(rawUrl, options = {}) {
|
|
93
|
-
const raw = String(rawUrl == null ? "" : rawUrl);
|
|
94
|
-
if (!raw) return { kind: "empty" };
|
|
95
|
-
|
|
96
|
-
const route = options.route;
|
|
97
|
-
const appCode = options.appCode || "";
|
|
98
|
-
|
|
99
|
-
// 1. 白名单:存量普通写法的包内共享组件 → @base
|
|
100
|
-
if (BASE_VIEW_WHITELIST.indexOf(stripVue(raw)) >= 0) {
|
|
101
|
-
return { kind: "base", base: true, rel: ensureVue(raw) };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 2. 委托 menuAdapter:处理 @ 前缀、/micro/ 剥离与归属、/base 命名空间
|
|
105
|
-
const path = resolveComponentPath({ url: raw }, appCode);
|
|
106
|
-
if (!path) return { kind: "empty" };
|
|
107
|
-
|
|
108
|
-
// 3. 单字段 remote:/micro/<别家>/... 时 resolveComponentPath 原样返回
|
|
109
|
-
if (isMicroPath(path)) {
|
|
110
|
-
return {
|
|
111
|
-
kind: "remote",
|
|
112
|
-
owner: getOwnerSegment(path),
|
|
113
|
-
targetPath: stripMicroPrefix(path),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// 4. 双字段 remote 防御:url 无 /micro/ 前缀,但 route 归属别家
|
|
118
|
-
const routeOwner = getOwnerSegment(String(route || ""));
|
|
119
|
-
if (routeOwner && routeOwner !== appCode) {
|
|
120
|
-
return { kind: "remote", owner: routeOwner, targetPath: ensureLeadingSlash(raw) };
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 5. 落位到 @base/views 或 @/views
|
|
124
|
-
if (path.indexOf(BASE_VIEW_PREFIX) === 0) {
|
|
125
|
-
return { kind: "base", base: true, rel: ensureVue(path.slice(BASE_VIEW_PREFIX.length)) };
|
|
126
|
-
}
|
|
127
|
-
if (path.indexOf(APP_VIEW_PREFIX) === 0) {
|
|
128
|
-
return { kind: "localPrivate", base: false, rel: ensureVue(path.slice(APP_VIEW_PREFIX.length)) };
|
|
129
|
-
}
|
|
130
|
-
if (path.charAt(0) === "@") {
|
|
131
|
-
// 其它 @ 别名(罕见):不猜测归属,交回调用方
|
|
132
|
-
return { kind: "unknown", raw: path };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// 原始 /xxx → 渲染方私有 @/views
|
|
136
|
-
return { kind: "localPrivate", base: false, rel: ensureVue(ensureLeadingSlash(path)) };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// ——— 以下为 require 落地层(依赖 webpack context,不进纯函数单测) ———
|
|
140
|
-
|
|
141
|
-
function requireBaseView(rel) {
|
|
142
|
-
return require("@base/views" + rel);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function requireAppView(rel) {
|
|
146
|
-
return require("@/views" + rel);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* 惰性读取本应用(渲染方)appCode,避免把 settings 拉进 resolveViewPath 的纯函数单测。
|
|
151
|
-
* 子应用取 settings.appCode(qiankun mount 会写入 props.appCode,与派生一致);
|
|
152
|
-
* 主应用 appCode 恒空、身份是 WEB_PREFIX 去斜杠(/sys → sys)——故回落 WEB_PREFIX。
|
|
153
|
-
* 与 store/modules/permission.js 的 getOwnAppCode 同口径:使 /micro/<自己>/... 被判成本地,
|
|
154
|
-
* 不误判成 remote 去自装载(也修掉子应用独立运行时 micro.appCode 为空的老坑)。
|
|
155
|
-
*/
|
|
156
|
-
function getRendererAppCode() {
|
|
157
|
-
const webPrefix = (window.WEB_PREFIX || "").replace(/^\/+/, "");
|
|
158
|
-
try {
|
|
159
|
-
// settings.js 是 CommonJS(module.exports),取 .default 会拿到 undefined,
|
|
160
|
-
// 必须兼容两种形态,否则 appCode 永远读不到、退化成 WEB_PREFIX 派生值,
|
|
161
|
-
// 与 store/modules/permission.js 的 getOwnAppCode 口径不一致(appCode 与
|
|
162
|
-
// WEB_PREFIX 不同名的应用会误判归属)。
|
|
163
|
-
const mod = require("@/settings");
|
|
164
|
-
const settings = (mod && mod.default) || mod;
|
|
165
|
-
return (settings && settings.appCode) || webPrefix;
|
|
166
|
-
} catch (e) {
|
|
167
|
-
return webPrefix;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* 解析并加载详情页组件。resolveViewPath 的运行时外壳。
|
|
173
|
-
*
|
|
174
|
-
* @param {string} rawUrl 同 resolveViewPath
|
|
175
|
-
* @param {object} [options] 同 resolveViewPath;appCode 缺省时从 store 读取
|
|
176
|
-
* @returns {object} resolveViewPath 的结果,附加 component 字段:
|
|
177
|
-
* - base / localPrivate:component 为组件对象(require 失败或缺文件时为 null,附 error)
|
|
178
|
-
* - remote / empty / unknown:component 为 null,由调用方决定后续(装载子应用 / 兜底提示)
|
|
179
|
-
*/
|
|
180
|
-
export function loadViewComponent(rawUrl, options = {}) {
|
|
181
|
-
const opts = Object.assign({}, options);
|
|
182
|
-
if (opts.appCode == null) opts.appCode = getRendererAppCode();
|
|
183
|
-
|
|
184
|
-
const result = resolveViewPath(rawUrl, opts);
|
|
185
|
-
if (result.kind !== "base" && result.kind !== "localPrivate") {
|
|
186
|
-
return Object.assign({ component: null }, result);
|
|
187
|
-
}
|
|
188
|
-
try {
|
|
189
|
-
const mod = result.base ? requireBaseView(result.rel) : requireAppView(result.rel);
|
|
190
|
-
return Object.assign({ component: mod && mod.default }, result);
|
|
191
|
-
} catch (e) {
|
|
192
|
-
return Object.assign({ component: null, error: e }, result);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* 兼容旧签名的便捷封装:直接返回组件对象(或 null)。
|
|
198
|
-
* 供 components/wf/wf.js、mobile wfModifyDialogMixin.js 的 requireView 平滑替换——
|
|
199
|
-
* 它们历史上返回 require(...).default。remote / 缺文件时返回 null(不再抛错崩溃)。
|
|
200
|
-
*/
|
|
201
|
-
export function requireViewCompat(rawUrl, options = {}) {
|
|
202
|
-
return loadViewComponent(rawUrl, options).component;
|
|
203
|
-
}
|
|
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 的语义来源。
|
|
24
|
+
*/
|
|
25
|
+
import {
|
|
26
|
+
getOwnerSegment,
|
|
27
|
+
resolveComponentPath,
|
|
28
|
+
MICRO_SEGMENT,
|
|
29
|
+
MICRO_DEBUG_SEGMENT,
|
|
30
|
+
} from "@base/utils/menuAdapter";
|
|
31
|
+
|
|
32
|
+
const BASE_VIEW_PREFIX = "@base/views";
|
|
33
|
+
const APP_VIEW_PREFIX = "@/views";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 历史遗留的包内共享组件:以普通 /user/... 写法表达(未走 /base 命名空间),
|
|
37
|
+
* 必须落到 @base。微前端下的包内组件应改用 /base/... 或 @base/views 前缀,
|
|
38
|
+
* 由 resolveComponentPath 正确处理;本白名单只兜底存量写法。
|
|
39
|
+
*/
|
|
40
|
+
export const BASE_VIEW_WHITELIST = [
|
|
41
|
+
"/user/bill_setting/h5_view",
|
|
42
|
+
"/user/form/view/list",
|
|
43
|
+
"/user/form/view/edit",
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
function stripVue(p) {
|
|
47
|
+
return p.replace(/\.vue$/i, "");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function ensureVue(p) {
|
|
51
|
+
return /\.vue$/i.test(p) ? p : p + ".vue";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function ensureLeadingSlash(p) {
|
|
55
|
+
if (!p) return p;
|
|
56
|
+
return p.charAt(0) === "/" ? p : "/" + p;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function firstSegment(p) {
|
|
60
|
+
return String(p || "").replace(/^\//, "").split("?")[0].split("/")[0];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isMicroPath(p) {
|
|
64
|
+
const seg = firstSegment(p);
|
|
65
|
+
return seg === MICRO_SEGMENT || seg === MICRO_DEBUG_SEGMENT;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 剥掉 /micro/<appCode> 或 /micro_debug/<appCode> 两段,得子应用内部路径 */
|
|
69
|
+
function stripMicroPrefix(p) {
|
|
70
|
+
const clean = ensureLeadingSlash(String(p || ""));
|
|
71
|
+
const parts = clean.split("/"); // ["", "micro", "appA", "user", ...]
|
|
72
|
+
return "/" + parts.slice(3).join("/");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 解析组件来源(纯函数,无 require、无副作用,可完整单测)。
|
|
77
|
+
*
|
|
78
|
+
* @param {string} rawUrl 组件来源路径:menu url / option.url / row.url /
|
|
79
|
+
* row.billUrl / row.mobileurl / defaultHomePage 等,
|
|
80
|
+
* 可带或不带 .vue 尾缀。
|
|
81
|
+
* @param {object} options
|
|
82
|
+
* @param {string} [options.route] 访问路径,用于归属判断(双字段写法下
|
|
83
|
+
* url 是组件来源、route 才带 /micro/ 归属段)
|
|
84
|
+
* @param {string} [options.appCode] 本应用(渲染方)appCode;主应用为空字符串
|
|
85
|
+
* @returns {object} 三态描述:
|
|
86
|
+
* { kind: 'empty' }
|
|
87
|
+
* { kind: 'base', base: true, rel: '/user/xxx.vue' }
|
|
88
|
+
* { kind: 'localPrivate', base: false, rel: '/user/xxx.vue' }
|
|
89
|
+
* { kind: 'remote', owner: 'appB', targetPath: '/user/xxx' }
|
|
90
|
+
* { kind: 'unknown', raw: '@other/xxx' } // 罕见的其它 @ 别名,调用方自行决定
|
|
91
|
+
*/
|
|
92
|
+
export function resolveViewPath(rawUrl, options = {}) {
|
|
93
|
+
const raw = String(rawUrl == null ? "" : rawUrl);
|
|
94
|
+
if (!raw) return { kind: "empty" };
|
|
95
|
+
|
|
96
|
+
const route = options.route;
|
|
97
|
+
const appCode = options.appCode || "";
|
|
98
|
+
|
|
99
|
+
// 1. 白名单:存量普通写法的包内共享组件 → @base
|
|
100
|
+
if (BASE_VIEW_WHITELIST.indexOf(stripVue(raw)) >= 0) {
|
|
101
|
+
return { kind: "base", base: true, rel: ensureVue(raw) };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 2. 委托 menuAdapter:处理 @ 前缀、/micro/ 剥离与归属、/base 命名空间
|
|
105
|
+
const path = resolveComponentPath({ url: raw }, appCode);
|
|
106
|
+
if (!path) return { kind: "empty" };
|
|
107
|
+
|
|
108
|
+
// 3. 单字段 remote:/micro/<别家>/... 时 resolveComponentPath 原样返回
|
|
109
|
+
if (isMicroPath(path)) {
|
|
110
|
+
return {
|
|
111
|
+
kind: "remote",
|
|
112
|
+
owner: getOwnerSegment(path),
|
|
113
|
+
targetPath: stripMicroPrefix(path),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// 4. 双字段 remote 防御:url 无 /micro/ 前缀,但 route 归属别家
|
|
118
|
+
const routeOwner = getOwnerSegment(String(route || ""));
|
|
119
|
+
if (routeOwner && routeOwner !== appCode) {
|
|
120
|
+
return { kind: "remote", owner: routeOwner, targetPath: ensureLeadingSlash(raw) };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 5. 落位到 @base/views 或 @/views
|
|
124
|
+
if (path.indexOf(BASE_VIEW_PREFIX) === 0) {
|
|
125
|
+
return { kind: "base", base: true, rel: ensureVue(path.slice(BASE_VIEW_PREFIX.length)) };
|
|
126
|
+
}
|
|
127
|
+
if (path.indexOf(APP_VIEW_PREFIX) === 0) {
|
|
128
|
+
return { kind: "localPrivate", base: false, rel: ensureVue(path.slice(APP_VIEW_PREFIX.length)) };
|
|
129
|
+
}
|
|
130
|
+
if (path.charAt(0) === "@") {
|
|
131
|
+
// 其它 @ 别名(罕见):不猜测归属,交回调用方
|
|
132
|
+
return { kind: "unknown", raw: path };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 原始 /xxx → 渲染方私有 @/views
|
|
136
|
+
return { kind: "localPrivate", base: false, rel: ensureVue(ensureLeadingSlash(path)) };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ——— 以下为 require 落地层(依赖 webpack context,不进纯函数单测) ———
|
|
140
|
+
|
|
141
|
+
function requireBaseView(rel) {
|
|
142
|
+
return require("@base/views" + rel);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function requireAppView(rel) {
|
|
146
|
+
return require("@/views" + rel);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 惰性读取本应用(渲染方)appCode,避免把 settings 拉进 resolveViewPath 的纯函数单测。
|
|
151
|
+
* 子应用取 settings.appCode(qiankun mount 会写入 props.appCode,与派生一致);
|
|
152
|
+
* 主应用 appCode 恒空、身份是 WEB_PREFIX 去斜杠(/sys → sys)——故回落 WEB_PREFIX。
|
|
153
|
+
* 与 store/modules/permission.js 的 getOwnAppCode 同口径:使 /micro/<自己>/... 被判成本地,
|
|
154
|
+
* 不误判成 remote 去自装载(也修掉子应用独立运行时 micro.appCode 为空的老坑)。
|
|
155
|
+
*/
|
|
156
|
+
function getRendererAppCode() {
|
|
157
|
+
const webPrefix = (window.WEB_PREFIX || "").replace(/^\/+/, "");
|
|
158
|
+
try {
|
|
159
|
+
// settings.js 是 CommonJS(module.exports),取 .default 会拿到 undefined,
|
|
160
|
+
// 必须兼容两种形态,否则 appCode 永远读不到、退化成 WEB_PREFIX 派生值,
|
|
161
|
+
// 与 store/modules/permission.js 的 getOwnAppCode 口径不一致(appCode 与
|
|
162
|
+
// WEB_PREFIX 不同名的应用会误判归属)。
|
|
163
|
+
const mod = require("@/settings");
|
|
164
|
+
const settings = (mod && mod.default) || mod;
|
|
165
|
+
return (settings && settings.appCode) || webPrefix;
|
|
166
|
+
} catch (e) {
|
|
167
|
+
return webPrefix;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 解析并加载详情页组件。resolveViewPath 的运行时外壳。
|
|
173
|
+
*
|
|
174
|
+
* @param {string} rawUrl 同 resolveViewPath
|
|
175
|
+
* @param {object} [options] 同 resolveViewPath;appCode 缺省时从 store 读取
|
|
176
|
+
* @returns {object} resolveViewPath 的结果,附加 component 字段:
|
|
177
|
+
* - base / localPrivate:component 为组件对象(require 失败或缺文件时为 null,附 error)
|
|
178
|
+
* - remote / empty / unknown:component 为 null,由调用方决定后续(装载子应用 / 兜底提示)
|
|
179
|
+
*/
|
|
180
|
+
export function loadViewComponent(rawUrl, options = {}) {
|
|
181
|
+
const opts = Object.assign({}, options);
|
|
182
|
+
if (opts.appCode == null) opts.appCode = getRendererAppCode();
|
|
183
|
+
|
|
184
|
+
const result = resolveViewPath(rawUrl, opts);
|
|
185
|
+
if (result.kind !== "base" && result.kind !== "localPrivate") {
|
|
186
|
+
return Object.assign({ component: null }, result);
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const mod = result.base ? requireBaseView(result.rel) : requireAppView(result.rel);
|
|
190
|
+
return Object.assign({ component: mod && mod.default }, result);
|
|
191
|
+
} catch (e) {
|
|
192
|
+
return Object.assign({ component: null, error: e }, result);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* 兼容旧签名的便捷封装:直接返回组件对象(或 null)。
|
|
198
|
+
* 供 components/wf/wf.js、mobile wfModifyDialogMixin.js 的 requireView 平滑替换——
|
|
199
|
+
* 它们历史上返回 require(...).default。remote / 缺文件时返回 null(不再抛错崩溃)。
|
|
200
|
+
*/
|
|
201
|
+
export function requireViewCompat(rawUrl, options = {}) {
|
|
202
|
+
return loadViewComponent(rawUrl, options).component;
|
|
203
|
+
}
|
package/src/utils/vab.js
CHANGED
|
@@ -842,9 +842,12 @@ install = (Vue, opts = {}) => {
|
|
|
842
842
|
originTarget.$emit("update:" + key, updateParam[key]);
|
|
843
843
|
}
|
|
844
844
|
parentTarget[visibleKey] = false;
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
845
|
+
return new Promise((resolve) => {
|
|
846
|
+
setTimeout(() => {
|
|
847
|
+
parentTarget[visibleKey] = true;
|
|
848
|
+
parentTarget.$nextTick(resolve);
|
|
849
|
+
}, 200);
|
|
850
|
+
});
|
|
848
851
|
};
|
|
849
852
|
|
|
850
853
|
Vue.prototype.$baseStartPickerOptions = function (value, type) {
|
|
@@ -478,6 +478,13 @@ export default {
|
|
|
478
478
|
},
|
|
479
479
|
};
|
|
480
480
|
</script>
|
|
481
|
-
<style scoped lang="scss">
|
|
482
|
-
|
|
481
|
+
<style scoped lang="scss">
|
|
482
|
+
.designer-drawer{
|
|
483
|
+
left:0;top:50px;
|
|
484
|
+
}
|
|
485
|
+
::v-deep .dialog-style.list-dialog{
|
|
486
|
+
.designer-drawer .el-drawer__body .designer-box{
|
|
487
|
+
height:100%
|
|
488
|
+
}
|
|
489
|
+
}
|
|
483
490
|
</style>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
class="is-pointer"
|
|
21
21
|
>
|
|
22
22
|
<template #form>
|
|
23
|
-
<div style="margin-bottom: 8px;" class="clearfix">
|
|
23
|
+
<div style="margin-bottom: 8px;" class="clearfix screen-btns">
|
|
24
24
|
<div class="fl">
|
|
25
25
|
<vxe-button status="primary" class="button-sty" icon="el-icon-plus" @click="openEditDialog">
|
|
26
26
|
{{ $t1('新增属性名') }}
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
visible-key="showRender"
|
|
19
19
|
:visiable.sync="showRender"
|
|
20
20
|
:parent-target="_self"
|
|
21
|
-
@reload="
|
|
22
|
-
:dataId
|
|
21
|
+
@reload="forwardReload"
|
|
22
|
+
:dataId="dataId"
|
|
23
|
+
@update:dataId="$emit('update:dataId', $event)"
|
|
24
|
+
@update:formCode="$emit('update:formCode', $event)"
|
|
23
25
|
:param="param"
|
|
24
26
|
v-bind="$attrs"
|
|
25
27
|
@openCopyEditTab="openCopyEditTab"
|
|
@@ -59,6 +61,19 @@ export default {
|
|
|
59
61
|
this.getReportTemplate();
|
|
60
62
|
},
|
|
61
63
|
methods: {
|
|
64
|
+
forwardReload(target, option) {
|
|
65
|
+
let reloadListener = this.$listeners?.reload;
|
|
66
|
+
if (Array.isArray(reloadListener)) {
|
|
67
|
+
return Promise.all(
|
|
68
|
+
reloadListener.map((listener) => listener(this, option))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (typeof reloadListener === "function") {
|
|
72
|
+
return reloadListener(this, option);
|
|
73
|
+
}
|
|
74
|
+
this.$emit("reload", this, option);
|
|
75
|
+
return Promise.resolve();
|
|
76
|
+
},
|
|
62
77
|
dataTableSearch() {
|
|
63
78
|
let gridRef = this.$refs.vFormRef.getGridWidgetRef()
|
|
64
79
|
if(!gridRef)return
|
|
@@ -59,11 +59,7 @@
|
|
|
59
59
|
:param="item.param"
|
|
60
60
|
v-if="item.showContent"
|
|
61
61
|
:parent-target="_self"
|
|
62
|
-
@reload="
|
|
63
|
-
(...args) => {
|
|
64
|
-
reloadAutoContent(...args);
|
|
65
|
-
}
|
|
66
|
-
"
|
|
62
|
+
@reload="(...args) => reloadAutoContent(...args)"
|
|
67
63
|
:openEditDialog="openEditDialog1"
|
|
68
64
|
></vFormRender>
|
|
69
65
|
</div>
|
|
@@ -368,7 +364,7 @@ export default {
|
|
|
368
364
|
},
|
|
369
365
|
reload(...args) {
|
|
370
366
|
this.formData = {};
|
|
371
|
-
this.$reloadHandle(...args);
|
|
367
|
+
let reloadTask = this.$reloadHandle(...args);
|
|
372
368
|
// 常规模式新增保存:把新单插入翻单序列首位(navIndex=-1 表示当前为新增未定位)
|
|
373
369
|
let param = args[1];
|
|
374
370
|
let newId = param && param.updateParam ? param.updateParam.dataId : null;
|
|
@@ -376,6 +372,7 @@ export default {
|
|
|
376
372
|
this.firstNavRows = [{ id: newId }, ...this.firstNavRows];
|
|
377
373
|
this.firstNavIndex = 0;
|
|
378
374
|
}
|
|
375
|
+
return reloadTask;
|
|
379
376
|
},
|
|
380
377
|
reload2() {
|
|
381
378
|
this.formData = {};
|
|
@@ -433,7 +430,7 @@ export default {
|
|
|
433
430
|
? param.updateParam.formCode
|
|
434
431
|
: null;
|
|
435
432
|
this.applyTabSaveResult(tab, dataId, formCode, this.resolveFormModel(target));
|
|
436
|
-
this.$refs.xTabs.reloadTabContent(target, param, tab); // 重载编辑态(内容重渲染)
|
|
433
|
+
return this.$refs.xTabs.reloadTabContent(target, param, tab); // 重载编辑态(内容重渲染)
|
|
437
434
|
},
|
|
438
435
|
// 供「保存并提交」路径调用:只升级当前活动新增页签的元数据,不重渲染详情内容。
|
|
439
436
|
// 目的:保存成功即升级为编辑态(防止提交失败/取消后重复入库),且不多刷一次详情。
|
|
@@ -539,10 +536,14 @@ export default {
|
|
|
539
536
|
}
|
|
540
537
|
if (tab) {
|
|
541
538
|
tab.showContent = false;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
539
|
+
return new Promise((resolve) => {
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
tab.showContent = true;
|
|
542
|
+
this.$nextTick(resolve);
|
|
543
|
+
}, 200);
|
|
544
|
+
});
|
|
545
545
|
}
|
|
546
|
+
return Promise.resolve();
|
|
546
547
|
},
|
|
547
548
|
},
|
|
548
549
|
};
|