wui-components-v2 1.1.65 → 1.1.67
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.
- package/components/action-popup/action-popup.vue +4 -4
- package/components/add-address-page/add-address-page.vue +20 -20
- package/components/card-botom-buttons/card-botom-buttons.vue +58 -35
- package/components/custom-select-picker/custom-select-picker.vue +19 -27
- package/components/demo-block/demo-block.vue +2 -5
- package/components/detail-popup/detail-popup.vue +12 -5
- package/components/evaluation-page/evaluation-page.vue +192 -0
- package/components/fold-card/fold-card.vue +25 -5
- package/components/form-control/form-control.vue +289 -43
- package/components/label-value/label-value.vue +1 -1
- package/components/list-top-buttons/list-top-buttons.vue +1 -1
- package/components/login-form/login-form.vue +31 -26
- package/components/mulselect-picker/mulselect-picker.vue +10 -12
- package/components/privacy-popup/privacy-popup.vue +13 -0
- package/components/product-card/product-card.vue +95 -21
- package/components/search/search.vue +23 -22
- package/components/tree-select/components/index.vue +1 -1
- package/components/wui-edit-page/wui-edit-page-copy.vue +1 -1
- package/components/wui-edit-page/wui-edit-page.vue +2 -2
- package/components/wui-login/wui-login.vue +3 -3
- package/components/wui-login1/wui-login.vue +4 -4
- package/components/wui-menus1/components/navbar.vue +1 -1
- package/components/wui-menus1/components/quick-panel.vue +3 -3
- package/components/wui-menus1/components/section-menus.vue +4 -4
- package/components/wui-menus1/wui-menus-top.vue +1 -1
- package/components/wui-menus1/wui-menus-top1.vue +1 -1
- package/components/wui-menus1/wui-menus.vue +3 -3
- package/components/wui-notify-info/wui-notify-info.vue +65 -35
- package/components/wui-select-list/wui-select-list.vue +1 -1
- package/components/wui-select-popup/wui-select-popup.vue +27 -17
- package/components/wui-system-settings/wui-system-settings.vue +31 -24
- package/components/wui-tabbar/wui-tabbar.vue +14 -5
- package/components/wui-tree-page/components/tree-item.vue +51 -30
- package/components/wui-user/wui-user.vue +68 -57
- package/index.ts +5 -3
- package/package.json +1 -1
- package/store/manualThemeStore.ts +7 -7
- package/styles/dark-mode.scss +424 -0
|
@@ -72,11 +72,11 @@ async function action() {
|
|
|
72
72
|
<template>
|
|
73
73
|
<wd-popup v-model="show" position="bottom" closable :z-index="999999" @close="() => { show = false }">
|
|
74
74
|
<view class="h-50vh w-100vw">
|
|
75
|
-
<view class="h-44px
|
|
76
|
-
<view class="w-[calc(100%-44px)] overflow-auto
|
|
75
|
+
<view class="h-44px bg-white dark:bg-[var(--wot-dark-background)]" />
|
|
76
|
+
<view class="w-[calc(100%-44px)] overflow-auto bg-white dark:bg-[var(--wot-dark-background)]">
|
|
77
77
|
<formControl v-if="props.fieldGroup" ref="formControlRef" :field-group="props.fieldGroup" :enum-column="enumColumn" />
|
|
78
|
-
<view class="h-44px
|
|
79
|
-
<view class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2
|
|
78
|
+
<view class="h-44px bg-white dark:bg-[var(--wot-dark-background)]" />
|
|
79
|
+
<view class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 bg-white dark:bg-[var(--wot-dark-background)]">
|
|
80
80
|
<wd-button :loading="btnLoading" custom-class="flex-1" @click="() => { action() }">
|
|
81
81
|
提交
|
|
82
82
|
</wd-button>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="
|
|
3
|
-
<view class="
|
|
4
|
-
<wd-textarea v-model="personDetail" placeholder="「粘贴识别」或输入文本,智能拆分、姓名、电话和地址"
|
|
5
|
-
<view class="
|
|
6
|
-
|
|
2
|
+
<view class="rounded-md mb-3">
|
|
3
|
+
<view class="rounded-md shadow-md bg-white pb-3">
|
|
4
|
+
<wd-textarea v-model="personDetail" placeholder="「粘贴识别」或输入文本,智能拆分、姓名、电话和地址" />
|
|
5
|
+
<view class="flex justify-end align-center px-3">
|
|
6
|
+
<view class="px-3 text-white bg-[#007AFF] rounded-md py-1 text-sm box-border" @click="identifyingFn">
|
|
7
|
+
智能识别
|
|
8
|
+
</view>
|
|
7
9
|
</view>
|
|
8
10
|
</view>
|
|
9
11
|
</view>
|
|
@@ -22,16 +24,16 @@ const props = defineProps<{
|
|
|
22
24
|
const model = defineModel<any>()
|
|
23
25
|
const personDetail = ref('')
|
|
24
26
|
const loading = ref(false)
|
|
25
|
-
const form=ref(null)
|
|
27
|
+
const form = ref(null)
|
|
26
28
|
/**
|
|
27
29
|
* @description: 智能识别
|
|
28
30
|
*/
|
|
29
|
-
function identifyingFn(){
|
|
30
|
-
if(!personDetail.value){
|
|
31
|
-
|
|
31
|
+
function identifyingFn() {
|
|
32
|
+
if (!personDetail.value) {
|
|
33
|
+
toast.info('请输入内容')
|
|
32
34
|
return
|
|
33
35
|
}
|
|
34
|
-
const currentValue:any =
|
|
36
|
+
const currentValue: any = parse(personDetail.value)
|
|
35
37
|
console.log('智能识别', currentValue)
|
|
36
38
|
if (!currentValue) {
|
|
37
39
|
toast.info('无法识别地址')
|
|
@@ -44,34 +46,32 @@ function identifyingFn(){
|
|
|
44
46
|
switch (index) {
|
|
45
47
|
case 0:
|
|
46
48
|
model.value[item.sourceId] = currentValue.name || ''
|
|
47
|
-
break
|
|
49
|
+
break
|
|
48
50
|
case 1:
|
|
49
51
|
model.value[item.sourceId] = currentValue.telNumber || currentValue.phone || ''
|
|
50
|
-
break
|
|
52
|
+
break
|
|
51
53
|
case 2:
|
|
52
54
|
model.value[item.sourceId] = currentValue.provinceName || ''
|
|
53
|
-
break
|
|
55
|
+
break
|
|
54
56
|
case 3:
|
|
55
57
|
model.value[item.sourceId] = currentValue.cityName || ''
|
|
56
|
-
break
|
|
58
|
+
break
|
|
57
59
|
case 4:
|
|
58
60
|
model.value[item.sourceId] = currentValue.countyName || ''
|
|
59
|
-
break
|
|
61
|
+
break
|
|
60
62
|
case 5:
|
|
61
63
|
model.value[item.sourceId] = currentValue.address || ''
|
|
62
|
-
break
|
|
64
|
+
break
|
|
63
65
|
default:
|
|
64
|
-
break
|
|
66
|
+
break
|
|
65
67
|
}
|
|
66
68
|
})
|
|
67
69
|
console.log('智能识别', currentValue)
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
71
|
</script>
|
|
72
72
|
|
|
73
73
|
<style scoped>
|
|
74
|
-
.custom-border{
|
|
74
|
+
.custom-border {
|
|
75
75
|
border-bottom: 0.6px solid #e8e8e8;
|
|
76
76
|
}
|
|
77
77
|
</style>
|
|
@@ -61,19 +61,22 @@ function edit() {
|
|
|
61
61
|
const sourceData = props.item.classEditConfigs.find((item: ClassEditConfigs) => {
|
|
62
62
|
return item.preposes[0].transDefaultValue.includes(props.data.fieldMap[item.preposes[0].sourceId])
|
|
63
63
|
})
|
|
64
|
-
router.push(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
router.push(
|
|
65
|
+
`/pages/edit-page/index?sourceId=${sourceData?.id || props.sourceId}&id=${props.code}&title=${props.item.title}&pageType=${props.pageType}&addEvent=${props.addEvent}`
|
|
66
|
+
)
|
|
67
|
+
} else {
|
|
68
|
+
router.push(
|
|
69
|
+
`/pages/edit-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}&pageType=${props.pageType}&addEvent=${props.addEvent}`
|
|
70
|
+
)
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
const actionItem = ref<Groups>()
|
|
72
|
-
const actionItemShow = ref(false)// rowActions输入弹框开关
|
|
73
|
-
const showMoreButn = ref(false)// 更多按钮开关
|
|
75
|
+
const actionItemShow = ref(false) // rowActions输入弹框开关
|
|
76
|
+
const showMoreButn = ref(false) // 更多按钮开关
|
|
74
77
|
// 打开rowActions弹框
|
|
75
78
|
async function action(subitem: rowActions) {
|
|
76
|
-
console.log(subitem)
|
|
79
|
+
console.log(subitem, 2222222222222222)
|
|
77
80
|
if (subitem.writes.length) {
|
|
78
81
|
actionItem.value = {
|
|
79
82
|
...props.item,
|
|
@@ -81,14 +84,12 @@ async function action(subitem: rowActions) {
|
|
|
81
84
|
id: subitem.id,
|
|
82
85
|
}
|
|
83
86
|
actionItemShow.value = true
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
87
|
+
} else {
|
|
86
88
|
try {
|
|
87
89
|
await actionDataSave(subitem.id, props.code, {})
|
|
88
90
|
props.zpaging.reload()
|
|
89
91
|
toast.success({ msg: '操作成功!' })
|
|
90
|
-
}
|
|
91
|
-
catch (error: any) {
|
|
92
|
+
} catch (error: any) {
|
|
92
93
|
toast.error(error)
|
|
93
94
|
console.log(error)
|
|
94
95
|
}
|
|
@@ -97,7 +98,9 @@ async function action(subitem: rowActions) {
|
|
|
97
98
|
|
|
98
99
|
// 跳转raction页面
|
|
99
100
|
function raction(subitem: rowActions) {
|
|
100
|
-
router.push(
|
|
101
|
+
router.push(
|
|
102
|
+
`/pages/list/index?sourceId=${subitem.id}&mainCode=${props.code}&title=${subitem.title}&pageType=${props.pageType}`
|
|
103
|
+
)
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
// 跳转详情页面
|
|
@@ -121,7 +124,10 @@ function isShowAction(item: rowActions) {
|
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
function isControlType(item: Columns): string {
|
|
124
|
-
return ControlTypeSupportor.getControlType(
|
|
127
|
+
return ControlTypeSupportor.getControlType(
|
|
128
|
+
{ ...item, hidden: false, disabled: false, defaultValue: '', transDefaultValue: '', required: false },
|
|
129
|
+
props.data.fieldMap[item.sourceId]
|
|
130
|
+
)
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
// 删除
|
|
@@ -137,15 +143,12 @@ function del() {
|
|
|
137
143
|
toast.success({ msg: '删除成功!' })
|
|
138
144
|
}
|
|
139
145
|
message.close()
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
146
|
+
} catch (error) {
|
|
142
147
|
console.log(error)
|
|
143
|
-
}
|
|
144
|
-
finally {
|
|
148
|
+
} finally {
|
|
145
149
|
resolve(true)
|
|
146
150
|
}
|
|
147
151
|
},
|
|
148
|
-
|
|
149
152
|
})
|
|
150
153
|
}
|
|
151
154
|
|
|
@@ -157,7 +160,7 @@ interface Morebutns extends Omit<rowActions, ''> {
|
|
|
157
160
|
const morebutns = computed(() => {
|
|
158
161
|
let buts: Morebutns[] = []
|
|
159
162
|
if (props.rowActions) {
|
|
160
|
-
buts = anctions.value.map(
|
|
163
|
+
buts = anctions.value.map(item => {
|
|
161
164
|
return {
|
|
162
165
|
actionType: 'rowActions',
|
|
163
166
|
name: item.title,
|
|
@@ -167,26 +170,24 @@ const morebutns = computed(() => {
|
|
|
167
170
|
}
|
|
168
171
|
if (props.ractions) {
|
|
169
172
|
buts = buts.concat(
|
|
170
|
-
ractions.value.map(
|
|
173
|
+
ractions.value.map(item => {
|
|
171
174
|
return {
|
|
172
175
|
actionType: 'ractions',
|
|
173
176
|
name: item.title,
|
|
174
177
|
...item,
|
|
175
178
|
}
|
|
176
|
-
})
|
|
177
|
-
|
|
179
|
+
})
|
|
178
180
|
)
|
|
179
181
|
}
|
|
180
182
|
if (props.actions) {
|
|
181
183
|
buts = buts.concat(
|
|
182
|
-
actions.value.map(
|
|
184
|
+
actions.value.map(item => {
|
|
183
185
|
return {
|
|
184
186
|
actionType: 'rowActions',
|
|
185
187
|
name: item.title,
|
|
186
188
|
...item,
|
|
187
189
|
}
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
+
})
|
|
190
191
|
)
|
|
191
192
|
}
|
|
192
193
|
return buts
|
|
@@ -199,6 +200,9 @@ function closeMoreButn() {
|
|
|
199
200
|
|
|
200
201
|
// 点击更多按钮
|
|
201
202
|
function select({ item }: { item: any }) {
|
|
203
|
+
if (item.title.includes('评价') && item.actionType === 'rowActions') {
|
|
204
|
+
return action(item)
|
|
205
|
+
}
|
|
202
206
|
message.confirm({
|
|
203
207
|
msg: `确定${item.title}操作吗?`,
|
|
204
208
|
title: '提示',
|
|
@@ -212,6 +216,7 @@ function select({ item }: { item: any }) {
|
|
|
212
216
|
},
|
|
213
217
|
})
|
|
214
218
|
}
|
|
219
|
+
console.log(props, '3333333333333')
|
|
215
220
|
</script>
|
|
216
221
|
|
|
217
222
|
<template>
|
|
@@ -227,28 +232,46 @@ function select({ item }: { item: any }) {
|
|
|
227
232
|
</wd-button>
|
|
228
233
|
</view> -->
|
|
229
234
|
<view>
|
|
230
|
-
<wd-button
|
|
235
|
+
<wd-button
|
|
236
|
+
v-if="morebutns.length > 3"
|
|
237
|
+
size="small"
|
|
238
|
+
type="info"
|
|
239
|
+
@click="
|
|
240
|
+
() => {
|
|
241
|
+
showMoreButn = true
|
|
242
|
+
}
|
|
243
|
+
"
|
|
244
|
+
>
|
|
231
245
|
更多
|
|
232
246
|
</wd-button>
|
|
233
247
|
<view v-else class="flex gap-2 flex-wrap">
|
|
234
|
-
<wd-button
|
|
248
|
+
<wd-button
|
|
249
|
+
v-for="subitem in morebutns"
|
|
250
|
+
:key="subitem.id"
|
|
251
|
+
plain
|
|
252
|
+
size="small"
|
|
253
|
+
@click="
|
|
254
|
+
() => {
|
|
255
|
+
select({ item: subitem })
|
|
256
|
+
}
|
|
257
|
+
"
|
|
258
|
+
>
|
|
235
259
|
{{ subitem.title }}
|
|
236
260
|
</wd-button>
|
|
237
261
|
</view>
|
|
238
262
|
</view>
|
|
239
263
|
|
|
240
|
-
<wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">
|
|
241
|
-
|
|
242
|
-
</wd-button>
|
|
243
|
-
<wd-button v-if="props.item.buttons.includes('detail')" size="small" type="info" @click="detail()">
|
|
244
|
-
详情
|
|
245
|
-
</wd-button>
|
|
264
|
+
<wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">编辑</wd-button>
|
|
265
|
+
<wd-button v-if="props.item.buttons.includes('detail')" size="small" type="info" @click="detail()">详情</wd-button>
|
|
246
266
|
<wd-button v-if="props.item.buttons.includes('singleDelete')" size="small" type="danger" @click="del()">
|
|
247
267
|
删除
|
|
248
268
|
</wd-button>
|
|
249
269
|
<ActionPopup
|
|
250
|
-
v-model:show="actionItemShow"
|
|
251
|
-
:
|
|
270
|
+
v-model:show="actionItemShow"
|
|
271
|
+
:enum-column="props.enumColumn"
|
|
272
|
+
:zpaging="props.zpaging"
|
|
273
|
+
:field-group="actionItem"
|
|
274
|
+
:code="props.code"
|
|
252
275
|
/>
|
|
253
276
|
<!-- 更多按钮 -->
|
|
254
277
|
<wd-action-sheet v-model="showMoreButn" :actions="morebutns" @close="closeMoreButn" @select="select" />
|
|
@@ -34,44 +34,36 @@ function clear() {
|
|
|
34
34
|
|
|
35
35
|
watch(
|
|
36
36
|
() => props.modelValue,
|
|
37
|
-
|
|
37
|
+
val => {
|
|
38
38
|
console.log('val', val, Array.isArray(val))
|
|
39
39
|
currentValue.value = val
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
watch(currentValue,
|
|
43
|
+
watch(currentValue, val => {
|
|
44
44
|
emit('update:modelValue', val)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
const labelText = computed(() => {
|
|
48
48
|
// 多选情况:currentValue 是数组
|
|
49
49
|
if (Array.isArray(currentValue.value)) {
|
|
50
|
-
const labels = currentValue.value
|
|
51
|
-
|
|
52
|
-
item => item[props.valueKey] === val
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const labels = currentValue.value
|
|
51
|
+
.map(val => {
|
|
52
|
+
const item = props.columns.find(item => item[props.valueKey] === val)
|
|
53
|
+
return item ? item[props.labelKey] : ''
|
|
54
|
+
})
|
|
55
|
+
.filter(Boolean)
|
|
56
56
|
return labels.join(', ')
|
|
57
57
|
}
|
|
58
58
|
// 单选情况:currentValue 是单个值
|
|
59
|
-
const item = props.columns.find(
|
|
60
|
-
item => item[props.valueKey] === currentValue.value,
|
|
61
|
-
)
|
|
59
|
+
const item = props.columns.find(item => item[props.valueKey] === currentValue.value)
|
|
62
60
|
return item ? item[props.labelKey] : ''
|
|
63
61
|
})
|
|
64
62
|
</script>
|
|
65
63
|
|
|
66
64
|
<template>
|
|
67
65
|
<div class="flex items-center justify-between">
|
|
68
|
-
<wd-input
|
|
69
|
-
v-model="labelText"
|
|
70
|
-
readonly
|
|
71
|
-
:placeholder="placeholder"
|
|
72
|
-
class="flex-1"
|
|
73
|
-
@click="open = true"
|
|
74
|
-
/>
|
|
66
|
+
<wd-input v-model="labelText" readonly :placeholder="placeholder" class="flex-1" @click="open = true" />
|
|
75
67
|
<wd-icon v-if="labelText" name="close-circle" size="16px" @click="clear" />
|
|
76
68
|
<wd-icon v-else name="right" size="16px" @click="clear" />
|
|
77
69
|
</div>
|
|
@@ -91,13 +83,13 @@ const labelText = computed(() => {
|
|
|
91
83
|
.custom-select-picker {
|
|
92
84
|
width: 100%;
|
|
93
85
|
:deep(.wd-select-picker__wrapper) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
:deep(.uni-scroll-view) {
|
|
100
|
-
|
|
101
|
-
}
|
|
86
|
+
padding: 0 20px;
|
|
87
|
+
overflow: auto;
|
|
88
|
+
scrollbar-width: none;
|
|
89
|
+
-ms-overflow-style: none;
|
|
90
|
+
}
|
|
91
|
+
:deep(.uni-scroll-view) {
|
|
92
|
+
scrollbar-width: none;
|
|
93
|
+
}
|
|
102
94
|
}
|
|
103
95
|
</style>
|
|
@@ -51,12 +51,9 @@ export default {
|
|
|
51
51
|
<template>
|
|
52
52
|
<view
|
|
53
53
|
class="mb-3 box-border w-full px-3 text-gray-500 last:mb-0 dark:text-gray-300"
|
|
54
|
-
:class="[
|
|
55
|
-
transparent ? '' : 'bg-white dark:bg-[var(--wot-dark-background2)]',
|
|
56
|
-
customClass,
|
|
57
|
-
]"
|
|
54
|
+
:class="[transparent ? '' : 'bg-white dark:bg-[var(--wot-dark-background2)]', customClass]"
|
|
58
55
|
>
|
|
59
|
-
<view v-if="title" class="px-4 py-3 text-26rpx">
|
|
56
|
+
<view v-if="title" class="px-4 py-3 text-26rpx dark:text-gray-200">
|
|
60
57
|
{{ title }}
|
|
61
58
|
</view>
|
|
62
59
|
<view :style="transparent ? '' : style">
|
|
@@ -54,11 +54,11 @@ function handleClose() {
|
|
|
54
54
|
<view class="text-[#1c64fd]" @click="open">{{ text }}</view>
|
|
55
55
|
<wd-popup v-model="showDetail" custom-style="border-radius: 32rpx;">
|
|
56
56
|
<view class="custom-popup">
|
|
57
|
-
<view class="text-center mb-4">详情内容</view>
|
|
57
|
+
<view class="text-center mb-4 text-gray-900 dark:text-gray-100">详情内容</view>
|
|
58
58
|
<scroll-view scroll-y class="scroll-area">
|
|
59
|
-
<view class="flex items-center gap-2 mb-4 text-
|
|
60
|
-
<view class="break-words">{{ item.title }}:</view>
|
|
61
|
-
<view class="text-
|
|
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
62
|
{{ formatItemData(rowData.fieldMap[item.sourceId], isControlType(item)) }}
|
|
63
63
|
</view>
|
|
64
64
|
</view>
|
|
@@ -72,7 +72,7 @@ function handleClose() {
|
|
|
72
72
|
|
|
73
73
|
<style scoped lang="scss">
|
|
74
74
|
.custom-popup {
|
|
75
|
-
color:
|
|
75
|
+
color: var(--wot-dark-color, #333);
|
|
76
76
|
padding: 24rpx;
|
|
77
77
|
width: 600rpx;
|
|
78
78
|
max-width: 600rpx;
|
|
@@ -89,4 +89,11 @@ function handleClose() {
|
|
|
89
89
|
margin-top: 24rpx;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
// 暗黑模式适配
|
|
94
|
+
:global(.wot-theme-dark) {
|
|
95
|
+
.custom-popup {
|
|
96
|
+
color: var(--wot-dark-color2, #e0e0e0);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
92
99
|
</style>
|
|
@@ -0,0 +1,192 @@
|
|
|
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>
|
|
@@ -90,7 +90,12 @@ function toggleCollapse(contentId: string) {
|
|
|
90
90
|
<view>
|
|
91
91
|
<view class="flex items-center gap-2">
|
|
92
92
|
<view class="overflow-hidden text-ellipsis font-700">
|
|
93
|
-
{{
|
|
93
|
+
{{
|
|
94
|
+
formatItemData(
|
|
95
|
+
data.fieldMap[props.primaryColumn.sourceId],
|
|
96
|
+
props.primaryColumn.extControlType || props.primaryColumn.controlType
|
|
97
|
+
)
|
|
98
|
+
}}
|
|
94
99
|
</view>
|
|
95
100
|
<slot name="addressInfo" />
|
|
96
101
|
</view>
|
|
@@ -101,10 +106,17 @@ function toggleCollapse(contentId: string) {
|
|
|
101
106
|
v-if="props.labelColumn"
|
|
102
107
|
class="whitespace-nowrap rounded px-1 py-1 text-sm text-white font-700"
|
|
103
108
|
:style="{
|
|
104
|
-
color: labelColumns?.find(
|
|
109
|
+
color: labelColumns?.find(
|
|
110
|
+
item => props.labelColumn && item.value === data.fieldMap[props.labelColumn.sourceId]
|
|
111
|
+
)?.css?.color,
|
|
105
112
|
}"
|
|
106
113
|
>
|
|
107
|
-
{{
|
|
114
|
+
{{
|
|
115
|
+
formatItemData(
|
|
116
|
+
data.fieldMap[props.labelColumn.sourceId],
|
|
117
|
+
props.labelColumn.extControlType || props.labelColumn.controlType
|
|
118
|
+
)
|
|
119
|
+
}}
|
|
108
120
|
</view>
|
|
109
121
|
</view>
|
|
110
122
|
|
|
@@ -129,7 +141,15 @@ function toggleCollapse(contentId: string) {
|
|
|
129
141
|
<view class="flex items-center justify-between border-t border-gray-100">
|
|
130
142
|
<!-- 折叠按钮 -->
|
|
131
143
|
<view>
|
|
132
|
-
<wd-icon
|
|
144
|
+
<wd-icon
|
|
145
|
+
v-if="showCollapse"
|
|
146
|
+
id="toggle-btn-2"
|
|
147
|
+
name="down"
|
|
148
|
+
size="24px"
|
|
149
|
+
:icon="collapseIcon"
|
|
150
|
+
class="mr-auto flex items-center px-3 py-2 text-sm text-[#6b7280] !py-1"
|
|
151
|
+
@click.stop="toggleCollapse(data.code)"
|
|
152
|
+
/>
|
|
133
153
|
</view>
|
|
134
154
|
|
|
135
155
|
<view class="flex items-center gap-1">
|
|
@@ -146,6 +166,6 @@ function toggleCollapse(contentId: string) {
|
|
|
146
166
|
background-color: #f9f9f9 !important;
|
|
147
167
|
}
|
|
148
168
|
:deep(.wot-theme-dark .wd-collapse-item__body) {
|
|
149
|
-
background-color: #
|
|
169
|
+
background-color: #1b1b1e !important;
|
|
150
170
|
}
|
|
151
171
|
</style>
|