这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
2.6 KiB

<template>
<div>
<BasicTable @register="registerTable">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:stop-button-propagation="true"
:actions="[
{
//auth: 'AbpOpenIddict.Applications.Update',
label: L('Edit'),
icon: 'ant-design:edit-outlined',
onClick: handleEdit.bind(null, record),
},
{
//auth: 'AbpOpenIddict.Applications.Delete',
label: L('Delete'),
color: 'error',
icon: 'ant-design:delete-outlined',
onClick: handleDelete.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<ApplicationModal @register="registerModal" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction, useTable } from '/@/components/Table';
import { getDataColumns } from '../datas/TableData';
import { getSearchFormProps } from '../datas/ModalData';
import { useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { GetListAsyncByInput, DeleteAsyncById } from '/@/api/openiddict/open-iddict-application';
import { formatPagedRequest } from '/@/utils/http/abp/helper';
import ApplicationModal from './ApplicationModal.vue';
const { L } = useLocalization('AbpOpenIddict');
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
rowKey: 'id',
title: L('Applications'),
api: GetListAsyncByInput,
columns: getDataColumns(),
beforeFetch: formatPagedRequest,
pagination: true,
striped: false,
useSearchForm: true,
showIndexColumn: false,
showTableSetting: true,
formConfig: getSearchFormProps(),
bordered: true,
canResize: true,
immediate: true,
actionColumn: {
width: 150,
title: L('Actions'),
dataIndex: 'action',
},
});
function handleEdit(record) {
openModal(true, record);
}
function handleDelete(record) {
createConfirm({
iconType: 'warning',
title: L('AreYouSure'),
content: L('ItemWillBeDeletedMessage'),
onOk: () => {
return DeleteAsyncById(record.key).then(() => {
createMessage.success(L('SuccessfullyDeleted'));
reload();
});
},
});
}
</script>