wui-components-v2 1.0.38 → 1.0.40

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 || ''
@@ -405,6 +410,7 @@ function gotoRowAdd(group: Groups) {
405
410
  }]
406
411
  }
407
412
 
413
+ console.log(pageConfig.value.entity)
408
414
  // 显示数据
409
415
  if (pageConfig.value.entity && pageConfig.value.entity.arrayMap[group.id]) {
410
416
  pageConfig.value.entity.arrayMap[group.id].push({
@@ -416,20 +422,39 @@ function gotoRowAdd(group: Groups) {
416
422
  })
417
423
  }
418
424
  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: {},
425
+ if (pageConfig.value.entity.arrayMap) {
426
+ pageConfig.value.entity = {
427
+ arrayMap: {
428
+ ...pageConfig.value.entity.arrayMap,
429
+ [group.id]: [{
430
+ arrayMap: {},
431
+ code: '',
432
+ fieldMap: {
433
+ ...data,
434
+ },
435
+ }],
436
+ },
437
+ code: '',
438
+ fieldMap: {},
439
+ }
440
+ }
441
+ else {
442
+ pageConfig.value.entity = {
443
+ arrayMap: {
444
+ [group.id]: [{
445
+ arrayMap: {},
446
+ code: '',
447
+ fieldMap: {
448
+ ...data,
449
+ },
450
+ }],
451
+ },
452
+ code: '',
453
+ fieldMap: {},
454
+ }
431
455
  }
432
456
  }
457
+
433
458
  console.log(rowData.value, 'rowData.value')
434
459
  uni.$off(rowAddEvent)
435
460
  })
@@ -529,14 +554,14 @@ function remove(group: Groups, field: Entities) {
529
554
  <TreeSelectControl v-model="tree" select-mode="single" :source-id="sourceId" title="分组" ext-control-type="relselect " :readonly="false" :clearable="false" />
530
555
  </wd-cell>
531
556
  <wd-collapse v-model="collapses">
532
- <wd-collapse-item v-for="group in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
557
+ <wd-collapse-item v-for="group in groupsformat" :key="group.id" :title="group.title" :name="group.id">
533
558
  <FormControl v-if="group.type === 'fieldGroup'" ref="formControlRef" :field-group="group" :entity="pageConfig?.entity?.fieldMap" :enum-column="Enumcolumn" />
534
559
  <view v-if="group.type === 'relation'">
535
560
  <view v-if="selectData[group.id]?.loading " class="flex justify-center p-3">
536
561
  <wd-loading />
537
562
  </view>
538
563
  <view v-else>
539
- <view class="flex justify-center">
564
+ <view v-if="!group.readOnly" class="flex justify-center">
540
565
  <wd-button v-if="group.buttons.includes('selectAdd')" :disabled="canClick(group)" type="info" size="small" @click="gotoSlect(group)">
541
566
  选择
542
567
  </wd-button>
@@ -549,7 +574,7 @@ function remove(group: Groups, field: Entities) {
549
574
  </view>
550
575
  <view v-for="field in pageConfig?.entity?.arrayMap[group.id]" :key="field.code">
551
576
  <foldCard :enum-column="{}" :groups="group" :source-id="sourceId" :columns="group.fields" model="complex" :data="field">
552
- <template #buttons>
577
+ <template v-if="!group.readOnly" #buttons>
553
578
  <wd-button v-if="group.buttons.includes('dtmplEdit')" size="small" @click="edit(group, field)">
554
579
  编辑
555
580
  </wd-button>
@@ -29,6 +29,14 @@ const exhibitData = computed(() => {
29
29
  const columns = props.columns.length >= num ? props.columns.slice(0, num) : props.columns
30
30
  return columns.filter(item => item.title !== '操作')
31
31
  })
32
+
33
+ // 是否展示折叠按钮
34
+ const showCollapse = computed(() => {
35
+ const { collapseNum } = props
36
+ const num = collapseNum || 2
37
+ return props.columns.length > num
38
+ })
39
+
32
40
  // 折叠内容
33
41
  const collapseData = ref<Columns[]>([])
34
42
 
@@ -115,7 +123,7 @@ function toggleCollapse(contentId: string) {
115
123
  <view class="flex items-center justify-between border-t border-gray-100">
116
124
  <view>
117
125
  <wd-button
118
-
126
+ v-if="showCollapse"
119
127
  id="toggle-btn-2"
120
128
  type="icon"
121
129
  :icon="collapseIcon"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/type.ts CHANGED
@@ -58,6 +58,8 @@ export interface Groups {
58
58
  relationNames: string[]
59
59
  max?: number
60
60
  classEditConfigs?: ClassEditConfigs[]
61
+ readOnly: boolean
62
+ displayConfig: string[]
61
63
  }
62
64
 
63
65
  export interface Entity extends Entities {