@epxing/core 5.3.0-beta.2 → 5.3.0-beta.4

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 (100) hide show
  1. package/API.md +715 -714
  2. package/README.md +3 -1
  3. package/dist/.cache/route-chart-release/frontend/frame/public/js/ecStat.min.js +4 -0
  4. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts-wordcloud.min.js +6 -0
  5. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +49 -0
  6. package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
  7. package/dist/_virtual/jsencrypt.min.js +1 -1
  8. package/dist/assets/role_select-DTqRlFNz.webp +0 -0
  9. package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
  10. package/dist/src/RootApp.js +54 -0
  11. package/dist/src/api/createHttp.js +6 -0
  12. package/dist/src/app-ui-settings.js +49 -0
  13. package/dist/src/axios.js +10 -15
  14. package/dist/src/chart-runtime-assets.js +19 -0
  15. package/dist/src/chart-runtime-sources.js +8 -0
  16. package/dist/src/create-app.js +3 -6
  17. package/dist/src/index.js +2 -0
  18. package/dist/src/loadComponent.js +2 -2
  19. package/dist/src/menu-route.js +11 -0
  20. package/dist/src/mixins/component.js +3 -0
  21. package/dist/src/navigation-context.js +47 -0
  22. package/dist/src/navigation.js +43 -12
  23. package/dist/src/package-install.js +3 -2
  24. package/dist/src/plugins/element-plus.js +8 -8
  25. package/dist/src/public-api.js +4 -2
  26. package/dist/src/route-components.js +9 -0
  27. package/dist/src/router/config.js +7 -8
  28. package/dist/src/runtime-services.js +1 -1
  29. package/dist/src/runtime-utils/meta.js +3 -0
  30. package/dist/src/runtime-utils/pdf.viewer.js +31 -15
  31. package/dist/src/runtime-utils/util.js +28 -5
  32. package/dist/src/shared-packages.js +1 -3
  33. package/dist/src/store/modules/list.js +25 -3
  34. package/dist/src/store/modules/meta.js +49 -7
  35. package/dist/src/style-presets.js +4 -4
  36. package/dist/src/ui-settings.js +90 -18
  37. package/dist/src/views/App.js +48 -0
  38. package/dist/src/views/AppRoleSelect.js +233 -0
  39. package/dist/src/views/Error.js +210 -0
  40. package/dist/src/views/Module.js +173 -0
  41. package/dist/style.css +251 -0
  42. package/package.json +4 -4
  43. package/src/RootApp.vue +75 -0
  44. package/src/api/createHttp.js +7 -0
  45. package/src/api/index.js +47 -47
  46. package/src/app-ui-settings.js +31 -0
  47. package/src/axios.js +311 -318
  48. package/src/chart-runtime-assets.js +13 -0
  49. package/src/chart-runtime-sources.js +5 -0
  50. package/src/create-app.js +3 -7
  51. package/src/index.js +28 -28
  52. package/src/install.js +157 -157
  53. package/src/loadComponent.js +187 -187
  54. package/src/loadLibrary.js +99 -99
  55. package/src/menu-route.js +12 -1
  56. package/src/mixins/component.js +1464 -1461
  57. package/src/navigation-context.js +49 -0
  58. package/src/navigation.js +208 -176
  59. package/src/package-install.js +2 -1
  60. package/src/plugins/element-plus.js +302 -302
  61. package/src/plugins/frame.js +178 -178
  62. package/src/public-api.js +1 -0
  63. package/src/route-components.js +7 -0
  64. package/src/router/config.js +861 -864
  65. package/src/router/public.js +1 -1
  66. package/src/runtime-services.js +1 -1
  67. package/src/runtime-utils/fieldFactory.js +179 -179
  68. package/src/runtime-utils/meta.js +399 -378
  69. package/src/runtime-utils/pdf.viewer.js +672 -644
  70. package/src/runtime-utils/util.js +1359 -1330
  71. package/src/shared-packages.js +1 -3
  72. package/src/store/modules/config.js +351 -351
  73. package/src/store/modules/list.js +30 -3
  74. package/src/store/modules/locale.js +236 -236
  75. package/src/store/modules/meta.js +314 -265
  76. package/src/style-presets.js +4 -4
  77. package/src/ui-settings.js +84 -23
  78. package/src/views/App.vue +53 -0
  79. package/src/views/AppRoleSelect.vue +334 -0
  80. package/src/views/Error.vue +63 -0
  81. package/src/views/Module.vue +210 -0
  82. package/src/xss.js +26 -26
  83. package/types/app.d.ts +10 -10
  84. package/types/axios.d.ts +1 -1
  85. package/types/component-mixin.d.ts +1 -1
  86. package/types/field-factory.d.ts +1 -1
  87. package/types/global-mixin.d.ts +1 -1
  88. package/types/http.d.ts +1 -1
  89. package/types/index.d.ts +3 -0
  90. package/types/meta.d.ts +1 -1
  91. package/types/navigation.d.ts +21 -21
  92. package/types/pdf-viewer.d.ts +1 -1
  93. package/types/runtime.d.ts +13 -13
  94. package/types/store.d.ts +1 -1
  95. package/types/util.d.ts +2 -2
  96. /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
  97. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
  98. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
  99. /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
  100. /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
- class Meta {
3
- constructor (props = {}) {
4
- var me = this
5
- me.attriNames = props.attriNames
6
- me.name = props.name // 名称
7
- me.id = props.id // 编号
8
- me.code = props.code // 编号
9
- me.label = props.label // 外部标签字段
10
- me.keyType = props.keyType // 主键生成方式
11
- me.attributes = props.attributes // 对象所有属性元数据-数组
12
- me.attriIds = props.attriIds // 对象所有字段编号-数组
13
- me.attriNames = props.attriNames // 对象所有字段名-数组
14
- me.keyNames = props.keyName ? [props.keyName] : [] // 主键字段-数组
15
- me.relatedEntitys = props.relatedEntitys // 关联对象
16
- me.attriRelys = props.attriRelys // 字段依赖
17
- me.operates = props.operates // 对象操作
18
- me.searchFields = props.searchFields // 查询字段
19
- me.metaView = props.metaView // 对象视图
20
- me.addPage = props.addPage // 新增页面
21
- me.detailPage = props.detailPage // 详情页面
22
- me.editPage = props.editPage // 编辑页面
23
- me.findPage = props.findPage // 查找页面
24
- me.defaultStatisticsPage = props.defaultStatisticsPage // 默认统计反查页面
25
- me.clientCode = props.clientCode // 系统编号
26
- me.systemId = props.systemId // 系统ID
27
- me.systemCode = props.systemCode // 系统编号
28
- me.serverCode = props.serverCode // 服务编号
29
- me.metaType = props.metaType // 服务编号
30
- return me
31
- }
32
-
33
- getId () {
34
- return this.id
35
- }
36
-
37
- getCode () {
38
- return this.code
39
- }
40
-
41
- getName () {
42
- return this.name
43
- }
44
-
45
- getLabel () {
46
- return this.label
47
- }
48
-
49
- getSystemId () {
50
- return this.systemId
51
- }
52
-
53
- getSystemCode () {
54
- return this.systemCode
55
- }
56
-
57
- getServerCode () {
58
- return this.serverCode
59
- }
60
-
61
- getKeyType () {
62
- return this.keyType
63
- }
64
-
65
- getAttributes () {
66
- const currentLanguage = util.getCurrentLanguage()
67
- for (const key in this.attributes) {
68
- const item = this.attributes[key]
69
- for (const key in item.languageMap) {
70
- const currentValue = item.languageMap[key] ? item.languageMap[key][currentLanguage] : null
71
- item[key] = currentValue || item[key]
72
- }
73
- }
74
- return this.attributes
75
- }
76
-
77
- getAttriIds () {
78
- return this.attriIds
79
- }
80
-
81
- getAttriNames () {
82
- return this.attriNames
83
- }
84
-
85
- getKeyNames () {
86
- return this.keyNames
87
- }
88
-
89
- getRelatedEntitys () {
90
- return this.relatedEntitys
91
- }
92
-
93
- getModel () {
94
- return this.attriNames
95
- }
96
-
97
- getAttribute (field) {
98
- return this.getAttributes()[field]
99
- }
100
-
101
- /**
102
- * 获取列表字段
103
- */
104
- getAllFields () {
105
- const attributes = this.getAttributes()
106
- const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
107
-
108
- attributesArr.sort((a, b) => a.orderNum - b.orderNum)
109
-
110
- return attributesArr.map(item => item.name)
111
- }
112
-
113
- /**
114
- * 获取列表字段
115
- */
116
- getListFields () {
117
- const attributes = this.getAttributes()
118
- const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
119
- attributesArr.sort((a, b) => a.orderNum - b.orderNum)
120
-
121
- return attributesArr.map(item => item.name)
122
- }
123
-
124
- /**
125
- * 获取列表字段
126
- */
127
- getFormFields () {
128
- const attributes = this.getAttributes()
129
- 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'))
130
- attributesArr.sort((a, b) => a.orderNum - b.orderNum)
131
-
132
- return attributesArr.map(item => item.name)
133
- }
134
-
135
- getAllFieldConfigs () {
136
- const attributes = this.getAttributes()
137
- const attributesArr = Object.values(attributes).filter(item => (!['LOG_C_TIME', 'LOG_C_USER', 'LOG_U_TIME', 'LOG_U_USER'].includes(item.name)))
138
- attributesArr.sort((a, b) => a.orderNum - b.orderNum)
139
-
140
- return attributesArr.map(item => ({ attribute: item, attriName: item.name, attriLabel: item.label, dataType: item.dataType, isRequired: item.isRequired, codeKey: item.relatedEntity || item.codeKey }))
141
- }
142
-
143
- getIndex (orderNum, fields) {
144
- if (fields[orderNum]) {
145
- return this.getIndex(orderNum + 1, fields)
146
- } else {
147
- return orderNum
148
- }
149
- }
150
-
151
- getExportFields () {
152
- const attributes = this.getAttributes()
153
- const attributesArr = Object.values(attributes)
154
- attributesArr.sort((a, b) => a.orderNum - b.orderNum)
155
- const exportFields = {}
156
- Object.values(attributes).forEach(item => {
157
- const index = this.getIndex(item.orderNum * 1000, exportFields)
158
- exportFields[index] = { ...item, attriName: item.name, attriLabel: item.label }
159
- })
160
- const fields = Object.values(exportFields)
161
- return fields
162
- }
163
-
164
- /**
165
- * 主键字段
166
- * @return {}
167
- */
168
- getKey () {
169
- // var me=this;
170
- return this.keyNames[0]
171
- }
172
-
173
- getKeyAttribute () {
174
- // var me=this;
175
- return this.attributes[this.getKey()]
176
- }
177
-
178
- /**
179
- * 业务主键
180
- * @returns
181
- */
182
- getBusiKeyAttrs () {
183
- const attributes = this.getAttributes()
184
- const keyAttrs = Object.values(attributes).filter(item => item.busiKey === '1') || []
185
- return keyAttrs
186
- }
187
-
188
- /**
189
- * 获取所有属性
190
- * @return {}
191
- */
192
- getAttris () {
193
- const data = []
194
- const m = this
195
- const attris = m.attributes
196
- attris.forEach((name, index) => {
197
- const a = attris[name]
198
- data[index] = { ID: a.name, NAME: a.label }
199
- })
200
- return data
201
- }
202
-
203
- /**
204
- * ID对应LAVEL
205
- */
206
- getIdLabelAttris () {
207
- const data = []
208
- const m = this
209
- const attris = m.attributes
210
- attris.forEach((name, index) => {
211
- const a = attris[name]
212
- data[index] = { ID: a.id, NAME: a.label }
213
- })
214
- return data
215
- }
216
-
217
- /**
218
- * NAME对应LAVEL
219
- */
220
- getNameLabelAttris () {
221
- const data = []
222
- const m = this
223
- const attris = m.attributes
224
- attris.forEach((name, index) => {
225
- const a = attris[name]
226
- data[index] = { ID: a.name, NAME: a.label }
227
- })
228
- return data
229
- }
230
-
231
- /**
232
- * 根据字段ID获取字段Name
233
- * @param {} attriId
234
- * @return {}
235
- */
236
- getAttriNameById (attriId) {
237
- const me = this
238
- if (me.attriIds) {
239
- return me.attriIds[attriId]
240
- }
241
- return null
242
- }
243
-
244
- /**
245
- * 根据字段key获取label
246
- */
247
- getLabelByField (field) {
248
- const m = this
249
- const attribute = m.getAttributes()[field]
250
- if (attribute) {
251
- return attribute.label
252
- }
253
- if (!field) field = { attriName: '' }
254
- return field.attriName || field
255
- }
256
-
257
- getDataType (field) {
258
- const m = this
259
- const attribute = m.getAttributes()[field]
260
- if (attribute) {
261
- return attribute.dataType
262
- }
263
- return ''
264
- }
265
-
266
- getRelationByMetaId (relatedMetaId) {
267
- var me = this
268
- var relation = null
269
- if (me.relatedEntitys) {
270
- me.relatedEntitys.map(entity => {
271
- if (entity && entity.entityA === relatedMetaId) {
272
- relation = entity
273
- }
274
- })
275
- }
276
- return relation
277
- }
278
-
279
- getRelationIdByMetaId (linkLabel) {
280
- var rel
281
- var meta = this
282
- if (meta.relatedEntitys) {
283
- meta.relatedEntitys.forEach(relation => {
284
- if (relation.flag && linkLabel) {
285
- if (relation.flag.toUpperCase() === linkLabel.toUpperCase()) rel = relation
286
- }
287
- })
288
- return rel && rel.entityA
289
- }
290
- }
291
-
292
- getRelations () {
293
- return this.relatedEntitys
294
- }
295
-
296
- /**
297
- * 获取级联编辑 的关联对象
298
- */
299
- getRelatedEntitysOfEdit () {
300
- var me = this
301
- var entitys = []
302
- if (me.relatedEntitys) {
303
- me.relatedEntitys.forEach(entity => {
304
- if (entity && entity.viewCascade === '1' && entity.relationSort === '1') {
305
- entitys.push(entity)
306
- }
307
- })
308
- }
309
- return entitys
310
- }
311
-
312
- /**
313
- * 获取级联查看的关联对象
314
- */
315
- getRelatedEntitysOfDetail () {
316
- var me = this
317
- var entitys = []
318
- if (me.relatedEntitys) {
319
- me.relatedEntitys.forEach(entity => {
320
- if (entity && entity.viewCascade === '1' && entity.relationSort === '1') {
321
- entitys.push(entity)
322
- }
323
- })
324
- }
325
- return entitys
326
- }
327
-
328
- /**
329
- * 根据标识符获取对象关系定义
330
- * @param {} flag
331
- * @return {}
332
- */
333
- getRelationByFlag (flag) {
334
- var me = this
335
- var relation = null
336
- var flags = flag.split('#')
337
- var meta = me
338
- if (flags.length === 1) {
339
- if (meta.relatedEntitys) {
340
- meta.relatedEntitys.map(entity => {
341
- if (flag.toLowerCase() === entity.flag.toLowerCase()) {
342
- relation = entity
343
- }
344
- })
345
- }
346
- }
347
- return relation
348
- }
349
-
350
- /**
351
- * 获取关联表所有关联字段
352
- */
353
- getLinkAttrs () {
354
- const relatedEntitys = this.getRelatedEntitys()
355
- const linkAttrs = relatedEntitys.reduce((attrs, relatedEntity) => {
356
- if (!attrs) attrs = {}
357
- // const { linkAttri, entityA, } = relatedEntity
358
- const { linkAttri, flag } = relatedEntity
359
- const key = flag
360
- const value = linkAttri || ''
361
- attrs[key] = value
362
- return attrs
363
- }, {})
364
- return linkAttrs
365
- }
366
-
367
- getLinkAttr (key) {
368
- const linkAttrs = this.getLinkAttrs() || {}
369
- for (const flag in linkAttrs) {
370
- if (flag.toLowerCase() === key.toLowerCase()) {
371
- return linkAttrs[flag]
372
- }
373
- }
374
- return null
375
- }
376
- }
377
-
378
- export default Meta
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