cloud-web-corejs 1.1.0-dev.33 → 1.1.0-dev.35

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.
Files changed (58) hide show
  1. package/README.md +38 -0
  2. package/bin/core-resources.js +16 -0
  3. package/bin/create-child-app.js +34 -0
  4. package/docs/child-app/README.md +95 -0
  5. package/docs/child-app/activiti-resources.md +63 -0
  6. package/docs/child-app/generate-prompt.md +55 -0
  7. package/docs/child-app/luckysheet-resources.md +80 -0
  8. package/docs/child-app/public-resources-plan.md +288 -0
  9. package/docs/child-app/resources-implementation.md +101 -0
  10. package/docs/child-app/tinymce-resources.md +88 -0
  11. package/docs/child-app/validation.md +34 -0
  12. package/docs/qiankun/346/216/245/345/205/245/345/215/217/350/256/256.md +298 -0
  13. package/docs/qiankun/350/257/246/346/203/205/346/211/277/350/275/275/345/255/220/345/272/224/347/224/250/345/257/271/346/216/245/346/270/205/345/215/225.md +111 -0
  14. package/package.json +18 -2
  15. package/resource-tools/index.js +126 -0
  16. package/src/app-bootstrap.js +7 -2
  17. package/src/components/Tinymce/dynamicLoadScript.js +51 -59
  18. package/src/components/Tinymce/index.vue +382 -339
  19. package/src/components/code-editor/index.vue +361 -343
  20. package/src/components/luckysheet/loadResources.js +64 -0
  21. package/src/components/luckysheet/view.vue +239 -210
  22. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +34 -3
  23. package/src/utils/featureResources.js +57 -0
  24. package/src/views/bd/setting/form_template/mixins/list.js +7 -6
  25. package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
  26. package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
  27. package/src/views/user/form/form_template/list.vue +513 -512
  28. package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
  29. package/src/views/user/wf/wf_obj_config/list.vue +747 -746
  30. package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
  31. package/templates/child-app/.env +3 -0
  32. package/templates/child-app/README.md +49 -0
  33. package/templates/child-app/app.config.js +6 -0
  34. package/templates/child-app/babel.config.js +1 -0
  35. package/templates/child-app/core-resources.config.js +15 -0
  36. package/templates/child-app/gitignore +7 -0
  37. package/templates/child-app/package.json +34 -0
  38. package/templates/child-app/public/index.html +12 -0
  39. package/templates/child-app/src/assets/401_images/401.gif +0 -0
  40. package/templates/child-app/src/assets/404_images/404.png +0 -0
  41. package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
  42. package/templates/child-app/src/assets/logo.png +0 -0
  43. package/templates/child-app/src/corejsConfig.js +2 -0
  44. package/templates/child-app/src/icons/index.js +2 -0
  45. package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
  46. package/templates/child-app/src/layout/index.vue +4 -0
  47. package/templates/child-app/src/main.js +5 -0
  48. package/templates/child-app/src/prefixConfig.js +13 -0
  49. package/templates/child-app/src/resources/css/login.scss +29 -0
  50. package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
  51. package/templates/child-app/src/resources/images/home-img.png +0 -0
  52. package/templates/child-app/src/router/modules/customer.js +3 -0
  53. package/templates/child-app/src/settings.js +24 -0
  54. package/templates/child-app/src/styles/app.scss +2 -0
  55. package/templates/child-app/src/views/demo/detail.vue +19 -0
  56. package/templates/child-app/src/views/demo/list.vue +38 -0
  57. package/templates/child-app/src/views/user/login/index.vue +18 -0
  58. package/templates/child-app/vue.config.js +107 -0
@@ -0,0 +1,64 @@
1
+ const pending = new Map();
2
+ const styles = ["plugins/css/pluginsCss.css", "plugins/plugins.css", "css/luckysheet.css", "assets/iconfont/iconfont.css"];
3
+ const scripts = ["plugins/js/plugin.js", "luckysheet.umd.js"];
4
+
5
+ function isCompatible(api) {
6
+ return api && typeof api.create === "function" && typeof api.destroy === "function";
7
+ }
8
+
9
+ function removeResource(url, tag) {
10
+ pending.delete(url);
11
+ const element = Array.from(document.querySelectorAll(tag)).find(candidate => new URL(candidate.href || candidate.src, window.location.href).href === url);
12
+ if (element && element.parentNode) element.parentNode.removeChild(element);
13
+ }
14
+
15
+ function loadElement(url, tag) {
16
+ if (pending.has(url)) return pending.get(url);
17
+ const existing = Array.from(document.querySelectorAll(tag)).find(element => new URL(element.href || element.src, window.location.href).href === url);
18
+ if (existing && (tag === "link" ? existing.sheet : existing.dataset.coreLoaded === "true")) return Promise.resolve(existing);
19
+ const element = existing || document.createElement(tag);
20
+ const promise = new Promise((resolve, reject) => {
21
+ const timer = setTimeout(() => finish(new Error(`Luckysheet 资源加载超时:${url}`)), 30000);
22
+ function finish(error) {
23
+ clearTimeout(timer);
24
+ element.onload = element.onerror = null;
25
+ if (error) {
26
+ if (!existing && element.parentNode) element.parentNode.removeChild(element);
27
+ reject(error);
28
+ } else {
29
+ element.dataset.coreLoaded = "true";
30
+ resolve(element);
31
+ }
32
+ }
33
+ element.onload = () => finish();
34
+ element.onerror = () => finish(new Error(`Luckysheet 资源加载失败:${url}`));
35
+ if (!existing) {
36
+ if (tag === "link") { element.rel = "stylesheet"; element.href = url; document.head.appendChild(element); }
37
+ else { element.src = url; document.body.appendChild(element); }
38
+ }
39
+ });
40
+ pending.set(url, promise);
41
+ promise.catch(() => pending.delete(url));
42
+ return promise;
43
+ }
44
+
45
+ export async function loadLuckysheet(base) {
46
+ const source = base + "luckysheet.umd.js";
47
+ if (window.luckysheet) {
48
+ if (!isCompatible(window.luckysheet)) {
49
+ throw new Error("页面已存在不兼容的 window.luckysheet 全局变量");
50
+ }
51
+ if (window.__CORE_LUCKYSHEET_SOURCE__ && window.__CORE_LUCKYSHEET_SOURCE__ !== source) {
52
+ throw new Error(`Luckysheet 已存在不同来源的全局实例:${window.__CORE_LUCKYSHEET_SOURCE__}`);
53
+ }
54
+ return window.luckysheet;
55
+ }
56
+ await Promise.all(styles.map(file => loadElement(base + file, "link")));
57
+ for (const file of scripts) await loadElement(base + file, "script");
58
+ if (!isCompatible(window.luckysheet)) {
59
+ removeResource(source, "script");
60
+ throw new Error(`Luckysheet 脚本未提供兼容实例:${source}`);
61
+ }
62
+ window.__CORE_LUCKYSHEET_SOURCE__ = source;
63
+ return window.luckysheet;
64
+ }
@@ -1,210 +1,239 @@
1
- <template>
2
- <div style="height: 100%">
3
- <div
4
- :id="containerId"
5
- :key="containerId"
6
- style="
7
- margin: 0px;
8
- padding: 0px;
9
- height: 100%;
10
- width: 100%;
11
- left: 0px;
12
- top: 30px;
13
- bottom: 0px;
14
- "
15
- ></div>
16
- <div
17
- v-show="isMaskShow"
18
- style="
19
- position: absolute;
20
- z-index: 1000000;
21
- left: 0px;
22
- top: 0px;
23
- bottom: 0px;
24
- right: 0px;
25
- background: rgba(255, 255, 255, 0.8);
26
- text-align: center;
27
- font-size: 40px;
28
- align-items: center;
29
- justify-content: center;
30
- display: flex;
31
- "
32
- >
33
- Downloading
34
- </div>
35
- </div>
36
- </template>
37
-
38
- <script>
39
- import LuckyExcel from "luckyexcel";
40
- //导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
41
- import { exportExcel, generateExcelFile } from "./export";
42
- import { saveAs } from "file-saver";
43
-
44
- export default {
45
- name: "luckysheet",
46
- props: {
47
- options: {
48
- type: Object,
49
- default: () => {},
50
- },
51
- data: {
52
- type: Array,
53
- default: () => [],
54
- },
55
- },
56
- data() {
57
- return {
58
- selected: "",
59
- isMaskShow: false,
60
- // 生成随机ID,避免多个组件实例之间的ID冲突
61
- containerId: "luckysheet-" + Math.random().toString(36).substr(2, 9),
62
- };
63
- },
64
- beforeDestroy() {
65
- if (luckysheet) {
66
- this.exitEditMode();
67
- luckysheet.destroy();
68
- }
69
- },
70
- mounted() {
71
- // In some cases, you need to use $nextTick
72
- // this.$nextTick(() => {
73
- let config = this.options.config || {};
74
- let data = this.data.length > 0 ? this.data : null;
75
- if (!data) {
76
- data = [
77
- {
78
- name: "Sheet1",
79
- color: "",
80
- status: "1",
81
- order: "0",
82
- data: [],
83
- config: {},
84
- index: 0,
85
- },
86
- ];
87
- }
88
- luckysheet.create({
89
- container: this.containerId,
90
- lang: "zh",
91
- showinfobar: false,
92
- data: data,
93
- ...config,
94
- });
95
-
96
- // });
97
- },
98
- methods: {
99
- generateExcelFile(callback) {
100
- // 检查luckysheet是否存在
101
- if (!luckysheet) {
102
- console.error("luckysheet未初始化");
103
- return;
104
- }
105
-
106
- try {
107
- // 获取luckysheet数据
108
- if (luckysheet.getLuckysheetfile) {
109
- const excelData = luckysheet.getLuckysheetfile();
110
- console.log("获取Excel数据成功", excelData);
111
-
112
- // 生成Excel文件对象
113
- generateExcelFile(excelData, "测试文件")
114
- .then((file) => {
115
- callback && callback(file);
116
- // console.log("生成Excel文件对象成功", file);
117
- // console.log("文件名:", file.name);
118
- // console.log("文件大小:", file.size);
119
- // console.log("文件类型:", file.type);
120
-
121
- // 这里可以使用file对象进行上传等操作
122
- // 例如:uploadFile(file);
123
- // const fileName = `电子表格_${new Date().getTime()}.xlsx`;
124
- // saveAs(file, fileName);
125
- })
126
- .catch((error) => {
127
- console.error("生成Excel文件对象失败:", error);
128
- });
129
- } else {
130
- console.error("luckysheet不支持getLuckysheetfile方法");
131
- }
132
- } catch (error) {
133
- console.error("生成Excel文件对象失败:", error);
134
- }
135
- },
136
- uploadExcel(evt) {
137
- const files = evt.target.files;
138
- if (files == null || files.length == 0) {
139
- alert("No files wait for import");
140
- return;
141
- }
142
-
143
- let name = files[0].name;
144
- let suffixArr = name.split("."),
145
- suffix = suffixArr[suffixArr.length - 1];
146
- if (suffix != "xlsx") {
147
- alert("Currently only supports the import of xlsx files");
148
- return;
149
- }
150
- const self = this;
151
- LuckyExcel.transformExcelToLucky(files[0], function (exportJson, luckysheetfile) {
152
- if (exportJson.sheets == null || exportJson.sheets.length == 0) {
153
- alert(
154
- "Failed to read the content of the excel file, currently does not support xls files!"
155
- );
156
- return;
157
- }
158
- luckysheet.destroy();
159
-
160
- luckysheet.create({
161
- container: self.containerId, //使用当前组件的容器ID
162
- showinfobar: false,
163
- data: exportJson.sheets,
164
- title: exportJson.info.name,
165
- userInfo: exportJson.info.name.creator,
166
- });
167
- });
168
- },
169
- exitEditMode() {
170
- luckysheet.exitEditMode();
171
- },
172
- getValue() {
173
- luckysheet.exitEditMode();
174
- let sheetData = luckysheet.getluckysheetfile();
175
- return sheetData;
176
- },
177
- downloadExcel() {
178
- exportExcel(luckysheet.getAllSheets(), "下载");
179
- },
180
- getJson() {
181
- luckysheet.exitEditMode();
182
- let json = luckysheet.toJson();
183
- return json;
184
- },
185
- },
186
- };
187
- </script>
188
-
189
- <!-- Add "scoped" attribute to limit CSS to this component only -->
190
- <style scoped>
191
- h3 {
192
- margin: 40px 0 0;
193
- }
194
- ul {
195
- list-style-type: none;
196
- padding: 0;
197
- }
198
- li {
199
- display: inline-block;
200
- margin: 0 10px;
201
- }
202
- a {
203
- color: #42b983;
204
- }
205
- </style>
206
- <style>
207
- #luckysheet-icon-morebtn-div {
208
- z-index: 10030 !important;
209
- }
210
- </style>
1
+ <template>
2
+ <div style="height: 100%">
3
+ <div v-if="resourceError" role="alert">
4
+ {{ resourceError }}
5
+ <button type="button" @click="initialize">重试</button>
6
+ </div>
7
+ <div
8
+ :id="containerId"
9
+ :key="containerId"
10
+ style="
11
+ margin: 0px;
12
+ padding: 0px;
13
+ height: 100%;
14
+ width: 100%;
15
+ left: 0px;
16
+ top: 30px;
17
+ bottom: 0px;
18
+ "
19
+ ></div>
20
+ <div
21
+ v-show="isMaskShow"
22
+ style="
23
+ position: absolute;
24
+ z-index: 1000000;
25
+ left: 0px;
26
+ top: 0px;
27
+ bottom: 0px;
28
+ right: 0px;
29
+ background: rgba(255, 255, 255, 0.8);
30
+ text-align: center;
31
+ font-size: 40px;
32
+ align-items: center;
33
+ justify-content: center;
34
+ display: flex;
35
+ "
36
+ >
37
+ Downloading
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ import LuckyExcel from "luckyexcel";
44
+ //导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
45
+ import { exportExcel, generateExcelFile } from "./export";
46
+ import { saveAs } from "file-saver";
47
+ import { spreadsheetResourcePath } from "../../utils/featureResources";
48
+ import { loadLuckysheet } from "./loadResources";
49
+
50
+ export default {
51
+ name: "LuckysheetView",
52
+ props: {
53
+ options: {
54
+ type: Object,
55
+ default: () => ({}),
56
+ },
57
+ data: {
58
+ type: Array,
59
+ default: () => [],
60
+ },
61
+ },
62
+ data() {
63
+ return {
64
+ selected: "",
65
+ isMaskShow: false,
66
+ resourceError: "",
67
+ sheetApi: null,
68
+ ownerToken: null,
69
+ destroyed: false,
70
+ // 生成随机ID,避免多个组件实例之间的ID冲突
71
+ containerId: "luckysheet-" + Math.random().toString(36).substr(2, 9),
72
+ };
73
+ },
74
+ beforeDestroy() {
75
+ this.destroyed = true;
76
+ if (this.sheetApi && window.__CORE_LUCKYSHEET_OWNER__ === this.ownerToken) {
77
+ try {
78
+ this.sheetApi.exitEditMode();
79
+ this.sheetApi.destroy();
80
+ } finally {
81
+ window.__CORE_LUCKYSHEET_OWNER__ = null;
82
+ }
83
+ }
84
+ this.sheetApi = null;
85
+ },
86
+ mounted() {
87
+ this.initialize();
88
+ },
89
+ methods: {
90
+ async initialize() {
91
+ if (this.sheetApi || this.destroyed) return;
92
+ this.resourceError = "";
93
+ let api;
94
+ try {
95
+ const base = spreadsheetResourcePath();
96
+ api = await loadLuckysheet(base);
97
+ if (this.destroyed) return;
98
+ if (window.__CORE_LUCKYSHEET_OWNER__) {
99
+ throw new Error("Luckysheet 2.1.13 是全局单例,同一页面只能挂载一个电子表格组件");
100
+ }
101
+ } catch (error) {
102
+ this.resourceError = error.message;
103
+ this.$emit("resource-error", error);
104
+ return;
105
+ }
106
+ this.ownerToken = `${this.containerId}-${Date.now()}`;
107
+ window.__CORE_LUCKYSHEET_OWNER__ = this.ownerToken;
108
+ this.sheetApi = api;
109
+ const config = this.options.config || {};
110
+ let data = this.data.length > 0 ? this.data : null;
111
+ if (!data) {
112
+ data = [{ name: "Sheet1", color: "", status: "1", order: "0", data: [], config: {}, index: 0 }];
113
+ }
114
+ try {
115
+ api.create({ container: this.containerId, lang: "zh", showinfobar: false, data, ...config });
116
+ } catch (error) {
117
+ this.sheetApi = null;
118
+ window.__CORE_LUCKYSHEET_OWNER__ = null;
119
+ this.resourceError = `Luckysheet 初始化失败:${error.message}`;
120
+ this.$emit("resource-error", error);
121
+ }
122
+ },
123
+ generateExcelFile(callback) {
124
+ // 检查luckysheet是否存在
125
+ const sheet = this.sheetApi;
126
+ if (!sheet) {
127
+ console.error("luckysheet未初始化");
128
+ return;
129
+ }
130
+
131
+ try {
132
+ // 获取luckysheet数据
133
+ const getter = sheet.getLuckysheetfile || sheet.getluckysheetfile;
134
+ if (getter) {
135
+ const excelData = getter.call(sheet);
136
+ console.log("获取Excel数据成功", excelData);
137
+
138
+ // 生成Excel文件对象
139
+ generateExcelFile(excelData, "测试文件")
140
+ .then((file) => {
141
+ callback && callback(file);
142
+ // console.log("生成Excel文件对象成功", file);
143
+ // console.log("文件名:", file.name);
144
+ // console.log("文件大小:", file.size);
145
+ // console.log("文件类型:", file.type);
146
+
147
+ // 这里可以使用file对象进行上传等操作
148
+ // 例如:uploadFile(file);
149
+ // const fileName = `电子表格_${new Date().getTime()}.xlsx`;
150
+ // saveAs(file, fileName);
151
+ })
152
+ .catch((error) => {
153
+ console.error("生成Excel文件对象失败:", error);
154
+ });
155
+ } else {
156
+ console.error("luckysheet不支持getLuckysheetfile方法");
157
+ }
158
+ } catch (error) {
159
+ console.error("生成Excel文件对象失败:", error);
160
+ }
161
+ },
162
+ uploadExcel(evt) {
163
+ const files = evt.target.files;
164
+ if (files == null || files.length == 0) {
165
+ alert("No files wait for import");
166
+ return;
167
+ }
168
+
169
+ let name = files[0].name;
170
+ let suffixArr = name.split("."),
171
+ suffix = suffixArr[suffixArr.length - 1];
172
+ if (suffix != "xlsx") {
173
+ alert("Currently only supports the import of xlsx files");
174
+ return;
175
+ }
176
+ const self = this;
177
+ LuckyExcel.transformExcelToLucky(files[0], function (exportJson, luckysheetfile) {
178
+ if (exportJson.sheets == null || exportJson.sheets.length == 0) {
179
+ alert(
180
+ "Failed to read the content of the excel file, currently does not support xls files!"
181
+ );
182
+ return;
183
+ }
184
+ if (!self.sheetApi) return;
185
+ self.sheetApi.destroy();
186
+
187
+ self.sheetApi.create({
188
+ container: self.containerId, //使用当前组件的容器ID
189
+ showinfobar: false,
190
+ data: exportJson.sheets,
191
+ title: exportJson.info.name,
192
+ userInfo: exportJson.info.name.creator,
193
+ });
194
+ });
195
+ },
196
+ exitEditMode() {
197
+ if (this.sheetApi) this.sheetApi.exitEditMode();
198
+ },
199
+ getValue() {
200
+ if (!this.sheetApi) return [];
201
+ this.sheetApi.exitEditMode();
202
+ let sheetData = this.sheetApi.getluckysheetfile();
203
+ return sheetData;
204
+ },
205
+ downloadExcel() {
206
+ if (this.sheetApi) exportExcel(this.sheetApi.getAllSheets(), "下载");
207
+ },
208
+ getJson() {
209
+ if (!this.sheetApi) return null;
210
+ this.sheetApi.exitEditMode();
211
+ let json = this.sheetApi.toJson();
212
+ return json;
213
+ },
214
+ },
215
+ };
216
+ </script>
217
+
218
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
219
+ <style scoped>
220
+ h3 {
221
+ margin: 40px 0 0;
222
+ }
223
+ ul {
224
+ list-style-type: none;
225
+ padding: 0;
226
+ }
227
+ li {
228
+ display: inline-block;
229
+ margin: 0 10px;
230
+ }
231
+ a {
232
+ color: #42b983;
233
+ }
234
+ </style>
235
+ <style>
236
+ #luckysheet-icon-morebtn-div {
237
+ z-index: 10030 !important;
238
+ }
239
+ </style>
@@ -12,6 +12,7 @@
12
12
  :sub-form-row-id="subFormRowId"
13
13
  >
14
14
  <el-dropdown
15
+ v-if="hasDropdownPermission(field) && hasVisibleDropdownItem"
15
16
  :trigger="field.options.dropdownTrigger"
16
17
  :disabled="field.options.disabled"
17
18
  >
@@ -39,7 +40,7 @@
39
40
  <el-dropdown-menu slot="dropdown">
40
41
  <template v-for="(subWidget, index) in field.widgetList">
41
42
  <el-dropdown-item
42
- v-show="!subWidget.options.hidden"
43
+ v-show="isDropdownItemVisible(subWidget)"
43
44
  :key="index"
44
45
  :icon="subWidget.options.icon"
45
46
  @click.native="(e) => handleSubButtonWidgetClick(e, index)"
@@ -105,7 +106,14 @@ export default {
105
106
  StaticContentWrapper,
106
107
  dropdownItemWidget,
107
108
  },
108
- computed: {},
109
+ computed: {
110
+ hasVisibleDropdownItem() {
111
+ if (this.designState) return true;
112
+ return this.field.widgetList.some((item) =>
113
+ this.isDropdownItemVisible(item)
114
+ );
115
+ },
116
+ },
109
117
  beforeCreate() {
110
118
  /* 这里不能访问方法和属性!! */
111
119
  },
@@ -146,7 +154,30 @@ export default {
146
154
  }
147
155
  },
148
156
  handleSubButtonWidgetClick(e, index) {
149
- this.$refs["item" + index][0].handleButtonWidgetClick(e);
157
+ let subWidget = this.field.widgetList[index];
158
+ if (!this.isDropdownItemVisible(subWidget)) return;
159
+ let itemRef = this.$refs["item" + index];
160
+ if (itemRef && itemRef[0]) {
161
+ itemRef[0].handleButtonWidgetClick(e);
162
+ }
163
+ },
164
+ getDropdownAuthCode(widget) {
165
+ let formRef = this.getFormRef();
166
+ let formCode = formRef?.reportTemplate?.formCode;
167
+ let authName = widget?.options?.name;
168
+ return formCode && authName ? formCode + ":" + authName : null;
169
+ },
170
+ hasDropdownPermission(widget) {
171
+ if (this.designState) return true;
172
+ let authCode = this.getDropdownAuthCode(widget);
173
+ if (!authCode) return true;
174
+ let dispermissions = this.$store.getters.dispermissions || [];
175
+ return !dispermissions.includes(authCode);
176
+ },
177
+ isDropdownItemVisible(widget) {
178
+ return (
179
+ !!widget && !widget.options.hidden && this.hasDropdownPermission(widget)
180
+ );
150
181
  },
151
182
  handleHidden() {
152
183
  let isShow = this.field.widgetList.some((item) => !item.options.hidden);
@@ -0,0 +1,57 @@
1
+ /* global __CORE_RESOURCES__ */
2
+ // Keep unmanaged legacy applications working. Managed starters fail explicitly
3
+ // when a feature/mode was not declared, instead of issuing hidden 404 requests.
4
+ export function codeEditorResourcePath(mode) {
5
+ const config = typeof __CORE_RESOURCES__ === "undefined" ? null : __CORE_RESOURCES__;
6
+ const feature = config && config.features.codeEditor;
7
+ if (config && !feature) throw new Error("CodeEditor 未启用资源,请配置 codeEditor 并运行 npm run resources:prepare");
8
+ if (feature && feature.modes !== "*" && !feature.modes.includes(mode)) {
9
+ throw new Error(`CodeEditor 资源未包含模式 ${mode},请使用 full 配置并重新构建`);
10
+ }
11
+ return resolveResourceBase((feature && feature.basePath) || "base/ace/src-min-noconflict/");
12
+ }
13
+
14
+ export function richTextResourcePath(locale) {
15
+ const config = typeof __CORE_RESOURCES__ === "undefined" ? null : __CORE_RESOURCES__;
16
+ const feature = config && config.features.richText;
17
+ if (config && !feature) throw new Error("TinyMCE 未启用资源,请配置 richText 并运行 npm run resources:prepare");
18
+ if (feature && !feature.locales.includes(locale)) throw new Error(`TinyMCE 资源未包含语言 ${locale}`);
19
+ return resolveResourceBase((feature && feature.basePath) || "base/tinymce/");
20
+ }
21
+
22
+ export function spreadsheetResourcePath() {
23
+ const config = typeof __CORE_RESOURCES__ === "undefined" ? null : __CORE_RESOURCES__;
24
+ const feature = config && config.features.spreadsheet;
25
+ if (config && !feature) throw new Error("Luckysheet 未启用资源,请配置 spreadsheet 并运行 npm run resources:prepare");
26
+ return resolveResourceBase((feature && feature.basePath) || "luckysheet/");
27
+ }
28
+
29
+ export function workflowDesignerResourcePath() {
30
+ const config = typeof __CORE_RESOURCES__ === "undefined" ? null : __CORE_RESOURCES__;
31
+ const feature = config && config.features.workflowDesigner;
32
+ if (config && !feature) throw new Error("Activiti 未启用资源,请配置 workflowDesigner 并运行 npm run resources:prepare");
33
+ const base = resolveResourceBase((feature && feature.basePath) || "activiti-explorer/");
34
+ if (window.__POWERED_BY_QIANKUN__) {
35
+ throw new Error("Activiti 5.17 依赖真实父窗口回调,只支持主应用或非 qiankun 的同源页面");
36
+ }
37
+ return base;
38
+ }
39
+
40
+ export function workflowDesignerUrl({ wfType, serviceId, modelId, baseApi }) {
41
+ const resourceBase = workflowDesignerResourcePath();
42
+ window.sysParamForWf = {
43
+ webPrefix: new URL("../", resourceBase).href.replace(/\/$/, ""),
44
+ baseApi,
45
+ };
46
+ const url = new URL("modeler.html", resourceBase);
47
+ url.searchParams.set("wfType", wfType);
48
+ url.searchParams.set("serviceId", serviceId);
49
+ url.searchParams.set("modelId", modelId);
50
+ return url.href;
51
+ }
52
+
53
+ function resolveResourceBase(relative) {
54
+ const base = window.__POWERED_BY_QIANKUN__ && window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__
55
+ ? window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ : (window.WEB_PREFIX || "") + "/";
56
+ return new URL(relative, new URL(base, window.location.href)).href;
57
+ }
@@ -24,6 +24,7 @@ import {
24
24
  getDesignerLayoutType,
25
25
  isH5FormTemplate,
26
26
  } from "@base/views/bd/setting/form_template/formTemplateType.js";
27
+ import { workflowDesignerUrl } from "@base/utils/featureResources";
27
28
 
28
29
  let modules = {};
29
30
  modules = {
@@ -546,12 +547,12 @@ modules = {
546
547
  openWfDesignDialog(actModelId) {
547
548
  //wfType 0:单据流程,1:场景流程
548
549
  let serviceId = this.currentRow.serviceName;
549
- this.wfUrl =
550
- WEB_PREFIX +
551
- "/activiti-explorer/modeler.html?wfType=0&serviceId=" +
552
- serviceId +
553
- "&modelId=" +
554
- actModelId;
550
+ this.wfUrl = workflowDesignerUrl({
551
+ wfType: 0,
552
+ serviceId,
553
+ modelId: actModelId,
554
+ baseApi: process.env.VUE_APP_BASE_API,
555
+ });
555
556
  this.dialogActiveName = "first";
556
557
  this.showWfDialog = true;
557
558
  },