wui-components-v2 1.2.88 → 1.2.92
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/card-botom-buttons/card-botom-buttons.vue +14 -0
- package/components/form-control/form-control.vue +23 -0
- package/components/wui-list/wui-list.vue +2 -0
- package/components/wui-menus1/components/quick-panel.vue +4 -5
- package/components/wui-menus1/wui-menus.vue +5 -0
- package/composables/useMenus.ts +19 -2
- package/package.json +1 -1
- package/store/language.ts +15 -6
- package/type.ts +2 -0
|
@@ -51,6 +51,8 @@ const props = defineProps<{
|
|
|
51
51
|
* 不传时走组件内置的 detail() 跳转逻辑。
|
|
52
52
|
*/
|
|
53
53
|
detailButtonConfig?: DetailButtonConfig
|
|
54
|
+
/** 行级自由按钮(rowCustomButtons),渲染到每行操作区 */
|
|
55
|
+
rowCustomButtons?: rowActions[]
|
|
54
56
|
}>()
|
|
55
57
|
const toast = useGlobalToast()
|
|
56
58
|
const message = useGlobalMessage()
|
|
@@ -382,6 +384,18 @@ const morebutns = computed(() => {
|
|
|
382
384
|
})
|
|
383
385
|
)
|
|
384
386
|
}
|
|
387
|
+
// 行级自由按钮(rowCustomButtons)固定渲染到行上,与批量操作条互不影响
|
|
388
|
+
if (props.rowCustomButtons) {
|
|
389
|
+
buts = buts.concat(
|
|
390
|
+
props.rowCustomButtons.map(item => {
|
|
391
|
+
return {
|
|
392
|
+
actionType: 'rowActions',
|
|
393
|
+
name: item.title,
|
|
394
|
+
...item,
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
)
|
|
398
|
+
}
|
|
385
399
|
if (props.actions) {
|
|
386
400
|
buts = buts.concat(
|
|
387
401
|
actions.value
|
|
@@ -1105,6 +1105,29 @@ console.log('clearValueMap', clearValueMap)
|
|
|
1105
1105
|
/>
|
|
1106
1106
|
</view>
|
|
1107
1107
|
</wd-form-item>
|
|
1108
|
+
<!-- yes-no-select / yes-no-radio:是/否 单选,取值与 yes-no-switch 一致(是/否) -->
|
|
1109
|
+
<wd-form-item
|
|
1110
|
+
v-else-if="
|
|
1111
|
+
['yes-no-select', 'yes-no-radio'].includes(
|
|
1112
|
+
ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId])
|
|
1113
|
+
)
|
|
1114
|
+
"
|
|
1115
|
+
:class="{ 'no-border-top': fields.indexOf(item) === 0 }"
|
|
1116
|
+
:prop="item.sourceId"
|
|
1117
|
+
:title="item.title"
|
|
1118
|
+
>
|
|
1119
|
+
<wd-radio-group
|
|
1120
|
+
v-if="!item.disabled"
|
|
1121
|
+
v-model="model[item.sourceId]"
|
|
1122
|
+
inline
|
|
1123
|
+
shape="dot"
|
|
1124
|
+
custom-class="custom-radio"
|
|
1125
|
+
>
|
|
1126
|
+
<wd-radio value="是">是</wd-radio>
|
|
1127
|
+
<wd-radio value="否">否</wd-radio>
|
|
1128
|
+
</wd-radio-group>
|
|
1129
|
+
<view v-else class="text-left">{{ model[item.sourceId] }}</view>
|
|
1130
|
+
</wd-form-item>
|
|
1108
1131
|
<wd-form-item
|
|
1109
1132
|
v-else-if="
|
|
1110
1133
|
['tree-entity-select', 'ltree-entity-select', 'lab-tree-select'].includes(
|
|
@@ -696,6 +696,7 @@ function tabSearchClick(data: any) {
|
|
|
696
696
|
:is-show-action="isShowAction"
|
|
697
697
|
:copy-mode="config.copyMode"
|
|
698
698
|
:edit-button-config="editButtonConfig"
|
|
699
|
+
:row-custom-buttons="config.rowCustomButtons"
|
|
699
700
|
/>
|
|
700
701
|
</view>
|
|
701
702
|
</template>
|
|
@@ -750,6 +751,7 @@ function tabSearchClick(data: any) {
|
|
|
750
751
|
:is-show-action="isShowAction"
|
|
751
752
|
:copy-mode="config.copyMode"
|
|
752
753
|
:edit-button-config="editButtonConfig"
|
|
754
|
+
:row-custom-buttons="config.rowCustomButtons"
|
|
753
755
|
/>
|
|
754
756
|
</view>
|
|
755
757
|
</template>
|
|
@@ -51,7 +51,7 @@ function numColor(item: { themeColor?: string }) {
|
|
|
51
51
|
|
|
52
52
|
<template>
|
|
53
53
|
<view v-if="quickPanel.length > 0 || capsuleMenu.length > 0" class="mb-3">
|
|
54
|
-
<view class="rounded-2xl bg-white p-
|
|
54
|
+
<view class="rounded-2xl bg-white p-3 shadow-[0_4px_16px_rgba(0,0,0,0.04)] dark:bg-black">
|
|
55
55
|
<view class="mb-3 flex items-center gap-2 text-size-4 font-bold text-gray-800 dark:text-white">
|
|
56
56
|
{{ languageStore.t('数据统计') }}
|
|
57
57
|
</view>
|
|
@@ -78,12 +78,11 @@ function numColor(item: { themeColor?: string }) {
|
|
|
78
78
|
:style="{ background: pillTheme(i).bg }"
|
|
79
79
|
@click="handleClick(item)"
|
|
80
80
|
>
|
|
81
|
-
<
|
|
82
|
-
<text class="text-[11px] font-semibold" :style="{ color: pillTheme(i).text }">
|
|
81
|
+
<text class="min-w-0 whitespace-nowrap text-[11px] font-semibold" :style="{ color: pillTheme(i).text }">
|
|
83
82
|
{{ stripParen(languageStore.t(item.title)) }}
|
|
84
83
|
</text>
|
|
85
|
-
<text class="text-[15px] font-extrabold" :style="{ color: pillTheme(i).text }">{{ item.count }}</text>
|
|
86
|
-
<text class="text-[11px]" :style="{ color: pillTheme(i).text, opacity: 0.7 }">{{ languageStore.t('条') }}</text>
|
|
84
|
+
<text class="shrink-0 text-[15px] font-extrabold" :style="{ color: pillTheme(i).text }">{{ item.count }}</text>
|
|
85
|
+
<text class="shrink-0 text-[11px]" :style="{ color: pillTheme(i).text, opacity: 0.7 }">{{ languageStore.t('条') }}</text>
|
|
87
86
|
</view>
|
|
88
87
|
</view>
|
|
89
88
|
</slot>
|
|
@@ -70,6 +70,11 @@ const props = defineProps({
|
|
|
70
70
|
type: Function as PropType<(item: any) => boolean | void>,
|
|
71
71
|
default: null,
|
|
72
72
|
},
|
|
73
|
+
// 是否过滤菜单标题中的「(运维)」标记(如「设备台账(运维)」→「设备台账」),默认不过滤
|
|
74
|
+
stripOpsTag: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
73
78
|
})
|
|
74
79
|
const languageStore = useLanguageStore()
|
|
75
80
|
const themeConfig = ref<any>({})
|
package/composables/useMenus.ts
CHANGED
|
@@ -13,6 +13,8 @@ interface Props {
|
|
|
13
13
|
icons: Icon[]
|
|
14
14
|
load: () => void
|
|
15
15
|
menuTopType: string
|
|
16
|
+
// 是否过滤菜单标题中的「(运维)」标记,默认不过滤,由调用方按需开启
|
|
17
|
+
stripOpsTag?: boolean
|
|
16
18
|
}
|
|
17
19
|
export interface MenuItem {
|
|
18
20
|
id: string
|
|
@@ -24,6 +26,21 @@ export interface MenuItem {
|
|
|
24
26
|
targetProgram?: string
|
|
25
27
|
children?: MenuItem[]
|
|
26
28
|
}
|
|
29
|
+
// 去掉菜单标题中的「(运维)」标记(如「设备台账(运维)」→「设备台账」),中英文括号都兼容
|
|
30
|
+
function stripOpsTag(title: string) {
|
|
31
|
+
return String(title ?? '').replace(/[((]运维[))]/g, '')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 递归处理菜单树,清理所有层级的标题
|
|
35
|
+
function stripOpsTagDeep(items: any[]): any[] {
|
|
36
|
+
return (items || []).map((it: any) => ({
|
|
37
|
+
...it,
|
|
38
|
+
title: stripOpsTag(it.title),
|
|
39
|
+
...(Array.isArray(it.items) ? { items: stripOpsTagDeep(it.items) } : {}),
|
|
40
|
+
...(Array.isArray(it.children) ? { children: stripOpsTagDeep(it.children) } : {}),
|
|
41
|
+
}))
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
export function useMenus(props?: Props, pagingRef?: Ref<any>) {
|
|
28
45
|
const router = useRouter()
|
|
29
46
|
const toast = useGlobalToast()
|
|
@@ -146,7 +163,7 @@ export function useMenus(props?: Props, pagingRef?: Ref<any>) {
|
|
|
146
163
|
}
|
|
147
164
|
navTitle.value = res?.programName || ''
|
|
148
165
|
uni.setNavigationBarTitle({ title: res?.programName || '' }) // 设置标题
|
|
149
|
-
pagingRef?.value.complete(res?.blocks || [])
|
|
166
|
+
pagingRef?.value.complete(props?.stripOpsTag ? stripOpsTagDeep(res?.blocks || []) : (res?.blocks || []))
|
|
150
167
|
})
|
|
151
168
|
.catch((res: any) => {
|
|
152
169
|
console.log(res)
|
|
@@ -168,7 +185,7 @@ export function useMenus(props?: Props, pagingRef?: Ref<any>) {
|
|
|
168
185
|
try {
|
|
169
186
|
const res = await fastmenu()
|
|
170
187
|
if (res.fastMenu) {
|
|
171
|
-
sectionmenu.value = res.fastMenu.QuickQueryBar || []
|
|
188
|
+
sectionmenu.value = props?.stripOpsTag ? stripOpsTagDeep(res.fastMenu.QuickQueryBar || []) : (res.fastMenu.QuickQueryBar || [])
|
|
172
189
|
} else {
|
|
173
190
|
sectionmenu.value = []
|
|
174
191
|
}
|
package/package.json
CHANGED
package/store/language.ts
CHANGED
|
@@ -44,6 +44,9 @@ export const useLanguageStore = defineStore('language', () => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// 进行中的加载 Promise(按语言缓存):并发调用共享同一个请求,避免重复请求语言包
|
|
48
|
+
const loadingPromises: Record<string, Promise<LanguagePackage>> = {}
|
|
49
|
+
|
|
47
50
|
/**
|
|
48
51
|
* 加载并设置语言
|
|
49
52
|
*/
|
|
@@ -54,14 +57,20 @@ export const useLanguageStore = defineStore('language', () => {
|
|
|
54
57
|
return
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
// 已有同语言请求在进行中时直接复用,不再发新请求
|
|
61
|
+
if (!loadingPromises[lang]) {
|
|
62
|
+
loadingPromises[lang] = loadLanguageFromNetwork(lang).then((langPack) => {
|
|
63
|
+
languagePackages.value[lang] = langPack
|
|
64
|
+
loadedLanguages.value.push(lang)
|
|
65
|
+
return langPack
|
|
66
|
+
}).finally(() => {
|
|
67
|
+
delete loadingPromises[lang]
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
loading.value = true
|
|
58
72
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
languagePackages.value[lang] = langPack
|
|
62
|
-
|
|
63
|
-
loadedLanguages.value.push(lang)
|
|
64
|
-
|
|
73
|
+
await loadingPromises[lang]
|
|
65
74
|
currentLanguage.value = lang
|
|
66
75
|
}
|
|
67
76
|
finally {
|
package/type.ts
CHANGED
|
@@ -91,6 +91,8 @@ export interface Config extends Groups {
|
|
|
91
91
|
/** 模板配置的文件导出按钮(音频下载/曲线下载等),批量操作条渲染 */
|
|
92
92
|
fileExports?: any[]
|
|
93
93
|
customButtons?: rowActions[]
|
|
94
|
+
/** 行级自由按钮,渲染到每行操作区(与批量操作条互不影响) */
|
|
95
|
+
rowCustomButtons?: rowActions[]
|
|
94
96
|
rowActions?: rowActions[]
|
|
95
97
|
ractions?: rowActions[]
|
|
96
98
|
actions?: rowActions[]
|