这是基于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.
 
 
 
 
 
 

97 lines
3.0 KiB

<template>
<div class="content">
<BasicTable @register="registerTable">
<template #code="{ record }">
<Tag :color="getHttpStatusColor(record.responseStatusCode)">{{ httpStatusCodeMap[record.responseStatusCode] }}</Tag>
</template>
<template #action="{ record }">
<TableAction
:stop-button-propagation="true"
:actions="[
{
auth: 'AbpWebhooks.SendAttempts',
label: L('Edit'),
icon: 'ant-design:edit-outlined',
onClick: handleEdit.bind(null, record),
},
{
auth: 'AbpWebhooks.SendAttempts.Delete',
color: 'error',
label: L('Delete'),
icon: 'ant-design:delete-outlined',
onClick: handleDelete.bind(null, record),
},
]"
:dropDownActions="[
{
auth: 'AbpWebhooks.SendAttempts.Resend',
label: L('Resend'),
ifShow: [JobStatus.Running, JobStatus.FailedRetry].includes(record.status),
onClick: handlePause.bind(null, record),
},
]"
/>
</template>
</BasicTable>
<SendAttemptModal @register="registerModal" />
</div>
</template>
<script lang="ts" setup>
import { Switch, Tag } from 'ant-design-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { useModal } from '/@/components/Modal';
import { BasicTable, TableAction, useTable } from '/@/components/Table';
import { formatPagedRequest } from '/@/utils/http/abp/helper';
import { getDataColumns } from '../datas/TableData';
import { getSearchFormSchemas } from '../datas/ModalData';
import { httpStatusCodeMap, getHttpStatusColor } from '../../typing';
import { getList } from '/@/api/webhooks/send-attempts';
import SendAttemptModal from './SendAttemptModal.vue';
const { createConfirm } = useMessage();
const { L } = useLocalization('WebhooksManagement');
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
rowKey: 'id',
title: L('SendAttempts'),
columns: getDataColumns(),
api: getList,
beforeFetch: formatPagedRequest,
pagination: true,
striped: false,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: false,
canResize: false,
immediate: true,
clickToRowSelect: false,
formConfig: getSearchFormSchemas(),
actionColumn: {
width: 220,
title: L('Actions'),
dataIndex: 'action',
slots: { customRender: 'action' },
},
});
function handleEdit(record) {
openModal(true, record);
}
function handleDelete(record) {
createConfirm({
iconType: 'warning',
title: L('AreYouSure'),
content: L('ItemWillBeDeletedMessage'),
okCancel: true,
onOk: () => {
deleteById(record.id).then(() => {
reload();
});
},
});
}
</script>