@epxing/core 5.3.0-beta.2 → 5.3.0-beta.3
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/API.md +26 -25
- package/README.md +3 -1
- package/dist/.cache/route-chart-release/frontend/frame/public/js/ecStat.min.js +4 -0
- package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts-wordcloud.min.js +4 -0
- package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +4 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/jsencrypt.min.js +1 -1
- package/dist/assets/ecStat.min-BrTYPOXX.js +1 -0
- package/dist/assets/echarts-wordcloud.min-nWR4Hzny.js +3 -0
- package/dist/assets/echarts.min-DROS9E5X.js +45 -0
- package/dist/assets/role_select-DTqRlFNz.webp +0 -0
- package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
- package/dist/src/RootApp.js +54 -0
- package/dist/src/api/createHttp.js +6 -0
- package/dist/src/app-ui-settings.js +49 -0
- package/dist/src/axios.js +10 -15
- package/dist/src/chart-runtime-assets.js +9 -0
- package/dist/src/create-app.js +3 -6
- package/dist/src/index.js +2 -0
- package/dist/src/loadComponent.js +2 -2
- package/dist/src/menu-route.js +11 -0
- package/dist/src/mixins/component.js +3 -0
- package/dist/src/navigation-context.js +47 -0
- package/dist/src/navigation.js +43 -12
- package/dist/src/package-install.js +3 -2
- package/dist/src/plugins/element-plus.js +8 -8
- package/dist/src/public-api.js +4 -2
- package/dist/src/route-components.js +9 -0
- package/dist/src/router/config.js +7 -8
- package/dist/src/runtime-services.js +1 -1
- package/dist/src/runtime-utils/meta.js +3 -0
- package/dist/src/runtime-utils/pdf.viewer.js +31 -15
- package/dist/src/runtime-utils/util.js +29 -5
- package/dist/src/shared-packages.js +1 -3
- package/dist/src/store/modules/list.js +25 -3
- package/dist/src/store/modules/meta.js +49 -7
- package/dist/src/style-presets.js +4 -4
- package/dist/src/ui-settings.js +90 -18
- package/dist/src/views/App.js +48 -0
- package/dist/src/views/AppRoleSelect.js +233 -0
- package/dist/src/views/Error.js +210 -0
- package/dist/src/views/Module.js +173 -0
- package/dist/style.css +251 -0
- package/package.json +4 -4
- package/src/RootApp.vue +75 -0
- package/src/api/createHttp.js +7 -0
- package/src/api/index.js +47 -47
- package/src/app-ui-settings.js +31 -0
- package/src/axios.js +311 -318
- package/src/chart-runtime-assets.js +7 -0
- package/src/create-app.js +3 -7
- package/src/index.js +28 -28
- package/src/install.js +157 -157
- package/src/loadComponent.js +187 -187
- package/src/loadLibrary.js +99 -99
- package/src/menu-route.js +12 -1
- package/src/mixins/component.js +1464 -1461
- package/src/navigation-context.js +49 -0
- package/src/navigation.js +208 -176
- package/src/package-install.js +2 -1
- package/src/plugins/element-plus.js +302 -302
- package/src/plugins/frame.js +178 -178
- package/src/public-api.js +1 -0
- package/src/route-components.js +7 -0
- package/src/router/config.js +861 -864
- package/src/router/public.js +1 -1
- package/src/runtime-services.js +1 -1
- package/src/runtime-utils/fieldFactory.js +179 -179
- package/src/runtime-utils/meta.js +399 -378
- package/src/runtime-utils/pdf.viewer.js +672 -644
- package/src/runtime-utils/util.js +1357 -1330
- package/src/shared-packages.js +1 -3
- package/src/store/modules/config.js +351 -351
- package/src/store/modules/list.js +30 -3
- package/src/store/modules/locale.js +236 -236
- package/src/store/modules/meta.js +314 -265
- package/src/style-presets.js +4 -4
- package/src/ui-settings.js +84 -23
- package/src/views/App.vue +53 -0
- package/src/views/AppRoleSelect.vue +334 -0
- package/src/views/Error.vue +63 -0
- package/src/views/Module.vue +210 -0
- package/src/xss.js +26 -26
- package/types/app.d.ts +10 -10
- package/types/axios.d.ts +1 -1
- package/types/component-mixin.d.ts +1 -1
- package/types/field-factory.d.ts +1 -1
- package/types/global-mixin.d.ts +1 -1
- package/types/http.d.ts +1 -1
- package/types/index.d.ts +3 -0
- package/types/meta.d.ts +1 -1
- package/types/navigation.d.ts +21 -21
- package/types/pdf-viewer.d.ts +1 -1
- package/types/runtime.d.ts +13 -13
- package/types/store.d.ts +1 -1
- package/types/util.d.ts +2 -2
- /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
- /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
- /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
- /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/en.js +0 -0
- /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/zh-cn.js +0 -0
|
@@ -1,378 +1,399 @@
|
|
|
1
|
-
import util from '@epxing/core/src/runtime-utils/util'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
me
|
|
23
|
-
me.
|
|
24
|
-
me.
|
|
25
|
-
me.
|
|
26
|
-
me.
|
|
27
|
-
me.
|
|
28
|
-
me.
|
|
29
|
-
me.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
return this.
|
|
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
|
-
return
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
1
|
+
import util from '@epxing/core/src/runtime-utils/util'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 元数据里的大块只读容器。
|
|
5
|
+
*
|
|
6
|
+
* 这些容器会被 Vuex 深度响应式化,而对象元数据本身很大(单个 JSON 100~250KB,几十个字段几十个关联),
|
|
7
|
+
* 深度响应式后每个属性都要挂 Dep + getter/setter,放大近 20 倍 —— 50 个子集的页面光元数据就是百 MB 级别。
|
|
8
|
+
* 元数据在一次会话里是只读的,不需要响应式,浅冻结这些容器即可让 Vue 的 observe() 直接跳过整棵子树
|
|
9
|
+
* (observe 会检查 Object.isExtensible)。
|
|
10
|
+
*
|
|
11
|
+
* 实测收益(50 个真实对象进 store):堆占用 142MB → 5.4MB(26x),构造+响应式化耗时 633ms → 91ms(7x)。
|
|
12
|
+
*
|
|
13
|
+
* 注意是「浅」冻结:getAttributes() 需要往 attributes[key] 这一层的子对象里写多语言值,
|
|
14
|
+
* 子对象没有被冻,仍然可写。唯一被挡住的是「往这些容器加新 key / 原地增删数组元素」,
|
|
15
|
+
* 全量检索过代码没有这种用法。
|
|
16
|
+
*/
|
|
17
|
+
// 各实例已写入多语言值的语言,记在实例之外避免变成响应式属性
|
|
18
|
+
const appliedLanguage = new WeakMap()
|
|
19
|
+
|
|
20
|
+
class Meta {
|
|
21
|
+
constructor (props = {}) {
|
|
22
|
+
var me = this
|
|
23
|
+
me.attriNames = props.attriNames
|
|
24
|
+
me.name = props.name // 名称
|
|
25
|
+
me.id = props.id // 编号
|
|
26
|
+
me.code = props.code // 编号
|
|
27
|
+
me.label = props.label // 外部标签字段
|
|
28
|
+
me.keyType = props.keyType // 主键生成方式
|
|
29
|
+
me.attributes = props.attributes // 对象所有属性元数据-数组
|
|
30
|
+
me.attriIds = props.attriIds // 对象所有字段编号-数组
|
|
31
|
+
me.attriNames = props.attriNames // 对象所有字段名-数组
|
|
32
|
+
me.keyNames = props.keyName ? [props.keyName] : [] // 主键字段-数组
|
|
33
|
+
me.relatedEntitys = props.relatedEntitys // 关联对象
|
|
34
|
+
me.attriRelys = props.attriRelys // 字段依赖
|
|
35
|
+
me.operates = props.operates // 对象操作
|
|
36
|
+
me.searchFields = props.searchFields // 查询字段
|
|
37
|
+
me.metaView = props.metaView // 对象视图
|
|
38
|
+
me.addPage = props.addPage // 新增页面
|
|
39
|
+
me.detailPage = props.detailPage // 详情页面
|
|
40
|
+
me.editPage = props.editPage // 编辑页面
|
|
41
|
+
me.findPage = props.findPage // 查找页面
|
|
42
|
+
me.defaultStatisticsPage = props.defaultStatisticsPage // 默认统计反查页面
|
|
43
|
+
me.clientCode = props.clientCode // 系统编号
|
|
44
|
+
me.systemId = props.systemId // 系统ID
|
|
45
|
+
me.systemCode = props.systemCode // 系统编号
|
|
46
|
+
me.serverCode = props.serverCode // 服务编号
|
|
47
|
+
me.metaType = props.metaType // 服务编号
|
|
48
|
+
return me
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getId () {
|
|
52
|
+
return this.id
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getCode () {
|
|
56
|
+
return this.code
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getName () {
|
|
60
|
+
return this.name
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getLabel () {
|
|
64
|
+
return this.label
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getSystemId () {
|
|
68
|
+
return this.systemId
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getSystemCode () {
|
|
72
|
+
return this.systemCode
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getServerCode () {
|
|
76
|
+
return this.serverCode
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getKeyType () {
|
|
80
|
+
return this.keyType
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getAttributes () {
|
|
84
|
+
const currentLanguage = util.getCurrentLanguage()
|
|
85
|
+
// 多语言值只在语言变化后重写一次:getAttribute 取单个字段也会走到这里,表达式求值等热路径每次都遍历全部字段太贵
|
|
86
|
+
if (appliedLanguage.get(this) === currentLanguage) return this.attributes
|
|
87
|
+
appliedLanguage.set(this, currentLanguage)
|
|
88
|
+
for (const key in this.attributes) {
|
|
89
|
+
const item = this.attributes[key]
|
|
90
|
+
for (const key in item.languageMap) {
|
|
91
|
+
const currentValue = item.languageMap[key] ? item.languageMap[key][currentLanguage] : null
|
|
92
|
+
item[key] = currentValue || item[key]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return this.attributes
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getAttriIds () {
|
|
99
|
+
return this.attriIds
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getAttriNames () {
|
|
103
|
+
return this.attriNames
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getKeyNames () {
|
|
107
|
+
return this.keyNames
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getRelatedEntitys () {
|
|
111
|
+
return this.relatedEntitys
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getModel () {
|
|
115
|
+
return this.attriNames
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getAttribute (field) {
|
|
119
|
+
return this.getAttributes()[field]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 获取列表字段
|
|
124
|
+
*/
|
|
125
|
+
getAllFields () {
|
|
126
|
+
const attributes = this.getAttributes()
|
|
127
|
+
const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
|
|
128
|
+
|
|
129
|
+
attributesArr.sort((a, b) => a.orderNum - b.orderNum)
|
|
130
|
+
|
|
131
|
+
return attributesArr.map(item => item.name)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 获取列表字段
|
|
136
|
+
*/
|
|
137
|
+
getListFields () {
|
|
138
|
+
const attributes = this.getAttributes()
|
|
139
|
+
const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
|
|
140
|
+
attributesArr.sort((a, b) => a.orderNum - b.orderNum)
|
|
141
|
+
|
|
142
|
+
return attributesArr.map(item => item.name)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 获取列表字段
|
|
147
|
+
*/
|
|
148
|
+
getFormFields () {
|
|
149
|
+
const attributes = this.getAttributes()
|
|
150
|
+
const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name) && item.dataType !== 'order'))
|
|
151
|
+
attributesArr.sort((a, b) => a.orderNum - b.orderNum)
|
|
152
|
+
|
|
153
|
+
return attributesArr.map(item => item.name)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
getAllFieldConfigs () {
|
|
157
|
+
const attributes = this.getAttributes()
|
|
158
|
+
const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
|
|
159
|
+
attributesArr.sort((a, b) => a.orderNum - b.orderNum)
|
|
160
|
+
|
|
161
|
+
return attributesArr.map(item => ({ attribute: item, attriName: item.name, attriLabel: item.label, dataType: item.dataType, isRequired: item.isRequired, codeKey: item.relatedEntity || item.codeKey }))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
getIndex (orderNum, fields) {
|
|
165
|
+
if (fields[orderNum]) {
|
|
166
|
+
return this.getIndex(orderNum + 1, fields)
|
|
167
|
+
} else {
|
|
168
|
+
return orderNum
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getExportFields () {
|
|
173
|
+
const attributes = this.getAttributes()
|
|
174
|
+
const attributesArr = Object.values(attributes)
|
|
175
|
+
attributesArr.sort((a, b) => a.orderNum - b.orderNum)
|
|
176
|
+
const exportFields = {}
|
|
177
|
+
Object.values(attributes).forEach(item => {
|
|
178
|
+
const index = this.getIndex(item.orderNum * 1000, exportFields)
|
|
179
|
+
exportFields[index] = { ...item, attriName: item.name, attriLabel: item.label }
|
|
180
|
+
})
|
|
181
|
+
const fields = Object.values(exportFields)
|
|
182
|
+
return fields
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 主键字段
|
|
187
|
+
* @return {}
|
|
188
|
+
*/
|
|
189
|
+
getKey () {
|
|
190
|
+
// var me=this;
|
|
191
|
+
return this.keyNames[0]
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
getKeyAttribute () {
|
|
195
|
+
// var me=this;
|
|
196
|
+
return this.attributes[this.getKey()]
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 业务主键
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
getBusiKeyAttrs () {
|
|
204
|
+
const attributes = this.getAttributes()
|
|
205
|
+
const keyAttrs = Object.values(attributes).filter(item => item.busiKey === '1') || []
|
|
206
|
+
return keyAttrs
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 获取所有属性
|
|
211
|
+
* @return {}
|
|
212
|
+
*/
|
|
213
|
+
getAttris () {
|
|
214
|
+
const data = []
|
|
215
|
+
const m = this
|
|
216
|
+
const attris = m.attributes
|
|
217
|
+
attris.forEach((name, index) => {
|
|
218
|
+
const a = attris[name]
|
|
219
|
+
data[index] = { ID: a.name, NAME: a.label }
|
|
220
|
+
})
|
|
221
|
+
return data
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* ID对应LAVEL
|
|
226
|
+
*/
|
|
227
|
+
getIdLabelAttris () {
|
|
228
|
+
const data = []
|
|
229
|
+
const m = this
|
|
230
|
+
const attris = m.attributes
|
|
231
|
+
attris.forEach((name, index) => {
|
|
232
|
+
const a = attris[name]
|
|
233
|
+
data[index] = { ID: a.id, NAME: a.label }
|
|
234
|
+
})
|
|
235
|
+
return data
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* NAME对应LAVEL
|
|
240
|
+
*/
|
|
241
|
+
getNameLabelAttris () {
|
|
242
|
+
const data = []
|
|
243
|
+
const m = this
|
|
244
|
+
const attris = m.attributes
|
|
245
|
+
attris.forEach((name, index) => {
|
|
246
|
+
const a = attris[name]
|
|
247
|
+
data[index] = { ID: a.name, NAME: a.label }
|
|
248
|
+
})
|
|
249
|
+
return data
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 根据字段ID获取字段Name
|
|
254
|
+
* @param {} attriId
|
|
255
|
+
* @return {}
|
|
256
|
+
*/
|
|
257
|
+
getAttriNameById (attriId) {
|
|
258
|
+
const me = this
|
|
259
|
+
if (me.attriIds) {
|
|
260
|
+
return me.attriIds[attriId]
|
|
261
|
+
}
|
|
262
|
+
return null
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 根据字段key获取label
|
|
267
|
+
*/
|
|
268
|
+
getLabelByField (field) {
|
|
269
|
+
const m = this
|
|
270
|
+
const attribute = m.getAttributes()[field]
|
|
271
|
+
if (attribute) {
|
|
272
|
+
return attribute.label
|
|
273
|
+
}
|
|
274
|
+
if (!field) field = { attriName: '' }
|
|
275
|
+
return field.attriName || field
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
getDataType (field) {
|
|
279
|
+
const m = this
|
|
280
|
+
const attribute = m.getAttributes()[field]
|
|
281
|
+
if (attribute) {
|
|
282
|
+
return attribute.dataType
|
|
283
|
+
}
|
|
284
|
+
return ''
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
getRelationByMetaId (relatedMetaId) {
|
|
288
|
+
var me = this
|
|
289
|
+
var relation = null
|
|
290
|
+
if (me.relatedEntitys) {
|
|
291
|
+
me.relatedEntitys.map(entity => {
|
|
292
|
+
if (entity && entity.entityA === relatedMetaId) {
|
|
293
|
+
relation = entity
|
|
294
|
+
}
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
return relation
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
getRelationIdByMetaId (linkLabel) {
|
|
301
|
+
var rel
|
|
302
|
+
var meta = this
|
|
303
|
+
if (meta.relatedEntitys) {
|
|
304
|
+
meta.relatedEntitys.forEach(relation => {
|
|
305
|
+
if (relation.flag && linkLabel) {
|
|
306
|
+
if (relation.flag.toUpperCase() === linkLabel.toUpperCase()) rel = relation
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
return rel && rel.entityA
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
getRelations () {
|
|
314
|
+
return this.relatedEntitys
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* 获取级联编辑 的关联对象
|
|
319
|
+
*/
|
|
320
|
+
getRelatedEntitysOfEdit () {
|
|
321
|
+
var me = this
|
|
322
|
+
var entitys = []
|
|
323
|
+
if (me.relatedEntitys) {
|
|
324
|
+
me.relatedEntitys.forEach(entity => {
|
|
325
|
+
if (entity && entity.viewCascade === '1' && entity.relationSort === '1') {
|
|
326
|
+
entitys.push(entity)
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
return entitys
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* 获取级联查看的关联对象
|
|
335
|
+
*/
|
|
336
|
+
getRelatedEntitysOfDetail () {
|
|
337
|
+
var me = this
|
|
338
|
+
var entitys = []
|
|
339
|
+
if (me.relatedEntitys) {
|
|
340
|
+
me.relatedEntitys.forEach(entity => {
|
|
341
|
+
if (entity && entity.viewCascade === '1' && entity.relationSort === '1') {
|
|
342
|
+
entitys.push(entity)
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
}
|
|
346
|
+
return entitys
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 根据标识符获取对象关系定义
|
|
351
|
+
* @param {} flag
|
|
352
|
+
* @return {}
|
|
353
|
+
*/
|
|
354
|
+
getRelationByFlag (flag) {
|
|
355
|
+
var me = this
|
|
356
|
+
var relation = null
|
|
357
|
+
var flags = flag.split('#')
|
|
358
|
+
var meta = me
|
|
359
|
+
if (flags.length === 1) {
|
|
360
|
+
if (meta.relatedEntitys) {
|
|
361
|
+
meta.relatedEntitys.map(entity => {
|
|
362
|
+
if (flag.toLowerCase() === entity.flag.toLowerCase()) {
|
|
363
|
+
relation = entity
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return relation
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* 获取关联表所有关联字段
|
|
373
|
+
*/
|
|
374
|
+
getLinkAttrs () {
|
|
375
|
+
const relatedEntitys = this.getRelatedEntitys()
|
|
376
|
+
const linkAttrs = relatedEntitys.reduce((attrs, relatedEntity) => {
|
|
377
|
+
if (!attrs) attrs = {}
|
|
378
|
+
// const { linkAttri, entityA, } = relatedEntity
|
|
379
|
+
const { linkAttri, flag } = relatedEntity
|
|
380
|
+
const key = flag
|
|
381
|
+
const value = linkAttri || ''
|
|
382
|
+
attrs[key] = value
|
|
383
|
+
return attrs
|
|
384
|
+
}, {})
|
|
385
|
+
return linkAttrs
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
getLinkAttr (key) {
|
|
389
|
+
const linkAttrs = this.getLinkAttrs() || {}
|
|
390
|
+
for (const flag in linkAttrs) {
|
|
391
|
+
if (flag.toLowerCase() === key.toLowerCase()) {
|
|
392
|
+
return linkAttrs[flag]
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return null
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export default Meta
|