wui-components-v2 1.2.88 → 1.2.90

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.
@@ -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
@@ -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>
@@ -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>({})
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.88",
3
+ "version": "1.2.90",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
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[]