agilebuilder-ui 1.1.39 → 1.1.40-sit1

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 (53) hide show
  1. package/lib/{401-10773a45.js → 401-09411643.js} +1 -1
  2. package/lib/{404-bc7b5bc4.js → 404-78725820.js} +1 -1
  3. package/lib/{iframe-page-593fe033.js → iframe-page-532b68e3.js} +1 -1
  4. package/lib/{index-5276895e.js → index-147b8176.js} +9499 -9462
  5. package/lib/super-ui.css +1 -1
  6. package/lib/super-ui.js +1 -1
  7. package/lib/super-ui.umd.cjs +64 -64
  8. package/lib/{tab-content-iframe-index-12a5a7c2.js → tab-content-iframe-index-ca45a6b8.js} +1 -1
  9. package/lib/{tab-content-index-6901441f.js → tab-content-index-6fe04e7b.js} +1 -1
  10. package/lib/{tache-subprocess-history-8fd8d5f7.js → tache-subprocess-history-61019029.js} +1 -1
  11. package/package.json +1 -1
  12. package/packages/department-tree-inline/src/department-single-tree-inline.vue +3 -1
  13. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +5 -1
  14. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +2 -1
  15. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -1
  16. package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +3 -1
  17. package/packages/fs-preview/src/fs-preview.vue +202 -65
  18. package/packages/fs-upload-list/src/fs-upload-list.vue +67 -192
  19. package/packages/fs-upload-new/src/fs-button-upload.vue +4 -4
  20. package/packages/fs-upload-new/src/fs-drag-upload.vue +4 -4
  21. package/packages/fs-upload-new/src/fs-preview-new.vue +6 -7
  22. package/packages/fs-upload-new/src/fs-upload-new.vue +13 -13
  23. package/packages/organization-input/src/organization-input.vue +3 -3
  24. package/packages/super-grid/src/components/mobile-table-card.jsx +0 -1
  25. package/packages/super-grid/src/custom-formatter.js +1 -1
  26. package/packages/super-grid/src/dynamic-input.vue +3 -26
  27. package/packages/super-grid/src/normal-column-content.vue +25 -18
  28. package/packages/super-grid/src/row-operation.vue +13 -9
  29. package/packages/super-grid/src/search-form-item.vue +47 -4
  30. package/packages/super-grid/src/search-form-mobile.vue +5 -0
  31. package/packages/super-grid/src/search-form-ordinarySearch.vue +5 -0
  32. package/packages/super-grid/src/search-methods.js +489 -575
  33. package/packages/super-grid/src/super-grid.vue +13 -0
  34. package/packages/utils/organization.ts +56 -40
  35. package/packages/workflow-history-list/src/workflow-history-list.vue +41 -3
  36. package/src/directives/permission/permission.js +7 -1
  37. package/src/i18n/langs/cn.js +10 -3
  38. package/src/i18n/langs/en.js +10 -3
  39. package/src/styles/mixin.scss +2 -2
  40. package/src/styles/table.scss +8 -7
  41. package/src/styles/theme/dark-blue/scrollbar-style.scss +2 -2
  42. package/src/styles/theme/gray/scrollbar-style.scss +2 -2
  43. package/src/styles/theme/green/scrollbar-style.scss +2 -2
  44. package/src/styles/theme/ocean-blue/scrollbar-style.scss +2 -2
  45. package/src/styles/theme/tiffany-blue-mobile/scrollbar-style.scss +2 -2
  46. package/src/utils/file-util.ts +12 -4
  47. package/src/utils/jump-page-utils.js +1 -0
  48. package/src/utils/permission.js +2 -2
  49. package/src/utils/permissionAuth.js +4 -2
  50. package/src/views/dsc-component/Sidebar/Item.vue +3 -3
  51. package/src/views/dsc-component/Sidebar/index.vue +0 -2
  52. package/src/views/layout/components/Menubar/Item.vue +6 -0
  53. package/src/views/layout/components/Menubar/SidebarItem.vue +37 -17
@@ -1,599 +1,513 @@
1
1
  const searchMethods = {
2
- packageSearchParam() {
3
- if (
4
- this.searchType === 'normal' ||
5
- !this.searchType ||
6
- this.searchType === null ||
7
- this.searchType === undefined ||
8
- this.searchType === ''
9
- ) {
10
- const searchParams = []
11
- this.searchableColumns.forEach((column) => {
12
- const param = {leftBracket: '', rightBracket: '', joinSign: 'and'}
13
- // 布尔型字段时prop中去掉了is字符,查询时返回带有is的属性字段,
14
- // 否则会导致查询布尔型报500错误
15
- let orgProp = column.orgProp
16
- // sql查询时,会把点“.”改为两个下划线"__"
17
- const replaceDot = '__'
18
- if (orgProp && orgProp.indexOf(replaceDot) > 0) {
19
- // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
20
- orgProp = orgProp.replace(replaceDot, '.')
21
- }
22
- param.propName = orgProp
23
- param.enumName = column.enumName
24
- param.operator = this.getOperator(column)
25
- param.dataType = column.dataType
26
- param.matchingType = column.queryMatching
27
- param.formatter = column.formatter
28
- ? JSON.parse(JSON.stringify(column.formatter))
29
- : column.formatter
30
- const values = this.getFormItemValue(column.prop)
31
- if (column.dataType === 'DATE' || column.dataType === 'TIME') {
32
- // 日期 或 时间类型
33
- // console.log('values==', values, column.prop)
34
- if (
35
- values&&
36
- values.length === 2 &&
37
- values[0] !== null &&
38
- values[1] !== null
39
- ) {
40
- const format = this.getDateTimeSearchFormatter(
41
- column,
42
- column.dataType,
43
- column.formatter
44
- )
45
- if (format) {
46
- if (!param.formatter) {
47
- param.formatter = {}
48
- param.formatter.options = {}
49
- } else if (!param.formatter.options) {
50
- param.formatter.options = {}
51
- }
52
- param.formatter.options.format = format
53
- }
54
- param.startValue = this.getDateTimeMillsByDateStr(values[0], format)
55
- param.endValue = this.getDateTimeMillsByDateStr(values[1], format)
56
- searchParams.push(param)
57
- }
58
- } else if (
59
- (column.dataType === 'INTEGER' ||
60
- column.dataType === 'LONG' ||
61
- column.dataType === 'DOUBLE') &&
62
- Array.isArray(values)
63
- ) {
64
- // 日期 或 时间类型
65
- // const values1 = this.getFormItemValue(column.prop)
66
- if (values) {
67
- if (column.componentType === 'yearRange') {
68
- if (values[0] || values[1]) {
69
- param.startValue = values[0]
70
- param.endValue = values[1]
71
- if (values[0] && !values[1]) {
72
- param.startValue = values[0]
73
- param.endValue = 9999
74
- } else if (!values[0] && values[1]) {
75
- param.startValue = 0
76
- param.endValue = values[1]
77
- }
78
- searchParams.push(param)
79
- }
80
- } else {
81
- if (
82
- !Array.isArray(values) ||
83
- values.length < 2 ||
84
- (values[0] === null && values[1] === null)
85
- ) {
86
- // 填写了一个有效值
87
- if (!Array.isArray(values)) {
88
- param.propValue = values
89
- searchParams.push(param)
90
- } else if (values.length < 2) {
91
- param.propValue = values[0]
92
- searchParams.push(param)
93
- } else if (values[0] === null) {
94
- param.propValue = values[1]
95
- searchParams.push(param)
96
- } else if (values[1] === null) {
97
- param.propValue = values[0]
98
- searchParams.push(param)
99
- }
100
- } else {
101
- // 填写了两个有效值
102
-
103
- param.startValue = values[0]
104
- param.endValue = values[1]
105
- searchParams.push(param)
106
- }
107
- }
108
- }
109
- } else if (
110
- column.componentType &&
111
- column.componentType.indexOf('Tree') !== -1 &&
112
- column.componentType.indexOf('single') === -1
113
- ) {
114
- // 说明是多选组织树
115
- // 是否是人员树
116
- const isUser = this.isUserTree(column.componentType)
117
- const values = this.getFormItemValue(column.prop)
118
- if (values && values !== '') {
119
- const newValue = []
120
- let valueArr = values
121
- if (Array.isArray(values)) {
122
- // 表示是数组
123
- valueArr = values
124
- } else {
125
- // 表示是字符串
126
- valueArr = values.split(',')
127
- }
128
- if (Array.isArray(valueArr) && valueArr && valueArr.length > 0) {
129
- valueArr.forEach((val) => {
130
- // 截取用户名中的英文名信息
131
- const userName = this.getUserName(isUser, val)
132
- if (userName !== undefined && userName !== null) {
133
- newValue.push(userName)
134
- }
135
- })
136
- }
137
- this.packageValueWithArray(newValue, searchParams, param)
138
- }
139
- } else if (
140
- column.componentType &&
141
- column.componentType.indexOf('Tree') !== -1
142
- ) {
143
- // 说明是单选组织树
144
- // 是否是人员树
145
- const isUser = this.isUserTree(column.componentType)
146
- let propValue = this.getFormItemValue(column.prop)
147
- // 截取用户名中的英文名信息
148
- propValue = this.getUserName(isUser, propValue)
149
- this.packageValueWithArray(propValue, searchParams, param)
150
- } else {
151
- if (column.componentType === 'multiselect') {
152
- // 表示是多选下拉框选择器选择的值
153
- const values = this.getFormItemValue(column.prop)
154
- // console.log('values==', values, column.prop)
155
- this.packageValueWithArray(values, searchParams, param)
156
- } else {
157
- const propValue = this.getFormItemValue(column.prop)
158
- this.packageValueWithArray(propValue, searchParams, param)
159
- }
160
- }
161
- })
162
- return searchParams
163
- } else {
164
- const newSearchFormList = []
165
- this.searchFormList.forEach((param) => {
166
- let newParam = {}
167
- newParam = param
168
- // const param = { leftBracket: '', rightBracket: '', joinSign: 'and' }
169
- // 布尔型字段时prop中去掉了is字符,查询时返回带有is的属性字段,
170
- // 否则会导致查询布尔型报500错误
171
- let orgProp = newParam.orgProp
172
- // sql查询时,会把点“.”改为两个下划线"__"
173
- const replaceDot = '__'
174
- if (orgProp && orgProp.indexOf(replaceDot) > 0) {
175
- // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
176
- orgProp = orgProp.replace(replaceDot, '.')
177
- }
178
- newParam.propName = orgProp
179
- newParam.operator = this.getOperator(param)
180
- newParam.matchingType = param.queryMatching
181
- if (newParam.dataType === 'DATE' || newParam.dataType === 'TIME') {
182
- // 日期 或 时间类型
183
- const values = newParam.value
184
- // console.log('values==', values, column.prop)
185
- if (
186
- values !== null &&
187
- values.length === 2 &&
188
- values[0] !== null &&
189
- values[1] !== null
190
- ) {
191
- newParam.startValue = values[0]
192
- newParam.endValue = values[1]
193
- }
194
- } else if (
195
- newParam.dataType === 'INTEGER' ||
196
- newParam.dataType === 'LONG'
197
- ) {
198
- const values1 = newParam.value
199
- if (values1) {
200
- if (
201
- !Array.isArray(values1) ||
202
- values1.length < 2 ||
203
- (values1[0] === null && values1[1] === null)
204
- ) {
205
- // 填写了一个有效值
206
- if (!Array.isArray(values1)) {
207
- newParam.propValue = values1
208
- } else if (values1.length < 2) {
209
- newParam.propValue = values1[0]
210
- } else if (values1[0] === null) {
211
- newParam.propValue = values1[1]
212
- } else if (values1[1] === null) {
213
- newParam.propValue = values1[0]
214
- }
215
- } else {
216
- // 填写了两个有效值
217
- newParam.startValue = values1[0]
218
- newParam.endValue = values1[1]
219
- }
220
- }
221
- } else if (
222
- newParam.componentType &&
223
- newParam.componentType.indexOf('Tree') !== -1 &&
224
- newParam.componentType.indexOf('single') === -1
225
- ) {
226
- // 树多选,先手动分割数组,在生成多条
227
- // 是否是人员树
228
- const isUser = this.isUserTree(newParam.componentType)
229
- const values = newParam.value
230
- if (values && values !== '') {
231
- const newValue = []
232
- let valueArr = values
233
- if (Array.isArray(values)) {
234
- valueArr = values
235
- } else {
236
- valueArr = values.split(',')
237
- }
238
- if (Array.isArray(valueArr) && valueArr && valueArr.length > 0) {
239
- valueArr.forEach((val) => {
240
- // 截取用户名中的英文名信息
241
- const userName = this.getUserName(isUser, val)
242
- if (userName !== undefined && userName !== null) {
243
- newValue.push(userName)
244
- }
245
- })
246
- }
247
- this.packageValueWithArray(newValue, newSearchFormList, param)
248
- }
249
- } else if (
250
- newParam.componentType &&
251
- newParam.componentType.indexOf('Tree') !== -1
252
- ) {
253
- // 说明是单选组织树
254
- // 是否是人员树
255
- const isUser = this.isUserTree(newParam.componentType)
256
- let propValue = newParam.value
257
- // 截取用户名中的英文名信息
258
- propValue = this.getUserName(isUser, propValue)
259
- this.packageValueWithArray(propValue, newSearchFormList, param)
260
- } else {
261
- if (newParam.componentType === 'multiselect') {
262
- // 表示是多选下拉框选择器选择的值
263
- const values = newParam.value
264
- // console.log('values==', values, column.prop)
265
- this.packageValueWithArray(values, newSearchFormList, param)
266
- } else {
267
- const values = newParam.value
268
- this.packageValueWithArray(values, newSearchFormList, param)
269
- }
270
- }
271
- })
272
- return newSearchFormList
273
- }
274
- },
275
- // 获得日期、时间查询格式配置,影响后台查询结果
276
- getDateTimeSearchFormatter(column, dataType, formatter) {
277
- const dateTimeFormat = 'yyyy-MM-dd HH:mm:ss'
278
- const dateFormat = 'yyyy-m-d'
279
- let format
280
- if (column.componentType === 'dateSection') {
281
- // 日期区间
282
- format = dateFormat
283
- } else if (column.componentType === 'dateTimePicker') {
284
- // 日期时间选择器
285
- format = dateTimeFormat
286
- } else if (column.dataType === 'DATE' || column.componentType === 'date') {
287
- // 日期选择器
288
- format = dateFormat
289
- }
290
- if (!format) {
291
- if (formatter) {
292
- const formatOptions = formatter.options
293
- if (formatOptions && formatOptions != null) {
294
- format = formatOptions.format
295
- }
296
- }
297
- }
298
-
299
- if (!format) {
300
- if (dataType === 'DATE') {
301
- format = 'yyyy-m-d'
302
- } else if (dataType === 'TIME') {
303
- format = 'yyyy-m-d hh:mm:ss'
304
- }
2
+ packageSearchParam() {
3
+ if (
4
+ this.searchType === 'normal' ||
5
+ !this.searchType ||
6
+ this.searchType === null ||
7
+ this.searchType === undefined ||
8
+ this.searchType === ''
9
+ ) {
10
+ const searchParams = []
11
+ this.searchableColumns.forEach((column) => {
12
+ const param = { leftBracket: '', rightBracket: '', joinSign: 'and' }
13
+ // 布尔型字段时prop中去掉了is字符,查询时返回带有is的属性字段,
14
+ // 否则会导致查询布尔型报500错误
15
+ let orgProp = column.orgProp
16
+ // sql查询时,会把点“.”改为两个下划线"__"
17
+ const replaceDot = '__'
18
+ if (orgProp && orgProp.indexOf(replaceDot) > 0) {
19
+ // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
20
+ orgProp = orgProp.replace(replaceDot, '.')
305
21
  }
306
- return format
307
- },
308
- // 根据日期字符串获得日期毫秒值
309
- getDateTimeMillsByDateStr(dateStr, format) {
310
- if (typeof dateStr === 'string' && format) {
311
- if (dateStr.indexOf('T') !== -1) {
312
- return new Date(dateStr).getTime()
22
+ param.propName = orgProp
23
+ param.enumName = column.enumName
24
+ param.operator = this.getOperator(column)
25
+ param.dataType = column.dataType
26
+ param.matchingType = column.queryMatching
27
+ param.formatter = column.formatter ? JSON.parse(JSON.stringify(column.formatter)) : column.formatter
28
+ param.isEmptyValue = column._emptyValue && column._emptyValue === '#blank#' ? true : false
29
+ const values = this.getFormItemValue(column.prop)
30
+ if (column.dataType === 'DATE' || column.dataType === 'TIME') {
31
+ // 日期 或 时间类型
32
+ // console.log('values==', values, column.prop)
33
+ if (values && values.length === 2 && values[0] !== null && values[1] !== null) {
34
+ const format = this.getDateTimeSearchFormatter(column, column.dataType, column.formatter)
35
+ if (format) {
36
+ if (!param.formatter) {
37
+ param.formatter = {}
38
+ param.formatter.options = {}
39
+ } else if (!param.formatter.options) {
40
+ param.formatter.options = {}
41
+ }
42
+ param.formatter.options.format = format
313
43
  }
314
- // 表示是格式化后的值,转成date毫秒值传给后台,解决时区问题
315
- format = format.toLowerCase()
316
- if (
317
- format.indexOf('h') > 0 &&
318
- format.indexOf('m') > 0 &&
319
- format.indexOf('s') > 0
320
- ) {
321
- // 表示有时分秒
322
- dateStr = new Date(dateStr).getTime()
323
- } else {
324
- // 表示精确到日
325
- dateStr = new Date(dateStr + ' 00:00:00').getTime()
326
- }
327
- }
328
- return dateStr
329
- },
330
- // 是否是人员树
331
- isUserTree(componentType) {
332
- if (
333
- componentType.indexOf('DeptManTree') > 0 ||
334
- componentType.indexOf('WgManTree') > 0
335
- ) {
336
- return true
337
- }
338
- return false
339
- },
340
- // 获得用户名
341
- getUserName(isUser, val) {
342
- if (
343
- isUser &&
344
- val !== undefined &&
345
- val !== null &&
346
- val.indexOf('(') > 0 &&
347
- val.indexOf(')') > 0
348
- ) {
349
- // 说明是人员树,如果是值中包括英文名,把英文名截取掉,因为有些字段保存的有英文名,有些没有英文名,为了便于查询,所以统一将英文名去掉。
350
- // 例如:张三(Andy),处理后是:张三
351
- val = val.substring(0, val.indexOf('('))
352
- }
353
- return val
354
- },
355
- getOperator(column) {
356
- if (
357
- (column.dataType === 'TEXT' || column.dataType === 'CLOB') &&
358
- column.fuzzy &&
359
- (!column.componentType ||
360
- (column.componentType &&
361
- ((column.componentType !== 'select' &&
362
- column.componentType !== 'multiselect') ||
363
- (column.componentType === 'multiselect' &&
364
- column.ifMultiData !== undefined &&
365
- column.ifMultiData === true))))
44
+ param.startValue = this.getDateTimeMillsByDateStr(values[0], format)
45
+ param.endValue = this.getDateTimeMillsByDateStr(values[1], format)
46
+ searchParams.push(param)
47
+ }
48
+ } else if (
49
+ (column.dataType === 'INTEGER' || column.dataType === 'LONG' || column.dataType === 'DOUBLE') &&
50
+ Array.isArray(values)
366
51
  ) {
367
- // 是否是文本类型的字段,且启用了模糊查询,则表示操作符为contains模糊查询
368
- return 'CONTAIN'
369
- } else if (Array.isArray(this.getFormItemValue(column.prop))) {
370
- if (
371
- column.dataType === 'INTEGER' ||
372
- column.dataType === 'LONG' ||
373
- column.dataType === 'DOUBLE'
374
- ) {
375
- return 'BETWEEN'
52
+ // 日期 或 时间类型
53
+ // const values1 = this.getFormItemValue(column.prop)
54
+ if (values) {
55
+ if (column.componentType === 'yearRange') {
56
+ if (values[0] || values[1]) {
57
+ param.startValue = values[0]
58
+ param.endValue = values[1]
59
+ if (values[0] && !values[1]) {
60
+ param.startValue = values[0]
61
+ param.endValue = 9999
62
+ } else if (!values[0] && values[1]) {
63
+ param.startValue = 0
64
+ param.endValue = values[1]
65
+ }
66
+ searchParams.push(param)
67
+ }
376
68
  } else {
377
- return 'EQ'
69
+ if (!Array.isArray(values) || values.length < 2 || (values[0] === null && values[1] === null)) {
70
+ // 填写了一个有效值
71
+ if (!Array.isArray(values)) {
72
+ param.propValue = values
73
+ searchParams.push(param)
74
+ } else if (values.length < 2) {
75
+ param.propValue = values[0]
76
+ searchParams.push(param)
77
+ } else if (values[0] === null) {
78
+ param.propValue = values[1]
79
+ searchParams.push(param)
80
+ } else if (values[1] === null) {
81
+ param.propValue = values[0]
82
+ searchParams.push(param)
83
+ }
84
+ } else {
85
+ // 填写了两个有效值
86
+
87
+ param.startValue = values[0]
88
+ param.endValue = values[1]
89
+ searchParams.push(param)
90
+ }
378
91
  }
379
- } else {
380
- // 否则就是等于
381
- return 'EQ'
382
- }
383
- },
384
- getFormItemValue(prop, index) {
385
- if (prop.indexOf('.') > 0) {
386
- const parentOjbect = this.getParentObject(prop)
387
- if (index != null && index !== undefined) {
388
- return parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index]
92
+ }
93
+ } else if (
94
+ column.componentType &&
95
+ column.componentType.indexOf('Tree') !== -1 &&
96
+ column.componentType.indexOf('single') === -1
97
+ ) {
98
+ // 说明是多选组织树
99
+ // 是否是人员树
100
+ const isUser = this.isUserTree(column.componentType)
101
+ const values = this.getFormItemValue(column.prop)
102
+ if (values && values !== '') {
103
+ const newValue = []
104
+ let valueArr = values
105
+ if (Array.isArray(values)) {
106
+ // 表示是数组
107
+ valueArr = values
389
108
  } else {
390
- return parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)]
109
+ // 表示是字符串
110
+ valueArr = values.split(',')
391
111
  }
392
- } else {
393
- if (index != null && index !== undefined) {
394
- return this.searchForm[prop][index]
395
- } else {
396
- return this.searchForm[prop]
112
+ if (Array.isArray(valueArr) && valueArr && valueArr.length > 0) {
113
+ valueArr.forEach((val) => {
114
+ // 截取用户名中的英文名信息
115
+ const userName = this.getUserName(isUser, val)
116
+ if (userName !== undefined && userName !== null) {
117
+ newValue.push(userName)
118
+ }
119
+ })
397
120
  }
398
- }
399
- },
400
- getParentObject(prop) {
401
- const nestedProp = prop.split('.')
402
- // 属性只有一个时父对象就是searchForm
403
- if (nestedProp.length === 1) {
404
- return this.searchForm
121
+ this.packageValueWithArray(newValue, searchParams, param)
122
+ }
123
+ } else if (column.componentType && column.componentType.indexOf('Tree') !== -1) {
124
+ // 说明是单选组织树
125
+ // 是否是人员树
126
+ const isUser = this.isUserTree(column.componentType)
127
+ let propValue = this.getFormItemValue(column.prop)
128
+ // 截取用户名中的英文名信息
129
+ propValue = this.getUserName(isUser, propValue)
130
+ this.packageValueWithArray(propValue, searchParams, param)
405
131
  } else {
406
- let parentObject
407
- // 属性超过2个时先找到最后一层属性的父对象
408
- for (let i = 0; i < nestedProp.length - 1; i++) {
409
- parentObject = this.searchForm[nestedProp[i]]
410
- }
411
- return parentObject
132
+ if (column.componentType === 'multiselect') {
133
+ // 表示是多选下拉框选择器选择的值
134
+ const values = this.getFormItemValue(column.prop)
135
+ // console.log('values==', values, column.prop)
136
+ this.packageValueWithArray(values, searchParams, param)
137
+ } else {
138
+ const propValue = this.getFormItemValue(column.prop)
139
+ this.packageValueWithArray(propValue, searchParams, param)
140
+ }
412
141
  }
413
- },
414
- // 处理多选下拉框时获得的值
415
- // 处理非多选下拉框的值
416
- packageValueWithArray(value, searchParams, param) {
417
- if (value && Array.isArray(value)) {
418
- const selectValues = value
419
- // if (!Array.isArray(values)) {
420
- // selectValues = values.split(',')
421
- // }
422
- let num = 0
423
- selectValues.forEach((val) => {
424
- const selectParam = Object.assign({}, param)
425
- selectParam.joinSign = 'or' // 将条件连接符修改为or,否则无法查询到值
426
- if (num === 0) {
427
- selectParam.leftBracket = '1' // 左边有1个括号
428
- }
429
- if (num === selectValues.length - 1) {
430
- // 说明是最后一个条件
431
- selectParam.rightBracket = '1' // 右边有1个括号
432
- selectParam.joinSign = 'and' // 最后一个条件的连接符需要修改为and
433
- }
434
- selectParam.propValue = val
435
- // 注释该代码,是因为多选下拉框数据库中以逗号分隔存储时,使用EQ无法查询出结果,需要使用getOpertator计算出的结果
436
- // selectParam.operator = 'EQ'
437
- if (val !== undefined && val !== null) {
438
- searchParams.push(selectParam)
439
- }
440
- num++
441
- })
442
- } else if (
443
- typeof value !== 'undefined' &&
444
- value !== '' &&
445
- value !== null &&
446
- !Array.isArray(value)
447
- ) {
448
- // 不是数组
449
- param.propValue = value
450
- searchParams.push(param)
142
+ })
143
+ return searchParams
144
+ } else {
145
+ const newSearchFormList = []
146
+ this.searchFormList.forEach((param) => {
147
+ let newParam = {}
148
+ newParam = param
149
+ // const param = { leftBracket: '', rightBracket: '', joinSign: 'and' }
150
+ // 布尔型字段时prop中去掉了is字符,查询时返回带有is的属性字段,
151
+ // 否则会导致查询布尔型报500错误
152
+ let orgProp = newParam.orgProp
153
+ // sql查询时,会把点“.”改为两个下划线"__"
154
+ const replaceDot = '__'
155
+ if (orgProp && orgProp.indexOf(replaceDot) > 0) {
156
+ // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
157
+ orgProp = orgProp.replace(replaceDot, '.')
451
158
  }
452
- },
453
- // 保存查询条件
454
- saveSearchCondition(condition) {
455
- return this.$http.post(
456
- window.$vueApp.config.globalProperties.baseAPI +
457
- '/component/super-grids/search-conditions',
458
- condition
459
- )
460
- },
461
- // 显示查询条件列表
462
- listSearchCondition(listCode) {
463
- return new Promise((resolve,reject)=>{
464
- if(!listCode){
465
- resolve([])
159
+ newParam.propName = orgProp
160
+ newParam.operator = this.getOperator(param)
161
+ newParam.matchingType = param.queryMatching
162
+ if (newParam.dataType === 'DATE' || newParam.dataType === 'TIME') {
163
+ // 日期 或 时间类型
164
+ const values = newParam.value
165
+ // console.log('values==', values, column.prop)
166
+ if (values !== null && values.length === 2 && values[0] !== null && values[1] !== null) {
167
+ newParam.startValue = values[0]
168
+ newParam.endValue = values[1]
169
+ }
170
+ } else if (newParam.dataType === 'INTEGER' || newParam.dataType === 'LONG') {
171
+ const values1 = newParam.value
172
+ if (values1) {
173
+ if (!Array.isArray(values1) || values1.length < 2 || (values1[0] === null && values1[1] === null)) {
174
+ // 填写了一个有效值
175
+ if (!Array.isArray(values1)) {
176
+ newParam.propValue = values1
177
+ } else if (values1.length < 2) {
178
+ newParam.propValue = values1[0]
179
+ } else if (values1[0] === null) {
180
+ newParam.propValue = values1[1]
181
+ } else if (values1[1] === null) {
182
+ newParam.propValue = values1[0]
183
+ }
466
184
  } else {
467
- this.$http.get(
468
- window.$vueApp.config.globalProperties.baseAPI +
469
- '/component/super-grids/search-condition-list/' +
470
- listCode
471
- ).then(data=>{
472
- resolve(data)
473
- })
185
+ // 填写了两个有效值
186
+ newParam.startValue = values1[0]
187
+ newParam.endValue = values1[1]
474
188
  }
475
- })
476
- },
477
- // 删除查询条件
478
- removeSearchCondition(conditionId) {
479
- return this.$http.delete(
480
- window.$vueApp.config.globalProperties.baseAPI +
481
- '/component/super-grids/search-conditions/' +
482
- conditionId
483
- )
484
- },
485
- // 查询条件
486
- getSearchCondition(conditionId) {
487
- return this.$http.get(
488
- window.$vueApp.config.globalProperties.baseAPI +
489
- '/component/super-grids/search-conditions/' +
490
- conditionId
491
- )
492
- },
493
- // 设置默认查询值
494
- setDefaultQueryValue(column, searchForm) {
495
- if (
496
- column.componentType === 'date' ||
497
- column.componentType === 'dateSection' ||
498
- column.componentType === 'timePicker' ||
499
- column.componentType === 'dateTimePicker'
189
+ }
190
+ } else if (
191
+ newParam.componentType &&
192
+ newParam.componentType.indexOf('Tree') !== -1 &&
193
+ newParam.componentType.indexOf('single') === -1
500
194
  ) {
501
- const formatList = {
502
- date: 'YYYYMMDD',
503
- dateSection: 'YYYYMMDDHHMMSS',
504
- timePicker: 'YYYYMMDD',
505
- dateTimePicker: 'YYYYMMDDHHMMSS',
506
- }
507
- const valueTypeList = {
508
- date: 'String',
509
- dateSection: 'Date',
510
- timePicker: 'String',
511
- dateTimePicker: 'String',
195
+ // 树多选,先手动分割数组,在生成多条
196
+ // 是否是人员树
197
+ const isUser = this.isUserTree(newParam.componentType)
198
+ const values = newParam.value
199
+ if (values && values !== '') {
200
+ const newValue = []
201
+ let valueArr = values
202
+ if (Array.isArray(values)) {
203
+ valueArr = values
204
+ } else {
205
+ valueArr = values.split(',')
512
206
  }
513
- const rowControlConfig = column['controlConfig']
514
- if (
515
- rowControlConfig !== null &&
516
- rowControlConfig !== undefined &&
517
- rowControlConfig !== ''
518
- ) {
519
- const controlConfig = JSON.parse(rowControlConfig)
520
- if (controlConfig.timeDefaultQueryRange) {
521
- const format = formatList[column.componentType]
522
- const valueType = valueTypeList[column.componentType]
523
- if (format && valueType) {
524
- const queryRange = this.getDateQueryRange(
525
- column.componentType,
526
- format,
527
- controlConfig.timeDefaultQueryRange,
528
- valueType
529
- )
530
- searchForm[column.prop] = queryRange
531
- }
207
+ if (Array.isArray(valueArr) && valueArr && valueArr.length > 0) {
208
+ valueArr.forEach((val) => {
209
+ // 截取用户名中的英文名信息
210
+ const userName = this.getUserName(isUser, val)
211
+ if (userName !== undefined && userName !== null) {
212
+ newValue.push(userName)
532
213
  }
214
+ })
533
215
  }
216
+ this.packageValueWithArray(newValue, newSearchFormList, param)
217
+ }
218
+ } else if (newParam.componentType && newParam.componentType.indexOf('Tree') !== -1) {
219
+ // 说明是单选组织树
220
+ // 是否是人员树
221
+ const isUser = this.isUserTree(newParam.componentType)
222
+ let propValue = newParam.value
223
+ // 截取用户名中的英文名信息
224
+ propValue = this.getUserName(isUser, propValue)
225
+ this.packageValueWithArray(propValue, newSearchFormList, param)
226
+ } else {
227
+ if (newParam.componentType === 'multiselect') {
228
+ // 表示是多选下拉框选择器选择的值
229
+ const values = newParam.value
230
+ // console.log('values==', values, column.prop)
231
+ this.packageValueWithArray(values, newSearchFormList, param)
232
+ } else {
233
+ const values = newParam.value
234
+ this.packageValueWithArray(values, newSearchFormList, param)
235
+ }
534
236
  }
535
- },
536
- // 获取近一周,近两周,近一个月的时间范围
537
- // componentType组件类型 date time
538
- // format 格式 年月日/年月日时分秒
539
- // queryRangeType 查询范围类型 近一周nearlyWeek/近两周nearlyTwoWeeks/近一个月nearlyMonth
540
- // valueType 返回对象类型 String Date
541
- getDateQueryRange(componentType, format, timeDefaultQueryRange, valueType) {
542
- const queryRange = []
543
- const nowDate = new Date() // 当前时间
544
- let startDate // 开始时间
545
- const endDate = new Date() // 结束时间
546
- if (timeDefaultQueryRange !== null && timeDefaultQueryRange > 0) {
547
- startDate = new Date(
548
- nowDate.setDate(nowDate.getDate() - parseInt(timeDefaultQueryRange))
549
- )
237
+ })
238
+ return newSearchFormList
239
+ }
240
+ },
241
+ // 获得日期、时间查询格式配置,影响后台查询结果
242
+ getDateTimeSearchFormatter(column, dataType, formatter) {
243
+ const dateTimeFormat = 'yyyy-MM-dd HH:mm:ss'
244
+ const dateFormat = 'yyyy-m-d'
245
+ let format
246
+ if (column.componentType === 'dateSection') {
247
+ // 日期区间
248
+ format = dateFormat
249
+ } else if (column.componentType === 'dateTimePicker') {
250
+ // 日期时间选择器
251
+ format = dateTimeFormat
252
+ } else if (column.dataType === 'DATE' || column.componentType === 'date') {
253
+ // 日期选择器
254
+ format = dateFormat
255
+ }
256
+ if (!format) {
257
+ if (formatter) {
258
+ const formatOptions = formatter.options
259
+ if (formatOptions && formatOptions != null) {
260
+ format = formatOptions.format
550
261
  }
551
- if (format === 'YYYYMMDD') {
552
- queryRange[0] =
553
- startDate.getFullYear() +
554
- '-' +
555
- (startDate.getMonth() + 1) +
556
- '-' +
557
- startDate.getDate()
558
- queryRange[1] =
559
- endDate.getFullYear() +
560
- '-' +
561
- (endDate.getMonth() + 1) +
562
- '-' +
563
- endDate.getDate()
564
- } else {
565
- queryRange[0] =
566
- startDate.getFullYear() +
567
- '-' +
568
- (startDate.getMonth() + 1) +
569
- '-' +
570
- startDate.getDate() +
571
- ' 00:00:00'
572
- queryRange[1] =
573
- endDate.getFullYear() +
574
- '-' +
575
- (endDate.getMonth() + 1) +
576
- '-' +
577
- endDate.getDate() +
578
- ' 23:59:59'
262
+ }
263
+ }
264
+
265
+ if (!format) {
266
+ if (dataType === 'DATE') {
267
+ format = 'yyyy-m-d'
268
+ } else if (dataType === 'TIME') {
269
+ format = 'yyyy-m-d hh:mm:ss'
270
+ }
271
+ }
272
+ return format
273
+ },
274
+ // 根据日期字符串获得日期毫秒值
275
+ getDateTimeMillsByDateStr(dateStr, format) {
276
+ if (typeof dateStr === 'string' && format) {
277
+ if (dateStr.indexOf('T') !== -1) {
278
+ return new Date(dateStr).getTime()
279
+ }
280
+ // 表示是格式化后的值,转成date毫秒值传给后台,解决时区问题
281
+ format = format.toLowerCase()
282
+ if (format.indexOf('h') > 0 && format.indexOf('m') > 0 && format.indexOf('s') > 0) {
283
+ // 表示有时分秒
284
+ dateStr = new Date(dateStr).getTime()
285
+ } else {
286
+ // 表示精确到日
287
+ dateStr = new Date(dateStr + ' 00:00:00').getTime()
288
+ }
289
+ }
290
+ return dateStr
291
+ },
292
+ // 是否是人员树
293
+ isUserTree(componentType) {
294
+ if (componentType.indexOf('DeptManTree') > 0 || componentType.indexOf('WgManTree') > 0) {
295
+ return true
296
+ }
297
+ return false
298
+ },
299
+ // 获得用户名
300
+ getUserName(isUser, val) {
301
+ if (isUser && val !== undefined && val !== null && val.indexOf('(') > 0 && val.indexOf(')') > 0) {
302
+ // 说明是人员树,如果是值中包括英文名,把英文名截取掉,因为有些字段保存的有英文名,有些没有英文名,为了便于查询,所以统一将英文名去掉。
303
+ // 例如:张三(Andy),处理后是:张三
304
+ val = val.substring(0, val.indexOf('('))
305
+ }
306
+ return val
307
+ },
308
+ getOperator(column) {
309
+ if (
310
+ (column.dataType === 'TEXT' || column.dataType === 'CLOB') &&
311
+ column.fuzzy &&
312
+ (!column.componentType ||
313
+ (column.componentType &&
314
+ ((column.componentType !== 'select' && column.componentType !== 'multiselect') ||
315
+ (column.componentType === 'multiselect' &&
316
+ column.ifMultiData !== undefined &&
317
+ column.ifMultiData === true))))
318
+ ) {
319
+ // 是否是文本类型的字段,且启用了模糊查询,则表示操作符为contains模糊查询
320
+ return 'CONTAIN'
321
+ } else if (Array.isArray(this.getFormItemValue(column.prop))) {
322
+ if (column.dataType === 'INTEGER' || column.dataType === 'LONG' || column.dataType === 'DOUBLE') {
323
+ return 'BETWEEN'
324
+ } else {
325
+ return 'EQ'
326
+ }
327
+ } else {
328
+ // 否则就是等于
329
+ return 'EQ'
330
+ }
331
+ },
332
+ getFormItemValue(prop, index) {
333
+ if (prop.indexOf('.') > 0) {
334
+ const parentOjbect = this.getParentObject(prop)
335
+ if (index != null && index !== undefined) {
336
+ return parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index]
337
+ } else {
338
+ return parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)]
339
+ }
340
+ } else {
341
+ if (index != null && index !== undefined) {
342
+ return this.searchForm[prop][index]
343
+ } else {
344
+ return this.searchForm[prop]
345
+ }
346
+ }
347
+ },
348
+ getParentObject(prop) {
349
+ const nestedProp = prop.split('.')
350
+ // 属性只有一个时父对象就是searchForm
351
+ if (nestedProp.length === 1) {
352
+ return this.searchForm
353
+ } else {
354
+ let parentObject
355
+ // 属性超过2个时先找到最后一层属性的父对象
356
+ for (let i = 0; i < nestedProp.length - 1; i++) {
357
+ parentObject = this.searchForm[nestedProp[i]]
358
+ }
359
+ return parentObject
360
+ }
361
+ },
362
+ // 处理多选下拉框时获得的值
363
+ // 处理非多选下拉框的值
364
+ packageValueWithArray(value, searchParams, param) {
365
+ if (value && Array.isArray(value)) {
366
+ const selectValues = value
367
+ // if (!Array.isArray(values)) {
368
+ // selectValues = values.split(',')
369
+ // }
370
+ let num = 0
371
+ selectValues.forEach((val) => {
372
+ const selectParam = Object.assign({}, param)
373
+ selectParam.joinSign = 'or' // 将条件连接符修改为or,否则无法查询到值
374
+ if (num === 0) {
375
+ selectParam.leftBracket = '1' // 左边有1个括号
376
+ }
377
+ if (num === selectValues.length - 1) {
378
+ // 说明是最后一个条件
379
+ selectParam.rightBracket = '1' // 右边有1个括号
380
+ selectParam.joinSign = 'and' // 最后一个条件的连接符需要修改为and
579
381
  }
580
- if (valueType === 'Date') {
581
- const queryRangeFormat = []
582
- queryRange.forEach((date) => {
583
- var tempStrs = date.split(' ')
584
- var dateStrs = tempStrs[0].split('-')
585
- var year = parseInt(dateStrs[0], 10)
586
- var month = parseInt(dateStrs[1], 10) - 1
587
- var day = parseInt(dateStrs[2], 10)
588
- var timeStrs = tempStrs[1].split(':')
589
- var hour = parseInt(timeStrs[0], 10)
590
- var minute = parseInt(timeStrs[1], 10)
591
- var second = parseInt(timeStrs[2], 10)
592
- queryRangeFormat.push(new Date(year, month, day, hour, minute, second))
593
- })
594
- return queryRangeFormat
382
+ selectParam.propValue = val
383
+ // 注释该代码,是因为多选下拉框数据库中以逗号分隔存储时,使用EQ无法查询出结果,需要使用getOpertator计算出的结果
384
+ // selectParam.operator = 'EQ'
385
+ if (val !== undefined && val !== null) {
386
+ searchParams.push(selectParam)
387
+ }
388
+ num++
389
+ })
390
+ } else if (
391
+ param.isEmptyValue ||
392
+ (typeof value !== 'undefined' && value !== '' && value !== null && !Array.isArray(value))
393
+ ) {
394
+ // 不是数组
395
+ param.propValue = value
396
+ searchParams.push(param)
397
+ }
398
+ },
399
+ // 保存查询条件
400
+ saveSearchCondition(condition) {
401
+ return this.$http.post(
402
+ window.$vueApp.config.globalProperties.baseAPI + '/component/super-grids/search-conditions',
403
+ condition
404
+ )
405
+ },
406
+ // 显示查询条件列表
407
+ listSearchCondition(listCode) {
408
+ return new Promise((resolve, reject) => {
409
+ if (!listCode) {
410
+ resolve([])
411
+ } else {
412
+ this.$http
413
+ .get(
414
+ window.$vueApp.config.globalProperties.baseAPI + '/component/super-grids/search-condition-list/' + listCode
415
+ )
416
+ .then((data) => {
417
+ resolve(data)
418
+ })
419
+ }
420
+ })
421
+ },
422
+ // 删除查询条件
423
+ removeSearchCondition(conditionId) {
424
+ return this.$http.delete(
425
+ window.$vueApp.config.globalProperties.baseAPI + '/component/super-grids/search-conditions/' + conditionId
426
+ )
427
+ },
428
+ // 查询条件
429
+ getSearchCondition(conditionId) {
430
+ return this.$http.get(
431
+ window.$vueApp.config.globalProperties.baseAPI + '/component/super-grids/search-conditions/' + conditionId
432
+ )
433
+ },
434
+ // 设置默认查询值
435
+ setDefaultQueryValue(column, searchForm) {
436
+ if (
437
+ column.componentType === 'date' ||
438
+ column.componentType === 'dateSection' ||
439
+ column.componentType === 'timePicker' ||
440
+ column.componentType === 'dateTimePicker'
441
+ ) {
442
+ const formatList = {
443
+ date: 'YYYYMMDD',
444
+ dateSection: 'YYYYMMDDHHMMSS',
445
+ timePicker: 'YYYYMMDD',
446
+ dateTimePicker: 'YYYYMMDDHHMMSS'
447
+ }
448
+ const valueTypeList = {
449
+ date: 'String',
450
+ dateSection: 'Date',
451
+ timePicker: 'String',
452
+ dateTimePicker: 'String'
453
+ }
454
+ const rowControlConfig = column['controlConfig']
455
+ if (rowControlConfig !== null && rowControlConfig !== undefined && rowControlConfig !== '') {
456
+ const controlConfig = JSON.parse(rowControlConfig)
457
+ if (controlConfig.timeDefaultQueryRange) {
458
+ const format = formatList[column.componentType]
459
+ const valueType = valueTypeList[column.componentType]
460
+ if (format && valueType) {
461
+ const queryRange = this.getDateQueryRange(
462
+ column.componentType,
463
+ format,
464
+ controlConfig.timeDefaultQueryRange,
465
+ valueType
466
+ )
467
+ searchForm[column.prop] = queryRange
468
+ }
595
469
  }
596
- return queryRange
597
- },
470
+ }
471
+ }
472
+ },
473
+ // 获取近一周,近两周,近一个月的时间范围
474
+ // componentType组件类型 date time
475
+ // format 格式 年月日/年月日时分秒
476
+ // queryRangeType 查询范围类型 近一周nearlyWeek/近两周nearlyTwoWeeks/近一个月nearlyMonth
477
+ // valueType 返回对象类型 String Date
478
+ getDateQueryRange(componentType, format, timeDefaultQueryRange, valueType) {
479
+ const queryRange = []
480
+ const nowDate = new Date() // 当前时间
481
+ let startDate // 开始时间
482
+ const endDate = new Date() // 结束时间
483
+ if (timeDefaultQueryRange !== null && timeDefaultQueryRange > 0) {
484
+ startDate = new Date(nowDate.setDate(nowDate.getDate() - parseInt(timeDefaultQueryRange)))
485
+ }
486
+ if (format === 'YYYYMMDD') {
487
+ queryRange[0] = startDate.getFullYear() + '-' + (startDate.getMonth() + 1) + '-' + startDate.getDate()
488
+ queryRange[1] = endDate.getFullYear() + '-' + (endDate.getMonth() + 1) + '-' + endDate.getDate()
489
+ } else {
490
+ queryRange[0] =
491
+ startDate.getFullYear() + '-' + (startDate.getMonth() + 1) + '-' + startDate.getDate() + ' 00:00:00'
492
+ queryRange[1] = endDate.getFullYear() + '-' + (endDate.getMonth() + 1) + '-' + endDate.getDate() + ' 23:59:59'
493
+ }
494
+ if (valueType === 'Date') {
495
+ const queryRangeFormat = []
496
+ queryRange.forEach((date) => {
497
+ var tempStrs = date.split(' ')
498
+ var dateStrs = tempStrs[0].split('-')
499
+ var year = parseInt(dateStrs[0], 10)
500
+ var month = parseInt(dateStrs[1], 10) - 1
501
+ var day = parseInt(dateStrs[2], 10)
502
+ var timeStrs = tempStrs[1].split(':')
503
+ var hour = parseInt(timeStrs[0], 10)
504
+ var minute = parseInt(timeStrs[1], 10)
505
+ var second = parseInt(timeStrs[2], 10)
506
+ queryRangeFormat.push(new Date(year, month, day, hour, minute, second))
507
+ })
508
+ return queryRangeFormat
509
+ }
510
+ return queryRange
511
+ }
598
512
  }
599
513
  export default searchMethods