imatrix-ui 0.0.15 → 0.1.1-up

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 (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,698 @@
1
+ import i18n from '../i18n/i18n'
2
+ import * as Vue from 'vue'
3
+ import { executeExpression } from './calculator/calculator-util'
4
+ export function getI18n() {
5
+ if (!window.$locale) {
6
+ i18n.locale = 'cn'
7
+ } else {
8
+ i18n.locale = window.$locale
9
+ }
10
+ return i18n
11
+ }
12
+
13
+ export function getLanguageWithLocale() {
14
+ const currentLocale = window.$locale
15
+ if (currentLocale && currentLocale === 'en') {
16
+ return 'en_US'
17
+ } else {
18
+ return 'zh_CN'
19
+ }
20
+ }
21
+ /**
22
+ * 根据动态数据源获得下拉选的选项集合
23
+ * @param {*} dynamicSourceCode 动态数据源编码
24
+ * @param {*} searchText 查询的文本
25
+ * @param {*} entity 实体信息
26
+ * @returns
27
+ */
28
+ export function findOptionsByDynamicDataSource(
29
+ dynamicSourceCode,
30
+ searchText,
31
+ entity,
32
+ additionalParameterStr
33
+ ) {
34
+ return new Promise((resolve, reject) => {
35
+ findDynamicDataSourceByCode(
36
+ dynamicSourceCode,
37
+ searchText,
38
+ entity,
39
+ additionalParameterStr
40
+ )
41
+ .then((dynamicDataSourceDto) => {
42
+ let options = []
43
+ if (dynamicDataSourceDto && dynamicDataSourceDto.options) {
44
+ const setOptions = dynamicDataSourceDto.options
45
+ let valueAttribute
46
+ if (dynamicDataSourceDto.valueAttribute) {
47
+ valueAttribute = dynamicDataSourceDto.valueAttribute
48
+ }
49
+ if (!valueAttribute || valueAttribute === '[label]') {
50
+ valueAttribute = '_label_'
51
+ }
52
+ setOptions.forEach((item) => {
53
+ // 值
54
+ const value = item[valueAttribute]
55
+ // 显示的标签
56
+ const label = item['_label_']
57
+ options.push({
58
+ label,
59
+ value,
60
+ })
61
+ })
62
+ }
63
+ if (!options) {
64
+ options = []
65
+ }
66
+ resolve(options)
67
+ })
68
+ .catch((error) => {
69
+ reject(error)
70
+ })
71
+ })
72
+ }
73
+
74
+ /**
75
+ * 根据动态数据源获得下拉选的选项对象集合
76
+ * @param {*} dynamicSourceCode 动态数据源编码
77
+ * @param {*} searchText 查询的文本
78
+ * @param {*} entity 实体信息
79
+ * @returns
80
+ */
81
+ export function findDynamicDataSourceByCode(
82
+ dynamicSourceCode,
83
+ searchText,
84
+ entity,
85
+ additionalParameterStr
86
+ ) {
87
+ return new Promise((resolve, reject) => {
88
+ if (searchText === undefined || searchText === null) {
89
+ searchText = ''
90
+ }
91
+ const params = {
92
+ searchText,
93
+ }
94
+ // const additionalParameterStr = window.sessionStorage.getItem('additionalParamMap')
95
+ if (additionalParameterStr) {
96
+ params.additionalParamMap = JSON.parse(additionalParameterStr)
97
+ }
98
+ if (entity && entity !== null) {
99
+ params.entity = entity
100
+ }
101
+ window.$vueApp.config.globalProperties.$http
102
+ .post(
103
+ window.$vueApp.config.globalProperties.baseURL +
104
+ '/common/dynamic-data-source/' +
105
+ dynamicSourceCode,
106
+ params
107
+ )
108
+ .then((dynamicDataSourceDto) => {
109
+ resolve(dynamicDataSourceDto)
110
+ })
111
+ .catch((error) => {
112
+ reject(error)
113
+ })
114
+ })
115
+ }
116
+
117
+ /**
118
+ * 解析是否可见的条件,例如:按钮是否按钮;列表单元格内容是否可见
119
+ * @param {*} conditionListJson
120
+ * @param {*} entity
121
+ * @param {*} additionalParameter
122
+ * @param {*} contextParameter
123
+ * @param {*} isSql
124
+ * @param {*} tableName
125
+ * @returns
126
+ */
127
+ export function analysisCondition(
128
+ conditionListJson,
129
+ entity,
130
+ additionalParameter,
131
+ contextParameter,
132
+ isSql,
133
+ tableName,
134
+ parentFormData
135
+ ) {
136
+ // console.log('analysisCondition判断条件conditionListJson', conditionListJson)
137
+ // console.log('analysisCondition判断条件entity', entity)
138
+ // console.log('analysisCondition判断条件additionalParameter', additionalParameter)
139
+ // console.log('analysisCondition判断条件contextParameter', contextParameter)
140
+ // console.log('analysisCondition判断条件isSql', isSql)
141
+ // console.log('analysisCondition判断条件tableName', tableName)
142
+ // console.log('analysisCondition判断条件parentFormData', parentFormData)
143
+ if (
144
+ conditionListJson === undefined ||
145
+ conditionListJson === '' ||
146
+ conditionListJson === null
147
+ ) {
148
+ // 如果条件不存在,则默认返回true
149
+ return true
150
+ }
151
+ if (typeof isSql === 'undefined' || isSql === null) {
152
+ // 默认是定制开发时
153
+ isSql = false
154
+ }
155
+ // 页面附加参数
156
+ let additionalParameterMap = {}
157
+ if (
158
+ additionalParameter &&
159
+ typeof additionalParameter === 'string' &&
160
+ additionalParameter !== ''
161
+ ) {
162
+ additionalParameterMap = JSON.parse(additionalParameter)
163
+ } else if (additionalParameter && typeof additionalParameter === 'object') {
164
+ additionalParameterMap = additionalParameter
165
+ }
166
+ // 环境变量,例如:当前用户id、当前用户登录名等
167
+ let contextParameterMap = {}
168
+ if (
169
+ contextParameter &&
170
+ typeof contextParameter === 'string' &&
171
+ contextParameter !== ''
172
+ ) {
173
+ contextParameterMap = JSON.parse(contextParameter)
174
+ } else if (contextParameter && typeof contextParameter === 'object') {
175
+ contextParameterMap = contextParameter
176
+ }
177
+ let conditionList = []
178
+ if (
179
+ conditionListJson &&
180
+ typeof conditionListJson === 'string' &&
181
+ conditionListJson !== ''
182
+ ) {
183
+ // conditionList = eval('('+conditionListJson+')')
184
+ conditionList = JSON.parse(conditionListJson)
185
+ } else if (conditionListJson && Array.isArray(conditionListJson)) {
186
+ conditionList = conditionListJson
187
+ }
188
+ return parseCondition(
189
+ entity,
190
+ conditionList,
191
+ isSql,
192
+ tableName,
193
+ additionalParameterMap,
194
+ contextParameterMap,
195
+ parentFormData
196
+ )
197
+ }
198
+
199
+ function parseCondition(
200
+ entity,
201
+ conditionList,
202
+ isSql,
203
+ tableName,
204
+ additionalParamMap,
205
+ contextParameterMap,
206
+ parentFormData
207
+ ) {
208
+ if (
209
+ conditionList === undefined ||
210
+ conditionList === null ||
211
+ conditionList.length === 0
212
+ ) {
213
+ // 表示没有设置条件,默认是true
214
+ return true
215
+ }
216
+ // 条件封装的表达式
217
+ let conditions = ''
218
+ for (let i = 0; i < conditionList.length; i++) {
219
+ const condition = conditionList[i]
220
+ let propName = condition.propName
221
+ let propDbName = condition.propDbName
222
+ if ((!propName || propName === '') && (!propDbName || propDbName === '')) {
223
+ // 没有属性和字段名表示是无效的条件
224
+ continue
225
+ }
226
+ let leftValue
227
+ if (isSql && propDbName) {
228
+ if (propDbName.indexOf('parent_+_') !== -1) {
229
+ propDbName = propDbName.replace('parent_+_', '')
230
+ // 再获取属于那张表
231
+ const propDbNameArr = propDbName.split('_+_')
232
+ propDbName = propDbNameArr[1]
233
+ leftValue = getValue(parentFormData, propDbName, isSql)
234
+ } else {
235
+ leftValue = getValue(entity, propDbName, isSql)
236
+ }
237
+ if (leftValue === undefined || leftValue === null) {
238
+ if (
239
+ tableName &&
240
+ propDbName.toLowerCase().startsWith(tableName.toLowerCase() + '.')
241
+ ) {
242
+ // 表示是当前表的字段
243
+ const myProp = propDbName.substring(propDbName.indexOf('.'))
244
+ leftValue = getValue(entity, myProp, isSql)
245
+ }
246
+ }
247
+ } else {
248
+ if (propName.indexOf('parent_+_') !== -1) {
249
+ propName = propName.replace('parent_+_', '')
250
+ const propNameArr = propName.split('_+_')
251
+ propName = propNameArr[1]
252
+ leftValue = getValue(parentFormData, propName, isSql)
253
+ } else {
254
+ leftValue = getValue(entity, propName, isSql)
255
+ }
256
+ if (propDbName && (leftValue === undefined || leftValue === null)) {
257
+ leftValue = getValue(entity, propDbName, isSql)
258
+ }
259
+ }
260
+ const operator = condition.operator
261
+ const propValue = condition.propValue
262
+ const dataType = condition.dataType
263
+ const variableIsNullStr = condition.variableIsNull
264
+ // 解析单个条件的值
265
+ // 判断value类型
266
+ let value = getPropValue(
267
+ propValue,
268
+ entity,
269
+ additionalParamMap,
270
+ contextParameterMap
271
+ )
272
+ if (variableIsNullStr && variableIsNullStr === 'null') {
273
+ if (value === undefined || value === '') {
274
+ value = null
275
+ }
276
+ }
277
+ let conditionResult = executeExpression(
278
+ leftValue,
279
+ operator,
280
+ value,
281
+ dataType
282
+ )
283
+ const leftBracket = condition.leftBracket
284
+ const rightBracket = condition.rightBracket
285
+ let joinSign = condition.joinSign
286
+ if (leftBracket && leftBracket !== null && leftBracket !== '') {
287
+ conditions = conditions + leftBracket
288
+ conditions = conditions + ' '
289
+ // conditions.append(leftBracket).append(' ')
290
+ }
291
+ if (variableIsNullStr && variableIsNullStr !== 'null') {
292
+ if (value === undefined || value === null || value + '' === '') {
293
+ if (variableIsNullStr === '1=1') {
294
+ conditionResult = true
295
+ } else {
296
+ conditionResult = false
297
+ }
298
+ }
299
+ }
300
+ conditions += conditionResult + ' '
301
+ if (rightBracket && rightBracket !== null && rightBracket !== '') {
302
+ conditions = conditions + rightBracket
303
+ conditions = conditions + ' '
304
+ // conditions.append(rightBracket).append(' ')
305
+ }
306
+ if (i < conditionList.length - 1) {
307
+ // 最后一个不拼接“连接符”
308
+ if (joinSign && joinSign !== null && joinSign !== '') {
309
+ const joinSignIgnoreCase = joinSign.toLowerCase()
310
+ if (joinSignIgnoreCase === 'and') {
311
+ joinSign = joinSignIgnoreCase.replace('and', '&&')
312
+ } else if (joinSignIgnoreCase === 'or') {
313
+ joinSign = joinSignIgnoreCase.replace('or', '||')
314
+ }
315
+ conditions += joinSign + ' '
316
+ }
317
+ }
318
+ }
319
+ console.log('parseCondition----conditions=', conditions)
320
+ if (conditions) {
321
+ // eslint-disable-next-line no-eval
322
+ return eval('(' + conditions + ')')
323
+ } else {
324
+ return true
325
+ }
326
+ }
327
+ const REPLACE_DOT = '__'
328
+
329
+ function getValue(entityData, fieldName, isSql) {
330
+ let value = null
331
+ if (entityData && entityData !== null) {
332
+ if (fieldName && fieldName !== null) {
333
+ value = getValueByField(entityData, fieldName)
334
+ if (value === undefined || value === null) {
335
+ if (isSql) {
336
+ if (value === undefined || value == null) {
337
+ if (fieldName.indexOf('.') > 0) {
338
+ // 将“.”替换为'__',列表组件中的entity中如果是'.',传过来的实体信息中的字段属性会是“__”
339
+ fieldName = fieldName.replace('.', REPLACE_DOT)
340
+ value = getValueByField(entityData, fieldName)
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ }
347
+ return value
348
+ }
349
+
350
+ function getValueByField(entityData, fieldName) {
351
+ if (entityData && entityData !== null) {
352
+ let value
353
+ if (fieldName.indexOf('.') > 0) {
354
+ // 表示是子表字段
355
+ value = getSubEntityValue(entityData, fieldName)
356
+ } else {
357
+ value = entityData[fieldName.toUpperCase()]
358
+ if (value === undefined) {
359
+ value = entityData[fieldName.toLowerCase()]
360
+ }
361
+ }
362
+ return value
363
+ }
364
+ }
365
+ function getSubEntityValue(entityData, fieldName) {
366
+ let value = null
367
+ let subEntityData = entityData
368
+ const fieldNames = fieldName.split('\\.')
369
+ for (let i = 0; i < fieldNames.length; i++) {
370
+ const field = fieldNames[i]
371
+ if (i === fieldNames.length) {
372
+ value = getSubEntityFieldValue(subEntityData, field)
373
+ } else {
374
+ subEntityData = getSubEntityFieldValue(subEntityData, field)
375
+ }
376
+ }
377
+ return value
378
+ }
379
+
380
+ /**
381
+ * 获得关联表字段的值。
382
+ * 处理sql 或 实体情况。
383
+ * @param subEntityData
384
+ * @param fieldName
385
+ * @return
386
+ */
387
+ function getSubEntityFieldValue(subEntityData, fieldName) {
388
+ if (subEntityData === undefined || subEntityData === null) {
389
+ return null
390
+ }
391
+ return subEntityData[fieldName]
392
+ }
393
+
394
+ function getContextValue(contextParameterMap, propValue) {
395
+ if (contextParameterMap) {
396
+ return contextParameterMap[propValue]
397
+ }
398
+ }
399
+
400
+ export function getPropValue(
401
+ propValue,
402
+ entity,
403
+ additionalParamMap,
404
+ contextParameterMap,
405
+ parentEntity,
406
+ subEntity,
407
+ task
408
+ ) {
409
+ let value = null
410
+ if (propValue && propValue !== null && propValue !== '') {
411
+ if (propValue === 'null') {
412
+ value = null
413
+ } else if (
414
+ propValue.includes('${context.') ||
415
+ propValue.includes('${request.') ||
416
+ propValue.includes('${obj.')
417
+ ) {
418
+ // 填写的固定值
419
+ if (propValue.includes('${context.')) {
420
+ propValue = propValue.replace('${context.', '').replace('}', '')
421
+ value = getContextValue(contextParameterMap, propValue)
422
+ } else if (
423
+ propValue.includes('${request.') &&
424
+ propValue !== '${request.term}'
425
+ ) {
426
+ // ${request.term}表示页面中手动输入的值
427
+ propValue = propValue.replace('${request.', '').replace('}', '')
428
+ if (
429
+ additionalParamMap &&
430
+ additionalParamMap != null &&
431
+ Object.keys(additionalParamMap).indexOf(propValue) >= 0 &&
432
+ additionalParamMap[propValue] &&
433
+ additionalParamMap[propValue] !== null
434
+ ) {
435
+ value = additionalParamMap[propValue]
436
+ } else {
437
+ value = null
438
+ }
439
+ } else if (propValue.includes('${obj.')) {
440
+ if (entity === undefined || entity == null) {
441
+ value = null
442
+ } else {
443
+ const propName = propValue.replace('${obj.', '').replace('}', '')
444
+ value = getEntityFieldValue(entity, propName)
445
+ }
446
+ }
447
+ } else if (propValue.includes('${parent.')) {
448
+ if (parentEntity === undefined || parentEntity == null) {
449
+ value = null
450
+ } else {
451
+ const propName = propValue.replace('${parent.', '').replace('}', '')
452
+ value = getEntityFieldValue(parentEntity, propName)
453
+ }
454
+ } else if (propValue.includes('${task.')) {
455
+ if (task === undefined || task == null) {
456
+ value = null
457
+ } else {
458
+ const propName = propValue.replace('${task.', '').replace('}', '')
459
+ value = getEntityFieldValue(task, propName)
460
+ }
461
+ } else if (propValue.includes('${subObj.')) {
462
+ if (subEntity === undefined || subEntity == null) {
463
+ value = null
464
+ } else {
465
+ const propName = propValue.replace('${subObj.', '').replace('}', '')
466
+ value = getEntityFieldValue(subEntity, propName)
467
+ }
468
+ } else if (propValue.includes('${input.')) {
469
+ value = propValue.replace('${input.', '').replace('}', '')
470
+ } else {
471
+ value = propValue
472
+ }
473
+ }
474
+ return value
475
+ }
476
+ /**
477
+ * 解析条件,例如:${obj.menu_code}-#-#${input.---}-#-#${context.currentTransactor}
478
+ * @param {*} conditionValue
479
+ * @param {*} entity
480
+ * @param {*} additionalParameter
481
+ * @param {*} contextParameter
482
+ * @returns
483
+ */
484
+ export function analysisValue(
485
+ conditionValue,
486
+ entity,
487
+ additionalParameter,
488
+ contextParameter
489
+ ) {
490
+ if (!conditionValue) {
491
+ return
492
+ }
493
+ let label = ''
494
+ const split = conditionValue.split('-#-#')
495
+ if (split != null && split.length > 0) {
496
+ split.forEach((item) => {
497
+ let value = getPropValue(
498
+ item,
499
+ entity,
500
+ additionalParameter,
501
+ contextParameter
502
+ )
503
+ if (!value || value === null) {
504
+ value = ''
505
+ }
506
+ label += value
507
+ })
508
+ }
509
+ return label
510
+ }
511
+
512
+ /**
513
+ * 设置entity中某属性的值,处理子对象的情况。使用该方法,性能可能有问题
514
+ * @param {*} entity
515
+ * @param {*} prop
516
+ * @param {*} value
517
+ */
518
+ export function setEntityFieldValue(entity, prop, value) {
519
+ if (prop && entity) {
520
+ if (prop && prop.indexOf('.') > 0) {
521
+ const parentObj = getParentObjectUtil(prop, entity)
522
+ if (parentObj) {
523
+ const subProp = prop.substring(prop.lastIndexOf('.') + 1)
524
+ if (parentObj[subProp] === undefined) {
525
+ // 动态对象属性赋值,防止属性不存在,导致属性无法赋值问题
526
+ parentObj[prop.substring(prop.lastIndexOf('.') + 1)] = value
527
+ } else {
528
+ // 静态对象属性赋值,提高性能
529
+ parentObj[subProp] = value
530
+ }
531
+ }
532
+ } else {
533
+ if (entity[prop] === undefined) {
534
+ // 动态对象属性赋值,防止属性不存在,导致属性无法赋值问题
535
+ entity[prop] = value
536
+ } else {
537
+ // 静态对象属性赋值,提高性能
538
+ entity[prop] = value
539
+ }
540
+ }
541
+ }
542
+ }
543
+
544
+ /**
545
+ * 获得字段的值,不需要处理大小写转换
546
+ * @param {*} entity
547
+ * @param {*} prop
548
+ * @returns
549
+ */
550
+ export function getEntityFieldValueWithOutCase(entity, prop) {
551
+ if (prop && prop.indexOf('.') > 0) {
552
+ const parentOjbect = getParentObjectUtil(prop, entity)
553
+ const modelName = prop.substring(prop.lastIndexOf('.') + 1)
554
+ return parentOjbect[modelName]
555
+ } else {
556
+ return entity[prop]
557
+ }
558
+ }
559
+
560
+ /**
561
+ * 获得实体entity中某属性的值,处理子表对象的情况
562
+ * @param {*} entity
563
+ * @param {*} prop
564
+ * @returns
565
+ */
566
+ export function getEntityFieldValue(entity, prop, isLowerCase) {
567
+ let value = getEntityFieldValueWithCase(entity, prop)
568
+ if (value === undefined || value === null) {
569
+ // 兼容mysql数据库
570
+ value = getEntityFieldValueWithCase(entity, prop.toLowerCase())
571
+ }
572
+ if (value === undefined || (value === null && isLowerCase === undefined)) {
573
+ // 兼容oracle数据库
574
+ value = getEntityFieldValueWithCase(entity, prop.toUpperCase())
575
+ }
576
+ return value
577
+ }
578
+
579
+ function getEntityFieldValueWithCase(entity, prop) {
580
+ if (prop && prop.indexOf('.') > 0) {
581
+ const parentOjbect = getParentObjectUtil(prop, entity)
582
+ const modelName = prop.substring(prop.lastIndexOf('.') + 1)
583
+ return parentOjbect[modelName]
584
+ } else {
585
+ return entity[prop]
586
+ }
587
+ }
588
+
589
+ export function getParentObjectUtil(prop, entity) {
590
+ const nestedProp = prop.split('.')
591
+ // 属性只有一个时父对象就是models
592
+ if (nestedProp.length === 1) {
593
+ return entity
594
+ } else {
595
+ let parentObject
596
+ // 属性超过2个时先找到最后一层属性的父对象
597
+ for (let i = 0; i < nestedProp.length - 1; i++) {
598
+ if (i === 0) {
599
+ parentObject = getParentModelProp(nestedProp[i], entity)
600
+ } else {
601
+ parentObject = getParentModelProp(nestedProp[i], parentObject)
602
+ }
603
+ }
604
+ return parentObject
605
+ }
606
+ }
607
+
608
+ function getParentModelProp(prop, parentObj) {
609
+ let myPparentObject = getParentModelPropWithCase(prop, parentObj)
610
+ if (myPparentObject === undefined) {
611
+ // 兼容mysql数据库
612
+ myPparentObject = getParentModelPropWithCase(prop.toLowerCase(), parentObj)
613
+ }
614
+ if (myPparentObject === undefined) {
615
+ // 兼容oracle数据库
616
+ myPparentObject = getParentModelPropWithCase(prop.toUpperCase(), parentObj)
617
+ }
618
+ return myPparentObject
619
+ }
620
+
621
+ function getParentModelPropWithCase(prop, parentObj) {
622
+ if (!parentObj) {
623
+ parentObj = {}
624
+ }
625
+ if (!parentObj[prop] && !parentObj[prop.toUpperCase()]) {
626
+ parentObj[prop] = {}
627
+ }
628
+ return parentObj[prop]
629
+ }
630
+ /**
631
+ * 获得系统信息
632
+ * @param {*}} systemCode
633
+ * @returns
634
+ */
635
+ export function findSystemInfoByCode(systemCode) {
636
+ return new Promise((resolve, reject) => {
637
+ if (!systemCode) {
638
+ systemCode = window.$vueApp.config.globalProperties.systemCode
639
+ }
640
+
641
+ window.$vueApp.config.globalProperties.$http
642
+ .get(
643
+ window.$vueApp.config.globalProperties.baseAPI +
644
+ '/component/business-systems/' +
645
+ systemCode
646
+ )
647
+ .then((system) => {
648
+ if (system) {
649
+ resolve({
650
+ zh_CN: system.name,
651
+ en_US: system.enName,
652
+ frontendUrl: system.frontendUrl,
653
+ })
654
+ } else {
655
+ resolve('系统:' + systemCode + '不存在')
656
+ }
657
+ })
658
+ .catch((error) => {
659
+ reject(error)
660
+ })
661
+ })
662
+ }
663
+
664
+ export function getPropNameWhenJoinTable(prop, isJoinTable, tableName) {
665
+ if (prop && isJoinTable !== undefined && isJoinTable === true) {
666
+ // 关联表时将点改成下划线,如果没点,则表示是主表字段,拼接主表tableName,因为列表组件中是这样处理的
667
+ const replaceDot = '__'
668
+ if (prop.indexOf('.') > 0) {
669
+ prop = prop.replace('.', replaceDot)
670
+ } else {
671
+ if (
672
+ tableName &&
673
+ tableName !== null &&
674
+ tableName !== '' &&
675
+ prop.indexOf(tableName + replaceDot) < 0
676
+ ) {
677
+ // 如果属性名没有拼接表名才需要拼接
678
+ prop = tableName + replaceDot + prop
679
+ }
680
+ }
681
+ }
682
+ return prop
683
+ }
684
+
685
+ export function isImage(fileName) {
686
+ // const fileType = fileName.substring(fileName.lastIndexOf('.'), fileName.length).toLowerCase()
687
+ // const imageTypes = ['.jpg', '.JPG', '.png', '.bmp', '.BMP', '.jpeg', '.gif', '.psd', '.tif', '.tga', '.svg', '.eps']
688
+ // const index = imageTypes.indexOf(fileType)
689
+ if (
690
+ /\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|psd|PSD|tif|TIF)$/.test(
691
+ fileName
692
+ )
693
+ ) {
694
+ return true
695
+ } else {
696
+ return false
697
+ }
698
+ }