cloud-web-corejs 1.1.0-dev.34 → 1.1.0-dev.36

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 (35) hide show
  1. package/bin/core-resources.js +16 -0
  2. package/docs/child-app/README.md +6 -3
  3. package/docs/child-app/activiti-resources.md +63 -0
  4. package/docs/child-app/generate-prompt.md +7 -1
  5. package/docs/child-app/luckysheet-resources.md +80 -0
  6. package/docs/child-app/public-resources-plan.md +288 -0
  7. package/docs/child-app/resources-implementation.md +101 -0
  8. package/docs/child-app/tinymce-resources.md +88 -0
  9. package/docs/child-app/validation.md +4 -3
  10. package/package.json +10 -2
  11. package/resource-tools/index.js +126 -0
  12. package/src/app-bootstrap.js +7 -2
  13. package/src/components/Tinymce/dynamicLoadScript.js +51 -59
  14. package/src/components/Tinymce/index.vue +382 -339
  15. package/src/components/code-editor/index.vue +361 -343
  16. package/src/components/luckysheet/loadResources.js +64 -0
  17. package/src/components/luckysheet/view.vue +239 -210
  18. package/src/components/onlineTalk/index.vue +2 -2
  19. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +34 -3
  20. package/src/layout/components/Sidebar/default.vue +17 -16
  21. package/src/utils/chunkLoadError.js +24 -0
  22. package/src/utils/featureResources.js +57 -0
  23. package/src/views/bd/setting/form_template/mixins/list.js +7 -6
  24. package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
  25. package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
  26. package/src/views/user/form/form_template/list.vue +527 -506
  27. package/src/views/user/wf/wf_manage/wfContentDialog.vue +65 -40
  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/README.md +2 -0
  32. package/templates/child-app/core-resources.config.js +15 -0
  33. package/templates/child-app/gitignore +1 -0
  34. package/templates/child-app/package.json +5 -0
  35. package/templates/child-app/vue.config.js +2 -1
@@ -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>
@@ -277,12 +277,12 @@
277
277
 
278
278
  <script>
279
279
  import {mixins} from "./mixins";
280
- import userDialog from './talkUserDialog.vue';
281
280
 
282
281
  export default {
283
282
  mixins: [mixins],
284
283
  components: {
285
- userDialog,
284
+ // 选人弹窗同步引入会把 tableForm 焊进 onlineTalk;仅打开选人时再拉
285
+ userDialog: () => import('./talkUserDialog.vue'),
286
286
  privateProfileDialog: () => import('../../components/VabUpload/privateProfileDialog')
287
287
  },
288
288
  data() {
@@ -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);
@@ -288,18 +288,11 @@
288
288
  <script>
289
289
  import { mapGetters } from "vuex";
290
290
  import variables from "@base/styles/variables.scss";
291
- import userInfo from "@base/views/user/user/info.vue";
292
- import userFormInfo from "@base/views/user/user/form_info.vue";
293
- import onlineTalk from "@base/components/onlineTalk";
294
291
  import { getToken } from "@base/utils/auth";
295
292
  import indexUtil from "@base/utils/index.js";
296
293
  import langTool from "../langTool.vue";
297
294
  import { initPddLog } from "@base/utils/pddLog";
298
-
299
- import extractedCodeCreateDialog from "../extractedCode/createDialog.vue";
300
- import extractedCodeQueryDialog from "../extractedCode/queryDialog.vue";
301
295
  import { getBdFlag } from "@base/api/user";
302
- import createCompanyDialog from "@base/layout/components/createCompany/createCompanyDialog.vue";
303
296
 
304
297
  export default {
305
298
  props: {
@@ -309,13 +302,17 @@ export default {
309
302
  },
310
303
  },
311
304
  components: {
312
- userInfo,
313
- userFormInfo,
314
- onlineTalk,
305
+ // 个人设置 / 在线沟通 / 提取码 / 建企业 首屏菜单用不到。同步 import 会把
306
+ // onlineTalk → talkUserDialog → tableForm 整条链焊进 Sidebar 异步包,
307
+ // 发布环境首次进入时左边菜单明显慢于首页。
308
+ userInfo: () => import("@base/views/user/user/info.vue"),
309
+ userFormInfo: () => import("@base/views/user/user/form_info.vue"),
310
+ onlineTalk: () => import("@base/components/onlineTalk"),
315
311
  langTool,
316
- extractedCodeCreateDialog,
317
- extractedCodeQueryDialog,
318
- createCompanyDialog,
312
+ extractedCodeCreateDialog: () => import("../extractedCode/createDialog.vue"),
313
+ extractedCodeQueryDialog: () => import("../extractedCode/queryDialog.vue"),
314
+ createCompanyDialog: () =>
315
+ import("@base/layout/components/createCompany/createCompanyDialog.vue"),
319
316
  },
320
317
  data() {
321
318
  return {
@@ -389,15 +386,19 @@ export default {
389
386
  filterText(val) {
390
387
  this.$refs.tree.filter(val);
391
388
  },
389
+ sidebarRouters() {
390
+ this.filterRoute();
391
+ },
392
392
  },
393
393
  created() {
394
394
  indexUtil.initI18nMessage("menus");
395
+ // generateRoutes2 在 next() 之前已经写入。放 created 而不是 mounted+100ms,
396
+ // 第一次 render 就带菜单项;也不用 immediate watcher(会早于 created,
397
+ // filterRoute 里的 $router.push 不安全)。
398
+ this.filterRoute();
395
399
  },
396
400
  mounted() {
397
401
  this.getUserInfo();
398
- setTimeout(() => {
399
- this.filterRoute();
400
- }, 100);
401
402
  this.countHeight();
402
403
  let query = this.$route.query;
403
404
  if (query && query.flag == 1) {