teacherOperation.vue 33 KB

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