Skip to content

Commit

Permalink
pref: 更改批量操作value类型的限制
Browse files Browse the repository at this point in the history
  • Loading branch information
peng-xiao-shuai committed Oct 28, 2024
1 parent 09d937a commit db719a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions packages/powerful-table/src/powerful-table-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import type {
ComponentEvent,
EmitEventType,
EmitType,
EventType,
InjectProps,
PowerfulTableData,
PowerfulTableHeader,
PowerfulTableHeaderProps,
PowerfulTableData,
StateData,
PowerfulTableProps,
_TYPE,
SetDataType,
EventType,
StateData,
} from '@/index'
import { LangKey, t } from '~/locale/lang'
// console.log(PTFDatePicker, PTFInput, PTFSelect)
Expand Down Expand Up @@ -310,12 +309,12 @@ export const useFunction = <L>(
ElMessage.warning(t(LangKey.SelectOperateData))
return
}
const currentItem = powerfulTableData.operate.operates.find(
(item) => item.value == powerfulTableData.operate.value
)

ElMessageBox.confirm(
t<(s: string) => string>(LangKey.BatchOperate)(
powerfulTableData.operate.operates[powerfulTableData.operate.value || 0]
.label
),
t<(s: string) => string>(LangKey.BatchOperate)(currentItem!.label),
t(LangKey.Hint),
{
confirmButtonText: t(LangKey.Confirm),
Expand All @@ -337,9 +336,7 @@ export const useFunction = <L>(

emit(EmitEnum.BatchOperate, {
ids,
item: powerfulTableData.operate.operates[
powerfulTableData.operate.value || 0
],
item: currentItem,
rows,
})
})
Expand Down
4 changes: 2 additions & 2 deletions typings/powerful-table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
Plugin,
SetupContext,
VNode,
WatchStopHandle,
VideoHTMLAttributes,
WatchStopHandle,
h as createElement,
} from 'vue'
import type { FDatePicker, FInput, FSelect } from '../filter'
Expand Down Expand Up @@ -189,7 +189,7 @@ export interface PowerfulTableOperateData {
* 当前批量操作下拉框选中的值
* @default ''
*/
value?: number | ''
value?: PowerfulTableLabelValue['value']
/**
* `@batchOperate` 事件返回的对象中 ids 组成的值。假设为 id 时,那 `@batchOperate` 事件中 ids 值为 `[选中数据].map(item => item.id)`
* @default 'id'
Expand Down

0 comments on commit db719a9

Please sign in to comment.