wui-components-v2 1.1.63 → 1.1.64

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,28 +1,92 @@
1
- <template>
2
- <view class=" text-[#2164f3]">
3
- 查看详情
4
- </view>
5
- </template>
6
- <script setup>
7
- import { ref, computed, onMounted } from 'vue'
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import type { Columns, Entities } from '../../type'
4
+ import { formatItemData } from '../../utils'
5
+ import ControlTypeSupportor from '../../utils/control-type-supportor'
6
+ import { detailPageConfig, detailPageData } from '@/core-components/api/page'
8
7
 
9
8
  defineOptions({
10
9
  name: 'DetailPopup',
11
10
  })
12
- defineProps({
13
- data: {
14
- type: Object,
15
- default: () => {},
16
- },
17
- })
18
11
 
12
+ const props = defineProps<{
13
+ source: Columns
14
+ text: string
15
+ code: string
16
+ }>()
17
+ interface DetailItem {
18
+ /** 行数据 */
19
+ data: Entities
20
+ /** 字段配置 */
21
+ columns: Columns[]
22
+ }
19
23
 
20
- const data = ref(null)
24
+ const showDetail = ref(false)
25
+ const exhibitData = ref<Columns[]>([])
26
+ const rowData = ref<Entities>({} as Entities)
27
+ const columns = ref<Columns[]>([])
21
28
 
22
- onMounted(() => {
23
- // mounted logic
24
- })
29
+ function isControlType(item: Columns): string {
30
+ return ControlTypeSupportor.getControlType(
31
+ { ...item, hidden: false, disabled: false, defaultValue: '', transDefaultValue: '', required: false },
32
+ rowData.value.fieldMap[item.sourceId]
33
+ )
34
+ }
35
+ async function open(item: DetailItem) {
36
+ const code = props.code.split('@R@')[0]
37
+ const formRes = await detailPageConfig(props.source.sourceId)
38
+ const valueRes = await detailPageData(props.source.sourceId, code)
39
+ if (formRes.status === 'success') {
40
+ columns.value = formRes.dtmplConfig.groups?.[0].fields || []
41
+ }
42
+ if (valueRes.status === 'success') {
43
+ rowData.value = valueRes.entity || {}
44
+ }
45
+ showDetail.value = true
46
+ }
47
+
48
+ function handleClose() {
49
+ showDetail.value = false
50
+ }
25
51
  </script>
26
52
 
27
- <style scoped>
53
+ <template>
54
+ <view class="text-[#1c64fd]" @click="open">{{ text }}</view>
55
+ <wd-popup v-model="showDetail" custom-style="border-radius: 32rpx;">
56
+ <view class="custom-popup">
57
+ <view class="text-center mb-4">详情内容</view>
58
+ <scroll-view scroll-y class="scroll-area">
59
+ <view class="flex items-center gap-2 mb-4 text-[#6b7280]" v-for="(item, sindex) in columns" :key="sindex">
60
+ <view class="break-words">{{ item.title }}:</view>
61
+ <view class="text-[#1f2937] break-all">
62
+ {{ formatItemData(rowData.fieldMap[item.sourceId], isControlType(item)) }}
63
+ </view>
64
+ </view>
65
+ </scroll-view>
66
+ <view class="footer flex justify-center items-center">
67
+ <wd-button class="flex-1" @click="handleClose">确定</wd-button>
68
+ </view>
69
+ </view>
70
+ </wd-popup>
71
+ </template>
72
+
73
+ <style scoped lang="scss">
74
+ .custom-popup {
75
+ color: black;
76
+ padding: 24rpx;
77
+ width: 600rpx;
78
+ max-width: 600rpx;
79
+ font-size: 40rpx;
80
+ border-radius: 32rpx;
81
+ position: relative;
82
+
83
+ .scroll-area {
84
+ height: 50vh;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .footer {
89
+ margin-top: 24rpx;
90
+ }
91
+ }
28
92
  </style>
@@ -7,6 +7,7 @@ import VideoPlay from '../video-play/video-play.vue'
7
7
  import audioPlay from '../audio-play/audio-play.vue'
8
8
  import { useManualTheme } from '../../composables/useManualTheme'
9
9
  import openValueMore from './open-value-more.vue'
10
+ import detailPopup from '../detail-popup/detail-popup.vue'
10
11
 
11
12
  defineOptions({
12
13
  name: 'LabelValue',
@@ -17,7 +18,6 @@ const props = defineProps<{
17
18
  index: number
18
19
  }>()
19
20
  const { primary } = useManualTheme()
20
- const showDetail=ref(false)
21
21
  const clums = computed(() => {
22
22
  return props.exhibitData.filter(item => !item.title?.includes('y'))
23
23
  })
@@ -28,15 +28,16 @@ function openVideo(uitem: any) {
28
28
  }
29
29
 
30
30
  function isControlType(item: Columns): string {
31
- return ControlTypeSupportor.getControlType({ ...item, hidden: false, disabled: false, defaultValue: '', transDefaultValue: '', required: false }, props.data.fieldMap[item.sourceId])
31
+ return ControlTypeSupportor.getControlType(
32
+ { ...item, hidden: false, disabled: false, defaultValue: '', transDefaultValue: '', required: false },
33
+ props.data.fieldMap[item.sourceId]
34
+ )
32
35
  }
33
36
  </script>
34
37
 
35
38
  <template>
36
39
  <view v-for="(item, sindex) in clums" :key="sindex" class="flex">
37
- <view class="mr-2 w-20 p-1 text-gray-500 dark:text-white">
38
- {{ item.title }}:
39
- </view>
40
+ <view class="mr-2 w-20 p-1 text-gray-500 dark:text-white">{{ item.title }}:</view>
40
41
  <view
41
42
  v-if="isControlType(item) === 'file' || isControlType(item) === 'relfile' || isControlType(item) === 'video'"
42
43
  class="flex flex-1 items-center text-gray-800 dark:text-white"
@@ -48,13 +49,14 @@ function isControlType(item: Columns): string {
48
49
  >
49
50
  <!-- 图片 -->
50
51
  <wd-img
51
- v-if="['png', 'jpg', 'jpeg'].includes(uitem.type)" enable-preview :width="100" :height="100"
52
+ v-if="['png', 'jpg', 'jpeg'].includes(uitem.type)"
53
+ enable-preview
54
+ :width="100"
55
+ :height="100"
52
56
  :src="uitem.url"
53
57
  >
54
58
  <template #error>
55
- <view class="flex items-center pt-4px">
56
- 暂无图片~
57
- </view>
59
+ <view class="flex items-center pt-4px">暂无图片~</view>
58
60
  </template>
59
61
  <template #loading>
60
62
  <view class="loading-wrap">
@@ -65,7 +67,15 @@ function isControlType(item: Columns): string {
65
67
  <!-- 视频 -->
66
68
  <view
67
69
  v-else-if="['mp4', 'mov', 'wmv', 'avi', 'rmvb', 'flv', 'mkv'].includes(uitem.type)"
68
- style="width: 70px;height: 70px;display: flex;align-items: center;justify-content: center;border: 1px solid #ccc;border-radius: 4px;"
70
+ style="
71
+ width: 70px;
72
+ height: 70px;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ border: 1px solid #ccc;
77
+ border-radius: 4px;
78
+ "
69
79
  @click="openVideo(uitem)"
70
80
  >
71
81
  <wd-icon name="play-circle-filled" size="22px" />
@@ -73,12 +83,42 @@ function isControlType(item: Columns): string {
73
83
  <!-- 音频 -->
74
84
  <view
75
85
  v-else-if="['mp3', 'wma', 'wav', 'aac', 'ogg', 'flac', 'm4a', 'amr'].includes(uitem.type)"
76
- style="display: flex;align-items: center;justify-content: center;"
86
+ style="display: flex; align-items: center; justify-content: center"
77
87
  >
78
88
  <audioPlay :src="uitem.url" />
79
89
  </view>
80
90
  <!-- 文件 -->
81
- <view v-else-if="['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'txt', 'zip', 'rar', '7z', 'gz', 'bz2', 'tar', 'iso', 'exe', 'dmg', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk'].includes(uitem.type)">
91
+ <view
92
+ v-else-if="
93
+ [
94
+ 'doc',
95
+ 'docx',
96
+ 'xls',
97
+ 'xlsx',
98
+ 'ppt',
99
+ 'pptx',
100
+ 'pdf',
101
+ 'txt',
102
+ 'zip',
103
+ 'rar',
104
+ '7z',
105
+ 'gz',
106
+ 'bz2',
107
+ 'tar',
108
+ 'iso',
109
+ 'exe',
110
+ 'dmg',
111
+ 'apk',
112
+ 'apk',
113
+ 'apk',
114
+ 'apk',
115
+ 'apk',
116
+ 'apk',
117
+ 'apk',
118
+ 'apk',
119
+ ].includes(uitem.type)
120
+ "
121
+ >
82
122
  <span :style="{ color: primary }" @click="downloadFile(uitem.url)">
83
123
  {{ uitem.name }}
84
124
  </span>
@@ -89,42 +129,16 @@ function isControlType(item: Columns): string {
89
129
  <view v-else-if="item.title === '序号'" class="flex flex-1 items-center text-gray-800 dark:text-white">
90
130
  {{ index + 1 }}
91
131
  </view>
92
- <openValueMore v-else :text="formatItemData(data.fieldMap[item.sourceId], isControlType(item)) " />
93
- </view>
94
- <VideoPlay ref="videoPlayRef" />
95
- <wd-popup v-model="showDetail" custom-style="border-radius: 32rpx;" >
96
- <view class="custom-popup">
97
- <view class="text-center mb-4">详情内容</view>
98
- <view class="flex items-center gap-2 mb-4 text-[#6b7280]" v-for="(item, sindex) in exhibitData" :key="sindex">
99
- <view class=" whitespace-nowrap">
100
- {{ item.title }}:
101
- </view>
102
- <view class="text-[#1f2937]">
103
- {{ formatItemData(data.fieldMap[item.sourceId], isControlType(item)) }}
104
- </view>
105
-
106
- </view>
107
- <view class="footer flex justify-center items-center">
108
- <wd-button class="flex-1" @click="showDetail = false">确定</wd-button>
132
+ <view v-else-if="item.buttons?.includes('detail')" class="flex flex-1 items-center text-gray-800 dark:text-white">
133
+ <detailPopup
134
+ :source="item"
135
+ :text="formatItemData(data.fieldMap[item.sourceId], isControlType(item))"
136
+ :code="data.fieldMap[item.sourceId]"
137
+ />
109
138
  </view>
139
+ <openValueMore v-else :text="formatItemData(data.fieldMap[item.sourceId], isControlType(item))" />
110
140
  </view>
111
- </wd-popup>
141
+ <VideoPlay ref="videoPlayRef" />
112
142
  </template>
113
143
 
114
- <style scoped lang="scss">
115
- .custom-popup {
116
- color: black;
117
- padding: 24rpx;
118
- min-width: 400rpx;
119
- min-height: 500rpx;
120
- // height: 600rpx;
121
- font-size: 40rpx;
122
- border-radius: 32rpx;
123
- position:relative;
124
- .footer{
125
- position: absolute;
126
- bottom: 24rpx;
127
- width: calc(100% - 48rpx);
128
- }
129
- }
130
- </style>
144
+ <style scoped lang="scss"></style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.1.63",
3
+ "version": "1.1.64",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",