feat: 【ele】增加 TableAction 组件

This commit is contained in:
puhui999
2025-06-07 10:40:14 +08:00
parent a026f88fde
commit 268a69c530
9 changed files with 422 additions and 78 deletions

View File

@@ -86,17 +86,17 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 创建示例联系人 */
function onCreate() {
function handleCreate() {
formModalApi.setData({}).open();
}
/** 编辑示例联系人 */
function onEdit(row: Demo01ContactApi.Demo01Contact) {
function handleEdit(row: Demo01ContactApi.Demo01Contact) {
formModalApi.setData(row).open();
}
/** 删除示例联系人 */
async function onDelete(row: Demo01ContactApi.Demo01Contact) {
async function handleDelete(row: Demo01ContactApi.Demo01Contact) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.id]),
duration: 0,
@@ -115,7 +115,7 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
}
/** 批量删除示例联系人 */
async function onDeleteBatch() {
async function handleDeleteBatch() {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting'),
duration: 0,
@@ -173,7 +173,6 @@ onMounted(() => {
class="w-full"
/>
</Form.Item>
<!-- TODO @puhui999貌似性别的宽度不对并且选择后会变哈 -->
<Form.Item label="性别" name="sex">
<Select
v-model:value="queryParams.sex"
@@ -181,7 +180,6 @@ onMounted(() => {
allow-clear
class="w-full"
>
<!-- TODO @puhui999要不咱还是把 getIntDictOptions 还是搞出来总归方便点~ -->
<Select.Option
v-for="dict in getDictOptions(
DICT_TYPE.SYSTEM_USER_SEX,
@@ -221,7 +219,7 @@ onMounted(() => {
class="ml-2"
:icon="h(Plus)"
type="primary"
@click="onCreate"
@click="handleCreate"
v-access:code="['infra:demo01-contact:create']"
>
{{ $t('ui.actionTitle.create', ['示例联系人']) }}
@@ -242,7 +240,7 @@ onMounted(() => {
danger
class="ml-2"
:disabled="isEmpty(checkedIds)"
@click="onDeleteBatch"
@click="handleDeleteBatch"
v-access:code="['infra:demo01-contact:delete']"
>
批量删除
@@ -282,7 +280,7 @@ onMounted(() => {
<Button
size="small"
type="link"
@click="onEdit(row as any)"
@click="handleEdit(row as any)"
v-access:code="['infra:demo01-contact:update']"
>
{{ $t('ui.actionTitle.edit') }}
@@ -292,7 +290,7 @@ onMounted(() => {
type="link"
danger
class="ml-2"
@click="onDelete(row as any)"
@click="handleDelete(row as any)"
v-access:code="['infra:demo01-contact:delete']"
>
{{ $t('ui.actionTitle.delete') }}