refactor: 优化部分代码

This commit is contained in:
2024-11-18 20:37:38 +08:00
parent f702e03124
commit 901213d133
16 changed files with 110 additions and 97 deletions

View File

@@ -146,6 +146,9 @@ const options: Options = {
grid: { cols: 2 },
btns: { hide: true },
}
const { form, resetForm } = useForm({
isOverride: false,
})
const formColumns: Columns = reactive([
{
label: '作者名称',
@@ -198,8 +201,8 @@ const formColumns: Columns = reactive([
type: 'switch',
props: {
type: 'round',
checkedValue: 1,
uncheckedValue: 2,
checkedValue: true,
uncheckedValue: false,
checkedText: '是',
uncheckedText: '否',
},
@@ -233,10 +236,6 @@ const columns: TableInstanceColumns[] = [
{ title: '关联字典', slotName: 'dictCode' },
]
const { form, resetForm } = useForm({
isOverride: false,
})
// 重置
const reset = () => {
formRef.value?.formRef?.resetFields()
@@ -281,6 +280,7 @@ const onOpen = async (tableName: string, comment: string) => {
// 查询生成配置
const { data } = await getGenConfig(tableName)
Object.assign(form, data)
form.isOverride = form.isOverride || false
visible.value = true
// 查询字段配置
await getDataList(tableName, false)