refactor:优化 sms 短信的实现

This commit is contained in:
YunaiV
2025-04-04 18:20:59 +08:00
parent 9f352291d7
commit 5705098fc7
16 changed files with 175 additions and 212 deletions

View File

@@ -128,7 +128,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
export function useGridColumns<T = SystemSmsChannelApi.SmsChannel>(
export function useGridColumns<T = SystemSmsChannelApi.SystemSmsChannel>(
onActionClick: OnActionClickFn<T>,
): VxeTableGridOptions['columns'] {
return [

View File

@@ -36,12 +36,12 @@ function onCreate() {
}
/** 编辑短信渠道 */
function onEdit(row: SystemSmsChannelApi.SmsChannel) {
function onEdit(row: SystemSmsChannelApi.SystemSmsChannel) {
formModalApi.setData(row).open();
}
/** 删除短信渠道 */
async function onDelete(row: SystemSmsChannelApi.SmsChannel) {
async function onDelete(row: SystemSmsChannelApi.SystemSmsChannel) {
const hideLoading = message.loading({
content: $t('ui.actionMessage.deleting', [row.signature]),
duration: 0,
@@ -63,7 +63,7 @@ async function onDelete(row: SystemSmsChannelApi.SmsChannel) {
function onActionClick({
code,
row,
}: OnActionClickParams<SystemSmsChannelApi.SmsChannel>) {
}: OnActionClickParams<SystemSmsChannelApi.SystemSmsChannel>) {
switch (code) {
case 'edit': {
onEdit(row);
@@ -102,7 +102,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: { code: 'query' },
search: true,
},
} as VxeTableGridOptions<SystemSmsChannelApi.SmsChannel>,
} as VxeTableGridOptions<SystemSmsChannelApi.SystemSmsChannel>,
});
</script>

View File

@@ -12,7 +12,7 @@ import { getSmsChannel, createSmsChannel, updateSmsChannel } from '#/api/system/
import { useFormSchema } from '../data';
const emit = defineEmits(['success']);
const formData = ref<SystemSmsChannelApi.SmsChannel>();
const formData = ref<SystemSmsChannelApi.SystemSmsChannel>();
const getTitle = computed(() => {
return formData.value?.id
? $t('ui.actionTitle.edit', ['短信渠道'])
@@ -36,7 +36,7 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
// 提交表单
const data = (await formApi.getValues()) as SystemSmsChannelApi.SmsChannel;
const data = (await formApi.getValues()) as SystemSmsChannelApi.SystemSmsChannel;
try {
await (formData.value?.id ? updateSmsChannel(data) : createSmsChannel(data));
// 关闭并提示
@@ -55,7 +55,7 @@ const [Modal, modalApi] = useVbenModal({
return;
}
// 加载数据
const data = modalApi.getData<SystemSmsChannelApi.SmsChannel>();
const data = modalApi.getData<SystemSmsChannelApi.SystemSmsChannel>();
if (!data || !data.id) {
return;
}