添加学生时增加手机号参数
This commit is contained in:
parent
bfd75b723b
commit
7e7bb8ded9
@ -1,12 +1,19 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" width="400px" :before-close="doClose">
|
||||
<el-form ref="form111" :model="studentModel" :rules="rules" label-width="120px" size="mini">
|
||||
<el-form-item label="学生姓名:" prop="name">
|
||||
<el-form-item v-if="title === '新建学生'" label="类型:">
|
||||
<el-radio v-model="isAccount" :label="true">学号</el-radio>
|
||||
<el-radio v-model="isAccount" :label="false">手机号</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isAccount" label="学生姓名:" prop="name">
|
||||
<el-input v-model="studentModel.name" style="width: 220px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学号:" prop="account">
|
||||
<el-form-item v-if="isAccount" label="学号:" prop="account">
|
||||
<el-input v-model="studentModel.account" style="width: 220px;" :disabled="title==='修改学生'" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!isAccount" label="手机号:" prop="mobile">
|
||||
<el-input v-model="studentModel.mobile" style="width: 220px;" :disabled="title==='修改学生'" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
@ -23,11 +30,13 @@ export default {
|
||||
name: 'CreateClass',
|
||||
data() {
|
||||
return {
|
||||
isAccount: true,
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
studentModel: {
|
||||
name: '',
|
||||
account: ''
|
||||
account: '',
|
||||
mobile: ''
|
||||
},
|
||||
title: '新建学生'
|
||||
};
|
||||
@ -40,6 +49,9 @@ export default {
|
||||
],
|
||||
account: [
|
||||
{ required: true, message: '请输入学生学号', trigger: 'blur' }
|
||||
],
|
||||
mobile: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return baseRules;
|
||||
@ -52,6 +64,8 @@ export default {
|
||||
if (row) {
|
||||
this.studentModel.name = row.name;
|
||||
this.studentModel.account = row.account;
|
||||
this.studentModel.mobile = row.mobile || '';
|
||||
this.isAccount = true;
|
||||
this.title = '修改学生';
|
||||
} else {
|
||||
this.title = '新建学生';
|
||||
@ -62,10 +76,15 @@ export default {
|
||||
create() {
|
||||
this.$refs.form111.validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
let model = {
|
||||
account: this.studentModel.account,
|
||||
name: this.studentModel.name
|
||||
};
|
||||
if (!this.isAccount) {
|
||||
model = {
|
||||
mobile: this.studentModel.mobile
|
||||
};
|
||||
}
|
||||
createStudent( this.$route.query.classId, model).then(response => {
|
||||
this.$emit('refresh');
|
||||
this.doClose();
|
||||
|
Loading…
Reference in New Issue
Block a user