jobHuntEdit.vue 14 KB

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