edit.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. <template>
  2. <div class="card-edit">
  3. <a-form :model="dataModel" autocomplete="off" @finish="onFinish">
  4. <a-divider orientation="left">求职人员信息</a-divider>
  5. <a-row :gutter="24">
  6. <a-col :span="8">
  7. <a-form-item label="姓名" :label-col="{ span: 6 }"
  8. name="name" :rules="[{ required: true, message: '请输入姓名!' }]">
  9. <a-input v-model:value="dataModel.name" placeholder=""/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :span="8">
  13. <a-form-item label="身份证号码" :label-col="{ span: 6 }"
  14. name="identityNumber" :rules="[{ required: true, message: '请输入身份证号码!' }]" >
  15. <a-input v-model:value="dataModel.identityNumber" placeholder="" @change="onIdentityNumberChange()"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :span="8">
  19. <a-form-item label="性别" :label-col="{span:6}"
  20. name="sex" :rules="[{ required: true, message: '请选择性别!' }]">
  21. <a-select
  22. ref="select" disabled
  23. v-model:value="dataModel.sex"
  24. :options="genderList"
  25. :field-names="{ label: 'name', value: 'value' }"
  26. :allow-clear="true"
  27. >
  28. </a-select>
  29. </a-form-item>
  30. </a-col>
  31. </a-row>
  32. <a-row :gutter="24">
  33. <a-col :span="8">
  34. <a-form-item label="重点人员类别" :label-col="{span:6}" name="keyPersonTypeID"
  35. :rules="[{ required: true, message: '请选择重点人员类别!' }]">
  36. <a-select
  37. ref="select"
  38. v-model:value="dataModel.keyPersonTypeID"
  39. :options="keyPersonTypeList"
  40. :field-names="{ label: 'name', value: 'value' }"
  41. :allow-clear="true"
  42. >
  43. </a-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :span="8">
  47. <a-form-item label="就业状态" :label-col="{span:6}" name="jobStatusID"
  48. :rules="[{ required: true, message: '请选择就业状态!' }]">
  49. <a-select
  50. ref="select"
  51. v-model:value="dataModel.jobStatusID"
  52. :options="jobStatusList"
  53. :field-names="{ label: 'name', value: 'value' }"
  54. :allow-clear="true"
  55. >
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :span="8">
  60. <a-form-item label="所属驿站" :label-col="{span:6}" name="siteID"
  61. :rules="[{ required: true, message: '请选择所属驿站!' }]">
  62. <a-select
  63. ref="select"
  64. v-model:value="dataModel.siteID"
  65. :options="siteList"
  66. :field-names="{ label: 'siteName', value: 'siteID' }"
  67. :allow-clear="true"
  68. >
  69. </a-select>
  70. </a-form-item>
  71. </a-col>
  72. </a-row>
  73. <a-row :gutter="24">
  74. <a-col :span="8">
  75. <a-form-item
  76. label="联系人"
  77. :label-col="{ span: 6 }"
  78. name="userName">
  79. <a-input v-model:value="dataModel.userName" placeholder=""/>
  80. </a-form-item>
  81. </a-col>
  82. <a-col :span="8">
  83. <a-form-item label="联系电话" :label-col="{ span: 6 }"
  84. name="userMobile" :rules="[{ required: true,message: '请输入联系电话!' }]">
  85. <a-input v-model:value="dataModel.userMobile" placeholder=""/>
  86. </a-form-item>
  87. </a-col>
  88. <a-col :span="8">
  89. <a-form-item
  90. label="地址"
  91. :label-col="{ span: 6 }"
  92. name="address"
  93. :rules="[{ required: true, message: '请输入地址!' }]"
  94. >
  95. <a-input v-model:value="dataModel.address" placeholder=""/>
  96. </a-form-item>
  97. </a-col>
  98. </a-row>
  99. <a-row :gutter="24">
  100. <a-col :span="8">
  101. <a-form-item
  102. label="籍贯"
  103. :label-col="{ span: 6 }"
  104. name="nativePlace">
  105. <a-input v-model:value="dataModel.nativePlace" placeholder=""/>
  106. </a-form-item>
  107. </a-col>
  108. <a-col :span="8">
  109. </a-col>
  110. <a-col :span="8">
  111. </a-col>
  112. </a-row>
  113. <a-divider orientation="left">其它信息</a-divider>
  114. <a-row :gutter="24">
  115. <a-col :span="8">
  116. <a-form-item label="社会保障卡号" :label-col="{ span: 6 }" name="socialSecurityCard">
  117. <a-input v-model:value="dataModel.socialSecurityCard" placeholder=""/>
  118. </a-form-item>
  119. </a-col>
  120. <a-col :span="8">
  121. <a-form-item label="毕业院校" :label-col="{span:6}" name="finishSchool">
  122. <a-input v-model:value="dataModel.finishSchool" placeholder=""/>
  123. </a-form-item>
  124. </a-col>
  125. <a-col :span="8">
  126. <a-form-item label="专业" :label-col="{ span: 6 }" name="profession">
  127. <a-input v-model:value="dataModel.profession" placeholder=""/>
  128. </a-form-item>
  129. </a-col>
  130. </a-row>
  131. <a-row :gutter="24">
  132. <a-col :span="8">
  133. <a-form-item label="是否全日制" :label-col="{ span: 6 }" name="socialSecurityCard">
  134. <a-select ref="select" v-model:value="dataModel.isFullTime" :options="isFullTimeList"
  135. :field-names="{ label: 'name', value: 'value' }" :allow-clear="false"></a-select>
  136. </a-form-item>
  137. </a-col>
  138. <a-col :span="8">
  139. <a-form-item label="职业资格类别" :label-col="{span:6}" name="occupationalCategoryName">
  140. <a-cascader :load-data="loadLevelOccupationalCategoryList"
  141. v-model:value="dataModel.occupationalCategoryName"
  142. :options="occupationalCategoryList" change-on-select @change="occupationalChange">
  143. </a-cascader>
  144. </a-form-item>
  145. </a-col>
  146. <a-col :span="8">
  147. <a-form-item label="职业资格等级" :label-col="{ span: 6 }" name="profession">
  148. <a-select ref="select" v-model:value="dataModel.occupationalLevel" :options="occupationalLevelList"
  149. :field-names="{ label: 'name', value: 'value' }" :allow-clear="false"></a-select>
  150. </a-form-item>
  151. </a-col>
  152. </a-row>
  153. <a-row :gutter="24">
  154. <a-col :span="8">
  155. <a-form-item label="民族" :label-col="{ span: 6 }" name="nation">
  156. <a-select
  157. ref="select"
  158. v-model:value="dataModel.nation"
  159. :options="nationList"
  160. :field-names="{ label: 'name', value: 'value' }"
  161. :allow-clear="true"
  162. ></a-select>
  163. </a-form-item>
  164. </a-col>
  165. <a-col :span="8">
  166. <a-form-item label="政治面貌" :label-col="{span:6}" name="politicsStatusID">
  167. <a-select
  168. ref="select"
  169. v-model:value="dataModel.politicsStatusID"
  170. :options="politicsStatusList"
  171. :field-names="{ label: 'name', value: 'value' }"
  172. :allow-clear="true"
  173. >
  174. </a-select>
  175. </a-form-item>
  176. </a-col>
  177. <a-col :span="8">
  178. <a-form-item label="出生地" :label-col="{ span: 6 }" name="birthPlace">
  179. <a-input v-model:value="dataModel.birthPlace" placeholder=""/>
  180. </a-form-item>
  181. </a-col>
  182. </a-row>
  183. <a-row :gutter="24">
  184. <a-col :span="8">
  185. <a-form-item label="出生日期" :label-col="{ span: 6 }" name="birthDay" >
  186. <a-date-picker disabled
  187. v-model:value="dataModel.birthDay"
  188. picker="date"
  189. value-format="YYYY-MM-DD"/>
  190. </a-form-item>
  191. </a-col>
  192. <a-col :span="8">
  193. <a-form-item label="户口性质" :label-col="{span:6}" name="familyNatureID" >
  194. <a-select
  195. ref="select"
  196. v-model:value="dataModel.familyNatureID"
  197. :options="familyNatureList"
  198. :field-names="{ label: 'name', value: 'value' }"
  199. :allow-clear="true"
  200. >
  201. </a-select>
  202. </a-form-item>
  203. </a-col>
  204. <a-col :span="8">
  205. <a-form-item label="最高学历" :label-col="{span:6}" name="cultureRank">
  206. <a-select
  207. ref="select"
  208. v-model:value="dataModel.cultureRank"
  209. :options="cultureList"
  210. :field-names="{ label: 'name', value: 'value' }"
  211. :allow-clear="true"
  212. >
  213. </a-select>
  214. </a-form-item>
  215. </a-col>
  216. </a-row>
  217. <a-row :gutter="24">
  218. <a-col :span="8">
  219. <a-form-item label="健康状况" :label-col="{span:6}" name="healthID">
  220. <a-select
  221. ref="select"
  222. v-model:value="dataModel.healthID"
  223. :options="healthList"
  224. :field-names="{ label: 'name', value: 'value' }"
  225. :allow-clear="true"
  226. >
  227. </a-select>
  228. </a-form-item>
  229. </a-col>
  230. <a-col :span="8">
  231. <a-form-item label="婚姻状况" :label-col="{span:6}" name="maritalStatusID">
  232. <a-select
  233. ref="select"
  234. v-model:value="dataModel.maritalStatusID"
  235. :options="maritalStatusList"
  236. :field-names="{ label: 'name', value: 'value' }"
  237. :allow-clear="true"
  238. >
  239. </a-select>
  240. </a-form-item>
  241. </a-col>
  242. <a-col :span="8">
  243. <a-form-item
  244. label="血型"
  245. :label-col="{ span: 6 }"
  246. name="bloodTypeID" >
  247. <a-select
  248. ref="select"
  249. v-model:value="dataModel.bloodTypeID"
  250. :options="bloodTypeList"
  251. :field-names="{ label: 'name', value: 'value' }"
  252. :allow-clear="true"
  253. >
  254. </a-select>
  255. </a-form-item>
  256. </a-col>
  257. </a-row>
  258. <a-row :gutter="24">
  259. <a-col :span="8">
  260. <a-form-item
  261. label="身高"
  262. :label-col="{ span: 6 }"
  263. name="height">
  264. <a-input v-model:value="dataModel.height" placeholder="" suffix="cm"/>
  265. </a-form-item>
  266. </a-col>
  267. <a-col :span="8">
  268. <a-form-item
  269. label="体重"
  270. :label-col="{ span: 6 }"
  271. name="weight" >
  272. <a-input v-model:value="dataModel.weight" placeholder="" suffix="kg"/>
  273. </a-form-item>
  274. </a-col>
  275. <a-col :span="8">
  276. <a-form-item
  277. label="视力"
  278. :label-col="{ span: 6 }"
  279. name="vision">
  280. <a-input v-model:value="dataModel.vision" placeholder=""/>
  281. </a-form-item>
  282. </a-col>
  283. </a-row>
  284. <a-row :gutter="24">
  285. <a-col :span="8">
  286. <a-form-item label="省份" :label-col="{span:6}" name="provinceCode">
  287. <a-select
  288. ref="select"
  289. v-model:value="dataModel.provinceCode"
  290. :options="provinceList"
  291. :field-names="{ label: 'name', value: 'code' }"
  292. :allow-clear="true"
  293. >
  294. </a-select>
  295. </a-form-item>
  296. </a-col>
  297. <a-col :span="8">
  298. <a-form-item label="市/县" :label-col="{span:6}" name="regionCode">
  299. <a-select
  300. ref="select"
  301. v-model:value="dataModel.regionCode"
  302. :options="regionList"
  303. :field-names="{ label: 'name', value: 'code' }"
  304. :allow-clear="true"
  305. @change="regionChange"
  306. >
  307. </a-select>
  308. </a-form-item>
  309. </a-col>
  310. <a-col :span="8">
  311. <a-form-item label="镇街" :label-col="{span:6}" name="streetCode">
  312. <a-select
  313. ref="select"
  314. v-model:value="dataModel.streetCode"
  315. :options="streetList"
  316. :field-names="{ label: 'name', value: 'code' }"
  317. :allow-clear="true"
  318. >
  319. </a-select>
  320. </a-form-item>
  321. </a-col>
  322. </a-row>
  323. <a-row :gutter="24">
  324. <a-col :span="8">
  325. <a-form-item
  326. label="家庭住址"
  327. :label-col="{ span: 6 }"
  328. name="familyAddress" >
  329. <a-input v-model:value="dataModel.familyAddress" placeholder=""/>
  330. </a-form-item>
  331. </a-col>
  332. <a-col :span="8">
  333. <a-form-item
  334. label="邮政编码"
  335. :label-col="{ span: 6 }"
  336. name="postalCode">
  337. <a-input v-model:value="dataModel.postalCode" placeholder=""/>
  338. </a-form-item>
  339. </a-col>
  340. <a-col :span="8">
  341. <a-form-item
  342. label="电子邮箱"
  343. :label-col="{ span: 6 }"
  344. name="email">
  345. <a-input v-model:value="dataModel.email" placeholder=""/>
  346. </a-form-item>
  347. </a-col>
  348. </a-row>
  349. <a-row :gutter="24">
  350. <a-col :span="16">
  351. <a-form-item label="兴趣爱好" :label-col="{ span: 3}" name="hobby" >
  352. <a-textarea v-model:value="dataModel.hobby" placeholder="兴趣爱好" :rows="2" />
  353. </a-form-item>
  354. </a-col>
  355. </a-row>
  356. <a-row :gutter="24">
  357. <a-col :span="16">
  358. <a-form-item label="个人技能" :label-col="{ span: 3 }" name="personalSkills" >
  359. <a-textarea v-model:value="dataModel.personalSkills" placeholder="个人技能" :rows="4" />
  360. </a-form-item>
  361. </a-col>
  362. </a-row>
  363. <a-row>
  364. <a-col :span="24" style="text-align: right; margin-top: 20px; margin-right: 20px">
  365. <Space>
  366. <a-button @click="addEducation">
  367. <template #icon>
  368. <plus-circle-outlined/>
  369. </template>
  370. 新增
  371. </a-button>
  372. </Space>
  373. </a-col>
  374. </a-row>
  375. <a-divider orientation="left">教育经历</a-divider>
  376. <a-row>
  377. <a-col style="margin-bottom: 20px;">
  378. <a-table :columns="educationColumns" :data-source="educationData" :pagination="false" bordered>
  379. <template #bodyCell="{ column ,index}">
  380. <template v-if="column.key === 'schoolName'">
  381. <div>
  382. <a-input v-model:value="educationData[index][column.key]" style="width: 200px" />
  383. </div>
  384. </template>
  385. <template v-if="column.key === 'cultureRank'">
  386. <div>
  387. <a-select
  388. ref="select"
  389. v-model:value="educationData[index][column.key]"
  390. :options="cultureList"
  391. :field-names="{ label: 'name', value: 'value' }"
  392. :allow-clear="false" style="width: 200px" >
  393. </a-select>
  394. </div>
  395. </template>
  396. <template v-if="column.key === 'schoolTime'">
  397. <div>
  398. <a-date-picker
  399. v-model:value="educationData[index][column.key]"
  400. picker="date" :allow-clear="false"
  401. value-format="YYYY-MM-DD"
  402. />
  403. </div>
  404. </template>
  405. <template v-if="column.key === 'overTime'">
  406. <div>
  407. <a-date-picker
  408. v-model:value="educationData[index][column.key]"
  409. picker="date" :allow-clear="false"
  410. value-format="YYYY-MM-DD"
  411. />
  412. </div>
  413. </template>
  414. <template v-if="column.key === 'major'">
  415. <div>
  416. <a-input
  417. v-model:value="educationData[index][column.key]" style="width: 200px"
  418. />
  419. </div>
  420. </template>
  421. <template v-if="column.key === 'educationOperation'">
  422. <a-button type="link" size="small" @click="delEducation(index)">删除</a-button>
  423. </template>
  424. </template>
  425. </a-table>
  426. </a-col>
  427. </a-row>
  428. <a-row>
  429. <a-col :span="24" style="text-align: right; margin-top: 20px; margin-right: 20px">
  430. <Space>
  431. <a-button @click="addExperience">
  432. <template #icon>
  433. <plus-circle-outlined/>
  434. </template>
  435. 新增
  436. </a-button>
  437. </Space>
  438. </a-col>
  439. </a-row>
  440. <a-divider orientation="left">工作经历</a-divider>
  441. <a-row>
  442. <a-col style="margin-bottom: 20px;">
  443. <a-table :columns="experienceColumns" :data-source="experienceData" :pagination="false"
  444. bordered>
  445. <template #bodyCell="{ column ,index}">
  446. <template v-if="column.key === 'startTime'">
  447. <div>
  448. <a-date-picker v-model:value="experienceData[index][column.key]"
  449. picker="date" value-format="YYYY-MM-DD" :allow-clear="false" />
  450. </div>
  451. </template>
  452. <template v-if="column.key === 'endTime'">
  453. <div>
  454. <a-date-picker v-model:value="experienceData[index][column.key]"
  455. picker="date" value-format="YYYY-MM-DD" :allow-clear="false" />
  456. </div>
  457. </template>
  458. <template v-if="column.key === 'workAddress'">
  459. <div>
  460. <a-input
  461. v-model:value="experienceData[index][column.key]" style="width: 200px"
  462. />
  463. </div>
  464. </template>
  465. <template v-if="column.key === 'duties'">
  466. <div>
  467. <a-input
  468. v-model:value="experienceData[index][column.key]" style="width: 200px"
  469. />
  470. </div>
  471. </template>
  472. <template v-if="column.key === 'experienceOperation'">
  473. <a-button type="link" size="small" @click="deleteExperience(index)">删除</a-button>
  474. </template>
  475. </template>
  476. </a-table>
  477. </a-col>
  478. </a-row>
  479. <a-form-item class="buttom-btns">
  480. <a-button @click="onClose">取消</a-button>
  481. <a-button type="primary" html-type="submit">提交</a-button>
  482. </a-form-item>
  483. </a-form>
  484. </div>
  485. </template>
  486. <script lang="ts">
  487. import {defineComponent, reactive, ref, toRefs} from 'vue';
  488. import type {SelectProps, TableColumnsType} from 'ant-design-vue';
  489. import {message} from "ant-design-vue";
  490. import {useTabsViewStore} from '@/store/modules/tabsView';
  491. import BUploadFile from '@/components/file/uploadFile.vue';
  492. import {get} from "@/api/common";
  493. import {getSysDictionaryList} from '@/api/system/dictionary';
  494. import {getDataById, getEducationList, getExperienceList, save} from '@/api/jobUserManager/jobuser';
  495. import {getSiteList} from "@/api/baseSettings/siteInfo";
  496. import {getInfo} from "@/api/account";
  497. import dayjs from "dayjs";
  498. interface FormState {
  499. dataModel: any;
  500. }
  501. export default defineComponent(
  502. {
  503. components: {BUploadFile},
  504. setup() {
  505. // const router = useRouter();
  506. const isAllowCommit = ref(true);
  507. const formState = reactive<FormState>({dataModel: {}});
  508. const formTableState = reactive({loading: false});
  509. const searchParams = reactive({
  510. pageIndex: 1,
  511. pageSize: 99
  512. });
  513. const provinceList = ref<SelectProps['options']>([{name: '广东省', code: '440000000000000'}]);
  514. const siteList = ref<any>([]);
  515. const genderList = ref<SelectProps['options']>();
  516. const keyPersonTypeList = ref<SelectProps['options']>();
  517. const jobStatusList = ref<SelectProps['options']>();
  518. const maritalStatusList = ref<SelectProps['options']>();
  519. const healthList = ref<SelectProps['options']>();
  520. const bloodTypeList = ref<SelectProps['options']>();
  521. const cultureList = ref<SelectProps['options']>();
  522. const politicsStatusList = ref<SelectProps['options']>();
  523. const regionList = ref<SelectProps['options']>();
  524. const streetList = ref<SelectProps['options']>();
  525. const familyNatureList = ref<SelectProps['options']>();
  526. const nationList = ref<SelectProps['options']>();
  527. const isFullTimeList = ref<SelectProps["options"]>();
  528. const occupationalCategoryList = ref<SelectProps["options"]>();
  529. const occupationalLevelList = ref<SelectProps["options"]>();
  530. const educationData = ref([]);
  531. const educationColumns: TableColumnsType = [
  532. {
  533. title: '序号',
  534. align: "center",
  535. key: 'educationID',
  536. width: 120,
  537. customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`
  538. },
  539. {
  540. title: '学校名',
  541. dataIndex: 'schoolName',
  542. key: 'schoolName',
  543. align: "center",
  544. width: 120
  545. },
  546. {
  547. title: '文化程度',
  548. dataIndex: 'cultureRank',
  549. key: 'cultureRank',
  550. align: "center",
  551. width: 120
  552. },
  553. {
  554. title: '就读时间',
  555. dataIndex: 'schoolTime',
  556. key: 'schoolTime',
  557. align: "center",
  558. width: 120
  559. },
  560. {
  561. title: '毕业时间',
  562. dataIndex: 'overTime',
  563. key: 'overTime',
  564. align: "center",
  565. width: 120
  566. },
  567. {
  568. title: '专业',
  569. dataIndex: 'major',
  570. key: 'major',
  571. align: "center",
  572. width: 120
  573. },
  574. {title: '操作', key: 'educationOperation', fixed: 'right', width: 120, align: "center"},
  575. ];
  576. // const fullpath = router.currentRoute.value.fullPath;
  577. const tabsViewStore = useTabsViewStore();
  578. const isEdit = true;
  579. const fileList = ref();
  580. const setFileList = (files) => {
  581. fileList.value = files;
  582. };
  583. const onIdentityNumberChange =()=>{
  584. const identReg = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
  585. if(formState.dataModel.identityNumber.match(identReg)&&formState.dataModel.identityNumber.length==18){
  586. const birthDayStr = String(formState.dataModel.identityNumber).substring(6,14);
  587. const sexStr = String(formState.dataModel.identityNumber).substring(16,17);
  588. formState.dataModel.sex = parseInt(sexStr)%2 == 0 ? 2 : 1; //双女单男
  589. formState.dataModel.birthDay = dayjs(birthDayStr).format("YYYY-MM-DD");
  590. }
  591. }
  592. const inputDataValidate = () =>{
  593. isAllowCommit.value = true;
  594. const identReg = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
  595. if(!formState.dataModel.identityNumber.match(identReg)){
  596. message.error("输入的身份证号码有误!");
  597. isAllowCommit.value = false;
  598. }
  599. const mobileReg = /^1[3|4|5|6|7|8|9]\d{9}$/;
  600. if(!mobileReg.test(formState.dataModel.userMobile)){
  601. message.error("输入的联系电话有误!");
  602. isAllowCommit.value = false;
  603. }
  604. const emailReg = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
  605. if(formState.dataModel.email!=null && formState.dataModel.email.trim()!==""){
  606. if(!emailReg.test(formState.dataModel.email)){
  607. message.error("输入的电子邮箱有误!");
  608. isAllowCommit.value = false;
  609. }
  610. }
  611. };
  612. const getAllSites = () => {
  613. getSiteList({pageIndex:1,pageSize:9999}).then((result :any) => {
  614. siteList.value = result.list;
  615. })
  616. }
  617. const getHealthList = () => {
  618. getSysDictionaryList('Health').then((data) => {
  619. healthList.value = data;
  620. });
  621. };
  622. const getGenderList = () => {
  623. getSysDictionaryList('Gender').then((data) => {
  624. genderList.value = data;
  625. });
  626. };
  627. const getCultureList = () => {
  628. getSysDictionaryList('HighestDegree').then((data) => {
  629. cultureList.value = data;
  630. });
  631. };
  632. const getJobStatusList = () => {
  633. getSysDictionaryList('JobStatus').then((data) => {
  634. jobStatusList.value = data;
  635. });
  636. };
  637. const getNationList = () => {
  638. getSysDictionaryList('NationType').then((data) => {
  639. nationList.value = data;
  640. });
  641. };
  642. const getBloodTypeList = () => {
  643. getSysDictionaryList('BloodType').then((data) => {
  644. bloodTypeList.value = data;
  645. });
  646. };
  647. const getFamilyNatureList = () => {
  648. getSysDictionaryList('FamilyNature').then((data) => {
  649. familyNatureList.value = data;
  650. });
  651. };
  652. const getKeyPersonTypeList = () => {
  653. getSysDictionaryList('KeyPersonType').then((data) => {
  654. keyPersonTypeList.value = data;
  655. });
  656. };
  657. const getMaritalStatusList = () => {
  658. getSysDictionaryList('MaritalStatus').then((data) => {
  659. maritalStatusList.value = data;
  660. });
  661. };
  662. const getPoliticsStatusList = () => {
  663. getSysDictionaryList('PoliticsStatus').then((data) => {
  664. politicsStatusList.value = data;
  665. });
  666. };
  667. const getIsFullTimeList = async function () {
  668. const result: any = await getSysDictionaryList("IsFullTime");
  669. isFullTimeList.value = result;
  670. }
  671. const getOccupationalLevelList = async function () {
  672. const result: any = await getSysDictionaryList("OccupationalLevel");
  673. occupationalLevelList.value = result;
  674. }
  675. get('system/area/getCityList', {}).then(data => {
  676. regionList.value = data;
  677. });
  678. const changeCity = () => {
  679. if (formState.dataModel.regionCode) {
  680. get('system/area/getAreaList', {code: formState.dataModel.regionCode}).then(data => {
  681. streetList.value = data;
  682. // formState.dataModel.streetCode = "";
  683. })
  684. }
  685. }
  686. const regionChange = async function () {
  687. formState.dataModel.streetCode = null;
  688. changeCity();
  689. }
  690. const loadEducation = (id: any) => {
  691. getEducationList(id).then(data => {
  692. if (data)
  693. educationData.value = data;
  694. });
  695. }
  696. const addEducation = () => {
  697. (educationData.value as any[]).push({
  698. schoolName: '',
  699. cultureRank: null,
  700. schoolTime: null,
  701. overTime: null,
  702. major: ''
  703. });
  704. }
  705. const delEducation = (record) => {
  706. (educationData.value as any[]).splice(record, 1);
  707. }
  708. const experienceColumns: TableColumnsType = [
  709. {
  710. title: '序号',
  711. align: "center",
  712. key: 'experienceID',
  713. width: 120,
  714. customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`
  715. },
  716. {
  717. title: '开始时间',
  718. dataIndex: 'startTime',
  719. key: 'startTime',
  720. align: "center",
  721. width: 120
  722. },
  723. {
  724. title: '结束时间',
  725. dataIndex: 'endTime',
  726. key: 'endTime',
  727. align: "center",
  728. width: 120
  729. },
  730. {
  731. title: '工作单位',
  732. dataIndex: 'workAddress',
  733. key: 'workAddress',
  734. align: "center",
  735. width: 120
  736. },
  737. {
  738. title: '职务',
  739. dataIndex: 'duties',
  740. key: 'duties',
  741. align: "center",
  742. width: 120
  743. },
  744. {title: '操作', key: 'experienceOperation', fixed: 'right', width: 120, align: "center"},
  745. ]
  746. const experienceData = ref([]);
  747. const loadExperienceData = (id: any) => {
  748. getExperienceList(id).then(data => {
  749. if (data) {
  750. experienceData.value = data;
  751. }
  752. })
  753. }
  754. const deleteExperience = (record) => {
  755. (experienceData.value as any[]).splice(record, 1);
  756. }
  757. const addExperience = () => {
  758. (experienceData.value as any[]).push({
  759. startTime: null,
  760. endTime: null,
  761. workAddress: null,
  762. duties: null,
  763. });
  764. }
  765. const onClose = (reload: any) => {
  766. tabsViewStore.closeCurrentTabByPath('/jobusermgr/jobseeker/add');
  767. tabsViewStore.closeCurrentTabByPath('/jobusermgr/jobseeker/edit');
  768. tabsViewStore.openTab('/jobusermgr/jobseeker/index', {reload: reload});
  769. };
  770. const onFinish = () => {
  771. inputDataValidate();
  772. if(isAllowCommit.value){
  773. formState.dataModel.jobEducation = educationData.value;
  774. formState.dataModel.jobExperience = experienceData.value;
  775. save(formState.dataModel).then(result => {
  776. if (result) {
  777. onClose(1)
  778. }
  779. });
  780. }
  781. }
  782. const getFirstOccupationalList = () => {
  783. get("occupational/getFirstOccupationalList", null).then(data => {
  784. occupationalCategoryList.value = (data as any[]).map((x) => {
  785. return {
  786. label: x.name,
  787. value: x.code,
  788. isLeaf: false,
  789. tag: 'firstLevel'
  790. }
  791. });
  792. });
  793. }
  794. const loadLevelOccupationalCategoryList = (selectedOptions) => {
  795. let targetOption = selectedOptions[selectedOptions.length - 1];
  796. if (targetOption) {
  797. get("occupational/getListByParentOccupationalID", {parentOccupationalID: targetOption.value}).then(data => {
  798. targetOption.loading = false;
  799. targetOption.children = (data as any[]).map((x) => {
  800. return {
  801. label: x.name,
  802. value: x.code,
  803. isLeaf: true,
  804. tag: 'secondLevel'
  805. };
  806. });
  807. });
  808. formState.dataModel.hasOccupational = false;
  809. }
  810. };
  811. // 职业资格选择变更事件
  812. function occupationalChange(value: any, selectedOptions: any) {
  813. if (value.length >= 2) {
  814. formState.dataModel.occupationalCategory = selectedOptions[1].value;
  815. formState.dataModel.occupationalCategoryName = selectedOptions[1].label;
  816. }
  817. }
  818. const loadData = (id: any) => {
  819. getAllSites();
  820. getHealthList();
  821. getGenderList();
  822. getCultureList();
  823. getJobStatusList();
  824. getNationList();
  825. getBloodTypeList();
  826. getFamilyNatureList();
  827. getKeyPersonTypeList();
  828. getMaritalStatusList();
  829. getPoliticsStatusList();
  830. getIsFullTimeList()
  831. getOccupationalLevelList()
  832. getFirstOccupationalList()
  833. getInfo().then((loginUserInfo:any)=>{
  834. getDataById(id,loginUserInfo.userID).then(data => {
  835. formState.dataModel = data;
  836. if (formState.dataModel.regionCode) {
  837. changeCity();
  838. }
  839. });
  840. });
  841. };
  842. return {
  843. ...toRefs(formState),
  844. isEdit,
  845. loadData,
  846. onClose,
  847. onFinish,
  848. setFileList,
  849. addEducation,
  850. delEducation,
  851. loadEducation,
  852. inputDataValidate,
  853. onIdentityNumberChange,
  854. siteList,
  855. regionList,
  856. streetList,
  857. cultureList,
  858. genderList,
  859. healthList,
  860. jobStatusList,
  861. provinceList,
  862. bloodTypeList,
  863. maritalStatusList,
  864. familyNatureList,
  865. formState,
  866. educationData,
  867. experienceData,
  868. formTableState,
  869. keyPersonTypeList,
  870. politicsStatusList,
  871. changeCity,
  872. regionChange,
  873. loadExperienceData,
  874. deleteExperience,
  875. addExperience,
  876. experienceColumns,
  877. educationColumns,
  878. nationList,
  879. isFullTimeList,
  880. occupationalCategoryList,
  881. occupationalLevelList,
  882. loadLevelOccupationalCategoryList,
  883. occupationalChange
  884. }
  885. },
  886. created() {
  887. const id = history.state.params?.id;
  888. this.loadData(id);
  889. if (id) {
  890. this.loadEducation(id);
  891. this.loadExperienceData(id);
  892. }
  893. }
  894. })
  895. </script>