wui-components-v2 1.2.95 → 1.2.98
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.
|
@@ -21,7 +21,6 @@ const props = defineProps<{
|
|
|
21
21
|
pageType?: string
|
|
22
22
|
data: Entities
|
|
23
23
|
rowActions?: rowActions[]
|
|
24
|
-
actions?: rowActions[]
|
|
25
24
|
ractions?: rowActions[]
|
|
26
25
|
zpaging?: any
|
|
27
26
|
enumColumn?: Enums
|
|
@@ -76,12 +75,6 @@ const ractions = computed(() => {
|
|
|
76
75
|
return list.filter(isActionVisible)
|
|
77
76
|
})
|
|
78
77
|
|
|
79
|
-
// actions按钮
|
|
80
|
-
const actions = computed(() => {
|
|
81
|
-
const actions = props.actions || []
|
|
82
|
-
return [...actions.filter(isActionVisible)]
|
|
83
|
-
})
|
|
84
|
-
|
|
85
78
|
// 跳转编辑页面
|
|
86
79
|
function edit() {
|
|
87
80
|
if (props.item.classEditConfigs && props.item.classEditConfigs.length > 0) {
|
|
@@ -267,6 +260,8 @@ function detail() {
|
|
|
267
260
|
|
|
268
261
|
// 判断按钮是否满足条件显示
|
|
269
262
|
function isActionVisible(item?: { preposes?: Fields[] }) {
|
|
263
|
+
// TODO: 临时跳过显隐条件判断,用于测试「报警处理」按钮显示,测试完删除这行恢复原逻辑
|
|
264
|
+
return true
|
|
270
265
|
if (item?.preposes?.length) {
|
|
271
266
|
return item.preposes.every((prepose: Fields) => {
|
|
272
267
|
// 判断字段值是否满足要求
|
|
@@ -396,25 +391,56 @@ const morebutns = computed(() => {
|
|
|
396
391
|
})
|
|
397
392
|
)
|
|
398
393
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
actions.value
|
|
402
|
-
// 列表级批量 action(multible === true)只在底部批量操作条展示,不渲染到行上
|
|
403
|
-
.filter(item => item.multible !== true)
|
|
404
|
-
.map(item => {
|
|
405
|
-
return {
|
|
406
|
-
actionType: 'rowActions',
|
|
407
|
-
name: item.title,
|
|
408
|
-
...item,
|
|
409
|
-
}
|
|
410
|
-
})
|
|
411
|
-
)
|
|
412
|
-
}
|
|
394
|
+
// 只有 row 开头的字段(rowActions / ractions / rowCustomButtons)渲染到行上;
|
|
395
|
+
// actions / customButtons 属列表级,分别在底部批量操作条展示,不进每行
|
|
413
396
|
return buts
|
|
414
397
|
})
|
|
415
398
|
|
|
399
|
+
// doType === 'show_window' 时跳转按钮配置的 path(rowCustomButtons 等行级按钮)
|
|
400
|
+
function goShowWindow(item: rowActions) {
|
|
401
|
+
if (!item.path) {
|
|
402
|
+
console.warn('[show_window] 按钮未配置 path', item)
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
// 只对 path 中未编码的非 ASCII 做编码,避免二次编码已编码的 % 导致 App 端乱码
|
|
406
|
+
let safePath = String(item.path).replace(/[^\x00-\x7F]+/g, s => encodeURIComponent(s))
|
|
407
|
+
// 绝对路径补前导斜杠(相对路径不受影响)
|
|
408
|
+
if (!safePath.startsWith('/') && !safePath.startsWith('./') && !safePath.startsWith('../')) {
|
|
409
|
+
safePath = `/${safePath}`
|
|
410
|
+
}
|
|
411
|
+
// 拼接当前列表的 sourceId 与当前行数据 code;path 配置里已携带的参数以配置为准,缺失的才补
|
|
412
|
+
const hasSourceId = /[?&]sourceId=/.test(safePath)
|
|
413
|
+
const hasId = /[?&]id=/.test(safePath)
|
|
414
|
+
const params: string[] = []
|
|
415
|
+
if (!hasSourceId) params.push(`sourceId=${props.sourceId}`)
|
|
416
|
+
if (!hasId) params.push(`id=${props.code}`)
|
|
417
|
+
if (params.length) {
|
|
418
|
+
const sep = safePath.includes('?') ? '&' : '?'
|
|
419
|
+
safePath = `${safePath}${sep}${params.join('&')}`
|
|
420
|
+
}
|
|
421
|
+
console.log('[show_window] 跳转 path:', safePath)
|
|
422
|
+
try {
|
|
423
|
+
router.push(safePath)
|
|
424
|
+
} catch (e) {
|
|
425
|
+
// 项目注册了 beforeEach 守卫,uni-mini-router 会先在路由表中查找 path,
|
|
426
|
+
// 查不到时内部 JSON.parse(undefined) 抛错;此处回退原生跳转兜底
|
|
427
|
+
console.warn('[show_window] router.push 失败,回退 uni.navigateTo:', safePath, e)
|
|
428
|
+
uni.navigateTo({
|
|
429
|
+
url: safePath,
|
|
430
|
+
fail: err => {
|
|
431
|
+
console.error('[show_window] 页面跳转失败,请确认 path 已在 pages.json 注册:', safePath, err)
|
|
432
|
+
uni.showToast({ title: '页面跳转失败', icon: 'error' })
|
|
433
|
+
},
|
|
434
|
+
})
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
416
438
|
// 点击操作按钮
|
|
417
439
|
async function select({ item }: { item: any }) {
|
|
440
|
+
// 配置了 doType === 'show_window' 的按钮直接跳转配置的 path,不走确认与数据操作
|
|
441
|
+
if (item.doType === 'show_window') {
|
|
442
|
+
return goShowWindow(item)
|
|
443
|
+
}
|
|
418
444
|
if (item.title.includes('评价') && item.actionType === 'rowActions') {
|
|
419
445
|
return action(item)
|
|
420
446
|
}
|
|
@@ -46,9 +46,11 @@ watch(
|
|
|
46
46
|
)
|
|
47
47
|
// 判断字段实际渲染的控件类型是否为纯文本输入(优先 extControlType,回退 controlType)
|
|
48
48
|
const isTextCriterion = (item: Fields) => ControlTypeSupportor.getControlType(item) === 'text'
|
|
49
|
-
// 用于 wd-search 的搜索字段:primaryCriterion
|
|
49
|
+
// 用于 wd-search 的搜索字段:primaryCriterion 存在且实际控件类型是文本时才用作搜索框
|
|
50
|
+
// (服务端可能把 relselect/table-entity-select 等选择类字段指成 primaryCriterion,
|
|
51
|
+
// 文本框语义上无法承载它们的取值格式,此时让它回落到筛选弹窗渲染成正确控件)
|
|
50
52
|
const searchCriterion = computed(() => {
|
|
51
|
-
if (props.primaryCriterion) {
|
|
53
|
+
if (props.primaryCriterion && isTextCriterion(props.primaryCriterion)) {
|
|
52
54
|
return props.primaryCriterion
|
|
53
55
|
}
|
|
54
56
|
return props.criteria.find(item => isTextCriterion(item)) || null
|
|
@@ -70,8 +72,14 @@ const filterCriteria = computed(() => {
|
|
|
70
72
|
// 否则(extControlType 存在)该字段应回落到筛选弹窗中参与筛选
|
|
71
73
|
const searchSourceId = showSearch.value ? searchCriterion.value?.sourceId : undefined
|
|
72
74
|
// 弹窗筛选需保留 preferred 字段(与外置字段双向绑定),因此不排除 preferredCriteria
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
const list = props.criteria.filter(item => !split2TabSourceIds.value.includes(item.sourceId))
|
|
76
|
+
// primaryCriterion 若不在 criteria 数组里(服务端分开下发),回落时补进弹窗,避免字段静默消失
|
|
77
|
+
const primary = props.primaryCriterion
|
|
78
|
+
if (primary && primary.sourceId && !list.some(item => item.sourceId === primary.sourceId)) {
|
|
79
|
+
list.push(primary)
|
|
80
|
+
}
|
|
81
|
+
if (!searchSourceId) return list
|
|
82
|
+
return list.filter(item => item.sourceId !== searchSourceId)
|
|
75
83
|
})
|
|
76
84
|
// 把外部/弹窗表单返回的数据归一化后再写入 entity:
|
|
77
85
|
// 数组值统一转成逗号分隔字符串,避免弹窗 initFormData 对数组调用 split 报错导致空白
|
|
@@ -16,10 +16,13 @@ import { useEnums } from '../../composables/useEnumes'
|
|
|
16
16
|
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
17
17
|
import { useGlobalMessage } from '../../composables/useGlobalMessage'
|
|
18
18
|
import GlobalMessage from '../global-message/global-message.vue'
|
|
19
|
+
import { useManualThemeStore } from '../../store/manualThemeStore'
|
|
19
20
|
|
|
20
21
|
defineOptions({
|
|
21
22
|
name: 'WuiList',
|
|
22
23
|
})
|
|
24
|
+
// 列表页通常没有 default 布局(无 wd-config-provider 祖先),暗色类需自行挂到 batch-bar 上
|
|
25
|
+
const themeStore = useManualThemeStore()
|
|
23
26
|
const props = withDefaults(
|
|
24
27
|
defineProps<{
|
|
25
28
|
/** 数据源 ID,用于获取页面配置和列表数据 */
|
|
@@ -229,16 +232,16 @@ const selectMode = ref(false)
|
|
|
229
232
|
/**
|
|
230
233
|
* 批量 action 按钮列表:
|
|
231
234
|
* 1. 优先使用 props.batchActions(调用方显式指定);
|
|
232
|
-
* 2.
|
|
235
|
+
* 2. 否则收集列表配置里的 customButtons(全部)与 actions(仅 multible === true),按 id 去重。
|
|
233
236
|
*/
|
|
234
237
|
const batchActionButtons = computed(() => {
|
|
235
238
|
if (props.batchActions && props.batchActions.length) {
|
|
236
239
|
return props.batchActions
|
|
237
240
|
}
|
|
238
|
-
const
|
|
241
|
+
const customs = config.value.customButtons || []
|
|
242
|
+
const actions = (config.value.actions || []).filter(item => item.multible === true)
|
|
239
243
|
const seen = new Set<string>()
|
|
240
|
-
|
|
241
|
-
return merged.filter(item => item.multible === true && (seen.has(item.id) ? false : (seen.add(item.id), true)))
|
|
244
|
+
return [...customs, ...actions].filter(item => (seen.has(item.id) ? false : (seen.add(item.id), true)))
|
|
242
245
|
})
|
|
243
246
|
/** 已选 code 的逗号分隔字符串,供批量接口与弹窗透传 */
|
|
244
247
|
const selectedCodesStr = computed(() => Array.from(selectedCodes.value).join(','))
|
|
@@ -685,7 +688,6 @@ function tabSearchClick(data: any) {
|
|
|
685
688
|
:detail-button-handle="detailButtonHandle"
|
|
686
689
|
:zpaging="Zpaging"
|
|
687
690
|
:enum-column="enumColumn"
|
|
688
|
-
:actions="config.actions"
|
|
689
691
|
:row-actions="config.rowActions"
|
|
690
692
|
:ractions="config.ractions"
|
|
691
693
|
:source-id="internalSourceId"
|
|
@@ -738,7 +740,6 @@ function tabSearchClick(data: any) {
|
|
|
738
740
|
:detail-button-handle="detailButtonHandle"
|
|
739
741
|
:zpaging="Zpaging"
|
|
740
742
|
:enum-column="enumColumn"
|
|
741
|
-
:actions="config.actions"
|
|
742
743
|
:row-actions="config.rowActions"
|
|
743
744
|
:ractions="config.ractions"
|
|
744
745
|
:source-id="internalSourceId"
|
|
@@ -759,7 +760,7 @@ function tabSearchClick(data: any) {
|
|
|
759
760
|
</view>
|
|
760
761
|
|
|
761
762
|
<!-- 底部批量操作条 -->
|
|
762
|
-
<view v-if="showBatchBar" class="batch-bar" @click.stop>
|
|
763
|
+
<view v-if="showBatchBar" class="batch-bar" :class="{ 'wot-theme-dark': themeStore.isDark }" @click.stop>
|
|
763
764
|
<view class="batch-bar__inner">
|
|
764
765
|
<view class="batch-bar__checkbox" @click.stop>
|
|
765
766
|
<wd-checkbox :model-value="allChecked" @change="toggleSelectAll">
|
|
@@ -836,8 +837,10 @@ function tabSearchClick(data: any) {
|
|
|
836
837
|
background: rgba(255, 255, 255, 0.98);
|
|
837
838
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
|
|
838
839
|
}
|
|
839
|
-
|
|
840
|
+
/* 暗色类直接挂在本元素上:列表页没有 config-provider 祖先,:global(.wot-theme-dark) 祖先选择器匹配不到 */
|
|
841
|
+
.batch-bar.wot-theme-dark {
|
|
840
842
|
background: rgba(28, 28, 30, 0.98);
|
|
843
|
+
color: #fff;
|
|
841
844
|
}
|
|
842
845
|
.batch-bar__inner {
|
|
843
846
|
display: flex;
|
package/package.json
CHANGED