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