wui-components-v2 1.1.58 → 1.1.60
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.
|
@@ -34,13 +34,14 @@ function clear() {
|
|
|
34
34
|
|
|
35
35
|
watch(
|
|
36
36
|
() => props.modelValue,
|
|
37
|
-
|
|
37
|
+
val => {
|
|
38
38
|
currentValue.value = val
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
)
|
|
41
41
|
|
|
42
|
-
watch(currentValue,
|
|
43
|
-
|
|
42
|
+
watch(currentValue, val => {
|
|
43
|
+
const newVal = props.type === 'year' ? dayjs(val).format('YYYY') : val
|
|
44
|
+
emit('update:modelValue', newVal)
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
const labelText = computed(() => {
|
|
@@ -51,13 +52,12 @@ const labelText = computed(() => {
|
|
|
51
52
|
} = {
|
|
52
53
|
date: 'YYYY-MM-DD',
|
|
53
54
|
datetime: 'YYYY-MM-DD HH:mm',
|
|
54
|
-
year:'YYYY'
|
|
55
|
+
year: 'YYYY',
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
if (['date', 'datetime', 'year'].includes(props.type)) {
|
|
58
59
|
return currentValue.value ? dayjs(currentValue.value).format(formatMap[props.type] as string) : ''
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
60
|
+
} else {
|
|
61
61
|
return currentValue.value || ''
|
|
62
62
|
}
|
|
63
63
|
})
|
|
@@ -65,19 +65,13 @@ const labelText = computed(() => {
|
|
|
65
65
|
|
|
66
66
|
<template>
|
|
67
67
|
<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
|
-
/>
|
|
68
|
+
<wd-input v-model="labelText" readonly :placeholder="placeholder" class="flex-1" @click="open = true" />
|
|
75
69
|
<wd-icon v-if="labelText" name="close-circle" size="16px" @click="clear" />
|
|
76
70
|
<wd-icon v-else name="right" size="16px" @click="clear" />
|
|
77
71
|
</div>
|
|
78
72
|
|
|
79
73
|
<wd-calendar
|
|
80
|
-
v-if="['date', 'datetime'
|
|
74
|
+
v-if="['date', 'datetime'].includes(type)"
|
|
81
75
|
v-model="currentValue"
|
|
82
76
|
v-model:visible="open"
|
|
83
77
|
label-key="label"
|
|
@@ -100,13 +94,13 @@ const labelText = computed(() => {
|
|
|
100
94
|
.custom-date-picker {
|
|
101
95
|
width: 100%;
|
|
102
96
|
:deep(.wd-calendar__wrapper) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
:deep(.uni-scroll-view) {
|
|
109
|
-
|
|
110
|
-
}
|
|
97
|
+
padding: 0 20px;
|
|
98
|
+
overflow: auto;
|
|
99
|
+
scrollbar-width: none;
|
|
100
|
+
-ms-overflow-style: none;
|
|
101
|
+
}
|
|
102
|
+
:deep(.uni-scroll-view) {
|
|
103
|
+
scrollbar-width: none;
|
|
104
|
+
}
|
|
111
105
|
}
|
|
112
106
|
</style>
|
|
@@ -301,6 +301,9 @@ async function save() {
|
|
|
301
301
|
if (editEvent.value)
|
|
302
302
|
uni.$emit(editEvent.value, res.entityCode)
|
|
303
303
|
|
|
304
|
+
// ★ 通知 wui-select-popup 刷新列表数据
|
|
305
|
+
uni.$emit('selectPopup:refresh', sourceId.value)
|
|
306
|
+
|
|
304
307
|
subLoading.value = false
|
|
305
308
|
router.back()
|
|
306
309
|
}).catch((error: any) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
|
2
|
+
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
3
|
import { enums, listData, pageConfig, pageKey } from '../../api/page'
|
|
4
4
|
import foldCard from '../fold-card/fold-card.vue'
|
|
5
5
|
import Search from '../search/search.vue'
|
|
6
6
|
import type { Config, Entities, Enums, FoldCardModel } from '../../type'
|
|
7
7
|
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
8
|
+
import listTopButtons from '../list-top-buttons/list-top-buttons.vue'
|
|
8
9
|
|
|
9
10
|
defineOptions({
|
|
10
11
|
name: 'WuiSelectPopup',
|
|
@@ -158,6 +159,8 @@ const formatAddress = (value: string) => {
|
|
|
158
159
|
|
|
159
160
|
// 标记是否已获取配置
|
|
160
161
|
const isConfigLoaded = ref(false)
|
|
162
|
+
// ★ 防止重复加载
|
|
163
|
+
const isLoading = ref(false)
|
|
161
164
|
|
|
162
165
|
// ★ 是否已完成默认首项选中
|
|
163
166
|
const hasDefaultSelected = ref(false)
|
|
@@ -174,7 +177,6 @@ watch(datas, val => {
|
|
|
174
177
|
: Object.values(selectData.value)
|
|
175
178
|
emit('update:modelValue', result)
|
|
176
179
|
hasDefaultSelected.value = true
|
|
177
|
-
console.log('[WuiSelectPopup] ✅ 默认选中首项:', first.code)
|
|
178
180
|
})
|
|
179
181
|
|
|
180
182
|
// 获取页面配置
|
|
@@ -215,6 +217,10 @@ async function getEnums() {
|
|
|
215
217
|
|
|
216
218
|
// 查询列表数据(完整流程:config -> key -> data)
|
|
217
219
|
async function queryList(pageNo: number, pageSize: number) {
|
|
220
|
+
// ★ 首次加载时防重复(分页加载不拦截,pageNo > 1 时放行)
|
|
221
|
+
if (pageNo === 1 && isLoading.value) return
|
|
222
|
+
if (pageNo === 1) isLoading.value = true
|
|
223
|
+
|
|
218
224
|
try {
|
|
219
225
|
// 步骤1:确保配置已加载
|
|
220
226
|
if (!isConfigLoaded.value) {
|
|
@@ -261,6 +267,8 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
261
267
|
} catch (error) {
|
|
262
268
|
console.error('[WuiSelectPopup] ❌ 数据加载失败:', error)
|
|
263
269
|
Zpaging.value.complete(false)
|
|
270
|
+
} finally {
|
|
271
|
+
if (pageNo === 1) isLoading.value = false
|
|
264
272
|
}
|
|
265
273
|
}
|
|
266
274
|
|
|
@@ -336,6 +344,7 @@ function openPopup(e?: any) {
|
|
|
336
344
|
watch(show, async val => {
|
|
337
345
|
console.log('[WuiSelectPopup] 📢 show 状态变化:', val)
|
|
338
346
|
if (val) {
|
|
347
|
+
if (isLoading.value) return // ★ 防重复
|
|
339
348
|
isConfigLoaded.value = false
|
|
340
349
|
await nextTick()
|
|
341
350
|
if (Zpaging.value) {
|
|
@@ -350,7 +359,22 @@ watch(show, async val => {
|
|
|
350
359
|
}
|
|
351
360
|
})
|
|
352
361
|
|
|
362
|
+
// ★ 监听 edit-page 返回后刷新数据(通过 sourceId 过滤,只响应自己的刷新)
|
|
363
|
+
function handleRefresh(refreshSourceId: string) {
|
|
364
|
+
if (refreshSourceId !== props.sourceId) return
|
|
365
|
+
console.log('[WuiSelectPopup] 🔄 收到刷新信号,重新加载数据')
|
|
366
|
+
if (show.value && Zpaging.value && !isLoading.value) {
|
|
367
|
+
isConfigLoaded.value = false
|
|
368
|
+
Zpaging.value.reload()
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
onMounted(() => {
|
|
373
|
+
uni.$on('selectPopup:refresh', handleRefresh)
|
|
374
|
+
})
|
|
375
|
+
|
|
353
376
|
onUnmounted(() => {
|
|
377
|
+
uni.$off('selectPopup:refresh', handleRefresh)
|
|
354
378
|
uni.removeStorageSync('paramsData')
|
|
355
379
|
})
|
|
356
380
|
|
|
@@ -430,6 +454,9 @@ defineExpose({
|
|
|
430
454
|
:primary-criteria="config.primaryCriteria"
|
|
431
455
|
@submit="submitSearch"
|
|
432
456
|
/>
|
|
457
|
+
<view>
|
|
458
|
+
<listTopButtons :buttons="config.buttons" :source-id="sourceId" :page-title="pageTitle" />
|
|
459
|
+
</view>
|
|
433
460
|
<slot name="top" />
|
|
434
461
|
</template>
|
|
435
462
|
|
package/package.json
CHANGED
package/pnpm-workspace.yaml
DELETED