mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-16 12:05:07 +08:00
perf: 优化表单校验和查询参数
This commit is contained in:
@ -1,5 +1,19 @@
|
||||
import { required } from '@/utils/formRules'
|
||||
import { reactive } from 'vue'
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
name: [required],
|
||||
sort: [required],
|
||||
email: [required],
|
||||
phone: [
|
||||
{
|
||||
pattern:
|
||||
/^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
|
||||
trigger: 'blur',
|
||||
message: '请输入正确的手机号码'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export const modelSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import { handleTree } from '@/utils/tree'
|
||||
import { onMounted, ref, unref, watch } from 'vue'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import { Form, FormExpose } from '@/components/Form'
|
||||
import { modelSchema } from './dept.data'
|
||||
import { modelSchema, rules } from './dept.data'
|
||||
import { DeptVO } from '@/api/system/dept/types'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { getListSimpleUsersApi } from '@/api/system/user'
|
||||
@ -159,7 +159,7 @@ onMounted(async () => {
|
||||
</div>
|
||||
<div v-if="showForm">
|
||||
<!-- 操作工具栏 -->
|
||||
<Form :schema="modelSchema" ref="formRef">
|
||||
<Form ref="formRef" :schema="modelSchema" :rules="rules">
|
||||
<template #parentId>
|
||||
<el-tree-select
|
||||
node-key="id"
|
||||
|
Reference in New Issue
Block a user