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.
77 lines
2.4 KiB
77 lines
2.4 KiB
2 years ago
|
<template>
|
||
2 years ago
|
<div>
|
||
|
<BasicTable @register="registerTable">
|
||
|
<template #toolbar>
|
||
2 years ago
|
<a-button type="primary" v-auth="['system:sms-channel:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
|
||
|
{{ t('action.create') }}
|
||
|
</a-button>
|
||
2 years ago
|
</template>
|
||
|
<template #bodyCell="{ column, record }">
|
||
|
<template v-if="column.key === 'action'">
|
||
|
<TableAction
|
||
|
:actions="[
|
||
2 years ago
|
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:sms-channel:update', onClick: handleEdit.bind(null, record) },
|
||
2 years ago
|
{
|
||
2 years ago
|
icon: IconEnum.DELETE,
|
||
2 years ago
|
color: 'error',
|
||
|
label: t('action.delete'),
|
||
2 years ago
|
auth: 'system:sms-channel:delete',
|
||
2 years ago
|
popConfirm: {
|
||
|
title: t('common.delMessage'),
|
||
|
placement: 'left',
|
||
|
confirm: handleDelete.bind(null, record)
|
||
|
}
|
||
|
}
|
||
|
]"
|
||
|
/>
|
||
|
</template>
|
||
|
</template>
|
||
|
</BasicTable>
|
||
|
<SmsChannelModal @register="registerModal" @success="reload()" />
|
||
|
</div>
|
||
2 years ago
|
</template>
|
||
2 years ago
|
<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'
|
||
2 years ago
|
import { IconEnum } from '@/enums/appEnum'
|
||
2 years ago
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||
2 years ago
|
import { deleteSmsChannel, getSmsChannelPage } from '@/api/system/sms/smsChannel'
|
||
2 years ago
|
import { columns, searchFormSchema } from './smsChannel.data'
|
||
|
|
||
|
const { t } = useI18n()
|
||
|
const { createMessage } = useMessage()
|
||
|
const [registerModal, { openModal }] = useModal()
|
||
|
|
||
|
const [registerTable, { reload }] = useTable({
|
||
|
title: '短信渠道列表',
|
||
2 years ago
|
api: getSmsChannelPage,
|
||
2 years ago
|
columns,
|
||
2 years ago
|
formConfig: { labelWidth: 120, schemas: searchFormSchema },
|
||
2 years ago
|
useSearchForm: true,
|
||
|
showTableSetting: true,
|
||
|
showIndexColumn: false,
|
||
|
actionColumn: {
|
||
|
width: 140,
|
||
|
title: t('common.action'),
|
||
|
dataIndex: 'action',
|
||
|
fixed: 'right'
|
||
|
}
|
||
|
})
|
||
|
|
||
|
function handleCreate() {
|
||
2 years ago
|
openModal(true, { isUpdate: false })
|
||
2 years ago
|
}
|
||
|
|
||
|
function handleEdit(record: Recordable) {
|
||
2 years ago
|
openModal(true, { record, isUpdate: true })
|
||
2 years ago
|
}
|
||
|
|
||
|
async function handleDelete(record: Recordable) {
|
||
2 years ago
|
await deleteSmsChannel(record.id)
|
||
2 years ago
|
createMessage.success(t('common.delSuccessText'))
|
||
|
reload()
|
||
|
}
|
||
|
</script>
|