wui-components-v2 1.1.69 → 1.1.71

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 (117) hide show
  1. package/api/core/index.ts +74 -74
  2. package/api/feishu.ts +20 -20
  3. package/api/index.ts +4 -4
  4. package/api/login.ts +51 -51
  5. package/api/menu.ts +45 -45
  6. package/api/page.ts +114 -114
  7. package/api/sys.ts +12 -12
  8. package/api/tree.ts +28 -28
  9. package/components/action-popup/action-popup.vue +116 -116
  10. package/components/add-address-list/add-address-list.vue +187 -187
  11. package/components/add-address-page/add-address-page.vue +77 -77
  12. package/components/add-address-page/config.ts +297 -297
  13. package/components/audio-play/audio-play.vue +220 -220
  14. package/components/batch-upload-file/batch-upload-file.vue +75 -75
  15. package/components/card-botom-buttons/card-botom-buttons.vue +279 -279
  16. package/components/custom-date-picker/custom-date-picker.vue +106 -106
  17. package/components/custom-select-picker/custom-select-picker.vue +95 -95
  18. package/components/demo-block/demo-block.vue +63 -63
  19. package/components/demo-card/demo-card.vue +44 -44
  20. package/components/detail-popup/detail-popup.vue +99 -99
  21. package/components/evaluation-page/evaluation-page.vue +196 -196
  22. package/components/fold-card/fold-card.vue +171 -171
  23. package/components/form-control/form-control.vue +661 -661
  24. package/components/global-loading/GlobalLoading.md +366 -366
  25. package/components/global-loading/global-loading.vue +55 -55
  26. package/components/global-message/GlobalMessage.md +570 -570
  27. package/components/global-message/global-message.vue +68 -68
  28. package/components/global-toast/GlobalToast.md +261 -261
  29. package/components/global-toast/global-toast.vue +56 -56
  30. package/components/label-value/label-value.vue +144 -144
  31. package/components/label-value/open-value-more.vue +56 -56
  32. package/components/list-top-buttons/list-top-buttons.vue +19 -19
  33. package/components/loading/loading.vue +5 -5
  34. package/components/login-form/login-form.vue +126 -126
  35. package/components/login-form-box/login-form-box.vue +65 -65
  36. package/components/mulselect-picker/mulselect-picker.vue +86 -86
  37. package/components/phone-login-form/phone-login-form.vue +204 -204
  38. package/components/privacy-popup/privacy-popup.vue +191 -191
  39. package/components/product-card/product-card.vue +201 -201
  40. package/components/scan-input/scan-input.vue +406 -406
  41. package/components/search/search.vue +128 -128
  42. package/components/select-col-picker/select-col-picker.vue +168 -168
  43. package/components/tab-search/tab-search.vue +73 -73
  44. package/components/tree-select/components/TreeNode.vue +200 -200
  45. package/components/tree-select/components/index.vue +471 -471
  46. package/components/tree-select/components/tree-select.vue +56 -56
  47. package/components/tree-select/index.vue +93 -93
  48. package/components/user-choose/user-choose.vue +169 -151
  49. package/components/video-play/video-play.vue +56 -56
  50. package/components/wui-auto-update-component/wui-auto-update-component.vue +132 -132
  51. package/components/wui-default/wui-default.vue +49 -49
  52. package/components/wui-details-page/wui-details-page.vue +147 -147
  53. package/components/wui-edit-page/wui-edit-page-copy.vue +757 -757
  54. package/components/wui-edit-page/wui-edit-page.vue +793 -793
  55. package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
  56. package/components/wui-list/wui-list.vue +235 -235
  57. package/components/wui-login/wui-login.vue +43 -43
  58. package/components/wui-login1/wui-login.vue +41 -41
  59. package/components/wui-menus/wui-menus-top.vue +137 -137
  60. package/components/wui-menus/wui-menus-top1.vue +8 -8
  61. package/components/wui-menus/wui-menus.vue +247 -247
  62. package/components/wui-menus1/components/banner-carousel.vue +320 -320
  63. package/components/wui-menus1/components/navbar.vue +43 -43
  64. package/components/wui-menus1/components/quick-panel.vue +55 -55
  65. package/components/wui-menus1/components/search-bar.vue +49 -49
  66. package/components/wui-menus1/components/section-menus.vue +208 -208
  67. package/components/wui-menus1/wui-menus-top.vue +718 -718
  68. package/components/wui-menus1/wui-menus-top1.vue +398 -398
  69. package/components/wui-menus1/wui-menus.vue +564 -564
  70. package/components/wui-notify-info/notify-handle.vue +53 -53
  71. package/components/wui-notify-info/wui-notify-info.vue +280 -280
  72. package/components/wui-scan-binding-sensor/wui-scan-binding-sensor.vue +75 -75
  73. package/components/wui-search-history-babbar/components/SearchBar.vue +70 -70
  74. package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
  75. package/components/wui-select-list/wui-select-list.vue +310 -310
  76. package/components/wui-select-popup/wui-select-popup.vue +613 -612
  77. package/components/wui-system-settings/wui-system-settings.vue +144 -144
  78. package/components/wui-tabbar/wui-tabbar.vue +106 -106
  79. package/components/wui-tree-page/components/tree-item.vue +238 -238
  80. package/components/wui-tree-page/wui-tree-page.vue +297 -297
  81. package/components/wui-update-component/wui-update-component.vue +221 -221
  82. package/components/wui-user/wui-user.vue +202 -202
  83. package/composables/types/theme.ts +65 -65
  84. package/composables/types/user.ts +5 -5
  85. package/composables/useColorGenerator.ts +221 -221
  86. package/composables/useCompanyFieldFilter.ts +91 -91
  87. package/composables/useEnumes.ts +43 -43
  88. package/composables/useEventBus.ts +37 -37
  89. package/composables/useGlobalLoading.ts +47 -47
  90. package/composables/useGlobalMessage.ts +53 -53
  91. package/composables/useGlobalToast.ts +63 -63
  92. package/composables/useLocale.ts +54 -54
  93. package/composables/useManualTheme.ts +179 -179
  94. package/composables/useMenus.ts +193 -193
  95. package/composables/useSectionMenus.ts +120 -120
  96. package/composables/useTabbar.ts +50 -50
  97. package/composables/useTheme.ts +74 -74
  98. package/composables/useUser.ts +24 -24
  99. package/index.d.ts +90 -90
  100. package/index.ts +83 -83
  101. package/package.json +24 -24
  102. package/static/iconfont/iconfont.css +63 -63
  103. package/store/language.ts +151 -151
  104. package/store/manualThemeStore.ts +143 -143
  105. package/store/persist.ts +41 -41
  106. package/store/themeStore.ts +74 -74
  107. package/store/userStore.ts +22 -22
  108. package/styles/dark-mode.css +523 -523
  109. package/styles/dark-mode.min.css +1 -1
  110. package/styles/dark-mode.scss +498 -498
  111. package/type.ts +154 -154
  112. package/utils/control-tree.ts +353 -353
  113. package/utils/control-type-supportor.ts +148 -148
  114. package/utils/eventBus.ts +36 -36
  115. package/utils/idata-scan.ts +99 -99
  116. package/utils/index.ts +979 -979
  117. package/utils/rsaEncrypt.ts +10 -10
@@ -1,99 +1,99 @@
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 '../../api/page'
7
-
8
- defineOptions({
9
- name: 'DetailPopup',
10
- })
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
- }
23
-
24
- const showDetail = ref(false)
25
- const exhibitData = ref<Columns[]>([])
26
- const rowData = ref<Entities>({} as Entities)
27
- const columns = ref<Columns[]>([])
28
-
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
- }
51
- </script>
52
-
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 text-gray-900 dark:text-gray-100">详情内容</view>
58
- <scroll-view scroll-y class="scroll-area">
59
- <view class="flex items-center gap-2 mb-4 text-gray-500 dark:text-gray-400" v-for="(item, sindex) in columns" :key="sindex">
60
- <view class="break-words dark:text-gray-400">{{ item.title }}:</view>
61
- <view class="text-gray-800 dark:text-gray-200 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: var(--wot-dark-color, #333);
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
- }
92
-
93
- // 暗黑模式适配
94
- :global(.wot-theme-dark) {
95
- .custom-popup {
96
- color: var(--wot-dark-color2, #e0e0e0);
97
- }
98
- }
99
- </style>
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 '../../api/page'
7
+
8
+ defineOptions({
9
+ name: 'DetailPopup',
10
+ })
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
+ }
23
+
24
+ const showDetail = ref(false)
25
+ const exhibitData = ref<Columns[]>([])
26
+ const rowData = ref<Entities>({} as Entities)
27
+ const columns = ref<Columns[]>([])
28
+
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
+ }
51
+ </script>
52
+
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 text-gray-900 dark:text-gray-100">详情内容</view>
58
+ <scroll-view scroll-y class="scroll-area">
59
+ <view class="flex items-center gap-2 mb-4 text-gray-500 dark:text-gray-400" v-for="(item, sindex) in columns" :key="sindex">
60
+ <view class="break-words dark:text-gray-400">{{ item.title }}:</view>
61
+ <view class="text-gray-800 dark:text-gray-200 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: var(--wot-dark-color, #333);
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
+ }
92
+
93
+ // 暗黑模式适配
94
+ :global(.wot-theme-dark) {
95
+ .custom-popup {
96
+ color: var(--wot-dark-color2, #e0e0e0);
97
+ }
98
+ }
99
+ </style>
@@ -1,196 +1,196 @@
1
- <script setup lang="ts">
2
- import { ref } from 'vue'
3
- import { onLoad } from '@dcloudio/uni-app'
4
- import { detailPageConfig, detailPageData, pageConfig as OperationPageConfig, actionDataSave } from '../../api/page'
5
- import type { Entities, Groups, dtmplConfig, rowActions } from '../../type'
6
- import LabelValue from '../label-value/label-value.vue'
7
- import ActionPopup from '../action-popup/action-popup.vue'
8
- import { useGlobalToast } from '../../composables/useGlobalToast'
9
-
10
- defineOptions({
11
- name: 'EvaluationPage',
12
- })
13
- const props = defineProps<{
14
- /** 评价提交成功后的跳转地址,不传则默认刷新详情 */
15
- successUrl?: string
16
- }>()
17
- const toast = useGlobalToast()
18
- const sourceId = ref('')
19
- const id = ref('')
20
- const title = ref('')
21
- const pageConfig = ref<dtmplConfig>({
22
- id: '',
23
- title: '',
24
- groups: [],
25
- entity: {} as any,
26
- buttons: [],
27
- })
28
- const data = ref<Entities>({
29
- code: '',
30
- fieldMap: {},
31
- arrayMap: {},
32
- })
33
- const groups = ref<Groups>({
34
- id: '',
35
- buttons: ['detail'],
36
- fields: [],
37
- title: '',
38
- type: '',
39
- pointSourceId: '',
40
- mstrucId: '',
41
- relationNames: [],
42
- readOnly: false,
43
- displayConfig: [],
44
- })
45
- const loading = ref(false)
46
- // 折叠面板
47
- const collapses = ref()
48
- // 评价操作配置
49
- const evaluationActions = ref<rowActions[]>([])
50
- onLoad((option: any) => {
51
- sourceId.value = option.sourceId
52
- id.value = option.id
53
- // #ifdef MP-WEIXIN
54
- const q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
55
- const sc: any = getQueryParams(q)
56
- sourceId.value = sc.sourceId || option.sourceId
57
- id.value = sc.id || option.id
58
- // #endif
59
- title.value = option.title
60
- uni.setNavigationBarTitle({
61
- title: `${option.title}`,
62
- })
63
- getPageConfig()
64
- })
65
-
66
- // 将 URL 中问号后面的参数转换为对象
67
- function getQueryParams(url: string) {
68
- // 获取问号后面的部分
69
- const queryString = url.split('?')[1]
70
-
71
- if (!queryString) {
72
- return {}
73
- }
74
-
75
- // 将参数字符串分割成键值对数组
76
- const pairs = queryString.split('&')
77
-
78
- // 创建结果对象
79
- const result: { [key: string]: string } = {}
80
-
81
- // 遍历键值对
82
- pairs.forEach(pair => {
83
- const [key, value] = pair.split('=')
84
- // 解码URI组件并添加到结果对象
85
- result[decodeURIComponent(key)] = decodeURIComponent(value || '')
86
- })
87
-
88
- return result
89
- }
90
-
91
- // 获取页面配置
92
- async function getPageConfig() {
93
- try {
94
- loading.value = true
95
- const res = await detailPageConfig(sourceId.value)
96
- // 初始化折叠面板
97
- if (res.dtmplConfig) {
98
- uni.setNavigationBarTitle({
99
- title: `${res.dtmplConfig.title}`,
100
- })
101
- pageConfig.value = res.dtmplConfig
102
- collapses.value = pageConfig.value.groups.map((item: Groups) => {
103
- return item.id
104
- })
105
- getDetailData()
106
- getOperationPageConfig()
107
- }
108
- } catch (error) {
109
- console.log(error)
110
- loading.value = false
111
- }
112
- }
113
-
114
- // 获取详情数据
115
- async function getDetailData() {
116
- try {
117
- const res = await detailPageData(sourceId.value, id.value)
118
- data.value = res.entity
119
- loading.value = false
120
- } catch (error) {
121
- loading.value = false
122
- console.log(error)
123
- }
124
- }
125
- async function getOperationPageConfig() {
126
- try {
127
- const res: any = await OperationPageConfig(sourceId.value)
128
- // 筛选出评价相关的操作
129
- if (res.ltmplConfig?.rowActions) {
130
- evaluationActions.value = res.ltmplConfig.rowActions.filter((item: rowActions) => item.title.includes('评价'))
131
- }
132
- } catch (error) {
133
- console.log(error)
134
- }
135
- }
136
-
137
- const actionItemShow = ref(false)
138
- const actionItem = ref<Groups>()
139
- const code = ref('')
140
- const enumColumn = ref()
141
- // 模拟 zpaging 对象,用于 ActionPopup 刷新
142
- const mockZpaging = {
143
- reload: () => getDetailData(),
144
- }
145
-
146
- // 评价按钮点击事件 - 迁移自 card-botom-buttons 的 select action 功能
147
- async function handleEvaluationClick() {
148
- if (evaluationActions.value.length === 0) {
149
- toast.error({ msg: '未找到评价操作配置' })
150
- return
151
- }
152
- // 取第一个评价操作
153
- const subitem = evaluationActions.value[0]
154
- if (subitem.writes.length) {
155
- actionItem.value = {
156
- ...groups.value,
157
- fields: subitem.writes,
158
- id: subitem.id,
159
- }
160
- code.value = id.value
161
- actionItemShow.value = true
162
- } else {
163
- try {
164
- await actionDataSave(subitem.id, id.value, {})
165
- toast.success({ msg: '评价成功!' })
166
- } catch (error: any) {
167
- toast.error(error)
168
- console.log(error)
169
- }
170
- }
171
- }
172
- </script>
173
-
174
- <template>
175
- <view class="p-4">
176
- <view v-if="loading" class="flex justify-center p-3">
177
- <wd-loading />
178
- </view>
179
- <view v-else>
180
- <view v-for="(group, index) in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
181
- <view class="text-sm space-y-3">
182
- <LabelValue :index="index" :exhibit-data="group.fields" :data="data" />
183
- </view>
184
- </view>
185
- </view>
186
- <wd-button type="primary" class="mt-4 w-full" @click="handleEvaluationClick">评价</wd-button>
187
- <ActionPopup
188
- v-model:show="actionItemShow"
189
- :enum-column="enumColumn"
190
- :zpaging="mockZpaging"
191
- :field-group="actionItem"
192
- :code="code"
193
- :success-url="props.successUrl + '?sourceId=' + sourceId"
194
- />
195
- </view>
196
- </template>
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import { onLoad } from '@dcloudio/uni-app'
4
+ import { detailPageConfig, detailPageData, pageConfig as OperationPageConfig, actionDataSave } from '../../api/page'
5
+ import type { Entities, Groups, dtmplConfig, rowActions } from '../../type'
6
+ import LabelValue from '../label-value/label-value.vue'
7
+ import ActionPopup from '../action-popup/action-popup.vue'
8
+ import { useGlobalToast } from '../../composables/useGlobalToast'
9
+
10
+ defineOptions({
11
+ name: 'EvaluationPage',
12
+ })
13
+ const props = defineProps<{
14
+ /** 评价提交成功后的跳转地址,不传则默认刷新详情 */
15
+ successUrl?: string
16
+ }>()
17
+ const toast = useGlobalToast()
18
+ const sourceId = ref('')
19
+ const id = ref('')
20
+ const title = ref('')
21
+ const pageConfig = ref<dtmplConfig>({
22
+ id: '',
23
+ title: '',
24
+ groups: [],
25
+ entity: {} as any,
26
+ buttons: [],
27
+ })
28
+ const data = ref<Entities>({
29
+ code: '',
30
+ fieldMap: {},
31
+ arrayMap: {},
32
+ })
33
+ const groups = ref<Groups>({
34
+ id: '',
35
+ buttons: ['detail'],
36
+ fields: [],
37
+ title: '',
38
+ type: '',
39
+ pointSourceId: '',
40
+ mstrucId: '',
41
+ relationNames: [],
42
+ readOnly: false,
43
+ displayConfig: [],
44
+ })
45
+ const loading = ref(false)
46
+ // 折叠面板
47
+ const collapses = ref()
48
+ // 评价操作配置
49
+ const evaluationActions = ref<rowActions[]>([])
50
+ onLoad((option: any) => {
51
+ sourceId.value = option.sourceId
52
+ id.value = option.id
53
+ // #ifdef MP-WEIXIN
54
+ const q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
55
+ const sc: any = getQueryParams(q)
56
+ sourceId.value = sc.sourceId || option.sourceId
57
+ id.value = sc.id || option.id
58
+ // #endif
59
+ title.value = option.title
60
+ uni.setNavigationBarTitle({
61
+ title: `${option.title}`,
62
+ })
63
+ getPageConfig()
64
+ })
65
+
66
+ // 将 URL 中问号后面的参数转换为对象
67
+ function getQueryParams(url: string) {
68
+ // 获取问号后面的部分
69
+ const queryString = url.split('?')[1]
70
+
71
+ if (!queryString) {
72
+ return {}
73
+ }
74
+
75
+ // 将参数字符串分割成键值对数组
76
+ const pairs = queryString.split('&')
77
+
78
+ // 创建结果对象
79
+ const result: { [key: string]: string } = {}
80
+
81
+ // 遍历键值对
82
+ pairs.forEach(pair => {
83
+ const [key, value] = pair.split('=')
84
+ // 解码URI组件并添加到结果对象
85
+ result[decodeURIComponent(key)] = decodeURIComponent(value || '')
86
+ })
87
+
88
+ return result
89
+ }
90
+
91
+ // 获取页面配置
92
+ async function getPageConfig() {
93
+ try {
94
+ loading.value = true
95
+ const res = await detailPageConfig(sourceId.value)
96
+ // 初始化折叠面板
97
+ if (res.dtmplConfig) {
98
+ uni.setNavigationBarTitle({
99
+ title: `${res.dtmplConfig.title}`,
100
+ })
101
+ pageConfig.value = res.dtmplConfig
102
+ collapses.value = pageConfig.value.groups.map((item: Groups) => {
103
+ return item.id
104
+ })
105
+ getDetailData()
106
+ getOperationPageConfig()
107
+ }
108
+ } catch (error) {
109
+ console.log(error)
110
+ loading.value = false
111
+ }
112
+ }
113
+
114
+ // 获取详情数据
115
+ async function getDetailData() {
116
+ try {
117
+ const res = await detailPageData(sourceId.value, id.value)
118
+ data.value = res.entity
119
+ loading.value = false
120
+ } catch (error) {
121
+ loading.value = false
122
+ console.log(error)
123
+ }
124
+ }
125
+ async function getOperationPageConfig() {
126
+ try {
127
+ const res: any = await OperationPageConfig(sourceId.value)
128
+ // 筛选出评价相关的操作
129
+ if (res.ltmplConfig?.rowActions) {
130
+ evaluationActions.value = res.ltmplConfig.rowActions.filter((item: rowActions) => item.title.includes('评价'))
131
+ }
132
+ } catch (error) {
133
+ console.log(error)
134
+ }
135
+ }
136
+
137
+ const actionItemShow = ref(false)
138
+ const actionItem = ref<Groups>()
139
+ const code = ref('')
140
+ const enumColumn = ref()
141
+ // 模拟 zpaging 对象,用于 ActionPopup 刷新
142
+ const mockZpaging = {
143
+ reload: () => getDetailData(),
144
+ }
145
+
146
+ // 评价按钮点击事件 - 迁移自 card-botom-buttons 的 select action 功能
147
+ async function handleEvaluationClick() {
148
+ if (evaluationActions.value.length === 0) {
149
+ toast.error({ msg: '未找到评价操作配置' })
150
+ return
151
+ }
152
+ // 取第一个评价操作
153
+ const subitem = evaluationActions.value[0]
154
+ if (subitem.writes.length) {
155
+ actionItem.value = {
156
+ ...groups.value,
157
+ fields: subitem.writes,
158
+ id: subitem.id,
159
+ }
160
+ code.value = id.value
161
+ actionItemShow.value = true
162
+ } else {
163
+ try {
164
+ await actionDataSave(subitem.id, id.value, {})
165
+ toast.success({ msg: '评价成功!' })
166
+ } catch (error: any) {
167
+ toast.error(error)
168
+ console.log(error)
169
+ }
170
+ }
171
+ }
172
+ </script>
173
+
174
+ <template>
175
+ <view class="p-4">
176
+ <view v-if="loading" class="flex justify-center p-3">
177
+ <wd-loading />
178
+ </view>
179
+ <view v-else>
180
+ <view v-for="(group, index) in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
181
+ <view class="text-sm space-y-3">
182
+ <LabelValue :index="index" :exhibit-data="group.fields" :data="data" />
183
+ </view>
184
+ </view>
185
+ </view>
186
+ <wd-button type="primary" class="mt-4 w-full" @click="handleEvaluationClick">评价</wd-button>
187
+ <ActionPopup
188
+ v-model:show="actionItemShow"
189
+ :enum-column="enumColumn"
190
+ :zpaging="mockZpaging"
191
+ :field-group="actionItem"
192
+ :code="code"
193
+ :success-url="props.successUrl + '?sourceId=' + sourceId"
194
+ />
195
+ </view>
196
+ </template>