suyanyan 2 месяцев назад
Родитель
Сommit
c97947169c
4 измененных файлов: 22 добавлений и 7 удалений
  1. +1
    -1
      SafeCampus.WEB/src/views/userManage/keyPersonnel/components/form/form_basic.vue
  2. +10
    -1
      SafeCampus.WEB/src/views/userManage/keyPersonnel/components/form/index.vue
  3. +1
    -1
      SafeCampus.WEB/src/views/userManage/personnel/components/form/form_basic.vue
  4. +10
    -4
      SafeCampus.WEB/src/views/userManage/personnel/components/form/index.vue

+ 1
- 1
SafeCampus.WEB/src/views/userManage/keyPersonnel/components/form/form_basic.vue Просмотреть файл

@@ -51,7 +51,7 @@
</el-col>
<el-col :span="12">
<s-form-item label="年龄" prop="age">
<s-input v-model="userInfo.age" type="number" min="1"></s-input>
<s-input v-model="userInfo.age" type="number" min="1" max="100"></s-input>
</s-form-item>
</el-col>
</el-row>


+ 10
- 1
SafeCampus.WEB/src/views/userManage/keyPersonnel/components/form/index.vue Просмотреть файл

@@ -42,6 +42,14 @@ const sysUserProps = reactive<FormProps.Base<SysUserPersonnel.SysUserPerInfo>>({
record: {},
disabled: false
});
const checkAgeNumber = (rule: any, value: any, callback: any) => {
if (value === "") callback("请输入年龄");
if (value > 100 || value < 0) {
callback(new Error("请输入正确的年龄(年龄范围1-100岁)"));
} else {
return callback();
}
};

// 表单验证规则
const rules = reactive({
@@ -51,7 +59,8 @@ const rules = reactive({
phone: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ validator: checkPhoneNumber, trigger: "blur" }
]
],
age: [{ validator: checkAgeNumber, trigger: "blur" }]
});

/**


+ 1
- 1
SafeCampus.WEB/src/views/userManage/personnel/components/form/form_basic.vue Просмотреть файл

@@ -73,7 +73,7 @@
</el-col>
<el-col :span="12">
<s-form-item label="年龄" prop="age">
<s-input v-model="userInfo.age"></s-input>
<s-input v-model="userInfo.age" type="number" max="100" min="1"></s-input>
</s-form-item>
</el-col>
</el-row>


+ 10
- 4
SafeCampus.WEB/src/views/userManage/personnel/components/form/index.vue Просмотреть файл

@@ -43,7 +43,14 @@ const sysUserProps = reactive<FormProps.Base<SysUserPersonnel.SysUserPerInfo>>({
record: {},
disabled: false
});

const checkAgeNumber = (rule: any, value: any, callback: any) => {
if (value === "") callback("请输入年龄");
if (value > 100 || value < 0) {
callback(new Error("请输入正确的年龄(年龄范围1-100岁)"));
} else {
return callback();
}
};
// 表单验证规则
const rules = reactive({
name: [required("请输入姓名")],
@@ -53,9 +60,8 @@ const rules = reactive({
{ required: true, message: "请输入手机号", trigger: "blur" },
{ validator: checkPhoneNumber, trigger: "blur" }
],
// depId: [required("请选择系部")],
// majorId: [required("请选择专业")],
personSetId: [required("请选择班级")]
personSetId: [required("请选择班级")],
age: [{ validator: checkAgeNumber, trigger: "blur" }]
});

/**


Загрузка…
Отмена
Сохранить