form.vue 22 KB

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