teacherOperation.vue 32 KB

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