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({ const { form } = useForm({
SITE_FAVICON: '', SITE_FAVICON: undefined,
SITE_LOGO: '', SITE_LOGO: undefined,
SITE_TITLE: '', SITE_TITLE: undefined,
SITE_COPYRIGHT: '' SITE_COPYRIGHT: undefined
}) })
const siteFavicon = ref<OptionResp>() const siteFavicon = ref<OptionResp>()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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