wui-components-v2 1.0.39 → 1.0.41

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.
@@ -47,6 +47,11 @@ const rowAddEvent = ref('')
47
47
  const sendRowAddEvent = ref('')
48
48
  // 折叠面板
49
49
  const collapses = ref()
50
+ const groupsformat = computed(() => {
51
+ return pageConfig.value.groups.filter((item: Groups) => {
52
+ return item.displayConfig.includes('displayed')
53
+ })
54
+ })
50
55
  onLoad((option: any) => {
51
56
  sourceId.value = option.sourceId
52
57
  mainCode.value = option.mainCode || ''
@@ -176,7 +181,24 @@ async function save() {
176
181
  })
177
182
  const res = await Promise.all(formArray)
178
183
  const beasData = res.reduce((acc, cur) => {
179
- return { ...acc, ...cur }
184
+ const data: any = {}
185
+ for (const key in cur) {
186
+ if (Object.prototype.hasOwnProperty.call(cur, key)) {
187
+ const element = cur[key]
188
+ if (element.response) {
189
+ data[key] = JSON.stringify({
190
+ valid: 'new',
191
+ fileKey: JSON.parse(element.response).fileKey,
192
+ fileName: element.name,
193
+ })
194
+ }
195
+ else {
196
+ data[key] = element
197
+ }
198
+ }
199
+ }
200
+
201
+ return { ...acc, ...data }
180
202
  }, {})
181
203
  subLoading.value = true
182
204
 
@@ -405,6 +427,7 @@ function gotoRowAdd(group: Groups) {
405
427
  }]
406
428
  }
407
429
 
430
+ console.log(pageConfig.value.entity)
408
431
  // 显示数据
409
432
  if (pageConfig.value.entity && pageConfig.value.entity.arrayMap[group.id]) {
410
433
  pageConfig.value.entity.arrayMap[group.id].push({
@@ -416,20 +439,39 @@ function gotoRowAdd(group: Groups) {
416
439
  })
417
440
  }
418
441
  else {
419
- pageConfig.value.entity = {
420
- arrayMap: {
421
- [group.id]: [{
422
- arrayMap: {},
423
- code: '',
424
- fieldMap: {
425
- ...data,
426
- },
427
- }],
428
- },
429
- code: '',
430
- fieldMap: {},
442
+ if (pageConfig.value.entity.arrayMap) {
443
+ pageConfig.value.entity = {
444
+ arrayMap: {
445
+ ...pageConfig.value.entity.arrayMap,
446
+ [group.id]: [{
447
+ arrayMap: {},
448
+ code: '',
449
+ fieldMap: {
450
+ ...data,
451
+ },
452
+ }],
453
+ },
454
+ code: '',
455
+ fieldMap: {},
456
+ }
457
+ }
458
+ else {
459
+ pageConfig.value.entity = {
460
+ arrayMap: {
461
+ [group.id]: [{
462
+ arrayMap: {},
463
+ code: '',
464
+ fieldMap: {
465
+ ...data,
466
+ },
467
+ }],
468
+ },
469
+ code: '',
470
+ fieldMap: {},
471
+ }
431
472
  }
432
473
  }
474
+
433
475
  console.log(rowData.value, 'rowData.value')
434
476
  uni.$off(rowAddEvent)
435
477
  })
@@ -529,7 +571,7 @@ function remove(group: Groups, field: Entities) {
529
571
  <TreeSelectControl v-model="tree" select-mode="single" :source-id="sourceId" title="分组" ext-control-type="relselect " :readonly="false" :clearable="false" />
530
572
  </wd-cell>
531
573
  <wd-collapse v-model="collapses">
532
- <wd-collapse-item v-for="group in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
574
+ <wd-collapse-item v-for="group in groupsformat" :key="group.id" :title="group.title" :name="group.id">
533
575
  <FormControl v-if="group.type === 'fieldGroup'" ref="formControlRef" :field-group="group" :entity="pageConfig?.entity?.fieldMap" :enum-column="Enumcolumn" />
534
576
  <view v-if="group.type === 'relation'">
535
577
  <view v-if="selectData[group.id]?.loading " class="flex justify-center p-3">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/type.ts CHANGED
@@ -59,6 +59,7 @@ export interface Groups {
59
59
  max?: number
60
60
  classEditConfigs?: ClassEditConfigs[]
61
61
  readOnly: boolean
62
+ displayConfig: string[]
62
63
  }
63
64
 
64
65
  export interface Entity extends Entities {