EnrollmentModal.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <a-modal
  3. :title="title"
  4. :width="1600"
  5. :visible="visible"
  6. :maskClosable="false"
  7. :confirmLoading="confirmLoading"
  8. @ok="handleOk"
  9. @cancel="handleCancel">
  10. <a-spin :spinning="confirmLoading">
  11. <!-- 主表单区域 -->
  12. <a-form :form="form">
  13. <a-row>
  14. <a-col :span="8 ">
  15. <a-form-item label="登记人 " :labelCol="labelCol" :wrapperCol="wrapperCol">
  16. <j-popup
  17. v-decorator="['operator', validatorRules.operator]"
  18. :trigger-change="true"
  19. org-fields="realname,depart_name"
  20. dest-fields="operator,operatorDept"
  21. code="user_dept"
  22. @callback="popupCallback"/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :span="8 ">
  26. <a-form-item label="登记部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
  27. <a-input v-decorator="[ 'operatorDept', validatorRules.operatorDept]" placeholder="请输入登记部门" disabled></a-input>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :span="8 ">
  31. <a-form-item label="登记日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  32. <j-date placeholder="请选择登记日期" v-decorator="[ 'operateDate', validatorRules.operateDate]" :trigger-change="true" style="width: 100%"/>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :span="8 ">
  36. <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
  37. <a-input v-decorator="[ 'realname', validatorRules.realname]" placeholder="请输入姓名"></a-input>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :span="8 ">
  41. <a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
  42. <a-input v-decorator="[ 'username', validatorRules.username]" placeholder="请输入用户账号" disabled></a-input>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :span="8 ">
  46. <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
  47. <a-select v-decorator="['gender', validatorRules.gender]" placeholder="请选择性别">
  48. <a-select-option :value="1">男</a-select-option>
  49. <a-select-option :value="2">女</a-select-option>
  50. </a-select>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :span="8 ">
  54. <a-form-item label="证件类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  55. <a-select v-decorator="['idType', validatorRules.idType]" placeholder="请选择证件类型">
  56. <a-select-option value="身份证">身份证</a-select-option>
  57. <a-select-option value="其他">其他</a-select-option>
  58. </a-select>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :span="8 ">
  62. <a-form-item label="证件号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
  63. <a-input v-decorator="[ 'idNo', validatorRules.idNo]" placeholder="请输入证件号码"></a-input>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :span="8 ">
  67. <a-form-item label="生日" :labelCol="labelCol" :wrapperCol="wrapperCol">
  68. <j-date placeholder="请选择生日" v-decorator="[ 'birthday', validatorRules.birthday]" :trigger-change="true" style="width: 100%"/>
  69. </a-form-item>
  70. </a-col>
  71. <a-col :span="8 ">
  72. <a-form-item label="入职日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  73. <j-date placeholder="请选择入职日期" v-decorator="[ 'joinDate', validatorRules.joinDate]" :trigger-change="true" style="width: 100%"/>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :span="8 ">
  77. <a-form-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">
  78. <j-select-position placeholder="请选择职务" :multiple="false" v-decorator="['post', validatorRules.post]" />
  79. </a-form-item>
  80. </a-col>
  81. <a-col :span="8 ">
  82. <a-form-item label="职级" :labelCol="labelCol" :wrapperCol="wrapperCol">
  83. <a-input v-decorator="[ 'postLevel', validatorRules.postLevel]" placeholder="请输入职级"></a-input>
  84. </a-form-item>
  85. </a-col>
  86. <a-col :span="8 ">
  87. <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol">
  88. <a-select v-decorator="['education', validatorRules.education]" placeholder="请选择学历">
  89. <a-select-option value="大专">大专</a-select-option>
  90. <a-select-option value="本科">本科</a-select-option>
  91. <a-select-option value="硕士">硕士</a-select-option>
  92. <a-select-option value="博士">博士</a-select-option>
  93. </a-select>
  94. </a-form-item>
  95. </a-col>
  96. <a-col :span="8 ">
  97. <a-form-item label="岗位类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
  98. <a-select v-decorator="['positionType', validatorRules.positionType]" placeholder="请选择岗位类型">
  99. <a-select-option value="管理类">管理类</a-select-option>
  100. <a-select-option value="专技类">专技类</a-select-option>
  101. </a-select>
  102. </a-form-item>
  103. </a-col>
  104. <a-col :span="8 ">
  105. <a-form-item label="部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
  106. <j-select-depart v-decorator="['departIds', validatorRules.departIds]" :trigger-change="true"/>
  107. </a-form-item>
  108. </a-col>
  109. <a-col :span="8 ">
  110. <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
  111. <a-input v-decorator="[ 'mobile', validatorRules.mobile]" placeholder="请输入手机号码"></a-input>
  112. </a-form-item>
  113. </a-col>
  114. <a-col :span="8 ">
  115. <a-form-item label="座机" :labelCol="labelCol" :wrapperCol="wrapperCol">
  116. <a-input v-decorator="[ 'phone', validatorRules.phone]" placeholder="请输入座机"></a-input>
  117. </a-form-item>
  118. </a-col>
  119. <a-col :span="8 ">
  120. <a-form-item label="联系地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
  121. <a-input v-decorator="[ 'address', validatorRules.address]" placeholder="请输入联系地址"></a-input>
  122. </a-form-item>
  123. </a-col>
  124. <a-col :span="8 ">
  125. <a-form-item label="试用结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  126. <j-date placeholder="请选择试用结束日期" v-decorator="[ 'probationEnd', validatorRules.probationEnd]" :trigger-change="true" style="width: 100%"/>
  127. </a-form-item>
  128. </a-col>
  129. <a-col :span="8 ">
  130. <a-form-item label="合同起始日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  131. <j-date placeholder="请选择合同起始日期" v-decorator="[ 'contractStart', validatorRules.contractStart]" :trigger-change="true" style="width: 100%"/>
  132. </a-form-item>
  133. </a-col>
  134. <a-col :span="8 ">
  135. <a-form-item label="合同结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
  136. <j-date placeholder="请选择合同结束日期" v-decorator="[ 'contractEnd', validatorRules.contractEnd]" :trigger-change="true" style="width: 100%"/>
  137. </a-form-item>
  138. </a-col>
  139. <a-col :span="8 ">
  140. <a-form-item label="身份" :labelCol="labelCol" :wrapperCol="wrapperCol">
  141. <a-radio-group v-decorator="[ 'identity', validatorRules.identity]">
  142. <a-radio :value="1">普通用户</a-radio>
  143. <a-radio :value="2">上级</a-radio>
  144. </a-radio-group>
  145. </a-form-item>
  146. </a-col>
  147. <a-col :span="8 ">
  148. <a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
  149. <a-input v-decorator="[ 'remark', validatorRules.remark]" placeholder="请输入备注"></a-input>
  150. </a-form-item>
  151. </a-col>
  152. <a-col :span="8 ">
  153. <a-form-item label="签字图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
  154. <j-upload v-decorator="['signature', validatorRules.signature]" :trigger-change="true"></j-upload>
  155. </a-form-item>
  156. </a-col>
  157. <a-col :span="8 ">
  158. <a-form-item label="附件" :labelCol="labelCol" :wrapperCol="wrapperCol">
  159. <j-upload v-decorator="['attachment', validatorRules.attachment]" :trigger-change="true"></j-upload>
  160. </a-form-item>
  161. </a-col>
  162. </a-row>
  163. </a-form>
  164. <!-- 子表单区域 -->
  165. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  166. <a-tab-pane tab="联系人" :key="refKeys[0]" :forceRender="true">
  167. <j-editable-table
  168. :ref="refKeys[0]"
  169. :loading="enrollmentContactTable.loading"
  170. :columns="enrollmentContactTable.columns"
  171. :dataSource="enrollmentContactTable.dataSource"
  172. :maxHeight="300"
  173. :rowNumber="true"
  174. :rowSelection="true"
  175. :actionButton="true"/>
  176. </a-tab-pane>
  177. <a-tab-pane tab="工作经历" :key="refKeys[1]" :forceRender="true">
  178. <j-editable-table
  179. :ref="refKeys[1]"
  180. :loading="enrollmentJobTable.loading"
  181. :columns="enrollmentJobTable.columns"
  182. :dataSource="enrollmentJobTable.dataSource"
  183. :maxHeight="300"
  184. :rowNumber="true"
  185. :rowSelection="true"
  186. :actionButton="true"/>
  187. </a-tab-pane>
  188. <a-tab-pane tab="学习经历" :key="refKeys[2]" :forceRender="true">
  189. <j-editable-table
  190. :ref="refKeys[2]"
  191. :loading="enrollmentEduTable.loading"
  192. :columns="enrollmentEduTable.columns"
  193. :dataSource="enrollmentEduTable.dataSource"
  194. :maxHeight="300"
  195. :rowNumber="true"
  196. :rowSelection="true"
  197. :actionButton="true"/>
  198. </a-tab-pane>
  199. </a-tabs>
  200. </a-spin>
  201. </a-modal>
  202. </template>
  203. <script>
  204. import pick from 'lodash.pick'
  205. import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
  206. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  207. import { validateDuplicateValue } from '@/utils/util'
  208. import JDate from '@/components/jeecg/JDate'
  209. import JUpload from '@/components/jeecg/JUpload'
  210. import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  211. import JDictSelectTag from "@/components/dict/JDictSelectTag"
  212. import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
  213. export default {
  214. name: 'EnrollmentModal',
  215. mixins: [JEditableTableMixin],
  216. components: {
  217. JDate,
  218. JUpload,
  219. JSelectDepart,
  220. JDictSelectTag,
  221. JSelectPosition
  222. },
  223. data() {
  224. return {
  225. labelCol: {
  226. span: 6
  227. },
  228. wrapperCol: {
  229. span: 16
  230. },
  231. labelCol2: {
  232. span: 3
  233. },
  234. wrapperCol2: {
  235. span: 20
  236. },
  237. // 新增时子表默认添加几行空数据
  238. addDefaultRowNum: 1,
  239. validatorRules: {
  240. operator: {rules: [
  241. {required: true, message: '请输入登记人 !'},
  242. ]},
  243. operatorDept: {rules: [
  244. ]},
  245. operateDate: {rules: [
  246. {required: true, message: '请输入登记日期!'},
  247. ]},
  248. realname: {rules: [
  249. ]},
  250. username: {rules: [
  251. ]},
  252. gender: {rules: [
  253. {required: true, message: '请输入性别!'},
  254. ]},
  255. idType: {rules: [
  256. {required: true, message: '请输入证件类型!'},
  257. ]},
  258. idNo: {rules: [
  259. {required: true, message: '请输入证件号码!'},
  260. ]},
  261. birthday: {rules: [
  262. {required: true, message: '请输入生日!'},
  263. ]},
  264. joinDate: {rules: [
  265. {required: true, message: '请输入入职日期!'},
  266. ]},
  267. post: {rules: [
  268. {required: true, message: '请输入职务!'},
  269. ]},
  270. postLevel: {rules: [
  271. {required: true, message: '请输入职级!'},
  272. ]},
  273. education: {rules: [
  274. {required: true, message: '请选择学历!'},
  275. ]},
  276. positionType: {rules: [
  277. {required: true, message: '请输入岗位类型!'},
  278. ]},
  279. departIds: {rules: [
  280. {required: true, message: '请输入部门!'},
  281. ]},
  282. mobile: {rules: [
  283. ]},
  284. phone: {rules: [
  285. ]},
  286. address: {rules: [
  287. ]},
  288. probationEnd: {rules: [
  289. {required: true, message: '请输入试用结束日期!'},
  290. ]},
  291. contractStart: {rules: [
  292. {required: true, message: '请输入合同起始日期!'},
  293. ]},
  294. contractEnd: {rules: [
  295. {required: true, message: '请输入合同结束日期!'},
  296. ]},
  297. remark: {rules: [
  298. ]},
  299. identity: {rules: [
  300. ]},
  301. signature: {rules: [
  302. ]},
  303. attachment: {rules: [
  304. ]},
  305. },
  306. refKeys: ['enrollmentContact', 'enrollmentJob', 'enrollmentEdu', ],
  307. tableKeys:['enrollmentContact', 'enrollmentJob', 'enrollmentEdu', ],
  308. activeKey: 'enrollmentContact',
  309. // 工作经历
  310. enrollmentJobTable: {
  311. loading: false,
  312. dataSource: [],
  313. columns: [
  314. {
  315. title: '单位',
  316. key: 'company',
  317. type: FormTypes.input,
  318. width:"200px",
  319. placeholder: '请输入${title}',
  320. defaultValue: '',
  321. },
  322. {
  323. title: '职位',
  324. key: 'position',
  325. type: FormTypes.input,
  326. width:"200px",
  327. placeholder: '请输入${title}',
  328. defaultValue: '',
  329. },
  330. {
  331. title: '起始日期',
  332. key: 'startDate',
  333. type: FormTypes.date,
  334. width:"200px",
  335. placeholder: '请输入${title}',
  336. defaultValue: '',
  337. },
  338. {
  339. title: '截止日期',
  340. key: 'endDate',
  341. type: FormTypes.date,
  342. width:"200px",
  343. placeholder: '请输入${title}',
  344. defaultValue: '',
  345. },
  346. ]
  347. },
  348. // 联系人
  349. enrollmentContactTable: {
  350. loading: false,
  351. dataSource: [],
  352. columns: [
  353. {
  354. title: '姓名',
  355. key: 'name',
  356. type: FormTypes.input,
  357. width:"200px",
  358. placeholder: '请输入${title}',
  359. defaultValue: '',
  360. },
  361. {
  362. title: '关系',
  363. key: 'relation',
  364. type: FormTypes.input,
  365. width:"200px",
  366. placeholder: '请输入${title}',
  367. defaultValue: '',
  368. },
  369. {
  370. title: '性别',
  371. key: 'sex',
  372. width:"200px",
  373. placeholder: '请输入${title}',
  374. defaultValue: '',
  375. type: FormTypes.select,
  376. options: [ // 下拉选项
  377. { title: '男', value: '1' },
  378. { title: '女', value: '2' },
  379. ],
  380. },
  381. {
  382. title: '联系方式',
  383. key: 'phone',
  384. type: FormTypes.input,
  385. width:"200px",
  386. placeholder: '请输入${title}',
  387. defaultValue: '',
  388. },
  389. {
  390. title: '职业',
  391. key: 'career',
  392. type: FormTypes.input,
  393. width:"200px",
  394. placeholder: '请输入${title}',
  395. defaultValue: '',
  396. },
  397. ]
  398. },
  399. // 学习经历
  400. enrollmentEduTable: {
  401. loading: false,
  402. dataSource: [],
  403. columns: [
  404. {
  405. title: '学校',
  406. key: 'school',
  407. type: FormTypes.input,
  408. width:"200px",
  409. placeholder: '请输入${title}',
  410. defaultValue: '',
  411. },
  412. {
  413. title: '起始日期',
  414. key: 'startDate',
  415. type: FormTypes.date,
  416. width:"200px",
  417. placeholder: '请输入${title}',
  418. defaultValue: '',
  419. },
  420. {
  421. title: '截止日期',
  422. key: 'endDate',
  423. type: FormTypes.date,
  424. width:"200px",
  425. placeholder: '请输入${title}',
  426. defaultValue: '',
  427. },
  428. ]
  429. },
  430. url: {
  431. add: "/oa/enrollment/add",
  432. edit: "/oa/enrollment/edit",
  433. enrollmentJob: {
  434. list: '/oa/enrollment/queryEnrollmentJobByMainId'
  435. },
  436. enrollmentContact: {
  437. list: '/oa/enrollment/queryEnrollmentContactByMainId'
  438. },
  439. enrollmentEdu: {
  440. list: '/oa/enrollment/queryEnrollmentEduByMainId'
  441. },
  442. }
  443. }
  444. },
  445. methods: {
  446. getAllTable() {
  447. let values = this.tableKeys.map(key => getRefPromise(this, key))
  448. return Promise.all(values)
  449. },
  450. /** 调用完edit()方法之后会自动调用此方法 */
  451. editAfter() {
  452. let fieldval = pick(this.model,'operator','operatorDept','operateDate','realname','username','gender','idType','idNo','birthday','joinDate','post','postLevel','education','positionType','departIds','mobile','phone','address','probationEnd','contractStart','contractEnd','remark','identity','signature','attachment')
  453. this.$nextTick(() => {
  454. this.form.setFieldsValue(fieldval)
  455. })
  456. // 加载子表数据
  457. if (this.model.id) {
  458. let params = { id: this.model.id }
  459. this.requestSubTableData(this.url.enrollmentJob.list, params, this.enrollmentJobTable)
  460. this.requestSubTableData(this.url.enrollmentContact.list, params, this.enrollmentContactTable)
  461. this.requestSubTableData(this.url.enrollmentEdu.list, params, this.enrollmentEduTable)
  462. }
  463. },
  464. /** 整理成formData */
  465. classifyIntoFormData(allValues) {
  466. debugger
  467. let main = Object.assign(this.model, allValues.formValue)
  468. return {
  469. ...main, // 展开
  470. enrollmentContactList: allValues.tablesValue[0].values,
  471. enrollmentJobList: allValues.tablesValue[1].values,
  472. enrollmentEduList: allValues.tablesValue[2].values,
  473. }
  474. },
  475. validateError(msg){
  476. this.$message.error(msg)
  477. },
  478. popupCallback(row){
  479. this.form.setFieldsValue(pick(row,'operator','operatorDept','operateDate','realname','username','gender','idType','idNo','birthday','joinDate','post','postLevel','education','positionType','departIds','mobile','phone','address','probationEnd','contractStart','contractEnd','remark','identity','signature','attachment'))
  480. },
  481. }
  482. }
  483. </script>
  484. <style scoped>
  485. </style>