wui-components-v2 1.2.65 → 1.2.66

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,6 +34,11 @@ const props = withDefaults(
34
34
  * 是否处于批量操作(勾选)模式。为 true 时「批量操作」按钮文本切换为「取消批量操作」。
35
35
  */
36
36
  batchEditing?: boolean
37
+ /**
38
+ * 是否存在批量操作能力(config.buttons 含 batchDelete/batchEdit,或有 multible action)。
39
+ * 为 false 时不展示「批量操作」按钮。
40
+ */
41
+ batchOpsVisible?: boolean
37
42
  }>(),
38
43
  {
39
44
  showButtons: true,
@@ -279,7 +284,13 @@ console.log(props.buttons, '33333')
279
284
  >
280
285
  {{ props.config?.exportBtnTitle || '导出' }}
281
286
  </wd-button>
282
- <wd-button class="flex-1" type="primary" @click="emit('batchEdit')" :icon="props.batchEditing ? 'close' : 'edit'">
287
+ <wd-button
288
+ v-if="props.batchOpsVisible !== false"
289
+ class="flex-1"
290
+ type="primary"
291
+ @click="emit('batchEdit')"
292
+ :icon="props.batchEditing ? 'close' : 'edit'"
293
+ >
283
294
  {{ props.batchEditing ? '取消批量操作' : props.config?.editBtnTitle || '批量操作' }}
284
295
  </wd-button>
285
296
  </view>
@@ -184,8 +184,21 @@ const allChecked = computed(() => {
184
184
  const hasSelected = computed(() => selectedCodes.value.size > 0)
185
185
  /** 是否处于勾选模式(常驻 batchSelect 或点「批量编辑」动态进入 selectMode) */
186
186
  const inSelectMode = computed(() => props.batchSelect || selectMode.value)
187
- /** 批量操作条是否显示:进入勾选模式即显示(未勾选时按钮点击会提示先勾选) */
188
- const showBatchBar = computed(() => inSelectMode.value)
187
+ /**
188
+ * 是否存在批量操作能力:config.buttons 含 batchDelete 或 batchEdit,
189
+ * 或 batchActionButtons 有数据(multible === true 的 action)。
190
+ * 供顶部「批量操作」按钮与底部批量操作条共用。
191
+ */
192
+ const hasBatchOperation = computed(
193
+ () =>
194
+ config.value.buttons.includes('batchDelete') ||
195
+ config.value.buttons.includes('batchEdit') ||
196
+ batchActionButtons.value.length > 0
197
+ )
198
+ /**
199
+ * 批量操作条是否显示:进入勾选模式且存在可执行操作时显示。
200
+ */
201
+ const showBatchBar = computed(() => inSelectMode.value && hasBatchOperation.value)
189
202
  /** 顶部「批量编辑」点击后动态进入的勾选模式开关 */
190
203
  const selectMode = ref(false)
191
204
  /**
@@ -203,7 +216,8 @@ const batchActionButtons = computed(() => {
203
216
  }
204
217
  const merged = [...(config.value.customButtons || []), ...(config.value.actions || [])]
205
218
  const seen = new Set<string>()
206
- return merged.filter(item => (seen.has(item.id) ? false : (seen.add(item.id), true)))
219
+ // 仅收集标记为批量操作(multible === true)的 action,并按 id 去重
220
+ return merged.filter(item => item.multible === true && (seen.has(item.id) ? false : (seen.add(item.id), true)))
207
221
  })
208
222
  /** 已选 code 的逗号分隔字符串,供批量接口与弹窗透传 */
209
223
  const selectedCodesStr = computed(() => Array.from(selectedCodes.value).join(','))
@@ -516,6 +530,7 @@ function tabSearchClick(data: any) {
516
530
  :show-buttons="showTopButtons"
517
531
  :query-key="queryKey"
518
532
  :batch-editing="selectMode"
533
+ :batch-ops-visible="hasBatchOperation"
519
534
  @batch-edit="toggleBatchEdit"
520
535
  />
521
536
  </view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.65",
3
+ "version": "1.2.66",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/type.ts CHANGED
@@ -39,6 +39,8 @@ export interface rowActions {
39
39
  writes: Fields[]
40
40
  preposes: Fields[]
41
41
  path?: string
42
+ /** 是否为批量操作按钮,仅当为 true 时才展示在批量操作条上 */
43
+ multible?: boolean
42
44
  }
43
45
 
44
46
  // 列表页面配置