form.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <div>
  3. <div class="description-title">
  4. <span>基本信息</span>
  5. </div>
  6. <el-form :model="form" :rules="rules" ref="ruleForm" label-width="0px">
  7. <div class="description-view">
  8. <table class="description-table">
  9. <tbody>
  10. <tr class="description-tr">
  11. <th class="description-label">姓名</th>
  12. <td class="description-content">
  13. <el-form-item prop="realName">
  14. <el-input v-model="form.realName" size="mini" placeholder="请输入姓名"/>
  15. </el-form-item>
  16. </td>
  17. <th class="description-label">手机号</th>
  18. <td class="description-content">
  19. <el-form-item prop="mobileNo">
  20. <el-input size="mini" minlength="11" maxlength="11" v-model="form.mobileNo" placeholder="请输入手机号"/>
  21. </el-form-item>
  22. </td>
  23. <th class="description-label">微信号</th>
  24. <td class="description-content">
  25. <el-form-item prop="wechatNo">
  26. <el-input size="mini" v-model="form.wechatNo" placeholder="请输入微信号"/>
  27. </el-form-item>
  28. </td>
  29. </tr>
  30. <tr class="description-tr" v-for="(item, index) in form.educations" :key="index">
  31. <th class="description-label desc-item">
  32. <span class="close">
  33. <i v-if="index === 0" @click="addEducation" class="el-icon-circle-plus-outline"/>
  34. <i v-else @click="removeEducation(index)" class="el-icon-remove-outline"/>
  35. </span>学历</th>
  36. <td class="description-content">
  37. <el-form-item
  38. :prop="'educations.' + index + '.level'"
  39. :rules="{ required: true, message: '请输入学历', trigger: 'blur' }"
  40. >
  41. <el-input v-model="form.educations[index].level" size="mini" placeholder="请输入学历"/>
  42. </el-form-item>
  43. </td>
  44. <th class="description-label">学校</th>
  45. <td class="description-content">
  46. <el-form-item
  47. :prop="'educations.' + index + '.school'"
  48. :rules="{ required: true, message: '请选择毕业时间', trigger: 'blur' }"
  49. >
  50. <el-input size="mini" v-model="form.educations[index].school" placeholder="请输入学校"/>
  51. </el-form-item>
  52. </td>
  53. <th class="description-label">毕业时间</th>
  54. <td class="description-content">
  55. <el-form-item
  56. :prop="'educations.' + index + '.year'"
  57. :rules="{ required: true, message: '请选择毕业时间', trigger: 'blur' }"
  58. >
  59. <el-date-picker
  60. type="month"
  61. placeholder="请选择毕业时间"
  62. size="mini"
  63. v-model="form.educations[index].year"
  64. />
  65. </el-form-item>
  66. </td>
  67. </tr>
  68. <tr class="description-tr">
  69. <th class="description-label">所在城市</th>
  70. <td class="description-content">
  71. <el-form-item prop="liveCity">
  72. <el-input size="mini" v-model.trim="form.liveCity" placeholder="请输入所在城市"/>
  73. </el-form-item>
  74. </td>
  75. <th class="description-label">工作意向</th>
  76. <td class="description-content">
  77. <el-form-item prop="intentionCity">
  78. <el-input size="mini" v-model.trim="form.intentionCity" placeholder="请输入工作意向"/>
  79. </el-form-item>
  80. </td>
  81. <th class="description-label">声部</th>
  82. <td class="description-content">
  83. <el-form-item prop="subjectIdList">
  84. <el-select
  85. v-model.trim="form.subjectIdList"
  86. clearable
  87. filterable
  88. multiple
  89. size="mini"
  90. collapse-tags
  91. placeholder='请选择声部'
  92. >
  93. <el-option-group v-for="group in subjectList"
  94. :key="group.label"
  95. :label="group.label">
  96. <el-option v-for="item in group.options"
  97. :key="item.value"
  98. :label="item.label"
  99. :value="String(item.value)">
  100. </el-option>
  101. </el-option-group>
  102. </el-select>
  103. </el-form-item>
  104. </td>
  105. </tr>
  106. <tr class="description-tr">
  107. <th class="description-label">评估结果</th>
  108. <td class="description-content">
  109. <el-form-item prop="assessmentResult">
  110. <el-input size="mini" v-model.trim="form.assessmentResult" placeholder="请输入评估结果"/>
  111. </el-form-item>
  112. </td>
  113. <th class="description-label">信息来源</th>
  114. <td class="description-content">
  115. <el-form-item prop="sourceFrom">
  116. <el-select v-model.trim="form.sourceFrom"
  117. clearable
  118. filterable
  119. size="mini"
  120. placeholder="请选择信息来源">
  121. <el-option label="BOSS"
  122. value="BOSS"></el-option>
  123. <el-option label="转介绍"
  124. value="转介绍"></el-option>
  125. </el-select>
  126. </el-form-item>
  127. </td>
  128. <th class="description-label">其他综合情况</th>
  129. <td class="description-content">
  130. <el-form-item prop="otherComment">
  131. <el-input size="mini" v-model.trim="form.otherComment" placeholder="请输入其他综合情况"/>
  132. </el-form-item>
  133. </td>
  134. </tr>
  135. </tbody>
  136. </table>
  137. </div>
  138. <div class="description-title" style="margin-top: 20px">
  139. <span>在职信息</span>
  140. </div>
  141. <div class="description-view">
  142. <table class="description-table">
  143. <tbody>
  144. <tr class="description-tr">
  145. <th class="description-label">入职日期</th>
  146. <td class="description-content">
  147. <el-form-item prop="entryDate">
  148. <el-date-picker
  149. type="date"
  150. placeholder="选择入职日期"
  151. size="mini"
  152. v-model="form.entryDate"
  153. />
  154. </el-form-item>
  155. </td>
  156. <th class="description-label">职位</th>
  157. <td class="description-content">
  158. <el-form-item prop="position">
  159. <el-select v-model.trim="form.position"
  160. clearable
  161. filterable
  162. size="mini"
  163. placeholder="请选择职位">
  164. <el-option label="指导老师"
  165. value="ADVISER"></el-option>
  166. <el-option label="教务老师"
  167. value="ACADEMIC"></el-option>
  168. <el-option label="乐队指导"
  169. value="TEACHING"></el-option>
  170. </el-select>
  171. </el-form-item>
  172. </td>
  173. <th class="description-label">分部</th>
  174. <td class="description-content">
  175. <el-form-item prop="organId">
  176. <el-select v-model.trim="form.organId"
  177. placeholder='请选择分部'
  178. clearable
  179. filterable
  180. size="mini"
  181. >
  182. <el-option v-for='(item,index) in organList'
  183. :key="index"
  184. :value="item.id"
  185. :label="item.name"
  186. >
  187. </el-option>
  188. </el-select>
  189. </el-form-item>
  190. </td>
  191. </tr>
  192. <tr class="description-tr">
  193. <th class="description-label">员工类型</th>
  194. <td class="description-content">
  195. <el-form-item prop="isProbationPeriod">
  196. <el-select size="mini" v-model.trim="form.isProbationPeriod"
  197. clearable
  198. filterable
  199. placeholder="请选择员工类型">
  200. <el-option label="正式"
  201. :value="true"></el-option>
  202. <el-option label="试用"
  203. :value="false"></el-option>
  204. </el-select>
  205. </el-form-item>
  206. </td>
  207. <th class="description-label">人员状态</th>
  208. <td class="description-content">
  209. <el-form-item prop="status">
  210. <el-select size="mini" v-model.trim="form.status"
  211. clearable
  212. filterable
  213. placeholder="请选择人员状态">
  214. <el-option label="未录用"
  215. value="NOT_EMPLOYED"></el-option>
  216. <el-option label="面试中"
  217. value="INTERVIEWING"></el-option>
  218. <el-option label="储备"
  219. value="RESERVE"></el-option>
  220. <el-option label="全职"
  221. value="PART_TIME"></el-option>
  222. <el-option label="兼职"
  223. value="FULL_TIME"></el-option>
  224. <el-option label="离职"
  225. value="DIMISSION"></el-option>
  226. </el-select>
  227. </el-form-item>
  228. </td>
  229. <th class="description-label">离职日期</th>
  230. <td class="description-content">
  231. <el-form-item
  232. prop="resignationDate"
  233. :rules="{ required: form.status === 'DIMISSION', message: '请选择离职日期', trigger: 'blur' }"
  234. >
  235. <el-date-picker
  236. type="date"
  237. placeholder="选择离职日期"
  238. size="mini"
  239. v-model="form.resignationDate"
  240. />
  241. </el-form-item>
  242. </td>
  243. </tr>
  244. <tr class="description-tr">
  245. <th class="description-label">证件号码</th>
  246. <td class="description-content" colspan="5">
  247. <el-form-item prop="idCard">
  248. <el-input size="mini" v-model="form.idCard" placeholder="请输入证件号码"/>
  249. </el-form-item>
  250. </td>
  251. </tr>
  252. <tr class="description-tr">
  253. <th class="description-label">年龄</th>
  254. <td class="description-content">
  255. <el-form-item prop="age">
  256. <el-input v-model="form.age" size="mini" placeholder="请输入年龄"/>
  257. </el-form-item>
  258. </td>
  259. <th class="description-label">性别</th>
  260. <td class="description-content" colspan="3">
  261. <el-form-item prop="gender">
  262. <el-select size="mini" v-model.trim="form.gender"
  263. clearable
  264. filterable
  265. placeholder="请选择性别">
  266. <el-option label="男"
  267. :value="true"></el-option>
  268. <el-option label="女"
  269. :value="false"></el-option>
  270. </el-select>
  271. </el-form-item>
  272. </td>
  273. </tr>
  274. <tr class="description-tr">
  275. <th class="description-label">开户行</th>
  276. <td class="description-content">
  277. <el-form-item prop="bankAddress">
  278. <el-input size="mini" v-model="form.bankAddress" placeholder="请输入开户行"/>
  279. </el-form-item>
  280. </td>
  281. <th class="description-label">银行卡号</th>
  282. <td class="description-content" colspan="3">
  283. <el-form-item prop="bankCardNo">
  284. <el-input size="mini" v-model="form.bankCardNo" placeholder="请输入银行卡号"/>
  285. </el-form-item>
  286. </td>
  287. </tr>
  288. <tr class="description-tr">
  289. <th class="description-label">紧急联系人姓名</th>
  290. <td class="description-content">
  291. <el-form-item prop="emergencyContactName">
  292. <el-input size="mini" v-model.trim="form.emergencyContactName" placeholder="请输入紧急联系人姓名"/>
  293. </el-form-item>
  294. </td>
  295. <th class="description-label">紧急联系人关系</th>
  296. <td class="description-content">
  297. <el-form-item prop="emergencyContactRelation">
  298. <el-input size="mini" v-model.trim="form.emergencyContactRelation" placeholder="请输入紧急联系人关系"/>
  299. </el-form-item>
  300. </td>
  301. <th class="description-label">紧急联系人电话</th>
  302. <td class="description-content">
  303. <el-form-item prop="emergencyContactPhone">
  304. <el-input size="mini" v-model.trim="form.emergencyContactPhone" minlength="11" maxlength="11" placeholder="请输入紧急联系人电话"/>
  305. </el-form-item>
  306. </td>
  307. </tr>
  308. </tbody>
  309. </table>
  310. </div>
  311. </el-form>
  312. <span class="dialog-footer">
  313. <el-button @click="close('ruleForm')">取 消</el-button>
  314. <el-button type="primary" class="main-button" @click="onTypeSubmit('ruleForm')">确 定</el-button>
  315. </span>
  316. </div>
  317. </template>
  318. <script>
  319. // import Vue from 'vue'
  320. import { employeeCreate, employeeUpdate } from '@/api/appTenant'
  321. import Descriptions from '@/components/Descriptions'
  322. // Vue.use(Descriptions)
  323. export default {
  324. name: 'hrform',
  325. props: ['detail', 'subjectList', 'organList', 'close', 'getList'],
  326. components: {
  327. descriptions: Descriptions
  328. },
  329. data() {
  330. return {
  331. realName: '',
  332. form: {
  333. age: '',
  334. bankAddress: '',
  335. bankCardNo: '',
  336. birthdate: '',
  337. educationalBackground: '',
  338. emergencyContactName: '',
  339. emergencyContactPhone: '',
  340. emergencyContactRelation: '',
  341. entryDate: '',
  342. gender: true,
  343. idCard: '',
  344. intentionCity: '',
  345. assessmentResult: '',
  346. status: '',
  347. isProbationPeriod: '',
  348. liveCity: '',
  349. mobileNo: '',
  350. otherComment: '',
  351. position: '',
  352. realName: '',
  353. resignationDate: '',
  354. subjectIdList: [],
  355. wechatNo: '',
  356. organId: '',
  357. sourceFrom: '',
  358. educations: [{level: '', school: '', year: ''}]
  359. },
  360. rules: {
  361. age: [
  362. { required: true, message: '请输入年龄', trigger: 'blur' },
  363. ],
  364. bankAddress: [
  365. { required: true, message: '请输入开户行', trigger: 'blur' },
  366. ],
  367. bankCardNo: [
  368. { required: true, message: '请输入卡号', trigger: 'blur' },
  369. ],
  370. birthdate: [
  371. { required: true, message: '请输入生日', trigger: 'blur' },
  372. ],
  373. sourceFrom: [
  374. { required: true, message: '请输入信息来源', trigger: 'blur' },
  375. ],
  376. emergencyContactName: [
  377. { required: true, message: '请输入紧急联系人姓名', trigger: 'blur' },
  378. ],
  379. emergencyContactPhone: [
  380. { required: true, message: '请输入紧急联系人电话', trigger: 'blur' },
  381. ],
  382. emergencyContactRelation: [
  383. { required: true, message: '请输入紧急联系人关系', trigger: 'blur' },
  384. ],
  385. entryDate: [
  386. { required: true, message: '请输入入职日期', trigger: 'blur' },
  387. ],
  388. gender: [
  389. { required: true, message: '请选择性别', trigger: 'blur' },
  390. ],
  391. idCard: [
  392. { required: true, message: '请输入证件号码', trigger: 'blur' },
  393. ],
  394. intentionCity: [
  395. { required: true, message: '请输入工作意向', trigger: 'blur' },
  396. ],
  397. status: [
  398. { required: true, message: '请选择员工状态', trigger: 'blur' },
  399. ],
  400. isProbationPeriod: [
  401. { required: true, message: '请选择员工类型', trigger: 'blur' },
  402. ],
  403. liveCity: [
  404. { required: true, message: '请输入所在城市', trigger: 'blur' },
  405. ],
  406. mobileNo: [
  407. { required: true, message: '请输入手机号', trigger: 'blur' },
  408. ],
  409. otherComment: [
  410. { required: true, message: '请输入其他综合情况', trigger: 'blur' },
  411. ],
  412. position: [
  413. { required: true, message: '请输入职位', trigger: 'blur' },
  414. ],
  415. realName: [
  416. { required: true, message: '请输入姓名', trigger: 'blur' },
  417. ],
  418. subjectIdList: [
  419. { required: true, message: '请选择声部', trigger: 'blur' },
  420. ],
  421. organId: [
  422. { required: true, message: '请选择分部', trigger: 'blur' },
  423. ],
  424. // assessmentResult: [
  425. // { required: true, message: '请输入评估结果', trigger: 'blur' },
  426. // ],
  427. }
  428. }
  429. },
  430. watch: {
  431. detail() {
  432. this.updateData()
  433. },
  434. },
  435. mounted() {
  436. this.updateData()
  437. },
  438. methods: {
  439. updateData() {
  440. if (this.detail) {
  441. try {
  442. this.detail.subjectIdList = this.detail.subjectIdList.split(',')
  443. } catch (error) {}
  444. this.form = Object.assign({
  445. educations: [{level: '', school: '', year: ''}]
  446. }, this.detail)
  447. try {
  448. this.form.educations = JSON.parse(this.detail.educationalBackground)
  449. if (this.form.educations.length < 1) {
  450. this.form.educations = [{level: '', school: '', year: ''}]
  451. }
  452. this.form = {...this.form}
  453. } catch (error) {}
  454. } else {
  455. this.form.educations = [{level: '', school: '', year: ''}]
  456. this.form = {...this.form}
  457. }
  458. },
  459. addEducation() {
  460. this.form.educations = [...this.form.educations, {level: '', school: '', year: ''}]
  461. this.form = {...this.form}
  462. },
  463. removeEducation(index) {
  464. this.form.educations[index] = null
  465. this.form.educations = this.form.educations.filter(item => !!item)
  466. this.form = {...this.form}
  467. },
  468. onTypeSubmit() {
  469. this.$refs['ruleForm'].validate(valid => {
  470. if (valid) {
  471. const { $message } = this
  472. this.form.educationalBackground = JSON.stringify(this.form.educations)
  473. const {educations, subjectIdList, ...rest} = this.form
  474. if (this.detail && this.detail.id) {
  475. employeeUpdate(Object.assign({id: this.detail.id, subjectIdList: (subjectIdList || []).join(',')}, rest))
  476. .then(res => {
  477. if (res.code === 200) {
  478. $message.success('修改成功')
  479. this.close('ruleForm')
  480. this.getList()
  481. }
  482. })
  483. } else {
  484. employeeCreate({subjectIdList: (subjectIdList || []).join(','), ...rest})
  485. .then(res => {
  486. if (res.code === 200) {
  487. $message.success('创建成功')
  488. this.close('ruleForm')
  489. this.getList()
  490. }
  491. })
  492. }
  493. }
  494. })
  495. }
  496. }
  497. }
  498. </script>
  499. <style lang="less" scoped>
  500. .desc-item{
  501. position: relative;
  502. .close{
  503. position: absolute;
  504. left: 10px;
  505. cursor: pointer;
  506. }
  507. }
  508. .main-button{
  509. background-color: #14928a;
  510. border-color: #14928a;
  511. }
  512. .dialog-footer{
  513. display: block;
  514. text-align: right;
  515. margin-top: 20px;
  516. }
  517. .description-title {
  518. margin-bottom: 20px;
  519. color: rgba(0,0,0,.85);
  520. font-weight: 700;
  521. font-size: 16px;
  522. line-height: 1.5;
  523. }
  524. .description-view {
  525. width: 100%;
  526. border: 1px solid #e8e8e8;
  527. }
  528. .description-view .description-table {
  529. width: 100%;
  530. /* border: 1px solid #e8e8e8; */
  531. border-collapse: collapse;
  532. table-layout: fixed;
  533. }
  534. .description-view .description-tr {
  535. border-bottom: 1px solid #e8e8e8;
  536. width: 100%;
  537. }
  538. .description-view .description-tr:last-child {
  539. border-bottom: none;
  540. }
  541. .description-view .description-label {
  542. border-right: 1px solid #e8e8e8;
  543. background-color: #fafafa;
  544. color: rgba(0, 0, 0, 0.85);
  545. font-weight: 400;
  546. font-size: 14px;
  547. line-height: 22px;
  548. /* margin-right: 8px; */
  549. padding: 12px 16px;
  550. white-space: nowrap;
  551. display: table-cell;
  552. }
  553. .description-view .description-label:after {
  554. content: ""; /** content: ":" */
  555. margin: 0 8px 0 2px;
  556. position: relative;
  557. top: -0.5px;
  558. }
  559. .description-view .description-content {
  560. white-space: nowrap;
  561. overflow: hidden;
  562. text-overflow: ellipsis;
  563. border-right: 1px solid #e8e8e8;
  564. font-size: 14px;
  565. line-height: 1.5;
  566. padding: 12px 16px;
  567. padding-bottom: 0;
  568. color: rgba(0, 0, 0, 0.65);
  569. display: table-cell;
  570. }
  571. .description-tr .description-content:last-child {
  572. border-right: none;
  573. }
  574. </style>