teacherOperation.vue 31 KB

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