super-pages 0.0.4-up → 0.0.6-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 (50) hide show
  1. package/README.md +7 -7
  2. package/index.html +13 -13
  3. package/lib/super-pages.css +1 -1
  4. package/lib/super-pages.js +1375 -1285
  5. package/lib/super-pages.umd.cjs +13 -13
  6. package/package.json +6 -3
  7. package/packages/index.js +30 -30
  8. package/packages/super-page/index.js +9 -9
  9. package/packages/super-page/src/button-group.vue +294 -294
  10. package/packages/super-page/src/chart-page.vue +215 -215
  11. package/packages/super-page/src/chart-query-page.vue +163 -163
  12. package/packages/super-page/src/export-form-report-dialog.vue +145 -145
  13. package/packages/super-page/src/form-head.vue +74 -74
  14. package/packages/super-page/src/form-page.vue +107 -107
  15. package/packages/super-page/src/group-tag.vue +21 -21
  16. package/packages/super-page/src/list-page.vue +1453 -1454
  17. package/packages/super-page/src/list-toolbar-dynamic-source.vue +89 -89
  18. package/packages/super-page/src/list-toolbar-page.vue +377 -377
  19. package/packages/super-page/src/my-button-base.vue +438 -438
  20. package/packages/super-page/src/my-button.vue +196 -196
  21. package/packages/super-page/src/page-custom-component.vue +56 -56
  22. package/packages/super-page/src/remove-signer-dialog.vue +103 -103
  23. package/packages/super-page/src/sub-tab-page.vue +79 -79
  24. package/packages/super-page/src/super-page-component.vue +86 -86
  25. package/packages/super-page/src/super-page.vue +162 -162
  26. package/packages/super-page/src/tab-page.vue +154 -154
  27. package/packages/super-page/src/task-informition-dialog.vue +82 -82
  28. package/packages/super-page/src/util/ListButtonEvent.js +896 -896
  29. package/packages/super-page/src/util/api.js +37 -37
  30. package/packages/super-page/src/util/callEvents.js +62 -62
  31. package/packages/super-page/src/util/chartButtonEvent.js +60 -60
  32. package/packages/super-page/src/util/common-util.js +102 -102
  33. package/packages/super-page/src/util/commonButtonEvent.js +70 -70
  34. package/packages/super-page/src/util/eventBus.js +8 -2
  35. package/packages/super-page/src/util/formButtonEvent.js +509 -509
  36. package/packages/super-page/src/util/store.js +3 -3
  37. package/packages/super-page/src/util/super-page.js +29 -29
  38. package/packages/super-page/src/util/workflowButtonEvent.js +1729 -1729
  39. package/packages/super-page/src/widget-col-page.vue +339 -339
  40. package/packages/super-page/src/widget-page.vue +703 -703
  41. package/packages/super-page/src/widget-sub-tab-pane-page.vue +115 -115
  42. package/packages/super-page/src/widget-tab-pane-page.vue +135 -135
  43. package/packages/super-page/src/workflow-button-group.vue +561 -561
  44. package/packages/super-page-dialog/index.js +9 -9
  45. package/packages/super-page-dialog/src/super-page-dialog.vue +200 -200
  46. package/packages/utils/gogocodeTransfer.js +59 -59
  47. package/src/i18n/langs/cn.js +65 -65
  48. package/src/i18n/langs/en.js +68 -68
  49. package/src/utils/common-util.js +9 -9
  50. package/vite.config.js +36 -36
@@ -1,377 +1,377 @@
1
- <template>
2
- <span>
3
- <span
4
- v-for="(toolbar, index) in listToolbarList"
5
- :key="index"
6
- style="display: inline-block; margin-bottom: 10px"
7
- >
8
- {{ toolbar.label }}
9
- <template
10
- v-if="
11
- (toolbar.controlType === 'select' ||
12
- toolbar.controlType === 'multipleSelect') &&
13
- toolbar.dynamicDataSourceCode
14
- "
15
- >
16
- <list-toolbar-dynamic-source
17
- :toolbar="toolbar"
18
- :additional-param-map="additionalParamMap"
19
- :model-obj="modelObj"
20
- @dynamic-source-onload="dynamicSourceOnload"
21
- @search-grid-data="searchGridData"
22
- />
23
- </template>
24
- <template v-else>
25
- <el-select
26
- v-if="toolbar.controlType === 'select'"
27
- v-model="modelObj[toolbar.propDbName]"
28
- :placeholder="toolbar.nullLabel"
29
- :size="toolbar.size ? toolbar.size : small"
30
- clearable
31
- @change="searchGridData"
32
- >
33
- <el-option
34
- v-for="item in toolbar.dynamicDataSourceCode
35
- ? optionsList[toolbar.dynamicDataSourceCode]
36
- : toolbar.optionGroupCode
37
- ? optionsList[toolbar.optionGroupCode]
38
- : null"
39
- :key="item.value"
40
- :label="item.label"
41
- :value="item.value"
42
- />
43
- </el-select>
44
- <el-select
45
- v-if="toolbar.controlType === 'multipleSelect'"
46
- v-model="modelObj[toolbar.propDbName]"
47
- :placeholder="toolbar.nullLabel"
48
- :size="toolbar.size ? toolbar.size : small"
49
- collapse-tags
50
- multiple
51
- clearable
52
- @change="searchGridData"
53
- >
54
- <el-option
55
- v-for="item in toolbar.dynamicDataSourceCode
56
- ? optionsList[toolbar.dynamicDataSourceCode]
57
- : toolbar.optionGroupCode
58
- ? optionsList[toolbar.optionGroupCode]
59
- : null"
60
- :key="item.value"
61
- :label="item.label"
62
- :value="item.value"
63
- />
64
- </el-select>
65
- <el-radio-group
66
- v-if="toolbar.controlType === 'radio'"
67
- v-model="modelObj[toolbar.propDbName]"
68
- :size="toolbar.size ? toolbar.size : small"
69
- @change="searchGridData"
70
- >
71
- <el-radio
72
- v-for="item in toolbar.dynamicDataSourceCode
73
- ? optionsList[toolbar.dynamicDataSourceCode]
74
- : toolbar.optionGroupCode
75
- ? optionsList[toolbar.optionGroupCode]
76
- : null"
77
- :key="item.value"
78
- :label="item.value"
79
- >
80
- {{ item.name == null ? item.label : item.name }}</el-radio
81
- >
82
- </el-radio-group>
83
- <el-checkbox-group
84
- v-if="toolbar.controlType === 'checkbox'"
85
- v-model="modelObj[toolbar.propDbName]"
86
- :size="toolbar.size ? toolbar.size : small"
87
- @change="searchGridData"
88
- >
89
- <el-checkbox
90
- v-for="item in toolbar.dynamicDataSourceCode
91
- ? optionsList[toolbar.dynamicDataSourceCode]
92
- : toolbar.optionGroupCode
93
- ? optionsList[toolbar.optionGroupCode]
94
- : null"
95
- :key="item.value"
96
- :label="item.value"
97
- >
98
- {{ item.name == null ? item.label : item.name }}
99
- </el-checkbox>
100
- </el-checkbox-group>
101
- <el-date-picker
102
- v-if="toolbar.controlType === 'year'"
103
- v-model="modelObj[toolbar.propDbName]"
104
- :size="toolbar.size ? toolbar.size : small"
105
- :placeholder="toolbar.nullLabel"
106
- type="year"
107
- value-format="yyyy"
108
- @change="searchGridData(toolbar.controlType)"
109
- />
110
- <el-date-picker
111
- v-if="toolbar.controlType === 'month'"
112
- v-model="modelObj[toolbar.propDbName]"
113
- :size="toolbar.size ? toolbar.size : small"
114
- :placeholder="toolbar.nullLabel"
115
- type="month"
116
- value-format="yyyy-MM"
117
- @change="searchGridData(toolbar.controlType)"
118
- />
119
- </template>
120
- </span>
121
- </span>
122
- </template>
123
-
124
- <script>
125
- import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
126
-
127
- import Util from './util/util'
128
- import { getStoreInfo } from './util/common-util'
129
- import ListToolbarDynamicSource from './list-toolbar-dynamic-source'
130
- export default {
131
- name: 'ListToolbarPage',
132
- components: {
133
- ListToolbarDynamicSource,
134
- },
135
- props: {
136
- // 工具栏
137
- listToolbarList: {
138
- type: Array,
139
- default: null,
140
- },
141
- // 页面编码
142
- pageCode: {
143
- type: String,
144
- default: null,
145
- },
146
- },
147
- data() {
148
- return {
149
- modelObj: {},
150
- modelObjType: {},
151
- optionsList: {},
152
- additionalParamMap: null,
153
- dataTypeObj: {},
154
- allData: {},
155
- dynamicDataSources: {},
156
- modelDynamicMapping: {},
157
- }
158
- },
159
- created() {
160
- const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
161
- if (additionalParamMap) {
162
- this.additionalParamMap = additionalParamMap
163
- }
164
- this.analysisListToolbarList()
165
- },
166
- mounted() {},
167
- beforeUnmount() {},
168
- methods: {
169
- ...Util,
170
- optionListResult(toolbar) {
171
- return toolbar.dynamicDataSourceCode
172
- ? this.optionsList[toolbar.dynamicDataSourceCode]
173
- : toolbar.optionGroupCode
174
- ? this.optionsList[toolbar.optionGroupCode]
175
- : null
176
- },
177
- // 解析listToolbarList
178
- analysisListToolbarList() {
179
- if (this.listToolbarList && this.listToolbarList.length > 0) {
180
- // 将每一条合并起来封装为一个对象 {prop}
181
- this.toolbarListToObj()
182
- // 将数据来源解析后封装
183
- this.toolbarListOptions()
184
- // 解析默认值
185
- this.analysisDefaultValue()
186
- }
187
- },
188
- // 将每一条合并起来封装为一个对象 {prop}
189
- toolbarListToObj() {
190
- for (var i = 0; i < this.listToolbarList.length; i++) {
191
- const item = this.listToolbarList[i]
192
- if (item && item.propDbName) {
193
- if (!this.modelObj[item.propDbName]) {
194
- this.modelObj[item.propDbName] = null
195
- if (
196
- item.controlType &&
197
- (item.controlType === 'year' || item.controlType === 'month')
198
- ) {
199
- this.modelObjType[item.propDbName + '~~' + item.controlType] =
200
- item.controlType
201
- } else {
202
- this.modelObjType[item.propDbName] = item.controlType
203
- }
204
- this.dataTypeObj[item.propDbName] = item.dataType
205
- }
206
- }
207
- }
208
- },
209
- // 将数据来源解析后封装
210
- toolbarListOptions() {
211
- for (var i = 0; i < this.listToolbarList.length; i++) {
212
- const item = this.listToolbarList[i]
213
- if (item && item.propDbName) {
214
- if (item.dynamicDataSourceCode) {
215
- this.dynamicDataSources[item.dynamicDataSourceCode] = {
216
- mounted: false,
217
- }
218
- this.modelDynamicMapping[item.propDbName] =
219
- item.dynamicDataSourceCode
220
- }
221
- if (item.optionGroupCode) {
222
- this.dynamicDataSources[item.optionGroupCode] = { mounted: false }
223
- this.getOptionGroupOptions(item.optionGroupCode).then((data) => {
224
- const defaultSelected = data.find(
225
- (element) => element.selected === true
226
- )
227
- this.dynamicDataSources[item.optionGroupCode].mounted = true
228
- if (defaultSelected) {
229
- this.modelObj[item.propDbName] = defaultSelected.value
230
- this.dynamicDataSources[
231
- item.optionGroupCode
232
- ].dynamicDataSourceDto = { defaultSelect: true }
233
- this.dynamicSourceAllCompleted()
234
- }
235
- this.optionsList[item.optionGroupCode] = data
236
- })
237
- }
238
- }
239
- }
240
- },
241
- // 解析默认值
242
- analysisDefaultValue() {
243
- const defaultValueList = []
244
- for (var i = 0; i < this.listToolbarList.length; i++) {
245
- const item = this.listToolbarList[i]
246
- if (item && item.propDbName) {
247
- if (item.propValue) {
248
- defaultValueList.push(item.propValue)
249
- } else {
250
- defaultValueList.push(null)
251
- }
252
- } else {
253
- defaultValueList.push(null)
254
- }
255
- }
256
- // 发送请求
257
- const map = {
258
- additionalParamMap: this.additionalParamMap,
259
- values: defaultValueList,
260
- }
261
- this.analysisStandardValues(map).then((data) => {
262
- if (data && data.returnValues) {
263
- if (data.returnValues.length === 1 && data.returnValues[0] === null) {
264
- return
265
- }
266
- for (var k = 0; k < this.listToolbarList.length; k++) {
267
- const item = this.listToolbarList[k]
268
- if (item && item.propDbName) {
269
- const value = data.returnValues[k]
270
- if (
271
- item.controlType === 'multipleSelect' ||
272
- item.controlType === 'checkbox'
273
- ) {
274
- this.modelObj[item.propDbName] = []
275
- if (value !== undefined && value !== null) {
276
- if (typeof value === 'string') {
277
- this.modelObj[item.propDbName] = value.split(',')
278
- } else {
279
- this.modelObj[item.propDbName] = value
280
- }
281
- }
282
- } else {
283
- if (value !== undefined && value !== null) {
284
- if (item.controlType === 'year') {
285
- const valArr = value.split('-')
286
- let year = null
287
- if (valArr.length >= 1) {
288
- year = valArr[0]
289
- }
290
- this.modelObj[item.propDbName] = year
291
- } else if (item.controlType === 'month') {
292
- const valArr = value.split('-')
293
- let month = null
294
- if (valArr.length >= 2) {
295
- month = valArr[0] + '-' + valArr[1]
296
- }
297
- this.modelObj[item.propDbName] = month
298
- } else {
299
- this.modelObj[item.propDbName] = value
300
- }
301
- }
302
- }
303
- }
304
- }
305
- this.dynamicSourceAllCompleted()
306
- }
307
- })
308
- },
309
- // 刷新列表数据
310
- searchGridData(contorlType) {
311
- console.log(this.modelObj)
312
- this.handleDymSelectEmptyValue()
313
- $emit(
314
- this,
315
- 'searchGridData',
316
- this.modelObj,
317
- this.modelObjType,
318
- this.dataTypeObj,
319
- contorlType
320
- )
321
- },
322
- dynamicSourceOnload(dynamicDataSourceDto) {
323
- this.dynamicDataSources[dynamicDataSourceDto.code].mounted = true
324
- this.dynamicDataSources[dynamicDataSourceDto.code].dynamicDataSourceDto =
325
- dynamicDataSourceDto
326
- this.dynamicSourceAllCompleted()
327
- },
328
- dynamicSourceAllCompleted() {
329
- const values = Object.values(this.dynamicDataSources)
330
- if (values.length === 0) {
331
- this.searchGridData()
332
- } else {
333
- const result = Object.values(this.dynamicDataSources).filter(
334
- (dym) => dym.mounted === false
335
- )
336
- if (result.length === 0) {
337
- const keys = Object.keys(this.dynamicDataSources)
338
- for (let i = 0; i < keys.length; i++) {
339
- if (
340
- this.dynamicDataSources[keys[i]].dynamicDataSourceDto
341
- .defaultSelect
342
- ) {
343
- this.searchGridData()
344
- break
345
- }
346
- }
347
- }
348
- }
349
- },
350
- handleDymSelectEmptyValue() {
351
- // 处理当动态数据源工具栏选项选择的是空值时,传递给后台所有的下拉值
352
- if (this.modelDynamicMapping) {
353
- const keys = Object.keys(this.modelDynamicMapping)
354
- keys.forEach((key) => {
355
- if (
356
- !this.modelObj[key] &&
357
- this.dynamicDataSources[this.modelDynamicMapping[key]]
358
- .dynamicDataSourceDto.defaultSelect
359
- ) {
360
- const ddsd =
361
- this.dynamicDataSources[this.modelDynamicMapping[key]]
362
- .dynamicDataSourceDto
363
- const valArr = []
364
- ddsd.options.forEach((option) => {
365
- if (option[ddsd.valueAttribute]) {
366
- valArr.push(option[ddsd.valueAttribute])
367
- }
368
- })
369
- this.modelObj[key] = valArr
370
- }
371
- })
372
- }
373
- },
374
- },
375
- emits: ['searchGridData'],
376
- }
377
- </script>
1
+ <template>
2
+ <span>
3
+ <span
4
+ v-for="(toolbar, index) in listToolbarList"
5
+ :key="index"
6
+ style="display: inline-block; margin-bottom: 10px"
7
+ >
8
+ {{ toolbar.label }}
9
+ <template
10
+ v-if="
11
+ (toolbar.controlType === 'select' ||
12
+ toolbar.controlType === 'multipleSelect') &&
13
+ toolbar.dynamicDataSourceCode
14
+ "
15
+ >
16
+ <list-toolbar-dynamic-source
17
+ :toolbar="toolbar"
18
+ :additional-param-map="additionalParamMap"
19
+ :model-obj="modelObj"
20
+ @dynamic-source-onload="dynamicSourceOnload"
21
+ @search-grid-data="searchGridData"
22
+ />
23
+ </template>
24
+ <template v-else>
25
+ <el-select
26
+ v-if="toolbar.controlType === 'select'"
27
+ v-model="modelObj[toolbar.propDbName]"
28
+ :placeholder="toolbar.nullLabel"
29
+ :size="toolbar.size ? toolbar.size : small"
30
+ clearable
31
+ @change="searchGridData"
32
+ >
33
+ <el-option
34
+ v-for="item in toolbar.dynamicDataSourceCode
35
+ ? optionsList[toolbar.dynamicDataSourceCode]
36
+ : toolbar.optionGroupCode
37
+ ? optionsList[toolbar.optionGroupCode]
38
+ : null"
39
+ :key="item.value"
40
+ :label="item.label"
41
+ :value="item.value"
42
+ />
43
+ </el-select>
44
+ <el-select
45
+ v-if="toolbar.controlType === 'multipleSelect'"
46
+ v-model="modelObj[toolbar.propDbName]"
47
+ :placeholder="toolbar.nullLabel"
48
+ :size="toolbar.size ? toolbar.size : small"
49
+ collapse-tags
50
+ multiple
51
+ clearable
52
+ @change="searchGridData"
53
+ >
54
+ <el-option
55
+ v-for="item in toolbar.dynamicDataSourceCode
56
+ ? optionsList[toolbar.dynamicDataSourceCode]
57
+ : toolbar.optionGroupCode
58
+ ? optionsList[toolbar.optionGroupCode]
59
+ : null"
60
+ :key="item.value"
61
+ :label="item.label"
62
+ :value="item.value"
63
+ />
64
+ </el-select>
65
+ <el-radio-group
66
+ v-if="toolbar.controlType === 'radio'"
67
+ v-model="modelObj[toolbar.propDbName]"
68
+ :size="toolbar.size ? toolbar.size : small"
69
+ @change="searchGridData"
70
+ >
71
+ <el-radio
72
+ v-for="item in toolbar.dynamicDataSourceCode
73
+ ? optionsList[toolbar.dynamicDataSourceCode]
74
+ : toolbar.optionGroupCode
75
+ ? optionsList[toolbar.optionGroupCode]
76
+ : null"
77
+ :key="item.value"
78
+ :label="item.value"
79
+ >
80
+ {{ item.name == null ? item.label : item.name }}</el-radio
81
+ >
82
+ </el-radio-group>
83
+ <el-checkbox-group
84
+ v-if="toolbar.controlType === 'checkbox'"
85
+ v-model="modelObj[toolbar.propDbName]"
86
+ :size="toolbar.size ? toolbar.size : small"
87
+ @change="searchGridData"
88
+ >
89
+ <el-checkbox
90
+ v-for="item in toolbar.dynamicDataSourceCode
91
+ ? optionsList[toolbar.dynamicDataSourceCode]
92
+ : toolbar.optionGroupCode
93
+ ? optionsList[toolbar.optionGroupCode]
94
+ : null"
95
+ :key="item.value"
96
+ :label="item.value"
97
+ >
98
+ {{ item.name == null ? item.label : item.name }}
99
+ </el-checkbox>
100
+ </el-checkbox-group>
101
+ <el-date-picker
102
+ v-if="toolbar.controlType === 'year'"
103
+ v-model="modelObj[toolbar.propDbName]"
104
+ :size="toolbar.size ? toolbar.size : small"
105
+ :placeholder="toolbar.nullLabel"
106
+ type="year"
107
+ value-format="yyyy"
108
+ @change="searchGridData(toolbar.controlType)"
109
+ />
110
+ <el-date-picker
111
+ v-if="toolbar.controlType === 'month'"
112
+ v-model="modelObj[toolbar.propDbName]"
113
+ :size="toolbar.size ? toolbar.size : small"
114
+ :placeholder="toolbar.nullLabel"
115
+ type="month"
116
+ value-format="yyyy-MM"
117
+ @change="searchGridData(toolbar.controlType)"
118
+ />
119
+ </template>
120
+ </span>
121
+ </span>
122
+ </template>
123
+
124
+ <script>
125
+ import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
126
+
127
+ import Util from './util/util'
128
+ import { getStoreInfo } from './util/common-util'
129
+ import ListToolbarDynamicSource from './list-toolbar-dynamic-source'
130
+ export default {
131
+ name: 'ListToolbarPage',
132
+ components: {
133
+ ListToolbarDynamicSource,
134
+ },
135
+ props: {
136
+ // 工具栏
137
+ listToolbarList: {
138
+ type: Array,
139
+ default: null,
140
+ },
141
+ // 页面编码
142
+ pageCode: {
143
+ type: String,
144
+ default: null,
145
+ },
146
+ },
147
+ data() {
148
+ return {
149
+ modelObj: {},
150
+ modelObjType: {},
151
+ optionsList: {},
152
+ additionalParamMap: null,
153
+ dataTypeObj: {},
154
+ allData: {},
155
+ dynamicDataSources: {},
156
+ modelDynamicMapping: {},
157
+ }
158
+ },
159
+ created() {
160
+ const additionalParamMap = getStoreInfo(this.pageCode, 'additionalParamMap')
161
+ if (additionalParamMap) {
162
+ this.additionalParamMap = additionalParamMap
163
+ }
164
+ this.analysisListToolbarList()
165
+ },
166
+ mounted() {},
167
+ beforeUnmount() {},
168
+ methods: {
169
+ ...Util,
170
+ optionListResult(toolbar) {
171
+ return toolbar.dynamicDataSourceCode
172
+ ? this.optionsList[toolbar.dynamicDataSourceCode]
173
+ : toolbar.optionGroupCode
174
+ ? this.optionsList[toolbar.optionGroupCode]
175
+ : null
176
+ },
177
+ // 解析listToolbarList
178
+ analysisListToolbarList() {
179
+ if (this.listToolbarList && this.listToolbarList.length > 0) {
180
+ // 将每一条合并起来封装为一个对象 {prop}
181
+ this.toolbarListToObj()
182
+ // 将数据来源解析后封装
183
+ this.toolbarListOptions()
184
+ // 解析默认值
185
+ this.analysisDefaultValue()
186
+ }
187
+ },
188
+ // 将每一条合并起来封装为一个对象 {prop}
189
+ toolbarListToObj() {
190
+ for (var i = 0; i < this.listToolbarList.length; i++) {
191
+ const item = this.listToolbarList[i]
192
+ if (item && item.propDbName) {
193
+ if (!this.modelObj[item.propDbName]) {
194
+ this.modelObj[item.propDbName] = null
195
+ if (
196
+ item.controlType &&
197
+ (item.controlType === 'year' || item.controlType === 'month')
198
+ ) {
199
+ this.modelObjType[item.propDbName + '~~' + item.controlType] =
200
+ item.controlType
201
+ } else {
202
+ this.modelObjType[item.propDbName] = item.controlType
203
+ }
204
+ this.dataTypeObj[item.propDbName] = item.dataType
205
+ }
206
+ }
207
+ }
208
+ },
209
+ // 将数据来源解析后封装
210
+ toolbarListOptions() {
211
+ for (var i = 0; i < this.listToolbarList.length; i++) {
212
+ const item = this.listToolbarList[i]
213
+ if (item && item.propDbName) {
214
+ if (item.dynamicDataSourceCode) {
215
+ this.dynamicDataSources[item.dynamicDataSourceCode] = {
216
+ mounted: false,
217
+ }
218
+ this.modelDynamicMapping[item.propDbName] =
219
+ item.dynamicDataSourceCode
220
+ }
221
+ if (item.optionGroupCode) {
222
+ this.dynamicDataSources[item.optionGroupCode] = { mounted: false }
223
+ this.getOptionGroupOptions(item.optionGroupCode).then((data) => {
224
+ const defaultSelected = data.find(
225
+ (element) => element.selected === true
226
+ )
227
+ this.dynamicDataSources[item.optionGroupCode].mounted = true
228
+ if (defaultSelected) {
229
+ this.modelObj[item.propDbName] = defaultSelected.value
230
+ this.dynamicDataSources[
231
+ item.optionGroupCode
232
+ ].dynamicDataSourceDto = { defaultSelect: true }
233
+ this.dynamicSourceAllCompleted()
234
+ }
235
+ this.optionsList[item.optionGroupCode] = data
236
+ })
237
+ }
238
+ }
239
+ }
240
+ },
241
+ // 解析默认值
242
+ analysisDefaultValue() {
243
+ const defaultValueList = []
244
+ for (var i = 0; i < this.listToolbarList.length; i++) {
245
+ const item = this.listToolbarList[i]
246
+ if (item && item.propDbName) {
247
+ if (item.propValue) {
248
+ defaultValueList.push(item.propValue)
249
+ } else {
250
+ defaultValueList.push(null)
251
+ }
252
+ } else {
253
+ defaultValueList.push(null)
254
+ }
255
+ }
256
+ // 发送请求
257
+ const map = {
258
+ additionalParamMap: this.additionalParamMap,
259
+ values: defaultValueList,
260
+ }
261
+ this.analysisStandardValues(map).then((data) => {
262
+ if (data && data.returnValues) {
263
+ if (data.returnValues.length === 1 && data.returnValues[0] === null) {
264
+ return
265
+ }
266
+ for (var k = 0; k < this.listToolbarList.length; k++) {
267
+ const item = this.listToolbarList[k]
268
+ if (item && item.propDbName) {
269
+ const value = data.returnValues[k]
270
+ if (
271
+ item.controlType === 'multipleSelect' ||
272
+ item.controlType === 'checkbox'
273
+ ) {
274
+ this.modelObj[item.propDbName] = []
275
+ if (value !== undefined && value !== null) {
276
+ if (typeof value === 'string') {
277
+ this.modelObj[item.propDbName] = value.split(',')
278
+ } else {
279
+ this.modelObj[item.propDbName] = value
280
+ }
281
+ }
282
+ } else {
283
+ if (value !== undefined && value !== null) {
284
+ if (item.controlType === 'year') {
285
+ const valArr = value.split('-')
286
+ let year = null
287
+ if (valArr.length >= 1) {
288
+ year = valArr[0]
289
+ }
290
+ this.modelObj[item.propDbName] = year
291
+ } else if (item.controlType === 'month') {
292
+ const valArr = value.split('-')
293
+ let month = null
294
+ if (valArr.length >= 2) {
295
+ month = valArr[0] + '-' + valArr[1]
296
+ }
297
+ this.modelObj[item.propDbName] = month
298
+ } else {
299
+ this.modelObj[item.propDbName] = value
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ this.dynamicSourceAllCompleted()
306
+ }
307
+ })
308
+ },
309
+ // 刷新列表数据
310
+ searchGridData(contorlType) {
311
+ console.log(this.modelObj)
312
+ this.handleDymSelectEmptyValue()
313
+ $emit(
314
+ this,
315
+ 'searchGridData',
316
+ this.modelObj,
317
+ this.modelObjType,
318
+ this.dataTypeObj,
319
+ contorlType
320
+ )
321
+ },
322
+ dynamicSourceOnload(dynamicDataSourceDto) {
323
+ this.dynamicDataSources[dynamicDataSourceDto.code].mounted = true
324
+ this.dynamicDataSources[dynamicDataSourceDto.code].dynamicDataSourceDto =
325
+ dynamicDataSourceDto
326
+ this.dynamicSourceAllCompleted()
327
+ },
328
+ dynamicSourceAllCompleted() {
329
+ const values = Object.values(this.dynamicDataSources)
330
+ if (values.length === 0) {
331
+ this.searchGridData()
332
+ } else {
333
+ const result = Object.values(this.dynamicDataSources).filter(
334
+ (dym) => dym.mounted === false
335
+ )
336
+ if (result.length === 0) {
337
+ const keys = Object.keys(this.dynamicDataSources)
338
+ for (let i = 0; i < keys.length; i++) {
339
+ if (
340
+ this.dynamicDataSources[keys[i]].dynamicDataSourceDto
341
+ .defaultSelect
342
+ ) {
343
+ this.searchGridData()
344
+ break
345
+ }
346
+ }
347
+ }
348
+ }
349
+ },
350
+ handleDymSelectEmptyValue() {
351
+ // 处理当动态数据源工具栏选项选择的是空值时,传递给后台所有的下拉值
352
+ if (this.modelDynamicMapping) {
353
+ const keys = Object.keys(this.modelDynamicMapping)
354
+ keys.forEach((key) => {
355
+ if (
356
+ !this.modelObj[key] &&
357
+ this.dynamicDataSources[this.modelDynamicMapping[key]]
358
+ .dynamicDataSourceDto.defaultSelect
359
+ ) {
360
+ const ddsd =
361
+ this.dynamicDataSources[this.modelDynamicMapping[key]]
362
+ .dynamicDataSourceDto
363
+ const valArr = []
364
+ ddsd.options.forEach((option) => {
365
+ if (option[ddsd.valueAttribute]) {
366
+ valArr.push(option[ddsd.valueAttribute])
367
+ }
368
+ })
369
+ this.modelObj[key] = valArr
370
+ }
371
+ })
372
+ }
373
+ },
374
+ },
375
+ emits: ['searchGridData'],
376
+ }
377
+ </script>