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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

80 lines
2.2 KiB

<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> {{ t('action.create') }} </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{ icon: 'clarity:note-edit-line', label: t('action.edit'), onClick: handleEdit.bind(null, record) },
{
icon: 'ant-design:delete-outlined',
color: 'error',
label: t('action.delete'),
popConfirm: {
title: t('common.delMessage'),
placement: 'left',
confirm: handleDelete.bind(null, record)
}
}
]"
/>
</template>
</template>
</BasicTable>
<SmsChannelModal @register="registerModal" @success="reload()" />
</div>
</template>
<script lang="ts" setup name="SmsChannel">
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal'
import SmsChannelModal from './SmsChannelModal.vue'
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { deleteSmsChannelApi, getSmsChannelPageApi } from '@/api/system/sms/smsChannel'
import { columns, searchFormSchema } from './smsChannel.data'
const { t } = useI18n()
const { createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload }] = useTable({
title: '短信渠道列表',
api: getSmsChannelPageApi,
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema
},
useSearchForm: true,
showTableSetting: true,
showIndexColumn: false,
actionColumn: {
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right'
}
})
function handleCreate() {
openModal(true, {
isUpdate: false
})
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true
})
}
async function handleDelete(record: Recordable) {
await deleteSmsChannelApi(record.id)
createMessage.success(t('common.delSuccessText'))
reload()
}
</script>