teacherOperation.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. <template>
  2. <div class="m-container">
  3. <!-- <h2>
  4. <el-page-header @back="onCancel" :content="'老师' + (pageType == 'create' ? '新增' : '修改')"></el-page-header>
  5. </h2>-->
  6. <div class="infoWrap">
  7. <div class="left">
  8. <h4>基本信息</h4>
  9. <el-form :model="topForm" :rules="rules" ref="form">
  10. <el-row>
  11. <el-col :span="12">
  12. <el-form-item
  13. label="姓名"
  14. prop="realName"
  15. :label-width="formLabelWidth"
  16. >
  17. <el-input v-model.trim="topForm.realName"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="12">
  21. <el-form-item label="姓名(备注)" :label-width="formLabelWidth">
  22. <el-input v-model.trim="topForm.memo"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. </el-row>
  26. <el-row>
  27. <el-col :span="12">
  28. <el-form-item
  29. label="性别"
  30. prop="gender"
  31. :label-width="formLabelWidth"
  32. >
  33. <el-select v-model.trim="topForm.gender">
  34. <el-option label="男" :value="1"></el-option>
  35. <el-option label="女" :value="0"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <el-form-item label="出生日期" :label-width="formLabelWidth">
  41. <el-date-picker
  42. v-model.trim="topForm.birthdate"
  43. type="date"
  44. :picker-options="{
  45. firstDayOfWeek: 1,
  46. }"
  47. value-format="yyyy-MM-dd"
  48. placeholder="出生日期"
  49. ></el-date-picker>
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="12">
  55. <el-form-item
  56. label="入职日期"
  57. prop="entryDate"
  58. :label-width="formLabelWidth"
  59. >
  60. <template #label>
  61. 入职日期
  62. <el-popover
  63. placement="top"
  64. width="280"
  65. trigger="hover">
  66. <!-- <el-button slot="reference"></el-button> -->
  67. <i slot="reference"
  68. class="el-icon-warning-outline"
  69. style="font-size: 14px; "
  70. />
  71. <p style="color: red; line-height: 1.3; margin-bottom: 10px;">入职日期之前课酬按100%计算;<br />
  72. 入职日期当天及以后课酬按80%计算;<br />
  73. 转正日期当天及以后课酬按100%计算;<br />
  74. 若入职日期和转正日期设置为同一天,则日期当天及以后课酬按100%计算;</p>
  75. </el-popover>
  76. </template>
  77. <el-date-picker
  78. v-model.trim="topForm.entryDate"
  79. type="date"
  80. :picker-options="pickerOptions2"
  81. value-format="yyyy-MM-dd"
  82. placeholder="入职日期"
  83. ></el-date-picker>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="12">
  87. <el-form-item
  88. label="工作类型"
  89. prop="jobNature"
  90. :label-width="formLabelWidth"
  91. >
  92. <el-select
  93. v-model.trim="topForm.jobNature"
  94. placeholder="工作类型"
  95. clearable
  96. filterable
  97. >
  98. <el-option
  99. v-for="item in jobNature"
  100. :key="item.value"
  101. :label="item.label"
  102. :value="item.value"
  103. ></el-option>
  104. </el-select>
  105. </el-form-item>
  106. </el-col>
  107. </el-row>
  108. <el-row>
  109. <el-col :span="12">
  110. <el-form-item
  111. label="所属分部"
  112. prop="organId"
  113. :label-width="formLabelWidth"
  114. >
  115. <el-select
  116. v-model.trim="topForm.organId"
  117. filterable
  118. clearable
  119. placeholder="所属分部"
  120. @change="switchOrgan"
  121. >
  122. <el-option
  123. v-for="item in branchList"
  124. :key="item.value"
  125. :label="item.label"
  126. :value="item.value"
  127. ></el-option>
  128. </el-select>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="12">
  132. <el-form-item label="流动范围" :label-width="formLabelWidth">
  133. <select-all
  134. v-model.trim="topForm.flowOrganRange"
  135. filterable
  136. clearable
  137. multiple
  138. placeholder="流动范围"
  139. >
  140. <el-option
  141. v-for="item in branchList"
  142. :key="item.value"
  143. :label="item.label"
  144. :value="item.value.toString()"
  145. ></el-option>
  146. </select-all>
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. <el-row>
  151. <el-col :span="12">
  152. <el-form-item
  153. label="员工状态"
  154. prop="isProbationPeriod"
  155. :label-width="formLabelWidth"
  156. >
  157. <el-select
  158. v-model.trim="topForm.isProbationPeriod"
  159. clearable
  160. filterable
  161. placeholder="员工状态"
  162. >
  163. <el-option v-for="item in ProbationPeriodList" :key="item.value" :label="item.label" :value="Number(item.value)"></el-option>
  164. <!-- <el-option label="正式" :value="0"></el-option>
  165. <el-option label="试用" :value="1"></el-option>
  166. <el-option label="实习" :value="3"></el-option> -->
  167. </el-select>
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="12" v-if="pageType == 'update'">
  171. <el-form-item label="教学点" :label-width="formLabelWidth">
  172. <el-input disabled v-model.trim="teacherSchools"></el-input>
  173. </el-form-item>
  174. </el-col>
  175. </el-row>
  176. <el-row>
  177. <el-col :span="12">
  178. <el-form-item label="老师简介" :label-width="formLabelWidth">
  179. <el-input
  180. type="textarea"
  181. v-model.trim="topForm.introduction"
  182. ></el-input>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="12" class="diSpan">
  186. <el-tooltip placement="top" popper-class="mTooltip">
  187. <div slot="content">
  188. 「是」此老师可作为网管课老师;
  189. <br />「否」此老师不可作为网管课老师;
  190. </div>
  191. <!-- <img :src="imageIcon" class="micon el-tooltip" style="width:8px height:8px" alt /> -->
  192. <i
  193. class="el-icon-question micon el-tooltip"
  194. style="font-size: 18px; color: #f56c6c"
  195. ></i>
  196. </el-tooltip>
  197. <el-form-item label="开放陪练" label-width="90px" class="course">
  198. <el-select
  199. v-model.trim="topForm.isSupportExtraPracticeLesson"
  200. clearable
  201. filterable
  202. placeholder="开放陪练"
  203. >
  204. <el-option label="是" :value="true"></el-option>
  205. <el-option label="否" :value="false"></el-option>
  206. </el-select>
  207. </el-form-item>
  208. </el-col>
  209. </el-row>
  210. <h4>资料学历</h4>
  211. <el-row>
  212. <el-col :span="12">
  213. <!-- :rules="[{ required: true, message: '手机号不能为空',trigger: 'blur'},{pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号',trigger: 'blur' }]" -->
  214. <el-form-item
  215. label="手机号"
  216. prop="phone"
  217. :label-width="formLabelWidth"
  218. >
  219. <el-input v-model.trim.number="topForm.phone"></el-input>
  220. </el-form-item>
  221. </el-col>
  222. <el-col :span="12">
  223. <el-form-item label="毕业学校" :label-width="formLabelWidth">
  224. <el-input v-model.trim="topForm.graduateSchool"></el-input>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. <el-row>
  229. <el-col :span="12">
  230. <el-form-item label="电子邮箱" :label-width="formLabelWidth">
  231. <el-input v-model.trim="topForm.email"></el-input>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="12">
  235. <el-form-item label="最高学历" :label-width="formLabelWidth">
  236. <!-- <el-input v-model.trim="topForm.educationBackground"></el-input> -->
  237. <el-select
  238. v-model.trim="topForm.educationBackground"
  239. clearable
  240. filterable
  241. placeholder="最高学历"
  242. >
  243. <el-option label="初中" value="初中"></el-option>
  244. <el-option label="高中" value="高中"></el-option>
  245. <el-option label="大专" value="大专"></el-option>
  246. <el-option label="本科" value="本科"></el-option>
  247. <el-option label="硕士" value="硕士"></el-option>
  248. <el-option label="博士" value="博士"></el-option>
  249. </el-select>
  250. </el-form-item>
  251. </el-col>
  252. </el-row>
  253. <el-row>
  254. <el-col :span="12">
  255. <el-form-item
  256. label="专业技能"
  257. :rules="[{ required: true }]"
  258. :label-width="formLabelWidth"
  259. >
  260. <select-all
  261. :disabled="!topForm.organId"
  262. v-model="subjectIds"
  263. clearable
  264. placeholder="专业技能"
  265. multiple
  266. >
  267. <el-option
  268. v-for="item in subjectList"
  269. :key="item.id"
  270. :label="item.name"
  271. :value="item.id"
  272. ></el-option>
  273. </select-all>
  274. </el-form-item>
  275. </el-col>
  276. <el-col :span="12">
  277. <el-form-item label="职称" :label-width="formLabelWidth">
  278. <el-input v-model.trim="topForm.technicalTitles"></el-input>
  279. </el-form-item>
  280. </el-col>
  281. </el-row>
  282. <el-row>
  283. <el-col :span="12">
  284. <el-form-item label="证件类型" :label-width="formLabelWidth">
  285. <el-input v-model.trim="topForm.certificateType"></el-input>
  286. <!-- <el-select v-model.trim="topForm.certificateType" placeholder="证件类型">
  287. <el-option label="身份证" value="身份证"></el-option>
  288. <el-option label="护照" value="护照"></el-option>
  289. <el-option label="港澳通行证" value="港澳通行证"></el-option>
  290. </el-select>-->
  291. </el-form-item>
  292. </el-col>
  293. <el-col :span="12">
  294. <el-form-item label="证件号码" :label-width="formLabelWidth">
  295. <el-input v-model.trim="topForm.certificateNum"></el-input>
  296. </el-form-item>
  297. </el-col>
  298. </el-row>
  299. <el-row>
  300. <el-col :span="12">
  301. <el-form-item label="转正日期" :label-width="formLabelWidth">
  302. <template #label>
  303. 转正日期
  304. <el-popover
  305. placement="top"
  306. width="280"
  307. trigger="hover">
  308. <!-- <el-button slot="reference"></el-button> -->
  309. <i slot="reference"
  310. class="el-icon-warning-outline"
  311. style="font-size: 14px; "
  312. />
  313. <p style="color: red; line-height: 1.3; margin-bottom: 10px;">入职日期之前课酬按100%计算;<br />
  314. 入职日期当天及以后课酬按80%计算;<br />
  315. 转正日期当天及以后课酬按100%计算;<br />
  316. 若入职日期和转正日期设置为同一天,则日期当天及以后课酬按100%计算;</p>
  317. </el-popover>
  318. </template>
  319. <el-date-picker
  320. v-model="topForm.formalStaffDate"
  321. value-format="yyyy-MM-dd"
  322. type="date"
  323. placeholder="选择转正日期"
  324. :picker-options="pickerOptions"
  325. >
  326. </el-date-picker>
  327. </el-form-item>
  328. </el-col>
  329. <el-col :span="12">
  330. <el-form-item label="离职日期" :label-width="formLabelWidth">
  331. <el-date-picker
  332. v-model="topForm.demissionDate"
  333. value-format="yyyy-MM-dd"
  334. type="date"
  335. placeholder="选择离职日期"
  336. >
  337. </el-date-picker>
  338. </el-form-item>
  339. </el-col>
  340. </el-row>
  341. <el-row>
  342. <el-col :span="12">
  343. <el-form-item label :label-width="formLabelWidth">
  344. <!-- <el-input v-model.trim="topForm.certificateType"></el-input> -->
  345. <el-checkbox
  346. v-model.trim="topForm.isSupportCourseScheduleRewardsRules"
  347. >适用VIP分部活动</el-checkbox
  348. >
  349. </el-form-item>
  350. </el-col>
  351. </el-row>
  352. <!-- <el-row>
  353. <el-col :span="24">
  354. <p style="color: red; line-height: 1.3; margin-bottom: 10px;">入职日期之前课酬按100%计算;<br />
  355. 入职日期当天及以后课酬按80%计算;<br />
  356. 转正日期当天及以后课酬按100%计算;<br />
  357. 若入职日期和转正日期设置为同一天,则日期当天及以后课酬按100%计算;</p>
  358. </el-col>
  359. </el-row> -->
  360. <el-form-item>
  361. <el-button @click="onSubmit('form')" type="primary"
  362. >立即{{ pageType == "create" ? "创建" : "修改" }}</el-button
  363. >
  364. <el-button @click="onReSet('form')">重置</el-button>
  365. </el-form-item>
  366. </el-form>
  367. </div>
  368. <div class="right">
  369. <div class="teacherIcon">
  370. <img v-if="topForm.avatar" key="avatar" :src="topForm.avatar" alt />
  371. <img v-else key="avatar" src="@/assets/images/base/woman.png" alt />
  372. </div>
  373. <el-upload
  374. class="ivu-upload"
  375. :show-upload-list="false"
  376. :show-file-list="false"
  377. :headers="headers"
  378. :on-success="handleSuccess"
  379. accept=".jpg, .jpeg, .png, .gif"
  380. :max-size="2048"
  381. multiple
  382. action="/api-web/uploadFile"
  383. >
  384. <el-button
  385. icon="ios-cloud-upload-outline"
  386. >修改头像</el-button
  387. >
  388. <!--
  389. v-if="pageType != 'create'"
  390. <el-button
  391. icon="ios-cloud-upload-outline"
  392. v-if="0. == 'create'"
  393. v-permission="{
  394. child: 'createTeacher/uploadFile',
  395. parent: '/teacherAdd/baseInfo',
  396. }"
  397. >新增头像</el-button
  398. > -->
  399. </el-upload>
  400. <p class="iconP">
  401. 推荐图片尺寸:200x200;
  402. <br />支持的格式:jpg,jpeg,png,gif;
  403. <br />*头像修改后,需要点击页面 <br />下方「立即修改」保存生效;
  404. </p>
  405. </div>
  406. </div>
  407. </div>
  408. </template>
  409. <script>
  410. // import { queryByOrganId } from '@/api/systemManage'
  411. import { getToken } from "@/utils/auth";
  412. import { branchQueryPage, subjectListTree } from "@/api/specialSetting";
  413. import { teacherAdd, teacherUpdate, teacherGet } from "@/api/teacherManager";
  414. import { getSubject } from "@/api/buildTeam";
  415. import store from "@/store";
  416. import { permission } from "@/utils/directivePage";
  417. import { jobNature, ProbationPeriodList } from "@/utils/searchArray";
  418. import { isvalidPhone } from "@/utils/validate";
  419. import dayjs from 'dayjs'
  420. let validPhone = (rule, value, callback) => {
  421. if (!value) {
  422. callback(new Error("请输入电话号码"));
  423. } else if (!isvalidPhone(value)) {
  424. callback(new Error("请输入正确的11位手机号码"));
  425. } else {
  426. callback();
  427. }
  428. };
  429. export default {
  430. name: "teacherOperation",
  431. data() {
  432. const that = this
  433. return {
  434. headers: {
  435. Authorization: getToken(),
  436. },
  437. jobNature: jobNature,
  438. ProbationPeriodList: ProbationPeriodList,
  439. organId: null,
  440. pageType: this.$route.query.type,
  441. teacherId: this.$route.query.teacherId,
  442. formLabelWidth: "120px",
  443. branchList: [], // 分部列表
  444. subjectList: [], //声部列表 // 多选声部列表
  445. teacherSchools: null,
  446. topForm: {
  447. realName: null,
  448. gender: null,
  449. birthdate: null,
  450. entryDate: null,
  451. jobNature: null,
  452. organId: null,
  453. flowOrganRange: null,
  454. introduction: null,
  455. phone: null,
  456. avatar: null,
  457. graduateSchool: null,
  458. email: null,
  459. educationBackground: null,
  460. demissionDate:null,
  461. formalStaffDate: null,
  462. isProbationPeriod: null,
  463. technicalTitles: null,
  464. certificateType: null,
  465. certificateNum: null,
  466. isSupportCourseScheduleRewardsRules: true,
  467. isSupportExtraPracticeLesson: null,
  468. memo: null,
  469. },
  470. subjectIds: [],
  471. tenantId: null,
  472. // imageIcon: require("@/assets/images/base/warning.png"),
  473. rules: {
  474. realName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
  475. gender: [{ required: true, message: "请选择性别", trigger: "change" }],
  476. entryDate: [
  477. { required: true, message: "请选择入职日期", trigger: "change" },
  478. ],
  479. jobNature: [
  480. { required: true, message: "请选择工作类型", trigger: "change" },
  481. ],
  482. isProbationPeriod: [
  483. { required: true, message: "请选择员工状态", trigger: "change" },
  484. ],
  485. organId: [
  486. { required: true, message: "请选择所属分部", trigger: "change" },
  487. ],
  488. phone: [{ required: true, validator: validPhone, trigger: "blur" }],
  489. subjectIds: [
  490. {
  491. required: true,
  492. type: "array",
  493. message: "请选择专业技能",
  494. trigger: "change",
  495. },
  496. ],
  497. isAvatar: null,
  498. },
  499. pickerOptions2: {
  500. firstDayOfWeek: 1,
  501. disabledDate(time) {
  502. let date = new Date(dayjs(that.topForm.formalStaffDate).format('YYYY-MM-DD') + ' 00:00:00')
  503. return that.topForm.formalStaffDate ? time.getTime() > date.getTime() : false;
  504. }
  505. },
  506. pickerOptions: {
  507. firstDayOfWeek: 1,
  508. disabledDate(time) {
  509. let date = new Date(dayjs(that.topForm.entryDate).format('YYYY-MM-DD') + ' 00:00:00')
  510. return that.topForm.entryDate ? date.getTime() > time.getTime() : false;
  511. }
  512. }
  513. };
  514. },
  515. created() {},
  516. mounted() {
  517. this.pageType = this.$route.query.type;
  518. this.teacherId = this.$route.query.teacherId;
  519. this.__init();
  520. },
  521. // activated() {
  522. // this.pageType = this.$route.query.type;
  523. // this.teacherId = this.$route.query.teacherId;
  524. // this.__init();
  525. // },
  526. methods: {
  527. __init() {
  528. if (this.$route.query.search) {
  529. this.Fsearch = this.$route.query.search;
  530. }
  531. if (this.$route.query.rules) {
  532. this.Frules = this.$route.query.rules;
  533. }
  534. // isAvatar
  535. branchQueryPage({
  536. // 获取分部
  537. delFlag: 0,
  538. rows: 9999,
  539. }).then((res) => {
  540. if (res.code == 200 && res.data && res.data.rows) {
  541. this.branchList = [];
  542. res.data.rows.forEach((item) => {
  543. this.branchList.push({
  544. label: item.name,
  545. value: item.id,
  546. });
  547. });
  548. }
  549. });
  550. if (this.pageType == "update") {
  551. teacherGet({ teacherId: this.teacherId }).then((res) => {
  552. if (res.code == 200) {
  553. let result = res.data;
  554. this.topForm = {
  555. realName: result.realName,
  556. gender: result.gender,
  557. birthdate: result.birthdate,
  558. entryDate: result.entryDate,
  559. jobNature: result.jobNature,
  560. organId: result.teacherOrganId ? result.teacherOrganId : null,
  561. flowOrganRange: result.flowOrganRangeId
  562. ? result.flowOrganRangeId.split(",")
  563. : null,
  564. introduction: result.introduction,
  565. phone: result.phone,
  566. avatar: result.avatar,
  567. graduateSchool: result.graduateSchool,
  568. email: result.email,
  569. educationBackground: result.educationBackground,
  570. demissionDate:result.demissionDate,
  571. formalStaffDate: result.formalStaffDate,
  572. technicalTitles: result.technicalTitles,
  573. certificateType: result.certificateType,
  574. certificateNum: result.certificateNum,
  575. isProbationPeriod: result.isProbationPeriod,
  576. isSupportCourseScheduleRewardsRules:
  577. result.isSupportCourseScheduleRewardsRules,
  578. isSupportExtraPracticeLesson: result.isSupportExtraPracticeLesson,
  579. memo: result.memo,
  580. };
  581. let sn = [];
  582. result.teacherSchools.forEach((item) => {
  583. sn.push(item.name);
  584. });
  585. if (result.subjectId) {
  586. let arr = result.subjectId.split(",");
  587. this.subjectIds = arr.map((item) => {
  588. return parseInt(item);
  589. });
  590. }
  591. this.teacherSchools = this.joinArray(sn, ","); // 教学点
  592. this.switchOrgan();
  593. }
  594. });
  595. }
  596. },
  597. // pickerOptions() {
  598. // return {
  599. // disabledDate(time) {
  600. // let date = new Date(this.topForm.entryDate)
  601. // return time.getTime() > date.now();
  602. // }
  603. // }
  604. // },
  605. joinArray(value, type) {
  606. if (!type) {
  607. type = " ";
  608. }
  609. if (typeof value == "object" && value != null) {
  610. return value.join(type);
  611. } else {
  612. return value;
  613. }
  614. },
  615. onSubmit(formName) {
  616. this.$refs[formName].validate((valid) => {
  617. if (valid) {
  618. if (this.subjectIds.length <= 0) {
  619. this.$message.error("请选择专业技能");
  620. return;
  621. }
  622. if (this.topForm.flowOrganRange instanceof Array) {
  623. this.topForm.flowOrganRange = this.topForm.flowOrganRange
  624. ? this.topForm.flowOrganRange.join(",")
  625. : null;
  626. }
  627. this.subjectId = this.subjectIds.join(",");
  628. this.topForm.subjectId = this.subjectId;
  629. if (this.pageType == "update") {
  630. this.topForm.id = this.teacherId;
  631. teacherUpdate(this.topForm).then((res) => {
  632. if (res.code == 200) {
  633. // this.$emit('onTeacher')
  634. this.$store.dispatch('delVisitedViews', this.$route)
  635. this.$router.push({
  636. path: "/teacherManager/teacherList",
  637. query: { rules: this.Frules, search: this.Fsearch },
  638. });
  639. }
  640. this.messageTips("修改", res);
  641. });
  642. } else if (this.pageType == "create") {
  643. if (this.topForm.id) {
  644. delete this.topForm.id;
  645. }
  646. teacherAdd(this.topForm).then((res) => {
  647. if (res.code == 200) {
  648. // 权限判断,是否有课酬设置
  649. if (permission("/teacherAdd/salarySeting")) {
  650. this.$emit("onTeacher", res.data);
  651. } else {
  652. this.$store.dispatch('delVisitedViews', this.$route)
  653. this.$router.push({
  654. path: "/teacherManager/teacherList",
  655. query: { rules: this.Frules, search: this.Fsearch },
  656. });
  657. }
  658. }
  659. this.messageTips("添加", res);
  660. });
  661. }
  662. } else {
  663. this.$nextTick(() => {
  664. let isError = document.getElementsByClassName('is-error')
  665. isError[0].scrollIntoView({
  666. // 滚动到指定节点
  667. // 值有start,center,end,nearest,当前显示在视图区域中间
  668. block: 'center',
  669. // 值有auto、instant,smooth,缓动动画(当前是慢速的)
  670. behavior: 'smooth',
  671. })
  672. })
  673. return false;
  674. }
  675. });
  676. },
  677. messageTips(title, res) {
  678. if (res.code == 200) {
  679. this.$message.success(title + "成功");
  680. } else {
  681. this.topForm.subjectIds = this.topForm.subjectIds.split(",");
  682. this.$message.error(res.msg);
  683. }
  684. },
  685. onReSet(formName) {
  686. this.topForm = {
  687. realName: null,
  688. gender: null,
  689. birthdate: null,
  690. entryDate: null,
  691. jobNature: null,
  692. organId: null,
  693. flowOrganRange: null,
  694. introduction: null,
  695. phone: null,
  696. avatar: null,
  697. graduateSchool: null,
  698. email: null,
  699. educationBackground: null,
  700. demissionDate: null,
  701. formalStaffDate: null,
  702. subjectIds: [],
  703. technicalTitles: null,
  704. certificateType: null,
  705. certificateNum: null,
  706. jobType: "ADVISER",
  707. memo: null
  708. };
  709. this.subjectIds = []
  710. this.$refs[formName].resetFields();
  711. },
  712. onCancel() {
  713. this.$store.dispatch('delVisitedViews', this.$route)
  714. this.$router.push({
  715. path: "/teacherManager/teacherList",
  716. query: { rules: this.Frules, search: this.Fsearch },
  717. });
  718. },
  719. handleSuccess(res) {
  720. // 获取富文本组件实例
  721. // let quill = this.editor
  722. // 如果上传成功
  723. if (res.code == 200) {
  724. // 获取光标所在位置
  725. this.topForm.avatar = res.data.url;
  726. }
  727. },
  728. // 选择分部
  729. switchOrgan() {
  730. if (this.topForm.organId == 43) {
  731. this.tenantId = 2;
  732. } else {
  733. this.tenantId = 1;
  734. }
  735. getSubject({ tenantId: this.tenantId }).then((res) => {
  736. if (res.code == 200) {
  737. this.subjectList = res.data;
  738. }
  739. });
  740. },
  741. },
  742. };
  743. </script>
  744. <style lang="scss" scoped>
  745. .atooltip.el-tooltip__popper[x-placement^="top"] .popper__arrow {
  746. border-top-color: #ecf0f0;
  747. color: #666666;
  748. }
  749. .atooltip.el-tooltip__popper[x-placement^="top"] .popper__arrow:after {
  750. border-top-color: #ecf0f0;
  751. color: #666666;
  752. }
  753. .atooltip {
  754. background: #ecf0f0 !important;
  755. color: #666666;
  756. }
  757. .diSpan {
  758. position: relative;
  759. .micon {
  760. position: absolute;
  761. top: 12px;
  762. left: 64px;
  763. }
  764. }
  765. .course {
  766. /deep/.el-form-item__label {
  767. text-align: left !important;
  768. }
  769. }
  770. // /deep/.el-tooltip__popper.is-dark {
  771. // background-color: #ECF0F0!important;
  772. // color: #666!important;
  773. // }
  774. .el-button--primary {
  775. background: #14928a;
  776. border-color: #14928a;
  777. color: #fff;
  778. &:hover,
  779. &:active,
  780. &:focus {
  781. background: #14928a;
  782. border-color: #14928a;
  783. color: #fff;
  784. }
  785. }
  786. /deep/.el-date-editor.el-input,
  787. /deep/.el-select {
  788. width: 100% !important;
  789. }
  790. // .el-row {
  791. // margin-top: 40px;
  792. // }
  793. // .el-col {
  794. // display: flex;
  795. // align-items: center;
  796. // margin-bottom: 20px;
  797. // justify-content: flex-end;
  798. // margin-right: 50%;
  799. // }
  800. // .el-input-group {
  801. // width: 200px;
  802. // margin: 0 20px;
  803. // }
  804. // /deep/.el-tree-node__content {
  805. // height: 40px !important;
  806. // }
  807. /deep/.el-form-item__content {
  808. font-size: 14px !important;
  809. margin-right: 5%;
  810. }
  811. .infoWrap {
  812. margin-top: 20px;
  813. display: flex;
  814. flex-direction: row;
  815. justify-content: flex-start;
  816. .left {
  817. max-width: 1000px;
  818. width: 100%;
  819. h4 {
  820. margin-bottom: 20px;
  821. }
  822. }
  823. .right {
  824. margin-left: 100px;
  825. display: flex;
  826. flex-direction: column;
  827. align-items: center;
  828. .teacherIcon {
  829. width: 150px;
  830. height: 150px;
  831. // border: 1px solid #444;
  832. border-radius: 50%;
  833. overflow: hidden;
  834. margin-bottom: 20px;
  835. img {
  836. width: 150px;
  837. height: 150px;
  838. object-fit: cover;
  839. }
  840. }
  841. }
  842. .iconP {
  843. margin-top: 10px;
  844. font-size: 14px;
  845. color: red;
  846. width: 260px;
  847. text-align: center;
  848. }
  849. }
  850. </style>