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.
- package/bin/core-resources.js +16 -0
- package/docs/child-app/README.md +6 -3
- package/docs/child-app/activiti-resources.md +63 -0
- package/docs/child-app/generate-prompt.md +7 -1
- package/docs/child-app/luckysheet-resources.md +80 -0
- package/docs/child-app/public-resources-plan.md +288 -0
- package/docs/child-app/resources-implementation.md +101 -0
- package/docs/child-app/tinymce-resources.md +88 -0
- package/docs/child-app/validation.md +4 -3
- package/package.json +10 -2
- package/resource-tools/index.js +126 -0
- package/src/app-bootstrap.js +7 -2
- package/src/components/Tinymce/dynamicLoadScript.js +51 -59
- package/src/components/Tinymce/index.vue +382 -339
- package/src/components/code-editor/index.vue +361 -343
- package/src/components/luckysheet/loadResources.js +64 -0
- package/src/components/luckysheet/view.vue +239 -210
- package/src/components/onlineTalk/index.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +34 -3
- package/src/layout/components/Sidebar/default.vue +17 -16
- package/src/utils/chunkLoadError.js +24 -0
- package/src/utils/featureResources.js +57 -0
- package/src/views/bd/setting/form_template/mixins/list.js +7 -6
- package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
- package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
- package/src/views/user/form/form_template/list.vue +527 -506
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +65 -40
- package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
- package/src/views/user/wf/wf_obj_config/list.vue +747 -746
- package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
- package/templates/child-app/README.md +2 -0
- package/templates/child-app/core-resources.config.js +15 -0
- package/templates/child-app/gitignore +1 -0
- package/templates/child-app/package.json +5 -0
- 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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
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="
|
|
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
|
|
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
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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) {
|