teacher.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <div id="teacher">
  3. <el-col :span="24">
  4. <el-form size="mini" ref="formUpdate" :model="formUpdate" label-width="120px">
  5. <el-form-item label="姓名:"> {{ formUpdate.name }}</el-form-item>
  6. <el-form-item label="身份证号:"> {{ formUpdate.idnumber }} </el-form-item>
  7. <el-form-item label="手机号:"> {{ formUpdate.phone }} </el-form-item>
  8. <el-form-item label="性别:">
  9. <el-radio-group disabled v-model="formUpdate.gender">
  10. <el-radio label="男">男</el-radio>
  11. <el-radio label="女">女</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. <el-form-item label="年龄:"> {{ formUpdate.age }} </el-form-item>
  15. <el-form-item label="出生年月:"> {{ formUpdate.birthday }} </el-form-item>
  16. <el-form-item label="政治面貌:">{{ formUpdate.politics }} </el-form-item>
  17. <el-form-item label="邮箱:">{{ formUpdate.email }} </el-form-item>
  18. <el-form-item label="学校:">{{ schname }}</el-form-item>
  19. <el-form-item label="入职时间:">{{ formUpdate.entrydate }} </el-form-item>
  20. <el-form-item label="所在部门:">{{ formUpdate.department }} </el-form-item>
  21. <el-form-item label="职务:">{{ formUpdate.job }} </el-form-item>
  22. <el-form-item label="职称:">{{ formUpdate.protitle }} </el-form-item>
  23. <el-form-item label="最后学历:">{{ formUpdate.education }} </el-form-item>
  24. <el-form-item label="最后学位:">{{ formUpdate.degree }} </el-form-item>
  25. <el-form-item label="教师所学专业:">{{ formUpdate.major }} </el-form-item>
  26. <el-form-item label="教师在校所教课程:">{{ formUpdate.schlesson }} </el-form-item>
  27. <el-form-item label="教育培训经历(从大学开始):">{{ formUpdate.experience }} </el-form-item>
  28. <el-form-item label="主讲课程:">{{ formUpdate.courses }} </el-form-item>
  29. <el-form-item label="主要学术成果及获奖情况:">{{ formUpdate.academic }} </el-form-item>
  30. <el-form-item label="从事就业创业教学工作年限:">{{ formUpdate.jobyear }} </el-form-item>
  31. <el-form-item label="科目:">{{ subname }}</el-form-item>
  32. <el-form-item label="是否可讲礼仪课:">
  33. <el-radio disabled v-model="formUpdate.islyteacher" label="0">否</el-radio>
  34. <el-radio disabled v-model="formUpdate.islyteacher" label="1">是</el-radio>
  35. </el-form-item>
  36. </el-form>
  37. </el-col>
  38. </div>
  39. </template>
  40. <script>
  41. import { mapState, createNamespacedHelpers } from 'vuex';
  42. const { mapActions: teacher } = createNamespacedHelpers('teacher');
  43. const { mapActions: mapSchool } = createNamespacedHelpers('school');
  44. const { mapActions: mapSubject } = createNamespacedHelpers('subject');
  45. export default {
  46. name: 'teacher',
  47. props: {
  48. teacherId: {},
  49. },
  50. components: {},
  51. data: () => ({
  52. formUpdate: {},
  53. schname: {},
  54. subname: {},
  55. schList: [],
  56. subList: [],
  57. politicsList: [],
  58. educationList: [],
  59. degreeList: [{ name: '博士学位' }, { name: '硕士学位' }, { name: '学士学位' }],
  60. }),
  61. created() {},
  62. computed: {},
  63. methods: {
  64. ...teacher(['fetch']),
  65. ...mapSchool(['query']),
  66. ...mapSubject({ subFetch: 'fetch', subQuery: 'query' }),
  67. async search() {
  68. const teacherInfo = await this.fetch(this.teacherId);
  69. this.$set(this, `formUpdate`, teacherInfo.data);
  70. this.teaSchool();
  71. this.teaSubject();
  72. },
  73. async teaSchool() {
  74. const school = await this.query({ code: this.formUpdate.schid });
  75. if (school.errcode == 0 && school.data.length > 0) {
  76. this.schname = school.data[0].name;
  77. }
  78. },
  79. async teaSubject() {
  80. const subject = await this.subFetch(this.formUpdate.subid);
  81. if (subject.errcode == 0) {
  82. this.subname = subject.data.name;
  83. }
  84. },
  85. },
  86. watch: {
  87. teacherId: {
  88. handler(val) {
  89. if (val) {
  90. this.search();
  91. }
  92. },
  93. immediate: true,
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="less" scoped></style>