jobHuntEdit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <ion-page class="list-page">
  3. <ion-header class="header-theme2">
  4. <ion-toolbar>
  5. <ion-buttons slot="start">
  6. <ion-icon :icon="arrowBackOutline" @click="onCancel" style="padding-left:10px;width:24px;height:24px;"></ion-icon>
  7. </ion-buttons>
  8. <ion-title>求职意向收集</ion-title>
  9. </ion-toolbar>
  10. </ion-header>
  11. <ion-content>
  12. <div class="stepFlex">
  13. <div v-for="(record,key) in stepList" :key="key" class="stepFlex-item">
  14. <div
  15. :class="[(record.val < curStepData?.statusVal || curStepData?.statusVal==stepList.val) ? 'greenCircle' :record.val == curStepData?.statusVal ? 'now' : 'grayCircle']"></div>
  16. <div v-if="key !== stepList.length - 1"
  17. :class="[record.val < curStepData?.statusVal ? 'greenLine' : 'grayLine']"></div>
  18. <div class="stepFlex-item-label">
  19. <p class="stepFlex-item-label-title">{{ record.title }}</p>
  20. <p class="stepFlex-item-label-desc">{{ record.desc }}</p>
  21. </div>
  22. </div>
  23. </div>
  24. <!-- <div class="form-input">
  25. <ion-label>工种名称<span class="danger">*</span></ion-label>
  26. <ion-input name="workName" id="workName" style="text-align: left;" class="custom"
  27. placeholder="请输入工种名称" v-model="dataModel.workName" ></ion-input>
  28. &lt;!&ndash; <ion-note slot="error">工种名称不能为空</ion-note>&ndash;&gt;
  29. </div>-->
  30. <form ref="editForm" @submit.prevent="onSave">
  31. <div class="bw-vue-form">
  32. <ion-list>
  33. <div class="form-title">求职意向</div>
  34. <div class="form-select">
  35. <ion-label>求职类型<span class="danger">*</span></ion-label>
  36. <ion-select name="jobHuntType" id="jobHuntType" okText="确定" cancelText="取消" v-model="dataModel.jobHuntType"
  37. interface="action-sheet" placeholder="请选择求职类型" style="width:100%;text-align: left;">
  38. <ion-select-option v-for=" (it,key) in jobHuntTypeList" :key="key" :value="it.value">
  39. {{ it.name }}
  40. </ion-select-option>
  41. </ion-select>
  42. <!-- <ion-note slot="error">求职类型不能为空</ion-note>-->
  43. </div>
  44. <div class="form-input">
  45. <ion-label>求职岗位<span class="danger">*</span></ion-label>
  46. <div>
  47. <ion-input placeholder="请选择岗位" label-placement="stacked" style="float: left;width:78%;"
  48. v-model="dataModel.professionName" class="custom">
  49. </ion-input>
  50. <ion-item style="width:22%;float: right;padding:0px;margin: 0px;">
  51. <post-selection :ProfessionID="dataModel.professionID" @SetProfessionID="onSetProfessionID"></post-selection>
  52. </ion-item>
  53. </div>
  54. <!-- <ion-note slot="error">请选择求职岗位</ion-note>-->
  55. </div>
  56. <div class="form-select">
  57. <ion-label>人才类型<span class="danger">*</span></ion-label>
  58. <ion-select name="jobUserType" id="jobUserType" okText="确定" cancelText="取消" v-model="dataModel.jobUserType"
  59. interface="action-sheet" placeholder="请选择人才类型" style="width:100%;text-align: left;">
  60. <ion-select-option v-for=" (it,key) in jobUserTypeList" :key="key" :value="it.value">
  61. {{ it.name }}
  62. </ion-select-option>
  63. </ion-select>
  64. <!-- <ion-note slot="error">人才类型不能为空</ion-note>-->
  65. </div>
  66. <div class="form-input">
  67. <ion-label>月薪要求(元)<span class="danger">*</span></ion-label>
  68. <div>
  69. <ion-input placeholder="请输入最低薪资" label-placement="stacked" style="float:left;width:42%;"
  70. v-model="dataModel.minSalary" class="custom">
  71. </ion-input>
  72. <ion-label style="float:left;width:5%;padding-top: 8px;">至</ion-label>
  73. <ion-input placeholder="请输入最高薪资" label-placement="stacked" style="float:left;width:42%;"
  74. v-model="dataModel.maxSalary" class="custom">
  75. </ion-input>
  76. <!-- <ion-note slot="error">月薪要求不能为空</ion-note>-->
  77. </div>
  78. </div>
  79. <div style="overflow: hidden;width:100%;"></div>
  80. <div class="form-select">
  81. <ion-label>工作年限<span class="danger">*</span></ion-label>
  82. <ion-select name="workYear" id="workYear" okText="确定" cancelText="取消" v-model="dataModel.workYear"
  83. interface="action-sheet" placeholder="请选择工作年限" style="width:100%;text-align: left;">
  84. <ion-select-option v-for=" (it,key) in workYearTypeList" :key="key" :value="it.value">
  85. {{ it.name }}
  86. </ion-select-option>
  87. </ion-select>
  88. <!-- <ion-note slot="error">工作年限不能为空</ion-note>-->
  89. </div>
  90. <div class="form-input">
  91. <ion-label>期望工作地区<span class="danger">*</span></ion-label>
  92. <ion-input name="areaWork" id="areaWork" style="text-align: left;" class="custom"
  93. placeholder="请输入期望工作地区" v-model="dataModel.areaWork" ></ion-input>
  94. <!-- <ion-note slot="error">期望工作地区不能为空</ion-note>-->
  95. </div>
  96. <div class="form-input">
  97. <ion-label>可到职日期<span class="danger">*</span></ion-label>
  98. <ion-datetime-button datetime="inDate" style="position: relative;right:110px;"></ion-datetime-button>
  99. <ion-modal :keep-contents-mounted="true">
  100. <ion-datetime name="inDate" id="inDate" placeholder="可到职日期"
  101. v-model="dataModel.inDate" :prefer-wheel="true"
  102. dataformatas="YYYY-MM-DD" presentation="date" cancel-text="取消" done-text="确定"
  103. :show-default-buttons="true">
  104. </ion-datetime>
  105. </ion-modal>
  106. </div>
  107. <div class="form-input">
  108. <ion-label>其他信息</ion-label>
  109. <ion-textarea placeholder="请输入其他信息" :rows="3" label-placement="stacked"
  110. v-model="dataModel.otherDemand" class="custom" style="border-bottom: 1px solid #fff2e8;">
  111. </ion-textarea>
  112. </div>
  113. </ion-list>
  114. </div>
  115. </form>
  116. </ion-content>
  117. <ion-footer>
  118. <ion-toolbar>
  119. <ion-button style="width: 100%;" @click="onSave">保 存</ion-button>
  120. </ion-toolbar>
  121. <ion-loading
  122. :is-open="loading"
  123. message="加载中..."
  124. @didDismiss="setOpen(false)" >
  125. </ion-loading>
  126. </ion-footer>
  127. </ion-page>
  128. </template>
  129. <script lang="ts">
  130. import {arrowBackOutline,addCircleOutline} from 'ionicons/icons';
  131. import {reactive,defineComponent, computed,ref,toRefs} from "vue";
  132. import {useRoute,useRouter} from "vue-router";
  133. import {required} from "@vuelidate/validators";
  134. import {useVuelidate} from "@vuelidate/core";
  135. import {getJobHuntByID,saveJobHunt} from "@/api/jobHuntInfo";
  136. import {getSysDictionaryList} from '@/api/system/dictionary';
  137. import {alertController, onIonViewDidEnter} from "@ionic/vue";
  138. import dayjs from "dayjs";
  139. import PostSelection from "@/components/postSelection.vue";
  140. interface huntModel {
  141. dataModel: any;
  142. }
  143. interface SelectProps {
  144. name: string,
  145. value: string
  146. }
  147. interface StepParams{
  148. loginUserID: string,
  149. statusVal: number
  150. }
  151. export class ExampleComponent {
  152. pinFormatter(value: number) {
  153. return `${value}`;
  154. }
  155. }
  156. export default defineComponent({
  157. name: 'jobHuntEdit',
  158. components:{PostSelection},
  159. setup() {
  160. const router = useRouter();
  161. const route = useRoute();
  162. const loading = ref(false);
  163. const editForm = ref();
  164. const curStepData = ref<StepParams>({
  165. loginUserID:"",
  166. statusVal: 2
  167. });
  168. const stepList = ref([
  169. {title: '基础信息', desc: '个人基础信息', val: 1},
  170. {title: '教育经历', desc: '完善教育经历',val: 2},
  171. {title: '工作经验', desc: '完善工作经验', val: 3},
  172. {title: '求职意向', desc: '个人求职意向', val: 4}
  173. ]);
  174. const jobHuntTypeList = ref<SelectProps[]>([]);
  175. const jobUserTypeList = ref<SelectProps[]>([]);
  176. const workYearTypeList = ref<SelectProps[]>([]);
  177. const jobHuntData = reactive<huntModel>({dataModel:{
  178. jobUserID:null,
  179. jobHuntType:null,
  180. jobUserType:null,
  181. professionID:null,
  182. professionName:null,
  183. minSalary:null,
  184. maxSalary:null,
  185. workYear:null,
  186. areaWork:null,
  187. inDate:dayjs().format("YYYY-MM-DD"),
  188. otherDemand:null
  189. }});
  190. const huntDataRule = computed(()=>{
  191. return {dataModel:{
  192. jobHuntType:{required},
  193. jobUserType:{required},
  194. professionID:{required},
  195. professionName:{required},
  196. minSalary:{required},
  197. maxSalary:{required},
  198. workYear:{required},
  199. areaWork:{required},
  200. inDate:{required}
  201. }}});
  202. const huntDataValid = useVuelidate(huntDataRule,jobHuntData);
  203. const setOpen = (isOpen: boolean) => {
  204. loading.value = isOpen;
  205. };
  206. const presentAlert = async (message: string) => {
  207. const alert = await alertController.create({
  208. header: '错误!',
  209. message: message,
  210. buttons: [
  211. '确定'
  212. ],
  213. });
  214. await alert.present();
  215. }
  216. const getJobHuntTypeList = async function(){
  217. const data :any = await getSysDictionaryList("JobHuntType");
  218. jobHuntTypeList.value = data;
  219. }
  220. const getJobUserTypeList = async function(){
  221. const data :any = await getSysDictionaryList("JobUserType");
  222. jobUserTypeList.value = data;
  223. }
  224. const getWorkYearTypeList = async function(){
  225. const data :any = await getSysDictionaryList("WorkYearType");
  226. workYearTypeList.value = data;
  227. }
  228. const onSetProfessionID = (data: any)=>{
  229. jobHuntData.dataModel.professionID = data.value;
  230. jobHuntData.dataModel.professionName = data.text;
  231. }
  232. const onSave = async function (){
  233. const isFormCorrect = await huntDataValid.value.$validate();
  234. if(!isFormCorrect){
  235. console.log("当前求职意向数据",jobHuntData.dataModel);
  236. await presentAlert("请填写完整的信息!");
  237. return null;
  238. }
  239. saveJobHunt(jobHuntData.dataModel).then(result => {
  240. if (result) {
  241. router.push({path: './userEdit', query: {reload:1,jobUserID: jobHuntData.dataModel.jobUserID,status:4,loginUserId:curStepData.value.loginUserID}});
  242. }
  243. });
  244. }
  245. const onCancel = () => {
  246. router.push({path: './,loginUserId:curStepData.value.loginUserID', query: {reload:1,jobUserID: jobHuntData.dataModel.jobUserID,status:4,loginUserId:curStepData.value.loginUserID}});
  247. }
  248. const loadData = async (jobHuntID: any,jobUserID:any,status:any,userID:any) => {
  249. loading.value = true;
  250. await getJobHuntTypeList();
  251. await getJobUserTypeList();
  252. await getWorkYearTypeList();
  253. const reqData = await getJobHuntByID(jobHuntID);
  254. curStepData.value.statusVal = status;
  255. curStepData.value.loginUserID = userID;
  256. jobHuntData.dataModel = reqData;
  257. jobHuntData.dataModel.jobUserID = jobUserID;
  258. console.log("初始化求职意向 ",jobHuntData.dataModel);
  259. loading.value = false;
  260. };
  261. const reload = (educationID: any,jobUserID:any,status:any,loginUserID:any) => {
  262. loadData(educationID,jobUserID,status,loginUserID);
  263. }
  264. onIonViewDidEnter(() => {
  265. if (route.query.reload){
  266. reload(route.query.jobHuntID,route.query.jobUserID,route.query.status,route.query.LoginUserID);
  267. }
  268. });
  269. return {
  270. ...toRefs(jobHuntData),
  271. arrowBackOutline,
  272. addCircleOutline,
  273. editForm,
  274. curStepData,
  275. stepList,
  276. jobUserTypeList,
  277. jobHuntTypeList,
  278. workYearTypeList,
  279. setOpen,
  280. onSetProfessionID,
  281. onSave,
  282. onCancel,
  283. loadData,
  284. route,
  285. router,
  286. loading,
  287. huntDataValid
  288. }
  289. }
  290. });
  291. </script>
  292. <style lang="less">
  293. .custom{
  294. --placeholder-color: gray;
  295. --placeholder-opacity: 0.5;
  296. }
  297. .title-item{
  298. margin-left: 15px;
  299. color:#1c3d70 !important;
  300. font-size: 14px !important;
  301. font-weight: bold;
  302. }
  303. .stepFlex {
  304. margin: 0;
  305. display: flex;
  306. width: 100%;
  307. .stepFlex-item {
  308. position: relative;
  309. flex: 1;
  310. text-align: center;
  311. margin-top: -10px;
  312. .stepFlex-item-label {
  313. padding-top: 60px;
  314. font-size: 14px;
  315. .stepFlex-item-label-title{
  316. margin-top:30px;
  317. }
  318. .stepFlex-item-label-desc{
  319. margin-top:5px;color: #b9b9bd;
  320. }
  321. }
  322. }
  323. .greenCircle {
  324. top: calc(50% - 15px);
  325. left: calc(50% - 4px);
  326. position: absolute;
  327. z-index: 2;
  328. width: 10px;
  329. height: 10px;
  330. border-radius: 50%;
  331. background-color: #31A2FE;
  332. }
  333. .now {
  334. top: calc(50% - 18px);
  335. left: calc(50% - 8px);
  336. position: absolute;
  337. z-index: 3;
  338. width: 16px;
  339. height: 16px;
  340. border-radius: 50%;
  341. background-color: #31A2FE;
  342. border: 4px solid #c5e8f9;
  343. }
  344. .grayCircle {
  345. top: calc(50% - 15px);
  346. left: calc(50% - 4px);
  347. position: absolute;
  348. z-index: 2;
  349. width: 10px;
  350. height: 10px;
  351. border-radius: 50%;
  352. background-color: #ccc;
  353. }
  354. .greenLine {
  355. width: 100%;
  356. top: calc(50% - 11px);
  357. left: calc(50% - 2px);
  358. height: 2px;
  359. background-color: #31A2FE;
  360. position: absolute;
  361. }
  362. .grayLine {
  363. height: 0;
  364. border: 1px dashed #ccc;
  365. width: 100%;
  366. top: calc(50% - 11px);
  367. left: calc(50% - 2px);
  368. position: absolute;
  369. }
  370. }
  371. </style>