refactor:优化 sms 短信的实现
This commit is contained in:
@@ -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 [
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user