wui-components-v2 1.1.69 → 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 (45) 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/add-address-page/add-address-page.vue +77 -77
  6. package/components/custom-date-picker/custom-date-picker.vue +106 -106
  7. package/components/custom-select-picker/custom-select-picker.vue +95 -95
  8. package/components/demo-block/demo-block.vue +63 -63
  9. package/components/detail-popup/detail-popup.vue +99 -99
  10. package/components/evaluation-page/evaluation-page.vue +196 -196
  11. package/components/fold-card/fold-card.vue +171 -171
  12. package/components/form-control/form-control.vue +661 -661
  13. package/components/global-message/global-message.vue +68 -68
  14. package/components/label-value/label-value.vue +144 -144
  15. package/components/list-top-buttons/list-top-buttons.vue +19 -19
  16. package/components/login-form/login-form.vue +126 -126
  17. package/components/mulselect-picker/mulselect-picker.vue +86 -86
  18. package/components/product-card/product-card.vue +201 -201
  19. package/components/search/search.vue +128 -128
  20. package/components/user-choose/user-choose.vue +1 -1
  21. package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
  22. package/components/wui-list/wui-list.vue +235 -235
  23. package/components/wui-menus/wui-menus.vue +247 -247
  24. package/components/wui-menus1/components/navbar.vue +43 -43
  25. package/components/wui-menus1/wui-menus.vue +564 -564
  26. package/components/wui-notify-info/wui-notify-info.vue +280 -280
  27. package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
  28. package/components/wui-select-list/wui-select-list.vue +310 -310
  29. package/components/wui-select-popup/wui-select-popup.vue +612 -612
  30. package/components/wui-system-settings/wui-system-settings.vue +144 -144
  31. package/components/wui-tabbar/wui-tabbar.vue +106 -106
  32. package/components/wui-tree-page/components/tree-item.vue +238 -238
  33. package/components/wui-user/wui-user.vue +202 -202
  34. package/composables/useCompanyFieldFilter.ts +91 -91
  35. package/composables/useEnumes.ts +2 -2
  36. package/composables/useMenus.ts +193 -193
  37. package/index.ts +83 -83
  38. package/package.json +1 -1
  39. package/static/iconfont/iconfont.css +63 -63
  40. package/store/language.ts +151 -151
  41. package/styles/dark-mode.css +523 -523
  42. package/styles/dark-mode.min.css +1 -1
  43. package/type.ts +2 -2
  44. package/utils/control-tree.ts +2 -2
  45. 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,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>