wui-components-v2 1.1.68 → 1.1.70

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 (47) hide show
  1. package/api/core/index.ts +74 -74
  2. package/api/menu.ts +45 -45
  3. package/api/page.ts +114 -114
  4. package/api/sys.ts +12 -12
  5. package/components/action-popup/action-popup.vue +46 -17
  6. package/components/add-address-page/add-address-page.vue +77 -77
  7. package/components/custom-date-picker/custom-date-picker.vue +106 -106
  8. package/components/custom-select-picker/custom-select-picker.vue +95 -95
  9. package/components/demo-block/demo-block.vue +63 -63
  10. package/components/detail-popup/detail-popup.vue +99 -99
  11. package/components/evaluation-page/evaluation-page.vue +196 -192
  12. package/components/fold-card/fold-card.vue +171 -171
  13. package/components/form-control/form-control.vue +661 -661
  14. package/components/global-message/global-message.vue +68 -68
  15. package/components/label-value/label-value.vue +144 -144
  16. package/components/list-top-buttons/list-top-buttons.vue +19 -19
  17. package/components/login-form/login-form.vue +126 -126
  18. package/components/mulselect-picker/mulselect-picker.vue +86 -86
  19. package/components/product-card/product-card.vue +201 -201
  20. package/components/search/search.vue +128 -128
  21. package/components/user-choose/user-choose.vue +1 -1
  22. package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
  23. package/components/wui-list/wui-list.vue +235 -235
  24. package/components/wui-menus/wui-menus.vue +247 -247
  25. package/components/wui-menus1/components/navbar.vue +43 -43
  26. package/components/wui-menus1/wui-menus.vue +564 -564
  27. package/components/wui-notify-info/wui-notify-info.vue +280 -280
  28. package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
  29. package/components/wui-select-list/wui-select-list.vue +310 -310
  30. package/components/wui-select-popup/wui-select-popup.vue +612 -612
  31. package/components/wui-system-settings/wui-system-settings.vue +144 -144
  32. package/components/wui-tabbar/wui-tabbar.vue +106 -106
  33. package/components/wui-tree-page/components/tree-item.vue +238 -238
  34. package/components/wui-user/wui-user.vue +202 -197
  35. package/composables/useCompanyFieldFilter.ts +91 -91
  36. package/composables/useEnumes.ts +2 -2
  37. package/composables/useMenus.ts +193 -193
  38. package/index.ts +83 -83
  39. package/package.json +1 -1
  40. package/static/iconfont/iconfont.css +63 -63
  41. package/store/language.ts +151 -151
  42. package/styles/dark-mode.css +523 -485
  43. package/styles/dark-mode.min.css +1 -1
  44. package/styles/dark-mode.scss +28 -0
  45. package/type.ts +2 -2
  46. package/utils/control-tree.ts +2 -2
  47. package/utils/control-type-supportor.ts +148 -148
@@ -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,192 +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 toast = useGlobalToast()
14
- const sourceId = ref('')
15
- const id = ref('')
16
- const title = ref('')
17
- const pageConfig = ref<dtmplConfig>({
18
- id: '',
19
- title: '',
20
- groups: [],
21
- entity: {} as any,
22
- buttons: [],
23
- })
24
- const data = ref<Entities>({
25
- code: '',
26
- fieldMap: {},
27
- arrayMap: {},
28
- })
29
- const groups = ref<Groups>({
30
- id: '',
31
- buttons: ['detail'],
32
- fields: [],
33
- title: '',
34
- type: '',
35
- pointSourceId: '',
36
- mstrucId: '',
37
- relationNames: [],
38
- readOnly: false,
39
- displayConfig: [],
40
- })
41
- const loading = ref(false)
42
- // 折叠面板
43
- const collapses = ref()
44
- // 评价操作配置
45
- const evaluationActions = ref<rowActions[]>([])
46
- onLoad((option: any) => {
47
- sourceId.value = option.sourceId
48
- id.value = option.id
49
- // #ifdef MP-WEIXIN
50
- const q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
51
- const sc: any = getQueryParams(q)
52
- sourceId.value = sc.sourceId || option.sourceId
53
- id.value = sc.id || option.id
54
- // #endif
55
- title.value = option.title
56
- uni.setNavigationBarTitle({
57
- title: `${option.title}`,
58
- })
59
- getPageConfig()
60
- })
61
-
62
- // 将 URL 中问号后面的参数转换为对象
63
- function getQueryParams(url: string) {
64
- // 获取问号后面的部分
65
- const queryString = url.split('?')[1]
66
-
67
- if (!queryString) {
68
- return {}
69
- }
70
-
71
- // 将参数字符串分割成键值对数组
72
- const pairs = queryString.split('&')
73
-
74
- // 创建结果对象
75
- const result: { [key: string]: string } = {}
76
-
77
- // 遍历键值对
78
- pairs.forEach(pair => {
79
- const [key, value] = pair.split('=')
80
- // 解码URI组件并添加到结果对象
81
- result[decodeURIComponent(key)] = decodeURIComponent(value || '')
82
- })
83
-
84
- return result
85
- }
86
-
87
- // 获取页面配置
88
- async function getPageConfig() {
89
- try {
90
- loading.value = true
91
- const res = await detailPageConfig(sourceId.value)
92
- // 初始化折叠面板
93
- if (res.dtmplConfig) {
94
- uni.setNavigationBarTitle({
95
- title: `${res.dtmplConfig.title}`,
96
- })
97
- pageConfig.value = res.dtmplConfig
98
- collapses.value = pageConfig.value.groups.map((item: Groups) => {
99
- return item.id
100
- })
101
- getDetailData()
102
- getOperationPageConfig()
103
- }
104
- } catch (error) {
105
- console.log(error)
106
- loading.value = false
107
- }
108
- }
109
-
110
- // 获取详情数据
111
- async function getDetailData() {
112
- try {
113
- const res = await detailPageData(sourceId.value, id.value)
114
- data.value = res.entity
115
- loading.value = false
116
- } catch (error) {
117
- loading.value = false
118
- console.log(error)
119
- }
120
- }
121
- async function getOperationPageConfig() {
122
- try {
123
- const res: any = await OperationPageConfig(sourceId.value)
124
- // 筛选出评价相关的操作
125
- if (res.ltmplConfig?.rowActions) {
126
- evaluationActions.value = res.ltmplConfig.rowActions.filter((item: rowActions) => item.title.includes('评价'))
127
- }
128
- console.log(res, '222222222')
129
- } catch (error) {
130
- console.log(error)
131
- }
132
- }
133
-
134
- const actionItemShow = ref(false)
135
- const actionItem = ref<Groups>()
136
- const code = ref('')
137
- const enumColumn = ref()
138
- // 模拟 zpaging 对象,用于 ActionPopup 刷新
139
- const mockZpaging = {
140
- reload: () => getDetailData(),
141
- }
142
-
143
- // 评价按钮点击事件 - 迁移自 card-botom-buttons 的 select action 功能
144
- async function handleEvaluationClick() {
145
- if (evaluationActions.value.length === 0) {
146
- toast.error({ msg: '未找到评价操作配置' })
147
- return
148
- }
149
- // 取第一个评价操作
150
- const subitem = evaluationActions.value[0]
151
- if (subitem.writes.length) {
152
- actionItem.value = {
153
- ...groups.value,
154
- fields: subitem.writes,
155
- id: subitem.id,
156
- }
157
- code.value = id.value
158
- actionItemShow.value = true
159
- } else {
160
- try {
161
- await actionDataSave(subitem.id, id.value, {})
162
- toast.success({ msg: '评价成功!' })
163
- } catch (error: any) {
164
- toast.error(error)
165
- console.log(error)
166
- }
167
- }
168
- }
169
- </script>
170
-
171
- <template>
172
- <view class="p-4">
173
- <view v-if="loading" class="flex justify-center p-3">
174
- <wd-loading />
175
- </view>
176
- <view v-else>
177
- <view v-for="(group, index) in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
178
- <view class="text-sm space-y-3">
179
- <LabelValue :index="index" :exhibit-data="group.fields" :data="data" />
180
- </view>
181
- </view>
182
- </view>
183
- <wd-button type="primary" class="mt-4 w-full" @click="handleEvaluationClick">评价</wd-button>
184
- <ActionPopup
185
- v-model:show="actionItemShow"
186
- :enum-column="enumColumn"
187
- :zpaging="mockZpaging"
188
- :field-group="actionItem"
189
- :code="code"
190
- />
191
- </view>
192
- </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>