@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
package/src/router/public.js
CHANGED
|
@@ -3,7 +3,7 @@ import routes, { beforeEach } from './config'
|
|
|
3
3
|
|
|
4
4
|
export const routerConfig = { routes, beforeEach }
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// 基础路由页由 core 安装;页面渲染组件和可选业务视图由产品按需安装。
|
|
7
7
|
export function createFrameRouter (options = {}) {
|
|
8
8
|
const { beforeEach: guard = beforeEach, ...routerOptions } = options
|
|
9
9
|
const router = createRouter({ history: createWebHashHistory(), routes, ...routerOptions })
|
package/src/runtime-services.js
CHANGED
|
@@ -41,7 +41,7 @@ export function registerRouteComponents (components) {
|
|
|
41
41
|
export function runtimeRouteComponent (name) {
|
|
42
42
|
return async () => {
|
|
43
43
|
const component = routeComponents.get(name)
|
|
44
|
-
if (!component) throw new Error(`[epx/core] 路由组件 ${name}
|
|
44
|
+
if (!component) throw new Error(`[epx/core] 路由组件 ${name} 尚未注册,请安装提供该页面的 components/business 包或传入 routeComponents`)
|
|
45
45
|
return component
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,179 +1,179 @@
|
|
|
1
|
-
import { runtimeStore } from '../runtime-services'
|
|
2
|
-
import { ADD_LIST, ADD_META } from '@epxing/core/src/store/actions'
|
|
3
|
-
import { isString } from 'lodash-es'
|
|
4
|
-
export class FieldFactory {
|
|
5
|
-
constructor (store = runtimeStore) {
|
|
6
|
-
this.store = store
|
|
7
|
-
}
|
|
8
|
-
// 创建字段配置
|
|
9
|
-
async createFields ({ fields, fieldScope, meta, pageType = 'DETAIL', metaId = '', metaViewId, hiddenFields = [], defaultFieldConfigs = {}, type = 'list' }) {
|
|
10
|
-
const fieldConfigMaps = []
|
|
11
|
-
let metaView = null
|
|
12
|
-
// 走 getter 而不是直接读 state,读取本身会刷新缓存的「最近使用」记录,避免被淘汰
|
|
13
|
-
let newMeta = meta || this.store.getters.getMetaById(`${metaId}`)
|
|
14
|
-
if (!newMeta) {
|
|
15
|
-
newMeta = await this.store.dispatch({ // 加回调
|
|
16
|
-
type: ADD_META,
|
|
17
|
-
metaId: metaId
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
if (newMeta.metaView) {
|
|
21
|
-
metaView = newMeta.metaView[metaViewId]
|
|
22
|
-
}
|
|
23
|
-
const metaViewFieldMap = {}
|
|
24
|
-
|
|
25
|
-
if (metaView && metaView.fields) {
|
|
26
|
-
const metaViewFields = JSON.parse(metaView.fields)
|
|
27
|
-
metaViewFields.forEach(item => {
|
|
28
|
-
if (typeof item !== 'string') {
|
|
29
|
-
metaViewFieldMap[item.attriName] = item
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
if (!fields || Object.keys(fields).length === 0) {
|
|
34
|
-
const allFields = [...type === 'form' ? newMeta.getFormFields() : newMeta.getListFields()]
|
|
35
|
-
if (metaView && metaView.listFields) {
|
|
36
|
-
fields = JSON.parse(metaView.listFields)
|
|
37
|
-
if (!fields || fields.length === 0) fields = allFields
|
|
38
|
-
} else {
|
|
39
|
-
fields = allFields
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const metaKeyName = newMeta.getKey()
|
|
43
|
-
const metaKeyType = newMeta.getKeyType()
|
|
44
|
-
for (let i = 0; i < fields.length; i++) {
|
|
45
|
-
let fieldConfig = {} // 字段配置信息
|
|
46
|
-
const field = fields[i]
|
|
47
|
-
if (field === null || field === undefined) continue
|
|
48
|
-
const metaViewFieldConfig = metaViewFieldMap[field.attriName || field] || {}
|
|
49
|
-
if (isString(field)) {
|
|
50
|
-
fieldConfig = { attriName: field, ...metaViewFieldConfig }
|
|
51
|
-
} else {
|
|
52
|
-
fieldConfig = { ...field, ...metaViewFieldConfig }
|
|
53
|
-
}
|
|
54
|
-
if (fieldConfig.type === 'meta') {
|
|
55
|
-
const relation = newMeta.relatedEntitys.find(item => item.flag === fieldConfig.attriName)
|
|
56
|
-
if (relation) {
|
|
57
|
-
if (!fieldConfig.attriLabel) fieldConfig.attriLabel = relation.title
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (!fieldConfig.attriName) {
|
|
61
|
-
continue
|
|
62
|
-
}
|
|
63
|
-
if (defaultFieldConfigs[fieldConfig.attriName]) {
|
|
64
|
-
fieldConfig = { ...defaultFieldConfigs[fieldConfig.attriName], ...fieldConfig }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (fieldConfig.attriName === metaKeyName && (fieldConfig.state || pageType) !== 'SEARCH' && fieldConfig.state !== 'DETAIL') {
|
|
68
|
-
if (metaKeyType !== 'assigned') {
|
|
69
|
-
fieldConfig.state = 'HIDDEN'
|
|
70
|
-
} else {
|
|
71
|
-
const { dataType } = newMeta.attributes[metaKeyName]
|
|
72
|
-
if (dataType === 'derive') {
|
|
73
|
-
if (pageType === 'EDIT' || pageType === 'ADD') {
|
|
74
|
-
fieldConfig.state = 'HIDDEN'
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!fieldConfig.state) fieldConfig.state = pageType
|
|
80
|
-
|
|
81
|
-
const isHidden = hiddenFields.find(item => fieldConfig.attriName === (item.attriName || item))
|
|
82
|
-
if (isHidden) {
|
|
83
|
-
fieldConfig.state = 'HIDDEN'
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// 无效字段
|
|
87
|
-
if (fieldConfig.state && fieldConfig.state === 'INVALID') {
|
|
88
|
-
fieldConfigMaps.push(fieldConfig)
|
|
89
|
-
continue
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 隐含字段
|
|
93
|
-
// if (fieldConfig.state && fieldConfig.state === 'HIDDEN') {
|
|
94
|
-
// fieldConfigMaps.push(fieldConfig)
|
|
95
|
-
// continue
|
|
96
|
-
// }
|
|
97
|
-
|
|
98
|
-
let fieldFromMetaId = newMeta.getId()
|
|
99
|
-
let fieldFromMeta = newMeta
|
|
100
|
-
let fieldName = fieldConfig.attriName
|
|
101
|
-
|
|
102
|
-
if (fieldName.indexOf('|') > -1) { // 关联字段
|
|
103
|
-
const fieldNameArray = fieldName.split('|')
|
|
104
|
-
fieldName = fieldNameArray[fieldNameArray.length - 1]
|
|
105
|
-
for (let i = 0; i < fieldNameArray.length - 1; i++) {
|
|
106
|
-
fieldFromMetaId = fieldFromMeta.getRelationIdByMetaId(fieldNameArray[i])
|
|
107
|
-
if (!fieldFromMetaId) break
|
|
108
|
-
fieldFromMeta = this.store.getters.getMetaById(fieldFromMetaId)
|
|
109
|
-
if (!fieldFromMeta) {
|
|
110
|
-
fieldFromMeta = await this.store.dispatch({ // 加回调
|
|
111
|
-
type: ADD_META,
|
|
112
|
-
metaId: fieldFromMetaId
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
fieldConfig = this.createFieldConfig({ fieldFromMeta, fieldConfig: { ...fieldConfig }, fieldName })
|
|
118
|
-
// 判断字段权限
|
|
119
|
-
if (fieldScope && fieldConfig.type !== 'meta') {
|
|
120
|
-
const type = fieldConfig.state === 'ADD' || fieldConfig.state === 'EDIT' ? '2' : '1'
|
|
121
|
-
const scope = fieldScope[type]
|
|
122
|
-
if (scope) {
|
|
123
|
-
if (fieldConfig.dataType !== 'custom' && !scope.includes(fieldConfig.attriName)) {
|
|
124
|
-
continue
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (fieldConfig.attriLabel) {
|
|
129
|
-
fieldConfigMaps.push(fieldConfig)
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return fieldConfigMaps
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
createFieldConfig ({ fieldFromMeta, fieldConfig, fieldName }) {
|
|
136
|
-
const attribute = fieldFromMeta.getAttribute(fieldName) || {}
|
|
137
|
-
attribute.entityId = fieldFromMeta.id
|
|
138
|
-
fieldConfig.attribute = { ...attribute, ...(fieldConfig.attribute || {}) }
|
|
139
|
-
if (!fieldConfig.attriLabel) fieldConfig.attriLabel = attribute.label
|
|
140
|
-
// if(!fieldConfig.fieldName) fieldConfig.fieldName = fieldName;
|
|
141
|
-
if (!fieldConfig.dataType) fieldConfig.dataType = attribute.dataType
|
|
142
|
-
if (!fieldConfig.codeKey) {
|
|
143
|
-
if (fieldConfig.dataType === 'list') fieldConfig.codeKey = attribute.codeKey
|
|
144
|
-
else fieldConfig.codeKey = attribute.relatedEntity || attribute.codeKey
|
|
145
|
-
}
|
|
146
|
-
if (!fieldConfig.isRequired) fieldConfig.isRequired = attribute.isRequired
|
|
147
|
-
if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD' || fieldConfig.state === 'SEARCH') {
|
|
148
|
-
if (fieldConfig.dataType === 'list' || fieldConfig.dataType === 'treeList' || fieldConfig.dataType === 'radio' || fieldConfig.dataType === 'multibox') {
|
|
149
|
-
this.setList(fieldConfig.dataType, fieldConfig.codeKey, fieldConfig.attribute)
|
|
150
|
-
} else if (fieldConfig.dataType === 'object') {
|
|
151
|
-
// this.setList(fieldConfig.dataType, fieldConfig.codeKey)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (fieldConfig.dataType === 'formula') {
|
|
156
|
-
fieldConfig.submitValue = false
|
|
157
|
-
if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD') {
|
|
158
|
-
fieldConfig.state = 'HIDDEN'
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (fieldConfig.fieldLabel) fieldConfig.attriLabel = fieldConfig.fieldLabel
|
|
162
|
-
if (fieldConfig.emptyText) fieldConfig.placeholder = fieldConfig.emptyText
|
|
163
|
-
return fieldConfig
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
setList (dataType, codeKey, { optionType }) {
|
|
167
|
-
this.store.dispatch({
|
|
168
|
-
type: ADD_LIST,
|
|
169
|
-
key: codeKey,
|
|
170
|
-
dataType: optionType || dataType
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function createFieldFactory (store) {
|
|
176
|
-
return new FieldFactory(store)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export default createFieldFactory()
|
|
1
|
+
import { runtimeStore } from '../runtime-services'
|
|
2
|
+
import { ADD_LIST, ADD_META } from '@epxing/core/src/store/actions'
|
|
3
|
+
import { isString } from 'lodash-es'
|
|
4
|
+
export class FieldFactory {
|
|
5
|
+
constructor (store = runtimeStore) {
|
|
6
|
+
this.store = store
|
|
7
|
+
}
|
|
8
|
+
// 创建字段配置
|
|
9
|
+
async createFields ({ fields, fieldScope, meta, pageType = 'DETAIL', metaId = '', metaViewId, hiddenFields = [], defaultFieldConfigs = {}, type = 'list' }) {
|
|
10
|
+
const fieldConfigMaps = []
|
|
11
|
+
let metaView = null
|
|
12
|
+
// 走 getter 而不是直接读 state,读取本身会刷新缓存的「最近使用」记录,避免被淘汰
|
|
13
|
+
let newMeta = meta || this.store.getters.getMetaById(`${metaId}`)
|
|
14
|
+
if (!newMeta) {
|
|
15
|
+
newMeta = await this.store.dispatch({ // 加回调
|
|
16
|
+
type: ADD_META,
|
|
17
|
+
metaId: metaId
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
if (newMeta.metaView) {
|
|
21
|
+
metaView = newMeta.metaView[metaViewId]
|
|
22
|
+
}
|
|
23
|
+
const metaViewFieldMap = {}
|
|
24
|
+
|
|
25
|
+
if (metaView && metaView.fields) {
|
|
26
|
+
const metaViewFields = JSON.parse(metaView.fields)
|
|
27
|
+
metaViewFields.forEach(item => {
|
|
28
|
+
if (typeof item !== 'string') {
|
|
29
|
+
metaViewFieldMap[item.attriName] = item
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
if (!fields || Object.keys(fields).length === 0) {
|
|
34
|
+
const allFields = [...type === 'form' ? newMeta.getFormFields() : newMeta.getListFields()]
|
|
35
|
+
if (metaView && metaView.listFields) {
|
|
36
|
+
fields = JSON.parse(metaView.listFields)
|
|
37
|
+
if (!fields || fields.length === 0) fields = allFields
|
|
38
|
+
} else {
|
|
39
|
+
fields = allFields
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const metaKeyName = newMeta.getKey()
|
|
43
|
+
const metaKeyType = newMeta.getKeyType()
|
|
44
|
+
for (let i = 0; i < fields.length; i++) {
|
|
45
|
+
let fieldConfig = {} // 字段配置信息
|
|
46
|
+
const field = fields[i]
|
|
47
|
+
if (field === null || field === undefined) continue
|
|
48
|
+
const metaViewFieldConfig = metaViewFieldMap[field.attriName || field] || {}
|
|
49
|
+
if (isString(field)) {
|
|
50
|
+
fieldConfig = { attriName: field, ...metaViewFieldConfig }
|
|
51
|
+
} else {
|
|
52
|
+
fieldConfig = { ...field, ...metaViewFieldConfig }
|
|
53
|
+
}
|
|
54
|
+
if (fieldConfig.type === 'meta') {
|
|
55
|
+
const relation = newMeta.relatedEntitys.find(item => item.flag === fieldConfig.attriName)
|
|
56
|
+
if (relation) {
|
|
57
|
+
if (!fieldConfig.attriLabel) fieldConfig.attriLabel = relation.title
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!fieldConfig.attriName) {
|
|
61
|
+
continue
|
|
62
|
+
}
|
|
63
|
+
if (defaultFieldConfigs[fieldConfig.attriName]) {
|
|
64
|
+
fieldConfig = { ...defaultFieldConfigs[fieldConfig.attriName], ...fieldConfig }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (fieldConfig.attriName === metaKeyName && (fieldConfig.state || pageType) !== 'SEARCH' && fieldConfig.state !== 'DETAIL') {
|
|
68
|
+
if (metaKeyType !== 'assigned') {
|
|
69
|
+
fieldConfig.state = 'HIDDEN'
|
|
70
|
+
} else {
|
|
71
|
+
const { dataType } = newMeta.attributes[metaKeyName]
|
|
72
|
+
if (dataType === 'derive') {
|
|
73
|
+
if (pageType === 'EDIT' || pageType === 'ADD') {
|
|
74
|
+
fieldConfig.state = 'HIDDEN'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!fieldConfig.state) fieldConfig.state = pageType
|
|
80
|
+
|
|
81
|
+
const isHidden = hiddenFields.find(item => fieldConfig.attriName === (item.attriName || item))
|
|
82
|
+
if (isHidden) {
|
|
83
|
+
fieldConfig.state = 'HIDDEN'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 无效字段
|
|
87
|
+
if (fieldConfig.state && fieldConfig.state === 'INVALID') {
|
|
88
|
+
fieldConfigMaps.push(fieldConfig)
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 隐含字段
|
|
93
|
+
// if (fieldConfig.state && fieldConfig.state === 'HIDDEN') {
|
|
94
|
+
// fieldConfigMaps.push(fieldConfig)
|
|
95
|
+
// continue
|
|
96
|
+
// }
|
|
97
|
+
|
|
98
|
+
let fieldFromMetaId = newMeta.getId()
|
|
99
|
+
let fieldFromMeta = newMeta
|
|
100
|
+
let fieldName = fieldConfig.attriName
|
|
101
|
+
|
|
102
|
+
if (fieldName.indexOf('|') > -1) { // 关联字段
|
|
103
|
+
const fieldNameArray = fieldName.split('|')
|
|
104
|
+
fieldName = fieldNameArray[fieldNameArray.length - 1]
|
|
105
|
+
for (let i = 0; i < fieldNameArray.length - 1; i++) {
|
|
106
|
+
fieldFromMetaId = fieldFromMeta.getRelationIdByMetaId(fieldNameArray[i])
|
|
107
|
+
if (!fieldFromMetaId) break
|
|
108
|
+
fieldFromMeta = this.store.getters.getMetaById(fieldFromMetaId)
|
|
109
|
+
if (!fieldFromMeta) {
|
|
110
|
+
fieldFromMeta = await this.store.dispatch({ // 加回调
|
|
111
|
+
type: ADD_META,
|
|
112
|
+
metaId: fieldFromMetaId
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
fieldConfig = this.createFieldConfig({ fieldFromMeta, fieldConfig: { ...fieldConfig }, fieldName })
|
|
118
|
+
// 判断字段权限
|
|
119
|
+
if (fieldScope && fieldConfig.type !== 'meta') {
|
|
120
|
+
const type = fieldConfig.state === 'ADD' || fieldConfig.state === 'EDIT' ? '2' : '1'
|
|
121
|
+
const scope = fieldScope[type]
|
|
122
|
+
if (scope) {
|
|
123
|
+
if (fieldConfig.dataType !== 'custom' && !scope.includes(fieldConfig.attriName)) {
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (fieldConfig.attriLabel) {
|
|
129
|
+
fieldConfigMaps.push(fieldConfig)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return fieldConfigMaps
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
createFieldConfig ({ fieldFromMeta, fieldConfig, fieldName }) {
|
|
136
|
+
const attribute = fieldFromMeta.getAttribute(fieldName) || {}
|
|
137
|
+
attribute.entityId = fieldFromMeta.id
|
|
138
|
+
fieldConfig.attribute = { ...attribute, ...(fieldConfig.attribute || {}) }
|
|
139
|
+
if (!fieldConfig.attriLabel) fieldConfig.attriLabel = attribute.label
|
|
140
|
+
// if(!fieldConfig.fieldName) fieldConfig.fieldName = fieldName;
|
|
141
|
+
if (!fieldConfig.dataType) fieldConfig.dataType = attribute.dataType
|
|
142
|
+
if (!fieldConfig.codeKey) {
|
|
143
|
+
if (fieldConfig.dataType === 'list') fieldConfig.codeKey = attribute.codeKey
|
|
144
|
+
else fieldConfig.codeKey = attribute.relatedEntity || attribute.codeKey
|
|
145
|
+
}
|
|
146
|
+
if (!fieldConfig.isRequired) fieldConfig.isRequired = attribute.isRequired
|
|
147
|
+
if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD' || fieldConfig.state === 'SEARCH') {
|
|
148
|
+
if (fieldConfig.dataType === 'list' || fieldConfig.dataType === 'treeList' || fieldConfig.dataType === 'radio' || fieldConfig.dataType === 'multibox') {
|
|
149
|
+
this.setList(fieldConfig.dataType, fieldConfig.codeKey, fieldConfig.attribute)
|
|
150
|
+
} else if (fieldConfig.dataType === 'object') {
|
|
151
|
+
// this.setList(fieldConfig.dataType, fieldConfig.codeKey)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (fieldConfig.dataType === 'formula') {
|
|
156
|
+
fieldConfig.submitValue = false
|
|
157
|
+
if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD') {
|
|
158
|
+
fieldConfig.state = 'HIDDEN'
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (fieldConfig.fieldLabel) fieldConfig.attriLabel = fieldConfig.fieldLabel
|
|
162
|
+
if (fieldConfig.emptyText) fieldConfig.placeholder = fieldConfig.emptyText
|
|
163
|
+
return fieldConfig
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
setList (dataType, codeKey, { optionType }) {
|
|
167
|
+
this.store.dispatch({
|
|
168
|
+
type: ADD_LIST,
|
|
169
|
+
key: codeKey,
|
|
170
|
+
dataType: optionType || dataType
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function createFieldFactory (store) {
|
|
176
|
+
return new FieldFactory(store)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export default createFieldFactory()
|