refactor: 升级框架
This commit is contained in:
@@ -31,7 +31,7 @@ const columnInfoRef = ref<InstanceType<typeof ColumnInfo>>();
|
||||
const generateInfoRef = ref<InstanceType<typeof GenerationInfo>>();
|
||||
|
||||
/** 获取详情数据 */
|
||||
const getDetail = async () => {
|
||||
async function getDetail() {
|
||||
const id = route.query.id as any;
|
||||
if (!id) {
|
||||
return;
|
||||
@@ -42,10 +42,10 @@ const getDetail = async () => {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
async function submitForm() {
|
||||
// 表单验证
|
||||
const basicInfoValid = await basicInfoRef.value?.validate();
|
||||
if (!basicInfoValid) {
|
||||
@@ -61,7 +61,6 @@ const submitForm = async () => {
|
||||
// 提交表单
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.updating'),
|
||||
duration: 0,
|
||||
key: 'action_process_msg',
|
||||
});
|
||||
try {
|
||||
@@ -74,32 +73,35 @@ const submitForm = async () => {
|
||||
columns,
|
||||
});
|
||||
// 关闭并提示
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.operationSuccess'),
|
||||
key: 'action_key_msg',
|
||||
});
|
||||
close();
|
||||
} catch (error) {
|
||||
console.error('保存失败', error);
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
};
|
||||
}
|
||||
const tabs = useTabs();
|
||||
/** 返回列表 */
|
||||
const close = () => {
|
||||
function close() {
|
||||
tabs.closeCurrentTab();
|
||||
router.push('/infra/codegen');
|
||||
};
|
||||
}
|
||||
|
||||
/** 下一步 */
|
||||
const nextStep = async () => {
|
||||
function nextStep() {
|
||||
currentStep.value += 1;
|
||||
};
|
||||
}
|
||||
|
||||
/** 上一步 */
|
||||
const prevStep = () => {
|
||||
function prevStep() {
|
||||
if (currentStep.value > 0) {
|
||||
currentStep.value -= 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 步骤配置 */
|
||||
const steps = [
|
||||
@@ -120,13 +122,11 @@ getDetail();
|
||||
|
||||
<template>
|
||||
<Page auto-content-height v-loading="loading">
|
||||
<div
|
||||
class="flex h-[95%] flex-col rounded-md bg-white p-4 dark:bg-[#1f1f1f] dark:text-gray-300"
|
||||
>
|
||||
<div class="bg-card flex h-[95%] flex-col rounded-md p-4">
|
||||
<Steps
|
||||
type="navigation"
|
||||
v-model:current="currentStep"
|
||||
class="mb-8 rounded shadow-sm dark:bg-[#141414]"
|
||||
class="mb-8 rounded shadow-sm"
|
||||
>
|
||||
<Steps.Step
|
||||
v-for="(step, index) in steps"
|
||||
|
||||
Reference in New Issue
Block a user