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