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

@@ -23,6 +23,7 @@
<script setup lang="ts">
import { Message } from '@arco-design/web-vue'
import { useWindowSize } from '@vueuse/core'
import { addDictItem, getDictItem, updateDictItem } from '@/apis/system/dict'
import { type Columns, GiForm, type Options } from '@/components/GiForm'
import { useForm } from '@/hooks'
@@ -31,6 +32,8 @@ const emit = defineEmits<{
(e: 'save-success'): void
}>()
const { width } = useWindowSize()
const dataId = ref('')
const dictId = ref('')
const visible = ref(false)
@@ -43,6 +46,12 @@ const options: Options = {
btns: { hide: true },
}
const { form, resetForm } = useForm({
color: 'blue',
sort: 999,
status: 1,
})
const columns: Columns = reactive([
{ label: '标签', field: 'label', type: 'input', rules: [{ required: true, message: '请输入标签' }] },
{ label: '值', field: 'value', type: 'input', rules: [{ required: true, message: '请输入值' }] },
@@ -79,12 +88,6 @@ const columns: Columns = reactive([
},
])
const { form, resetForm } = useForm({
color: 'blue',
sort: 999,
status: 1,
})
// 重置
const reset = () => {
formRef.value?.formRef?.resetFields()