teacherOperation.vue 34 KB

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