fix: 修复初始值使用错误

This commit is contained in:
2024-05-19 13:55:39 +08:00
parent f8ded4b491
commit fd55ad4228
12 changed files with 14 additions and 68 deletions

View File

@@ -142,10 +142,10 @@ const rules: FormInstance['rules'] = {
}
const { form } = useForm({
SITE_FAVICON: '',
SITE_LOGO: '',
SITE_TITLE: '',
SITE_COPYRIGHT: ''
SITE_FAVICON: undefined,
SITE_LOGO: undefined,
SITE_TITLE: undefined,
SITE_COPYRIGHT: undefined
})
const siteFavicon = ref<OptionResp>()

View File

@@ -15,7 +15,6 @@
<script setup lang="ts">
import { Message } from '@arco-design/web-vue'
import type { DeptReq } from './type'
import { addDept, getDept, updateDept } from '@/apis'
import { type Columns, GiForm } from '@/components/GiForm'
import { useForm } from '@/hooks'
@@ -93,9 +92,7 @@ const columns: Columns = [
}
]
const { form, resetForm } = useForm<DeptReq>({
name: '',
parentId: undefined,
const { form, resetForm } = useForm({
sort: 999,
status: 1
})

View File

@@ -79,9 +79,7 @@ const columns: Columns = [
]
const { form, resetForm } = useForm({
label: '',
value: '',
color: '',
color: 'blue',
sort: 999,
status: 1
})

View File

@@ -47,10 +47,7 @@ const columns: Columns = [
}
]
const { form, resetForm } = useForm({
name: '',
code: ''
})
const { form, resetForm } = useForm({})
// 重置
const reset = () => {

View File

@@ -122,7 +122,6 @@
<script setup lang="ts">
import { type FormInstance, Message } from '@arco-design/web-vue'
import { mapTree } from 'xe-utils'
import type { MenuForm } from './type'
import { type MenuResp, addMenu, getMenu, updateMenu } from '@/apis'
import { useForm } from '@/hooks'
import { filterTree, transformPathToName } from '@/utils'
@@ -163,20 +162,12 @@ const rules: FormInstance['rules'] = {
permission: [{ required: true, message: '请输入权限标识' }]
}
const { form, resetForm } = useForm<MenuForm>({
const { form, resetForm } = useForm({
type: 1,
icon: '',
title: '',
sort: 999,
permission: '',
path: '',
name: '',
component: '',
redirect: '',
isExternal: false,
isCache: false,
isHidden: false,
parentId: '',
status: 1
})
const componentName = computed(() => transformPathToName(form.path))

View File

@@ -122,13 +122,7 @@ const rules: FormInstance['rules'] = {
content: [{ required: true, message: '请输入内容' }]
}
const { form, resetForm } = useForm({
title: '',
content: '',
type: '',
effectiveTime: undefined,
terminateTime: undefined
})
const { form, resetForm } = useForm({})
// 重置
const reset = () => {

View File

@@ -112,13 +112,8 @@ const rules: FormInstance['rules'] = {
}
const { form, resetForm } = useForm({
name: '',
code: '',
sort: 999,
description: undefined,
menuIds: undefined,
dataScope: 4,
deptIds: undefined
dataScope: 4
})
const menuTreeRef = ref()

View File

@@ -90,7 +90,6 @@
<script setup lang="ts">
import { type FormInstance, Message } from '@arco-design/web-vue'
import { useWindowSize } from '@vueuse/core'
import type { StorageReq } from './type'
import { addStorage, getStorage, updateStorage } from '@/apis'
import { useForm } from '@/hooks'
import { useDict } from '@/hooks/app'
@@ -117,16 +116,8 @@ const rules: FormInstance['rules'] = {
bucketName: [{ required: true, message: '请输入桶名称' }]
}
const { form, resetForm } = useForm<StorageReq>({
name: '',
code: '',
const { form, resetForm } = useForm({
type: 2,
accessKey: undefined,
secretKey: undefined,
endpoint: undefined,
bucketName: undefined,
domain: undefined,
description: undefined,
isDefault: false,
sort: 999,
status: 1

View File

@@ -112,18 +112,8 @@ const rules: FormInstance['rules'] = {
}
const { form, resetForm } = useForm({
id: '',
username: '',
nickname: '',
gender: 1 as Gender,
phone: '',
email: '',
deptId: '',
roleIds: [] as string[],
description: '',
status: 1 as Status,
type: 2 as 1 | 2,
disabled: false
status: 1 as Status
})
// 重置

View File

@@ -36,9 +36,7 @@ const columns: Columns = [
{ label: '密码', field: 'newPassword', type: 'input-password', rules: [{ required: true, message: '请输入密码' }] }
]
const { form, resetForm } = useForm({
newPassword: ''
})
const { form, resetForm } = useForm({})
// 重置
const reset = () => {

View File

@@ -139,7 +139,7 @@ const {
pagination,
search,
handleDelete
} = useTable((page) => listUser({ ...queryForm, ...page }), { immediate: true })
} = useTable((page) => listUser({ ...queryForm, ...page }), { immediate: false })
const columns: TableInstanceColumns[] = [
{

View File

@@ -160,11 +160,6 @@ const rules: FormInstance['rules'] = {
}
const { form, resetForm } = useForm({
author: '',
businessName: '',
moduleName: '',
packageName: '',
tablePrefix: '',
isOverride: false
})