|
|
|
@ -1,32 +1,22 @@
|
|
|
|
<!--新增学生-->
|
|
|
|
<!--新增学员-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<el-dialog title="新增学生" :visible.sync="open" width="600px">
|
|
|
|
<el-dialog title="新增学员" :visible.sync="open" width="600px">
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
|
|
|
<el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="学生姓名:" prop="studentName">
|
|
|
|
<el-form-item label="学员姓名:" prop="studentName">
|
|
|
|
<el-input v-model="form.studentName" placeholder="请输入学生姓名" />
|
|
|
|
<el-input v-model="form.studentName" placeholder="请输入学员姓名" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="学校:" prop="schoolName">
|
|
|
|
<el-form-item label="性别:" prop="sex">
|
|
|
|
<el-select
|
|
|
|
<el-select v-model="form.sex" placeholder="请选择性别">
|
|
|
|
v-model="form.schoolName"
|
|
|
|
|
|
|
|
placeholder="请选择/输入所属学校"
|
|
|
|
|
|
|
|
clearable
|
|
|
|
|
|
|
|
filterable
|
|
|
|
|
|
|
|
default-first-option
|
|
|
|
|
|
|
|
allow-create
|
|
|
|
|
|
|
|
remote
|
|
|
|
|
|
|
|
:remote-method="schoolSelect"
|
|
|
|
|
|
|
|
:loading="loadingSelect"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
<el-option
|
|
|
|
v-for="item in schoolOptions"
|
|
|
|
v-for="dict in sexOptions"
|
|
|
|
:key="item.schoolId"
|
|
|
|
:key="dict.dictValue"
|
|
|
|
:label="item.schoolName"
|
|
|
|
:label="dict.dictLabel"
|
|
|
|
:value="item.schoolName"
|
|
|
|
:value="dict.dictValue"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -38,25 +28,14 @@
|
|
|
|
<el-date-picker
|
|
|
|
<el-date-picker
|
|
|
|
v-model="form.birthDay"
|
|
|
|
v-model="form.birthDay"
|
|
|
|
clearable
|
|
|
|
clearable
|
|
|
|
style="width: 200px"
|
|
|
|
style="width: 190px"
|
|
|
|
type="date"
|
|
|
|
type="date"
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
placeholder="选择出生日期"
|
|
|
|
placeholder="选择出生日期"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
|
|
|
|
<el-form-item label="性别:">
|
|
|
|
|
|
|
|
<el-radio-group v-model="form.sex" placeholder="请选择性别">
|
|
|
|
|
|
|
|
<el-radio
|
|
|
|
|
|
|
|
v-for="dict in sexOptions"
|
|
|
|
|
|
|
|
:key="dict.dictValue"
|
|
|
|
|
|
|
|
:label="dict.dictValue"
|
|
|
|
|
|
|
|
:value="dict.dictValue"
|
|
|
|
|
|
|
|
>{{ dict.dictLabel }}</el-radio>
|
|
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="入校时间:" prop="inTime">
|
|
|
|
<el-form-item label="入校时间:" prop="inTime">
|
|
|
|
<el-date-picker
|
|
|
|
<el-date-picker
|
|
|
|
@ -70,23 +49,8 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col v-for="(item, index) in contactArray" :key="index" :span="24" style="text-align: left;">
|
|
|
|
<el-col v-for="(item, index) in contactArray" :key="index" :span="24" style="text-align: left;">
|
|
|
|
<el-form-item label="联系人:">
|
|
|
|
<el-form-item label="联系电话:">
|
|
|
|
<el-select
|
|
|
|
<el-input v-model="contactArray[index].contactPhone" style="width: 200px;" placeholder="联系电话" />
|
|
|
|
v-model="contactArray[index].contactRelation"
|
|
|
|
|
|
|
|
filterable
|
|
|
|
|
|
|
|
placeholder="关系"
|
|
|
|
|
|
|
|
default-first-option
|
|
|
|
|
|
|
|
style="width: 80px"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="dict in contactRelationOptions"
|
|
|
|
|
|
|
|
:key="dict.dictValue"
|
|
|
|
|
|
|
|
:label="dict.dictLabel"
|
|
|
|
|
|
|
|
:value="dict.dictValue"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
<el-input v-model="contactArray[index].contactNick" style="width: 100px;" placeholder="称呼" />
|
|
|
|
|
|
|
|
<el-input v-model="contactArray[index].contactPhone" style="width: 150px;" placeholder="联系电话" />
|
|
|
|
|
|
|
|
<el-button v-if="index === 0 && contactArray.length > 0" style="padding: 3px 5px;margin-left: 5px;" type="primary" icon="el-icon-plus" size="mini" @click="handleAddContactInfo()" />
|
|
|
|
<el-button v-if="index === 0 && contactArray.length > 0" style="padding: 3px 5px;margin-left: 5px;" type="primary" icon="el-icon-plus" size="mini" @click="handleAddContactInfo()" />
|
|
|
|
<el-button v-if="index > 0" style="padding: 3px 5px;margin-left: 5px;" type="danger" icon="el-icon-minus" size="mini" @click="handleDeleteContactInfo(index)" />
|
|
|
|
<el-button v-if="index > 0" style="padding: 3px 5px;margin-left: 5px;" type="danger" icon="el-icon-minus" size="mini" @click="handleDeleteContactInfo(index)" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
@ -113,7 +77,7 @@ export default {
|
|
|
|
open: false,
|
|
|
|
open: false,
|
|
|
|
// 表单参数
|
|
|
|
// 表单参数
|
|
|
|
form: {
|
|
|
|
form: {
|
|
|
|
sex: 'M'
|
|
|
|
sex: '2'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 所属学校数据字典
|
|
|
|
// 所属学校数据字典
|
|
|
|
schoolOptions: [],
|
|
|
|
schoolOptions: [],
|
|
|
|
@ -121,7 +85,7 @@ export default {
|
|
|
|
sexOptions: [],
|
|
|
|
sexOptions: [],
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
studentName: [
|
|
|
|
studentName: [
|
|
|
|
{ required: true, message: '学生姓名不能为空', trigger: 'blur' }
|
|
|
|
{ required: true, message: '学员姓名不能为空', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
],
|
|
|
|
birthDay: [
|
|
|
|
birthDay: [
|
|
|
|
{ required: true, message: '出生日期不能为空', trigger: 'blur' }
|
|
|
|
{ required: true, message: '出生日期不能为空', trigger: 'blur' }
|
|
|
|
@ -147,7 +111,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
loadDictInfo() {
|
|
|
|
loadDictInfo() {
|
|
|
|
this.getDictListByDictType('sex').then(response => {
|
|
|
|
this.getDictListByDictType('sys_user_sex').then(response => {
|
|
|
|
this.sexOptions = response.data
|
|
|
|
this.sexOptions = response.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.getDictListByDictType('contact_relation').then(response => {
|
|
|
|
this.getDictListByDictType('contact_relation').then(response => {
|
|
|
|
@ -166,7 +130,7 @@ export default {
|
|
|
|
schoolName: undefined,
|
|
|
|
schoolName: undefined,
|
|
|
|
studentName: undefined,
|
|
|
|
studentName: undefined,
|
|
|
|
birthDay: undefined,
|
|
|
|
birthDay: undefined,
|
|
|
|
sex: 'M',
|
|
|
|
sex: '2',
|
|
|
|
phone: undefined,
|
|
|
|
phone: undefined,
|
|
|
|
inTime: moment(new Date()).format('YYYY-MM-DD')
|
|
|
|
inTime: moment(new Date()).format('YYYY-MM-DD')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -181,7 +145,7 @@ export default {
|
|
|
|
this.loadDictInfo()
|
|
|
|
this.loadDictInfo()
|
|
|
|
this.reset()
|
|
|
|
this.reset()
|
|
|
|
this.open = true
|
|
|
|
this.open = true
|
|
|
|
this.title = '添加学生基本信息'
|
|
|
|
this.title = '添加学员基本信息'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handleUpdate(studentId) {
|
|
|
|
handleUpdate(studentId) {
|
|
|
|
this.loadDictInfo()
|
|
|
|
this.loadDictInfo()
|
|
|
|
@ -192,7 +156,7 @@ export default {
|
|
|
|
this.contactArray = response.data.contactList
|
|
|
|
this.contactArray = response.data.contactList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.open = true
|
|
|
|
this.open = true
|
|
|
|
this.title = '修改学生基本信息'
|
|
|
|
this.title = '修改学员基本信息'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 提交按钮 */
|
|
|
|
/** 提交按钮 */
|
|
|
|
@ -201,7 +165,7 @@ export default {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
this.contactArray.forEach(item => {
|
|
|
|
this.contactArray.forEach(item => {
|
|
|
|
if (item.contactRelation === undefined || item.contactRelation === null || item.contactRelation.trim() === '') {
|
|
|
|
if (item.contactRelation === undefined || item.contactRelation === null || item.contactRelation.trim() === '') {
|
|
|
|
this.msgError('请选择联系人与学生关系')
|
|
|
|
this.msgError('请选择联系人与学员关系')
|
|
|
|
valid = false
|
|
|
|
valid = false
|
|
|
|
} else if (item.contactPhone === undefined || item.contactPhone === null || item.contactPhone.trim() === '') {
|
|
|
|
} else if (item.contactPhone === undefined || item.contactPhone === null || item.contactPhone.trim() === '') {
|
|
|
|
this.msgError('请填写联系人电话')
|
|
|
|
this.msgError('请填写联系人电话')
|
|
|
|
@ -227,7 +191,7 @@ export default {
|
|
|
|
if (response.respCode === '0000') {
|
|
|
|
if (response.respCode === '0000') {
|
|
|
|
this.msgSuccess('操作成功')
|
|
|
|
this.msgSuccess('操作成功')
|
|
|
|
this.open = false
|
|
|
|
this.open = false
|
|
|
|
this.$emit('success')
|
|
|
|
this.$emit('success',response.data)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.msgError(response.respMsg)
|
|
|
|
this.msgError(response.respMsg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|