| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- <template>
- <div class='m-container'>
- <!-- <h2>
- <el-page-header @back="onCancel" :content="'老师' + (pageType == 'create' ? '新增' : '修改')"></el-page-header>
- </h2> -->
- <div class="infoWrap">
- <div class="left">
- <h4>基本信息</h4>
- <el-form :model="topForm"
- :rules="rules"
- ref="form">
- <el-row>
- <el-col :span="12">
- <el-form-item label="姓名"
- prop="realName"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.realName"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="性别"
- prop="gender"
- :label-width="formLabelWidth">
- <el-select v-model="topForm.gender">
- <el-option label='男'
- :value='1'></el-option>
- <el-option label='女'
- :value='0'></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="出生日期"
- :label-width="formLabelWidth">
- <el-date-picker v-model="topForm.birthdate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="出生日期">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="入职日期"
- prop="entryDate"
- :label-width="formLabelWidth">
- <el-date-picker v-model="topForm.entryDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="入职日期">
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="工作类别"
- prop="jobNature"
- :label-width="formLabelWidth">
- <el-select v-model="topForm.jobNature"
- placeholder="工作类型">
- <el-option v-for="item in jobNature"
- :key="item.value"
- :label="item.label"
- :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="所属分部"
- prop="organId"
- :label-width="formLabelWidth">
- <el-select v-model="topForm.organId"
- placeholder="所属分部">
- <el-option v-for="item in branchList"
- :key="item.value"
- :label="item.label"
- :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="流动范围"
- :label-width="formLabelWidth">
- <el-select v-model="topForm.flowOrganRange"
- multiple
- placeholder="流动范围">
- <el-option v-for="item in branchList"
- :key="item.value"
- :label="item.label"
- :value="item.value.toString()"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="人事状态"
- prop="isProbationPeriod"
- :label-width="formLabelWidth">
- <el-select v-model="topForm.isProbationPeriod"
- placeholder="人事状态">
- <el-option label="正式"
- :value="1"></el-option>
- <el-option label="临时"
- :value="0"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="老师简介"
- :label-width="formLabelWidth">
- <el-input type='textarea'
- v-model="topForm.introduction"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12"
- v-if="pageType == 'update'">
- <el-form-item label="教学点"
- :label-width="formLabelWidth">
- <el-input disabled
- v-model="teacherSchools"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <h4>资料学历</h4>
- <el-row>
- <el-col :span="12">
- <el-form-item label="手机号"
- prop="phone"
- :label-width="formLabelWidth">
- <el-input v-model.number="topForm.phone"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="毕业学校"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.graduateSchool"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="电子邮箱"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.email"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="最高学历"
- :label-width="formLabelWidth">
- <!-- <el-input v-model="topForm.educationBackground"></el-input> -->
- <el-select v-model="topForm.educationBackground"
- placeholder="最高学历">
- <el-option label="初中"
- value="初中"></el-option>
- <el-option label="高中"
- value="高中"></el-option>
- <el-option label="大专"
- value="大专"></el-option>
- <el-option label="本科"
- value="本科"></el-option>
- <el-option label="硕士"
- value="硕士"></el-option>
- <el-option label="博士"
- value="博士"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="专业技能"
- prop="subjectIds"
- :label-width="formLabelWidth">
- <el-select multiple
- v-model="topForm.subjectIds"
- placeholder="专业技能">
- <el-option-group v-for="group in subjectList"
- :key="group.label"
- :label="group.label">
- <el-option v-for="item in group.options"
- :key="item.value"
- :label="item.label"
- :value="item.value.toString()">
- </el-option>
- </el-option-group>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="职称"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.technicalTitles"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="证件类型"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.certificateType"></el-input>
- <!-- <el-select v-model="topForm.certificateType" placeholder="证件类型">
- <el-option label="身份证" value="身份证"></el-option>
- <el-option label="护照" value="护照"></el-option>
- <el-option label="港澳通行证" value="港澳通行证"></el-option>
- </el-select> -->
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="证件号码"
- :label-width="formLabelWidth">
- <el-input v-model="topForm.certificateNum"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label=""
- :label-width="formLabelWidth">
- <!-- <el-input v-model="topForm.certificateType"></el-input> -->
- <el-checkbox v-model="topForm.isSupportCourseScheduleRewardsRules">适用VIP分部活动</el-checkbox>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item>
- <el-button @click="onSubmit('form')"
- type="primary">立即{{ pageType == "create" ? '创建' : '修改' }}</el-button>
- <el-button @click="onReSet('form')">重置</el-button>
- </el-form-item>
- </el-form>
- </div>
- <div class="right">
- <div class="teacherIcon">
- <img v-if="topForm.avatar"
- key="avatar"
- :src="topForm.avatar"
- alt="">
- <img v-else
- key="avatar"
- src="@/assets/images/base/woman.png"
- alt="">
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // import { queryByOrganId } from '@/api/systemManage'
- import { branchQueryPage, subjectListTree } from '@/api/specialSetting'
- import { teacherAdd, teacherUpdate, teacherGet } from '@/api/teacherManager'
- import store from '@/store'
- import { permission } from '@/utils/directivePage'
- import { jobNature } from '@/utils/searchArray'
- import { isvalidPhone } from '@/utils/validate'
- let validPhone = (rule, value, callback) => {
- if (!value) {
- callback(new Error('请输入电话号码'))
- } else if (!isvalidPhone(value)) {
- callback(new Error('请输入正确的11位手机号码'))
- } else {
- callback()
- }
- }
- export default {
- name: 'adminManager',
- data () {
- return {
- jobNature: jobNature,
- organId: store.getters.organ,
- pageType: this.$route.query.type,
- teacherId: this.$route.query.teacherId,
- formLabelWidth: '80px',
- branchList: [], // 分部列表
- subjectList: [], //声部列表
- teacherSchools: null,
- topForm: {
- realName: null,
- gender: null,
- birthdate: null,
- entryDate: null,
- jobNature: null,
- organId: store.getters.organ,
- flowOrganRange: null,
- introduction: null,
- phone: null,
- avatar: null,
- graduateSchool: null,
- email: null,
- educationBackground: null,
- subjectIds: [],
- isProbationPeriod: null,
- technicalTitles: null,
- certificateType: null,
- certificateNum: null,
- isSupportCourseScheduleRewardsRules: true
- },
- rules: {
- realName: [{ required: true, message: '请输入姓名', trigger: 'blur' },
- { min: 2, max: 10, message: '请输入 2 到 10 个字符', trigger: 'blur' }],
- gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
- entryDate: [{ required: true, message: '请选择入职日期', trigger: 'change' }],
- jobNature: [{ required: true, message: '请选择工作类别', trigger: 'change' }],
- isProbationPeriod: [{ required: true, message: '请选择人事状态', trigger: 'change' }],
- organId: [{ required: true, message: '请选择所属分部', trigger: 'change' }],
- phone: [{ required: true, validator: validPhone, trigger: 'blur' }],
- subjectIds: [{ required: true, type: 'array', message: '请选择专业技能', trigger: 'change' }]
- }
- }
- },
- mounted () {
- this.__init()
- },
- methods: {
- __init () {
- branchQueryPage({ // 获取分部
- delFlag: 0,
- rows: 9999
- }).then(res => {
- if (res.code == 200 && res.data && res.data.rows) {
- res.data.rows.forEach(item => {
- this.branchList.push({
- label: item.name,
- value: item.id
- })
- })
- }
- })
- subjectListTree({ // 声部
- delFlag: 0,
- rows: 9999
- }).then(res => {
- let result = res.data
- if (res.code == 200) {
- let tempArray = []
- result.rows.forEach((item, index) => {
- let subject = []
- item.subjects.forEach(s => {
- subject.push({
- value: s.id,
- label: s.name
- })
- })
- tempArray[index] = {
- label: item.name,
- options: subject
- }
- })
- this.subjectList = tempArray
- }
- })
- if (this.pageType == 'update') {
- teacherGet({ teacherId: this.teacherId }).then(res => {
- let result = res.data
- this.topForm = {
- realName: result.realName,
- gender: result.gender,
- birthdate: result.birthdate,
- entryDate: result.entryDate,
- jobNature: result.jobNature,
- organId: result.organId,
- flowOrganRange: result.flowOrganRangeId ? result.flowOrganRangeId.split(',') : null,
- introduction: result.introduction,
- phone: result.phone,
- avatar: result.avatar,
- graduateSchool: result.graduateSchool,
- email: result.email,
- educationBackground: result.educationBackground,
- subjectIds: result.subjectId ? result.subjectId.split(',') : null,
- technicalTitles: result.technicalTitles,
- certificateType: result.certificateType,
- certificateNum: result.certificateNum,
- isProbationPeriod: result.isProbationPeriod,
- isSupportCourseScheduleRewardsRules: result.isSupportCourseScheduleRewardsRules
- }
- this.teacherSchools = result.teacherSchools.length > 0 ? result.teacherSchools.join(',') : ''
- })
- }
- },
- onSubmit (formName) {
- this.$refs[formName].validate(valid => {
- if (valid) {
- this.topForm.flowOrganRange = this.topForm.flowOrganRange.join(',')
- this.topForm.subjectId = this.topForm.subjectIds.join(',')
- if (this.pageType == 'update') {
- this.topForm.id = this.teacherId
- teacherUpdate(this.topForm).then(res => {
- if (res.code == 200) {
- // this.$emit('onTeacher')
- this.$router.push('/business/teacherList')
- }
- this.messageTips('修改', res)
- })
- } else if (this.pageType == 'create') {
- if (this.topForm.id) {
- delete this.topForm.id
- }
- teacherAdd(this.topForm).then(res => {
- if (res.code == 200) {
- // 权限判断,是否有课酬设置
- if(permission('/teacherAdd/salarySeting')) {
- this.$router.push('/business/teacherList')
- } else {
- this.$emit('onTeacher', res.data)
- }
-
- }
- this.messageTips('添加', res)
- })
- }
- } else {
- return false
- }
- })
- },
- messageTips (title, res) {
- if (res.code == 200) {
- this.$message.success(title + '成功')
- } else {
- this.topForm.subjectIds = this.topForm.subjectIds.split(',')
- this.$message.error(res.msg)
- }
- },
- onReSet (formName) {
- this.topForm = {
- realName: null,
- gender: null,
- birthdate: null,
- entryDate: null,
- jobNature: null,
- organId: store.getters.organ,
- flowOrganRange: null,
- introduction: null,
- phone: null,
- avatar: null,
- graduateSchool: null,
- email: null,
- educationBackground: null,
- subjectIds: [],
- technicalTitles: null,
- certificateType: null,
- certificateNum: null,
- jobType: 'ADVISER'
- }
- this.$refs[formName].resetFields()
- },
- onCancel () {
- this.$router.push('/business/teacherList')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .el-button--primary {
- background: #14928a;
- border-color: #14928a;
- color: #fff;
- &:hover,
- &:active,
- &:focus {
- background: #14928a;
- border-color: #14928a;
- color: #fff;
- }
- }
- /deep/.el-date-editor.el-input,
- /deep/.el-select {
- width: 100% !important;
- }
- // .el-row {
- // margin-top: 40px;
- // }
- // .el-col {
- // display: flex;
- // align-items: center;
- // margin-bottom: 20px;
- // justify-content: flex-end;
- // margin-right: 50%;
- // }
- // .el-input-group {
- // width: 200px;
- // margin: 0 20px;
- // }
- // /deep/.el-tree-node__content {
- // height: 40px !important;
- // }
- /deep/.el-form-item__content {
- font-size: 14px !important;
- margin-right: 5%;
- }
- .infoWrap {
- margin-top: 20px;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- .left {
- max-width: 1000px;
- width: 100%;
- h4 {
- margin-bottom: 20px;
- }
- }
- .right {
- margin-left: 100px;
- .teacherIcon {
- width: 150px;
- height: 150px;
- // border: 1px solid #444;
- border-radius: 50%;
- overflow: hidden;
- img {
- width: 150px;
- height: 150px;
- }
- }
- }
- }
- </style>
|