Personal.js 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_config = require("../../common/config.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. // 添加承诺书相关数据
  8. showPromiseModal: true,
  9. promiseChecked: false,
  10. formData: {
  11. name: "",
  12. gender: "",
  13. threePeriod: "",
  14. birthDate: "",
  15. idCard: "",
  16. political: "",
  17. ethnic: "",
  18. height: "",
  19. weight: "",
  20. nativePlace: "",
  21. residence: "",
  22. marriage: "",
  23. expectedSalary: "",
  24. phone: "",
  25. email: "",
  26. currentAddress: "",
  27. emergencyContact: "",
  28. emergencyPhone: "",
  29. hobby: "",
  30. motto: "",
  31. // 添加应聘来源相关字段
  32. sourceType: "social",
  33. // 默认为社招
  34. socialSource: "",
  35. // 社招来源
  36. otherSocialSource: "",
  37. // 其他社招来源
  38. otherSchoolSource: "",
  39. // 其他学校来源
  40. // 添加技能和培训字段
  41. skills: "",
  42. training: ""
  43. },
  44. genderOptions: ["男", "女"],
  45. genderIndex: -1,
  46. threePeriodOptions: ["无", "孕期", "产期", "哺乳期"],
  47. threePeriodIndex: -1,
  48. politicalOptions: ["群众", "共青团员", "中共党员", "民主党派"],
  49. politicalIndex: -1,
  50. ethnicOptions: ["汉族", "壮族", "回族", "满族", "维吾尔族", "苗族", "彝族", "土家族", "藏族", "蒙古族", "侗族", "布依族", "瑶族", "白族", "朝鲜族", "哈尼族", "黎族", "哈萨克族", "傣族", "畲族", "其他"],
  51. ethnicIndex: -1,
  52. marriageOptions: ["未婚", "已婚", "离异", "丧偶"],
  53. marriageIndex: -1,
  54. familyMembers: [],
  55. familyMemberForm: {
  56. relation: "",
  57. name: "",
  58. workplaceOrAddress: "",
  59. position: "",
  60. phone: "",
  61. isEmergencyContact: false
  62. // 添加新字段
  63. },
  64. isEditing: false,
  65. editingIndex: -1,
  66. // 添加教育经历相关数据
  67. educationList: [],
  68. educationForm: {
  69. startTime: "",
  70. endTime: "",
  71. schoolName: "",
  72. major: "",
  73. degree: ""
  74. },
  75. isEditingEducation: false,
  76. editingEducationIndex: -1,
  77. degreeOptions: ["高中", "中专", "大专", "本科", "硕士", "博士"],
  78. degreeIndex: -1,
  79. // 添加工作经历相关数据
  80. workList: [],
  81. workForm: {
  82. startTime: "",
  83. endTime: "",
  84. companyName: "",
  85. department: "",
  86. employeeCount: "",
  87. position: "",
  88. monthlySalary: "",
  89. supervisor: "",
  90. supervisorPhone: ""
  91. },
  92. isEditingWork: false,
  93. editingWorkIndex: -1,
  94. // 添加步骤控制
  95. currentStep: 1,
  96. steps: [
  97. { id: 1, name: "基本信息" },
  98. { id: 3, name: "家庭成员" },
  99. { id: 5, name: "教育经历" },
  100. { id: 6, name: "专业技能" },
  101. { id: 8, name: "工作经历" }
  102. ],
  103. formErrors: {
  104. name: "",
  105. idCard: "",
  106. phone: "",
  107. gender: "",
  108. ethnic: "",
  109. currentAddress: "",
  110. height: "",
  111. weight: "",
  112. expectedSalary: "",
  113. skills: "",
  114. training: "",
  115. threePeriod: ""
  116. // 添加这一行
  117. },
  118. // Add loading state
  119. isLoading: true,
  120. familyMemberErrors: {
  121. relation: "",
  122. name: "",
  123. phone: "",
  124. workplaceOrAddress: "",
  125. position: ""
  126. },
  127. workErrors: {
  128. startTime: "",
  129. endTime: "",
  130. companyName: "",
  131. department: "",
  132. position: "",
  133. employeeCount: "",
  134. monthlySalary: "",
  135. supervisor: "",
  136. supervisorPhone: ""
  137. },
  138. // 在 data 中添加教育经历的错误提示对象
  139. educationErrors: {
  140. startTime: "",
  141. endTime: "",
  142. schoolName: "",
  143. major: "",
  144. degree: ""
  145. },
  146. // 添加统一的验证规则
  147. validationRules: {
  148. name: {
  149. required: true,
  150. message: "请输入姓名"
  151. },
  152. phone: {
  153. required: true,
  154. pattern: /^1[3-9]\d{9}$/,
  155. message: "请输入正确的手机号码",
  156. maxLength: 11
  157. },
  158. idCard: {
  159. required: true,
  160. pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  161. message: "请输入正确的身份证号码"
  162. },
  163. gender: {
  164. required: true,
  165. message: "请选择性别"
  166. },
  167. ethnic: {
  168. required: true,
  169. message: "请选择民族"
  170. },
  171. currentAddress: {
  172. required: true,
  173. message: "请输入现居住地址"
  174. },
  175. height: {
  176. pattern: /^\d+(\.\d{1,2})?$/,
  177. message: "请输入正确的身高(cm)"
  178. },
  179. weight: {
  180. pattern: /^\d+(\.\d{1,2})?$/,
  181. message: "请输入正确的体重(kg)"
  182. },
  183. expectedSalary: {
  184. pattern: /^\d+(\.\d{1,2})?$/,
  185. message: "请输入正确的期望薪资"
  186. }
  187. },
  188. // 获取配置信息
  189. configData: (() => {
  190. try {
  191. const configStr = common_vendor.index.getStorageSync("configData");
  192. if (configStr && configStr.trim()) {
  193. return JSON.parse(configStr);
  194. }
  195. return {};
  196. } catch (error) {
  197. console.warn("解析配置数据失败:", error);
  198. return {};
  199. }
  200. })()
  201. };
  202. },
  203. onLoad() {
  204. this.fetchUserData();
  205. console.log(this.configData);
  206. },
  207. watch: {
  208. // 监听步骤显示状态的变化
  209. shouldShowWorkStep(newVal) {
  210. console.log("工作经历显示状态变化:", newVal);
  211. if (!newVal && this.currentStep === 8) {
  212. this.$nextTick(() => {
  213. this.jumpToLastVisibleStep();
  214. });
  215. }
  216. },
  217. shouldShowSkillsStep(newVal) {
  218. console.log("专业技能显示状态变化:", newVal);
  219. },
  220. shouldShowEducationStep(newVal) {
  221. console.log("教育经历显示状态变化:", newVal);
  222. },
  223. shouldShowFamilyStep(newVal) {
  224. console.log("家庭成员显示状态变化:", newVal);
  225. }
  226. },
  227. computed: {
  228. // 添加计算属性来控制按钮显示
  229. showPrevButton() {
  230. return this.currentStep !== 1;
  231. },
  232. showNextButton() {
  233. const currentIndex = this.currentStepIndex;
  234. if (currentIndex === -1)
  235. return false;
  236. for (let i = currentIndex + 1; i < this.steps.length; i++) {
  237. const nextStepId = this.steps[i].id;
  238. let shouldShowNextStep = true;
  239. switch (nextStepId) {
  240. case 3:
  241. shouldShowNextStep = this.shouldShowFamilyStep;
  242. break;
  243. case 5:
  244. shouldShowNextStep = this.shouldShowEducationStep;
  245. break;
  246. case 6:
  247. shouldShowNextStep = this.shouldShowSkillsStep;
  248. break;
  249. case 8:
  250. shouldShowNextStep = this.shouldShowWorkStep;
  251. break;
  252. default:
  253. shouldShowNextStep = true;
  254. }
  255. if (shouldShowNextStep)
  256. return true;
  257. }
  258. return false;
  259. },
  260. showSubmitButton() {
  261. let lastVisibleStepId = null;
  262. for (let i = this.steps.length - 1; i >= 0; i--) {
  263. const stepId = this.steps[i].id;
  264. let shouldShowStep = false;
  265. switch (stepId) {
  266. case 3:
  267. shouldShowStep = this.shouldShowFamilyStep;
  268. break;
  269. case 5:
  270. shouldShowStep = this.shouldShowEducationStep;
  271. break;
  272. case 6:
  273. shouldShowStep = this.shouldShowSkillsStep;
  274. break;
  275. case 8:
  276. shouldShowStep = this.shouldShowWorkStep;
  277. break;
  278. default:
  279. shouldShowStep = true;
  280. }
  281. if (shouldShowStep) {
  282. lastVisibleStepId = stepId;
  283. break;
  284. }
  285. }
  286. console.log("当前步骤:", this.currentStep);
  287. console.log("最后一个可见步骤:", lastVisibleStepId);
  288. console.log("家庭成员显示:", this.shouldShowFamilyStep);
  289. console.log("教育经历显示:", this.shouldShowEducationStep);
  290. console.log("专业技能显示:", this.shouldShowSkillsStep);
  291. console.log("工作经历显示:", this.shouldShowWorkStep);
  292. console.log("是否显示提交按钮:", this.currentStep === lastVisibleStepId);
  293. return this.currentStep === lastVisibleStepId;
  294. },
  295. // 获取当前步骤在数组中的索引
  296. currentStepIndex() {
  297. return this.steps.findIndex((step) => step.id === this.currentStep);
  298. },
  299. // 添加安全的配置访问器
  300. safeConfigData() {
  301. return this.configData || {};
  302. },
  303. safeProfileFieldsConfig() {
  304. return this.safeConfigData.profile_fields_config || {};
  305. },
  306. safeFamilyFieldsConfig() {
  307. return this.safeConfigData.family_fields_config || {};
  308. },
  309. safeEducationFieldsConfig() {
  310. return this.safeConfigData.education_fields_config || {};
  311. },
  312. safeWorkFieldsConfig() {
  313. return this.safeConfigData.work_experience_fields_config || {};
  314. },
  315. // 字段显示控制方法
  316. showNameField() {
  317. var _a;
  318. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
  319. },
  320. showGenderField() {
  321. var _a;
  322. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.gender) == null ? void 0 : _a.visible) !== false;
  323. },
  324. showPhoneField() {
  325. var _a;
  326. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
  327. },
  328. showIdCardField() {
  329. var _a;
  330. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.id_card) == null ? void 0 : _a.visible) !== false;
  331. },
  332. showEthnicField() {
  333. var _a;
  334. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.ethnicity) == null ? void 0 : _a.visible) !== false;
  335. },
  336. showHeightField() {
  337. var _a;
  338. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.height) == null ? void 0 : _a.visible) !== false;
  339. },
  340. showWeightField() {
  341. var _a;
  342. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.weight) == null ? void 0 : _a.visible) !== false;
  343. },
  344. showCurrentAddress() {
  345. var _a;
  346. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.current_address) == null ? void 0 : _a.visible) !== false;
  347. },
  348. showResidence() {
  349. var _a;
  350. return Object.keys(this.safeProfileFieldsConfig).length === 0 || ((_a = this.safeProfileFieldsConfig.household_location) == null ? void 0 : _a.visible) !== false;
  351. },
  352. showMarriageIndex() {
  353. var _a;
  354. return ((_a = this.safeProfileFieldsConfig.marital_status) == null ? void 0 : _a.visible) !== false;
  355. },
  356. showExpectedSalary() {
  357. var _a;
  358. return ((_a = this.safeProfileFieldsConfig.expected_salary) == null ? void 0 : _a.visible) !== false;
  359. },
  360. // 家庭成员字段显示控制
  361. showFamilyRelationField() {
  362. var _a;
  363. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.relation) == null ? void 0 : _a.visible) !== false;
  364. },
  365. showFamilyNameField() {
  366. var _a;
  367. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.name) == null ? void 0 : _a.visible) !== false;
  368. },
  369. showFamilyWorkplaceField() {
  370. var _a;
  371. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.workplace) == null ? void 0 : _a.visible) !== false;
  372. },
  373. showFamilyPositionField() {
  374. var _a;
  375. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
  376. },
  377. showFamilyPhoneField() {
  378. var _a;
  379. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.phone) == null ? void 0 : _a.visible) !== false;
  380. },
  381. showFamilyisEmergency() {
  382. var _a;
  383. return Object.keys(this.safeFamilyFieldsConfig).length === 0 || ((_a = this.safeFamilyFieldsConfig.family_contact_person) == null ? void 0 : _a.visible) !== false;
  384. },
  385. // 教育经历字段显示控制
  386. showEducationTimeField() {
  387. var _a, _b;
  388. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.start_date) == null ? void 0 : _a.visible) !== false && ((_b = this.safeEducationFieldsConfig.end_date) == null ? void 0 : _b.visible) !== false;
  389. },
  390. showEducationSchoolField() {
  391. var _a;
  392. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.school_name) == null ? void 0 : _a.visible) !== false;
  393. },
  394. showEducationMajorField() {
  395. var _a;
  396. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.major) == null ? void 0 : _a.visible) !== false;
  397. },
  398. showEducationDegreeField() {
  399. var _a;
  400. return Object.keys(this.safeEducationFieldsConfig).length === 0 || ((_a = this.safeEducationFieldsConfig.degree) == null ? void 0 : _a.visible) !== false;
  401. },
  402. // 工作经历字段显示控制
  403. showWorkTimeField() {
  404. var _a, _b;
  405. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.start_date) == null ? void 0 : _a.visible) !== false && ((_b = this.safeWorkFieldsConfig.end_date) == null ? void 0 : _b.visible) !== false;
  406. },
  407. showWorkCompanyField() {
  408. var _a;
  409. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.company_name) == null ? void 0 : _a.visible) !== false;
  410. },
  411. showWorkDepartmentField() {
  412. var _a;
  413. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.department) == null ? void 0 : _a.visible) !== false;
  414. },
  415. showWorkEmployeeCountField() {
  416. var _a;
  417. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.company_size) == null ? void 0 : _a.visible) !== false;
  418. },
  419. showWorkPositionField() {
  420. var _a;
  421. return Object.keys(this.safeWorkFieldsConfig).length === 0 || ((_a = this.safeWorkFieldsConfig.position) == null ? void 0 : _a.visible) !== false;
  422. },
  423. showWorkMonthlySalary() {
  424. var _a;
  425. return (_a = this.safeWorkFieldsConfig.monthly_salary) == null ? void 0 : _a.visible;
  426. },
  427. showWorkSupervisor() {
  428. var _a;
  429. return (_a = this.safeWorkFieldsConfig.direct_supervisor) == null ? void 0 : _a.visible;
  430. },
  431. showWorkSupervisorPhone() {
  432. var _a;
  433. return (_a = this.safeWorkFieldsConfig.supervisor_phone) == null ? void 0 : _a.visible;
  434. },
  435. showRequireProfessionalSkillsField() {
  436. console.log(this.safeConfigData.require_professional_skills);
  437. const value = this.safeConfigData.require_professional_skills;
  438. return value === void 0 || value === null ? true : value;
  439. },
  440. showRequireTrainingInfoField() {
  441. console.log(this.safeConfigData.require_training_info);
  442. const value = this.safeConfigData.require_training_info;
  443. return value === void 0 || value === null ? true : value;
  444. },
  445. shouldShowSkillsStep() {
  446. return this.showRequireTrainingInfoField || this.showRequireProfessionalSkillsField;
  447. },
  448. // 判断是否显示教育经历步骤
  449. shouldShowEducationStep() {
  450. if (Object.keys(this.safeEducationFieldsConfig).length === 0) {
  451. return true;
  452. }
  453. const fields = ["start_date", "end_date", "school_name", "major", "degree"];
  454. return fields.some((field) => {
  455. var _a;
  456. return ((_a = this.safeEducationFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
  457. });
  458. },
  459. // 判断是否显示家庭成员步骤
  460. shouldShowFamilyStep() {
  461. if (Object.keys(this.safeFamilyFieldsConfig).length === 0) {
  462. return true;
  463. }
  464. const fields = ["relation", "name", "workplace", "position", "phone"];
  465. return fields.some((field) => {
  466. var _a;
  467. return ((_a = this.safeFamilyFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
  468. });
  469. },
  470. // 判断是否显示工作经历
  471. shouldShowWorkStep() {
  472. if (Object.keys(this.safeWorkFieldsConfig).length === 0) {
  473. return true;
  474. }
  475. const fields = ["start_date", "end_date", "company_name", "department", "company_size", "position", "monthly_salary", "direct_supervisor", "supervisor_phone"];
  476. return fields.some((field) => {
  477. var _a;
  478. return ((_a = this.safeWorkFieldsConfig[field]) == null ? void 0 : _a.visible) !== false;
  479. });
  480. },
  481. // 获取教育经历开始时间的初始值(默认为当前月份1号)
  482. defaultEducationStartTime() {
  483. if (this.educationForm.startTime) {
  484. return this.educationForm.startTime;
  485. }
  486. const now = /* @__PURE__ */ new Date();
  487. const year = now.getFullYear();
  488. const month = String(now.getMonth() + 1).padStart(2, "0");
  489. return `${year}-${month}-01`;
  490. },
  491. // 获取教育经历结束时间的初始值(默认为当前月份1号)
  492. defaultEducationEndTime() {
  493. if (this.educationForm.endTime) {
  494. return this.educationForm.endTime;
  495. }
  496. const now = /* @__PURE__ */ new Date();
  497. const year = now.getFullYear();
  498. const month = String(now.getMonth() + 1).padStart(2, "0");
  499. return `${year}-${month}-01`;
  500. },
  501. // 获取工作经历开始时间的初始值(默认为当前月份1号)
  502. defaultWorkStartTime() {
  503. if (this.workForm.startTime) {
  504. return this.workForm.startTime;
  505. }
  506. const now = /* @__PURE__ */ new Date();
  507. const year = now.getFullYear();
  508. const month = String(now.getMonth() + 1).padStart(2, "0");
  509. return `${year}-${month}-01`;
  510. },
  511. // 获取工作经历结束时间的初始值(默认为当前月份1号)
  512. defaultWorkEndTime() {
  513. if (this.workForm.endTime) {
  514. return this.workForm.endTime;
  515. }
  516. const now = /* @__PURE__ */ new Date();
  517. const year = now.getFullYear();
  518. const month = String(now.getMonth() + 1).padStart(2, "0");
  519. return `${year}-${month}-01`;
  520. }
  521. },
  522. methods: {
  523. // 确保当前步骤是有效的(如果需要显示的话)
  524. ensureValidStep() {
  525. const currentStepId = this.currentStep;
  526. let shouldShowCurrentStep = true;
  527. switch (currentStepId) {
  528. case 3:
  529. shouldShowCurrentStep = this.shouldShowFamilyStep;
  530. break;
  531. case 5:
  532. shouldShowCurrentStep = this.shouldShowEducationStep;
  533. break;
  534. case 6:
  535. shouldShowCurrentStep = this.shouldShowSkillsStep;
  536. break;
  537. case 8:
  538. shouldShowCurrentStep = this.shouldShowWorkStep;
  539. break;
  540. default:
  541. shouldShowCurrentStep = true;
  542. }
  543. if (!shouldShowCurrentStep) {
  544. this.jumpToLastVisibleStep();
  545. }
  546. },
  547. // 跳转到最后一个可见步骤
  548. jumpToLastVisibleStep() {
  549. let lastVisibleStepId = null;
  550. for (let i = this.steps.length - 1; i >= 0; i--) {
  551. const stepId = this.steps[i].id;
  552. let shouldShowStep = false;
  553. switch (stepId) {
  554. case 3:
  555. shouldShowStep = this.shouldShowFamilyStep;
  556. break;
  557. case 5:
  558. shouldShowStep = this.shouldShowEducationStep;
  559. break;
  560. case 6:
  561. shouldShowStep = this.shouldShowSkillsStep;
  562. break;
  563. case 8:
  564. shouldShowStep = this.shouldShowWorkStep;
  565. break;
  566. default:
  567. shouldShowStep = true;
  568. }
  569. if (shouldShowStep) {
  570. lastVisibleStepId = stepId;
  571. break;
  572. }
  573. }
  574. if (lastVisibleStepId) {
  575. console.log("跳转到最后一个可见步骤:", lastVisibleStepId);
  576. this.currentStep = lastVisibleStepId;
  577. common_vendor.index.pageScrollTo({
  578. scrollTop: 0,
  579. duration: 300
  580. });
  581. }
  582. },
  583. // 输入时限制小数位数
  584. handleInput(event, field, maxDecimals) {
  585. let value = event.detail.value;
  586. value = value.replace(/[^\d.-]/g, "").replace(/(\..*)\./g, "$1").replace(/(-\d*)-/g, "$1").replace(new RegExp(`^(-?\\d*\\.\\d{${maxDecimals}}).*$`), "$1");
  587. if (value.startsWith(".")) {
  588. value = "0" + value;
  589. }
  590. this.formData[field] = value;
  591. this.$nextTick(() => {
  592. event.target.value = value;
  593. });
  594. },
  595. // 失焦时补全小数位
  596. handleBlur(field, precision = 2) {
  597. const val = this.formData[field];
  598. if (val === "" || val === void 0 || val === null)
  599. return;
  600. const num = parseFloat(val);
  601. if (!isNaN(num)) {
  602. this.formData[field] = num.toFixed(precision);
  603. } else {
  604. this.formData[field] = "";
  605. }
  606. },
  607. // 添加承诺书相关方法
  608. togglePromiseChecked() {
  609. this.promiseChecked = !this.promiseChecked;
  610. },
  611. confirmPromise() {
  612. if (this.promiseChecked) {
  613. this.showPromiseModal = false;
  614. } else {
  615. common_vendor.index.showToast({
  616. title: "请先阅读并同意承诺书内容",
  617. icon: "none"
  618. });
  619. }
  620. },
  621. // 添加字段是否需要验证的判断方法
  622. shouldValidateField(fieldName, section) {
  623. section = section || "profile";
  624. switch (section) {
  625. case "profile":
  626. const fieldShowMap = {
  627. "name": this.showNameField,
  628. "gender": this.showGenderField,
  629. "phone": this.showPhoneField,
  630. "idCard": this.showIdCardField,
  631. "ethnic": this.showEthnicField,
  632. "height": this.showHeightField,
  633. "weight": this.showWeightField,
  634. "currentAddress": this.showCurrentAddress,
  635. // 现居住地址总是显示和必填
  636. "expectedSalary": this.showExpectedSalary,
  637. // 期望薪资总是显示
  638. "skills": this.showRequireTrainingInfoField,
  639. // 专业技能根据配置显示和必填
  640. "training": this.showRequireProfessionalSkillsField,
  641. // 培训经历根据配置显示和必填
  642. "threePeriod": this.formData.gender === "女"
  643. // 只有女性时才需要验证三期状态
  644. };
  645. return fieldShowMap[fieldName] !== false;
  646. case "family":
  647. const familyFieldShowMap = {
  648. "relation": this.showFamilyRelationField,
  649. "name": this.showFamilyNameField,
  650. "phone": this.showFamilyPhoneField,
  651. "workplaceOrAddress": this.showFamilyWorkplaceField,
  652. "position": this.showFamilyPositionField,
  653. "isEmergencyContact": this.showFamilyisEmergency
  654. };
  655. return familyFieldShowMap[fieldName] !== false;
  656. case "education":
  657. const educationFieldShowMap = {
  658. "startTime": this.showEducationTimeField,
  659. "endTime": this.showEducationTimeField,
  660. "schoolName": this.showEducationSchoolField,
  661. "major": this.showEducationMajorField,
  662. "degree": this.showEducationDegreeField
  663. };
  664. return educationFieldShowMap[fieldName] !== false;
  665. case "work":
  666. const workFieldShowMap = {
  667. "startTime": this.showWorkTimeField,
  668. "endTime": this.showWorkTimeField,
  669. "companyName": this.showWorkCompanyField,
  670. "department": this.showWorkDepartmentField,
  671. "position": this.showWorkPositionField,
  672. "employeeCount": this.showWorkEmployeeCountField,
  673. "monthlySalary": this.showWorkMonthlySalary,
  674. // 月薪总是需要验证
  675. "supervisor": this.showWorkSupervisor,
  676. // 直接领导总是需要验证
  677. "supervisorPhone": this.showWorkSupervisorPhone
  678. // 领导电话总是需要验证
  679. };
  680. return workFieldShowMap[fieldName] !== false;
  681. default:
  682. return true;
  683. }
  684. },
  685. bindGenderChange(e) {
  686. this.genderIndex = e.detail.value;
  687. this.formData.gender = this.genderOptions[this.genderIndex];
  688. if (this.formErrors.gender) {
  689. this.formErrors.gender = "";
  690. }
  691. if (this.formData.gender !== "女") {
  692. this.formData.threePeriod = "";
  693. this.threePeriodIndex = -1;
  694. this.formErrors.threePeriod = "";
  695. }
  696. },
  697. bindThreePeriodChange(e) {
  698. this.threePeriodIndex = e.detail.value;
  699. this.formData.threePeriod = this.threePeriodOptions[this.threePeriodIndex];
  700. if (this.formErrors.threePeriod) {
  701. this.formErrors.threePeriod = "";
  702. }
  703. },
  704. bindPoliticalChange(e) {
  705. this.politicalIndex = e.detail.value;
  706. this.formData.political = this.politicalOptions[this.politicalIndex];
  707. },
  708. bindEthnicChange(e) {
  709. this.ethnicIndex = e.detail.value;
  710. this.formData.ethnic = this.ethnicOptions[this.ethnicIndex];
  711. if (this.formErrors.ethnic) {
  712. this.formErrors.ethnic = "";
  713. }
  714. },
  715. bindMarriageChange(e) {
  716. this.marriageIndex = e.detail.value;
  717. this.formData.marriage = this.marriageOptions[this.marriageIndex];
  718. },
  719. bindDateChange(e) {
  720. this.formData.birthDate = e.detail.value;
  721. },
  722. saveFamilyMember() {
  723. this.resetFamilyMemberErrors();
  724. let isValid = true;
  725. if (this.shouldValidateField("relation", "family") && !this.familyMemberForm.relation) {
  726. this.familyMemberErrors.relation = "请输入称谓";
  727. isValid = false;
  728. }
  729. if (this.shouldValidateField("name", "family") && !this.familyMemberForm.name) {
  730. this.familyMemberErrors.name = "请输入姓名";
  731. isValid = false;
  732. }
  733. if (this.shouldValidateField("phone", "family") && this.familyMemberForm.phone && !/^1[3-9]\d{9}$/.test(this.familyMemberForm.phone)) {
  734. this.familyMemberErrors.phone = "请输入正确的手机号";
  735. isValid = false;
  736. }
  737. if (!isValid) {
  738. common_vendor.index.showToast({
  739. title: "请完善家庭成员信息",
  740. icon: "none"
  741. });
  742. return;
  743. }
  744. if (this.isEditing) {
  745. this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
  746. common_vendor.index.showToast({
  747. title: "修改成功",
  748. icon: "success"
  749. });
  750. this.isEditing = false;
  751. this.editingIndex = -1;
  752. } else {
  753. this.familyMembers.push({ ...this.familyMemberForm });
  754. common_vendor.index.showToast({
  755. title: "添加成功",
  756. icon: "success"
  757. });
  758. }
  759. this.resetFamilyMemberForm();
  760. },
  761. // 添加重置错误信息的方法
  762. resetFamilyMemberErrors() {
  763. this.familyMemberErrors = {
  764. relation: "",
  765. name: "",
  766. phone: "",
  767. workplaceOrAddress: "",
  768. position: ""
  769. };
  770. },
  771. // 修改重置表单的方法
  772. resetFamilyMemberForm() {
  773. this.familyMemberForm = {
  774. relation: "",
  775. name: "",
  776. workplaceOrAddress: "",
  777. position: "",
  778. phone: "",
  779. isEmergencyContact: false
  780. };
  781. this.resetFamilyMemberErrors();
  782. },
  783. editFamilyMember(index) {
  784. this.isEditing = true;
  785. this.editingIndex = index;
  786. this.familyMemberForm = { ...this.familyMembers[index] };
  787. common_vendor.index.pageScrollTo({
  788. selector: ".family-member-form",
  789. duration: 300
  790. });
  791. },
  792. cancelEdit() {
  793. this.isEditing = false;
  794. this.editingIndex = -1;
  795. this.familyMemberForm = {
  796. relation: "",
  797. name: "",
  798. workplaceOrAddress: "",
  799. position: "",
  800. phone: "",
  801. isEmergencyContact: false
  802. };
  803. },
  804. deleteFamilyMember(index) {
  805. if (this.isEditing && this.editingIndex === index) {
  806. this.cancelEdit();
  807. }
  808. this.familyMembers.splice(index, 1);
  809. common_vendor.index.showToast({
  810. title: "已删除",
  811. icon: "none"
  812. });
  813. },
  814. // 选择应聘来源类型
  815. selectSourceType(type) {
  816. this.formData.sourceType = type;
  817. if (type === "social") {
  818. this.formData.socialSource = "BOSS";
  819. } else {
  820. this.formData.socialSource = "";
  821. }
  822. },
  823. // 选择社招来源
  824. selectSocialSource(source) {
  825. this.formData.sourceType = "social";
  826. this.formData.socialSource = source;
  827. },
  828. // 教育经历相关方法
  829. bindStartTimeChange(e) {
  830. const startTime = e.detail.value;
  831. if (this.educationForm.endTime && startTime > this.educationForm.endTime) {
  832. common_vendor.index.showToast({
  833. title: "开始时间不能大于结束时间",
  834. icon: "none"
  835. });
  836. return;
  837. }
  838. this.educationForm.startTime = startTime;
  839. this.educationErrors.startTime = false;
  840. },
  841. bindEndTimeChange(e) {
  842. const endTime = e.detail.value;
  843. if (this.educationForm.startTime && endTime < this.educationForm.startTime) {
  844. common_vendor.index.showToast({
  845. title: "结束时间不能小于开始时间",
  846. icon: "none"
  847. });
  848. return;
  849. }
  850. this.educationForm.endTime = endTime;
  851. this.educationErrors.endTime = false;
  852. },
  853. bindDegreeChange(e) {
  854. this.degreeIndex = e.detail.value;
  855. this.educationForm.degree = this.degreeOptions[this.degreeIndex];
  856. },
  857. saveEducation() {
  858. this.resetEducationErrors();
  859. let isValid = true;
  860. if (this.shouldValidateField("startTime", "education") && !this.educationForm.startTime) {
  861. this.educationErrors.startTime = "请选择开始时间";
  862. isValid = false;
  863. }
  864. if (this.shouldValidateField("endTime", "education") && !this.educationForm.endTime) {
  865. this.educationErrors.endTime = "请选择结束时间";
  866. isValid = false;
  867. }
  868. if (this.shouldValidateField("schoolName", "education") && !this.educationForm.schoolName) {
  869. this.educationErrors.schoolName = "请输入学校名称";
  870. isValid = false;
  871. }
  872. if (this.shouldValidateField("major", "education") && !this.educationForm.major) {
  873. this.educationErrors.major = "请输入专业";
  874. isValid = false;
  875. }
  876. if (this.shouldValidateField("degree", "education") && !this.educationForm.degree) {
  877. this.educationErrors.degree = "请选择学历";
  878. isValid = false;
  879. }
  880. if (!isValid) {
  881. common_vendor.index.showToast({
  882. title: "请完善教育经历信息",
  883. icon: "none"
  884. });
  885. return;
  886. }
  887. if (this.isEditingEducation) {
  888. this.educationList[this.editingEducationIndex] = { ...this.educationForm };
  889. common_vendor.index.showToast({
  890. title: "修改成功",
  891. icon: "success"
  892. });
  893. this.isEditingEducation = false;
  894. this.editingEducationIndex = -1;
  895. } else {
  896. this.educationList.push({ ...this.educationForm });
  897. common_vendor.index.showToast({
  898. title: "添加成功",
  899. icon: "success"
  900. });
  901. }
  902. this.educationForm = {
  903. startTime: "",
  904. endTime: "",
  905. schoolName: "",
  906. major: "",
  907. degree: ""
  908. };
  909. this.degreeIndex = -1;
  910. },
  911. editEducation(index) {
  912. this.isEditingEducation = true;
  913. this.editingEducationIndex = index;
  914. this.educationForm = { ...this.educationList[index] };
  915. this.degreeIndex = this.degreeOptions.findIndex((item) => item === this.educationForm.degree);
  916. common_vendor.index.pageScrollTo({
  917. selector: ".education-form",
  918. duration: 300
  919. });
  920. },
  921. cancelEditEducation() {
  922. this.isEditingEducation = false;
  923. this.editingEducationIndex = -1;
  924. this.educationForm = {
  925. startTime: "",
  926. endTime: "",
  927. schoolName: "",
  928. major: "",
  929. degree: ""
  930. };
  931. this.degreeIndex = -1;
  932. },
  933. deleteEducation(index) {
  934. if (this.isEditingEducation && this.editingEducationIndex === index) {
  935. this.cancelEditEducation();
  936. }
  937. this.educationList.splice(index, 1);
  938. common_vendor.index.showToast({
  939. title: "已删除",
  940. icon: "none"
  941. });
  942. },
  943. // 工作经历相关方法
  944. bindWorkStartTimeChange(e) {
  945. const startTime = e.detail.value;
  946. if (this.workForm.endTime && startTime > this.workForm.endTime) {
  947. common_vendor.index.showToast({
  948. title: "开始时间不能大于结束时间",
  949. icon: "none"
  950. });
  951. return;
  952. }
  953. this.workForm.startTime = startTime;
  954. this.workErrors.startTime = false;
  955. },
  956. bindWorkEndTimeChange(e) {
  957. const endTime = e.detail.value;
  958. if (this.workForm.startTime && endTime < this.workForm.startTime) {
  959. common_vendor.index.showToast({
  960. title: "结束时间不能小于开始时间",
  961. icon: "none"
  962. });
  963. return;
  964. }
  965. this.workForm.endTime = endTime;
  966. this.workErrors.endTime = false;
  967. },
  968. saveWork() {
  969. this.workErrors = {
  970. startTime: "",
  971. endTime: "",
  972. companyName: "",
  973. department: "",
  974. position: "",
  975. employeeCount: "",
  976. monthlySalary: "",
  977. supervisor: "",
  978. supervisorPhone: ""
  979. };
  980. let isValid = true;
  981. if (this.shouldValidateField("startTime", "work") && !this.workForm.startTime) {
  982. this.workErrors.startTime = "请选择开始时间";
  983. isValid = false;
  984. }
  985. if (this.shouldValidateField("endTime", "work") && !this.workForm.endTime) {
  986. this.workErrors.endTime = "请选择结束时间";
  987. isValid = false;
  988. }
  989. if (this.shouldValidateField("companyName", "work") && !this.workForm.companyName) {
  990. this.workErrors.companyName = "请输入单位名称";
  991. isValid = false;
  992. }
  993. if (this.shouldValidateField("department", "work") && !this.workForm.department) {
  994. this.workErrors.department = "请输入任职部门";
  995. isValid = false;
  996. }
  997. if (this.shouldValidateField("position", "work") && !this.workForm.position) {
  998. this.workErrors.position = "请输入担任职务";
  999. isValid = false;
  1000. }
  1001. if (this.shouldValidateField("employeeCount", "work") && !this.workForm.employeeCount) {
  1002. this.workErrors.employeeCount = "请输入单位人数";
  1003. isValid = false;
  1004. }
  1005. if (this.shouldValidateField("monthlySalary", "work") && !this.workForm.monthlySalary) {
  1006. this.workErrors.monthlySalary = "请输入月总收入";
  1007. isValid = false;
  1008. }
  1009. if (!isValid) {
  1010. common_vendor.index.showToast({
  1011. title: "请完善工作经历信息",
  1012. icon: "none"
  1013. });
  1014. return;
  1015. }
  1016. if (this.isEditingWork) {
  1017. this.workList[this.editingWorkIndex] = { ...this.workForm };
  1018. common_vendor.index.showToast({
  1019. title: "修改成功",
  1020. icon: "success"
  1021. });
  1022. this.isEditingWork = false;
  1023. this.editingWorkIndex = -1;
  1024. } else {
  1025. this.workList.push({ ...this.workForm });
  1026. common_vendor.index.showToast({
  1027. title: "添加成功",
  1028. icon: "success"
  1029. });
  1030. }
  1031. this.workForm = {
  1032. startTime: "",
  1033. endTime: "",
  1034. companyName: "",
  1035. department: "",
  1036. employeeCount: "",
  1037. position: "",
  1038. monthlySalary: "",
  1039. supervisor: "",
  1040. supervisorPhone: ""
  1041. };
  1042. },
  1043. editWork(index) {
  1044. this.isEditingWork = true;
  1045. this.editingWorkIndex = index;
  1046. this.workForm = { ...this.workList[index] };
  1047. common_vendor.index.pageScrollTo({
  1048. selector: ".work-form",
  1049. duration: 300
  1050. });
  1051. },
  1052. cancelEditWork() {
  1053. this.isEditingWork = false;
  1054. this.editingWorkIndex = -1;
  1055. this.workForm = {
  1056. startTime: "",
  1057. endTime: "",
  1058. companyName: "",
  1059. department: "",
  1060. employeeCount: "",
  1061. position: "",
  1062. monthlySalary: "",
  1063. supervisor: "",
  1064. supervisorPhone: ""
  1065. };
  1066. },
  1067. deleteWork(index) {
  1068. if (this.isEditingWork && this.editingWorkIndex === index) {
  1069. this.cancelEditWork();
  1070. }
  1071. this.workList.splice(index, 1);
  1072. common_vendor.index.showToast({
  1073. title: "已删除",
  1074. icon: "none"
  1075. });
  1076. },
  1077. submitForm() {
  1078. var _a, _b;
  1079. if (!this.validateCurrentStep()) {
  1080. return;
  1081. }
  1082. this.autoSaveAllUnsavedForms();
  1083. const allRequired = [
  1084. "name",
  1085. "gender",
  1086. "phone",
  1087. "idCard",
  1088. "ethnic",
  1089. "currentAddress"
  1090. ];
  1091. let isValid = true;
  1092. allRequired.forEach((field) => {
  1093. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1094. isValid = false;
  1095. }
  1096. });
  1097. if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
  1098. this.formErrors.skills = "请描述您的专业技能";
  1099. isValid = false;
  1100. }
  1101. if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
  1102. this.formErrors.training = "请描述您的培训经历";
  1103. isValid = false;
  1104. }
  1105. if (!isValid) {
  1106. common_vendor.index.showToast({
  1107. title: "请完善所有必填信息",
  1108. icon: "none"
  1109. });
  1110. return;
  1111. }
  1112. const userInfo = common_vendor.index.getStorageSync("userInfo");
  1113. if (!userInfo) {
  1114. common_vendor.index.showToast({
  1115. title: "用户信息获取失败,请重新登录",
  1116. icon: "none",
  1117. duration: 2e3
  1118. });
  1119. return;
  1120. }
  1121. try {
  1122. const userData = JSON.parse(userInfo);
  1123. const submitData = {
  1124. tenant_id: common_vendor.index.getStorageSync("tenant_id") || JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1,
  1125. user_id: userData.id,
  1126. personal_info: {
  1127. name: this.formData.name,
  1128. gender: this.formData.gender,
  1129. phone: this.formData.phone,
  1130. id_card: this.formData.idCard,
  1131. address: this.formData.currentAddress,
  1132. professional_skills: this.formData.skills ? this.formData.skills.split(",") : []
  1133. },
  1134. profile: {
  1135. female_status: this.getFemaleStatus(),
  1136. marital_status: this.getMaritalStatus(),
  1137. height: parseFloat(this.formData.height) || 0,
  1138. weight: parseFloat(this.formData.weight) || 0,
  1139. ethnicity: this.formData.ethnic,
  1140. current_address: this.formData.currentAddress,
  1141. expected_salary: parseFloat(this.formData.expectedSalary) || 0
  1142. },
  1143. educations: this.formatEducations(),
  1144. family_members: this.formatFamilyMembers(),
  1145. work_experiences: this.formatWorkExperiences()
  1146. };
  1147. if (!submitData.personal_info.name || !submitData.personal_info.gender || !submitData.personal_info.phone) {
  1148. common_vendor.index.showToast({
  1149. title: "基本信息不完整",
  1150. icon: "none",
  1151. duration: 2e3
  1152. });
  1153. return;
  1154. }
  1155. this.sendFormData(submitData);
  1156. } catch (error) {
  1157. console.error("数据处理错误:", error);
  1158. common_vendor.index.showToast({
  1159. title: "数据处理错误,请重试",
  1160. icon: "none",
  1161. duration: 2e3
  1162. });
  1163. }
  1164. },
  1165. // 辅助方法:发送表单数据
  1166. sendFormData(submitData) {
  1167. common_vendor.index.showLoading({ title: "提交中..." });
  1168. const token = common_vendor.index.getStorageSync("token");
  1169. common_vendor.index.request({
  1170. url: `${common_config.apiBaseUrl}/wechat/user/profile/update`,
  1171. method: "POST",
  1172. data: submitData,
  1173. header: {
  1174. "content-type": "application/json",
  1175. "Authorization": token ? `Bearer ${token}` : ""
  1176. },
  1177. success: (res) => {
  1178. common_vendor.index.hideLoading();
  1179. if (res.statusCode === 200) {
  1180. if (res.data.code === 2e3) {
  1181. common_vendor.index.showToast({
  1182. title: "提交成功",
  1183. icon: "success",
  1184. duration: 2e3
  1185. });
  1186. common_vendor.index.navigateTo({
  1187. url: "/pages/interview-notice/interview-notice"
  1188. });
  1189. } else {
  1190. common_vendor.index.showToast({
  1191. title: res.data.msg || "提交失败",
  1192. icon: "none",
  1193. duration: 2e3
  1194. });
  1195. }
  1196. } else {
  1197. common_vendor.index.showToast({
  1198. title: "服务器响应错误",
  1199. icon: "none",
  1200. duration: 2e3
  1201. });
  1202. }
  1203. },
  1204. fail: (err) => {
  1205. console.error("提交失败:", err);
  1206. common_vendor.index.hideLoading();
  1207. if (err.errMsg.includes("timeout")) {
  1208. common_vendor.index.showToast({
  1209. title: "请求超时,请检查网络后重试",
  1210. icon: "none",
  1211. duration: 2e3
  1212. });
  1213. } else if (err.errMsg.includes("fail")) {
  1214. common_vendor.index.showToast({
  1215. title: "网络连接失败,请检查网络设置",
  1216. icon: "none",
  1217. duration: 2e3
  1218. });
  1219. } else {
  1220. common_vendor.index.showToast({
  1221. title: "提交失败,请稍后重试",
  1222. icon: "none",
  1223. duration: 2e3
  1224. });
  1225. }
  1226. },
  1227. complete: () => {
  1228. }
  1229. });
  1230. },
  1231. // 数据格式化方法
  1232. getFemaleStatus() {
  1233. if (this.formData.gender !== "女")
  1234. return 0;
  1235. const statusMap = { "孕期": 1, "产期": 2, "哺乳期": 3 };
  1236. return statusMap[this.formData.threePeriod] || 0;
  1237. },
  1238. getMaritalStatus() {
  1239. const statusMap = { "未婚": 0, "已婚": 1, "离异": 2, "丧偶": 3 };
  1240. return statusMap[this.formData.marriage] || 0;
  1241. },
  1242. formatEducations() {
  1243. return this.educationList.map((edu, index) => ({
  1244. education_type: index === 0 ? 1 : 2,
  1245. degree: this.mapDegreeToNumber(edu.degree),
  1246. start_date: edu.startTime,
  1247. end_date: edu.endTime,
  1248. school_name: edu.schoolName,
  1249. major: edu.major
  1250. }));
  1251. },
  1252. formatFamilyMembers() {
  1253. return this.familyMembers.map((member) => ({
  1254. relation: member.relation,
  1255. name: member.name,
  1256. workplace: member.workplaceOrAddress,
  1257. position: member.position,
  1258. phone: member.phone
  1259. //is_emergency_contact: member.isEmergencyContact||false // 添加紧急联系人标识
  1260. }));
  1261. },
  1262. formatWorkExperiences() {
  1263. return this.workList.map((work) => ({
  1264. start_date: work.startTime,
  1265. end_date: work.endTime,
  1266. company_name: work.companyName,
  1267. department: work.department,
  1268. company_size: parseInt(work.employeeCount) || 0,
  1269. position: work.position,
  1270. monthly_salary: work.monthlySalary || 0,
  1271. supervisor_name: work.supervisor,
  1272. supervisor_phone: work.supervisorPhone
  1273. }));
  1274. },
  1275. // 学历映射辅助方法
  1276. mapDegreeToNumber(degreeText) {
  1277. const degreeMap = {
  1278. "高中": 1,
  1279. "中专": 1,
  1280. "大专": 2,
  1281. "本科": 3,
  1282. "硕士": 4,
  1283. "博士": 5
  1284. };
  1285. return degreeMap[degreeText] || 6;
  1286. },
  1287. prevStep() {
  1288. const prevIndex = this.currentStepIndex - 1;
  1289. if (prevIndex >= 0) {
  1290. let targetIndex = prevIndex;
  1291. while (targetIndex >= 0) {
  1292. const stepId = this.steps[targetIndex].id;
  1293. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1294. targetIndex--;
  1295. continue;
  1296. }
  1297. if (stepId === 5 && !this.shouldShowEducationStep) {
  1298. targetIndex--;
  1299. continue;
  1300. }
  1301. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1302. targetIndex--;
  1303. continue;
  1304. }
  1305. if (stepId === 8 && !this.shouldShowWorkStep) {
  1306. targetIndex--;
  1307. continue;
  1308. }
  1309. break;
  1310. }
  1311. if (targetIndex >= 0) {
  1312. this.currentStep = this.steps[targetIndex].id;
  1313. }
  1314. common_vendor.index.pageScrollTo({
  1315. scrollTop: 0,
  1316. duration: 300
  1317. });
  1318. }
  1319. },
  1320. nextStep() {
  1321. if (!this.validateCurrentStep()) {
  1322. return;
  1323. }
  1324. if (this.currentStep === 1) {
  1325. this.verifyIdentity();
  1326. return;
  1327. }
  1328. const nextIndex = this.currentStepIndex + 1;
  1329. if (nextIndex < this.steps.length) {
  1330. let targetIndex = nextIndex;
  1331. while (targetIndex < this.steps.length) {
  1332. const stepId = this.steps[targetIndex].id;
  1333. console.log(this.steps[targetIndex].id);
  1334. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1335. targetIndex++;
  1336. continue;
  1337. }
  1338. if (stepId === 5 && !this.shouldShowEducationStep) {
  1339. targetIndex++;
  1340. continue;
  1341. }
  1342. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1343. targetIndex++;
  1344. continue;
  1345. }
  1346. if (stepId === 8 && !this.shouldShowWorkStep) {
  1347. targetIndex++;
  1348. continue;
  1349. }
  1350. break;
  1351. }
  1352. if (targetIndex < this.steps.length) {
  1353. this.currentStep = this.steps[targetIndex].id;
  1354. } else {
  1355. console.log("当前步骤是最后一个需要显示的步骤,显示提交按钮");
  1356. }
  1357. common_vendor.index.pageScrollTo({
  1358. scrollTop: 0,
  1359. duration: 300
  1360. });
  1361. }
  1362. },
  1363. // 身份验证方法
  1364. verifyIdentity() {
  1365. this.formErrors = {
  1366. name: "",
  1367. idCard: "",
  1368. phone: ""
  1369. };
  1370. common_vendor.index.showLoading({
  1371. title: "身份验证中..."
  1372. });
  1373. common_vendor.index.request({
  1374. url: `${common_config.apiBaseUrl}/wechat/identity/verify`,
  1375. method: "POST",
  1376. data: {
  1377. name: this.formData.name,
  1378. id_number: this.formData.idCard,
  1379. mobile: this.formData.phone
  1380. },
  1381. header: {
  1382. "content-type": "application/x-www-form-urlencoded"
  1383. },
  1384. success: (res) => {
  1385. common_vendor.index.hideLoading();
  1386. console.log(res);
  1387. if (res.data.code === 200) {
  1388. let targetIndex = this.currentStepIndex + 1;
  1389. while (targetIndex < this.steps.length) {
  1390. const stepId = this.steps[targetIndex].id;
  1391. if (stepId === 3 && !this.shouldShowFamilyStep) {
  1392. targetIndex++;
  1393. continue;
  1394. }
  1395. if (stepId === 5 && !this.shouldShowEducationStep) {
  1396. targetIndex++;
  1397. continue;
  1398. }
  1399. if (stepId === 6 && !this.shouldShowSkillsStep) {
  1400. targetIndex++;
  1401. continue;
  1402. }
  1403. if (stepId === 8 && !this.shouldShowWorkStep) {
  1404. targetIndex++;
  1405. continue;
  1406. }
  1407. break;
  1408. }
  1409. if (targetIndex < this.steps.length) {
  1410. this.currentStep = this.steps[targetIndex].id;
  1411. common_vendor.index.pageScrollTo({ scrollTop: 0, duration: 300 });
  1412. } else {
  1413. console.log("身份验证通过后,当前步骤是最后一个需要显示的步骤,显示提交按钮");
  1414. }
  1415. this.setUserInfo(this.formData);
  1416. } else {
  1417. this.handleVerificationError(res.data);
  1418. }
  1419. },
  1420. fail: (err) => {
  1421. this.handleRequestError(err);
  1422. }
  1423. });
  1424. },
  1425. setUserInfo(data) {
  1426. common_vendor.index.request({
  1427. url: `${common_config.apiBaseUrl}/wechat/updateUserInfo`,
  1428. method: "POST",
  1429. data: {
  1430. openid: JSON.parse(common_vendor.index.getStorageSync("userInfo")).openid,
  1431. name: data.name,
  1432. id_card: data.idCard,
  1433. purePhoneNumber: data.phone,
  1434. tenant_id: common_vendor.index.getStorageSync("tenant_id") || JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1,
  1435. examine: 0
  1436. },
  1437. header: {
  1438. "content-type": "application/x-www-form-urlencoded"
  1439. },
  1440. success: (res) => {
  1441. console.log(res);
  1442. }
  1443. });
  1444. },
  1445. // 处理验证错误
  1446. handleVerificationError(data) {
  1447. this.formErrors.name = "姓名验证失败,请检查姓名是否正确";
  1448. this.formErrors.idCard = "身份证号验证失败,请检查身份证号是否正确";
  1449. this.formErrors.phone = "手机号验证失败,请检查手机号是否正确";
  1450. common_vendor.index.showToast({
  1451. title: data.msg || "身份验证失败",
  1452. icon: "none"
  1453. });
  1454. },
  1455. // 处理请求错误
  1456. handleRequestError(err) {
  1457. common_vendor.index.hideLoading();
  1458. common_vendor.index.showToast({
  1459. title: "网络错误,请检查网络连接",
  1460. icon: "none",
  1461. duration: 2e3
  1462. });
  1463. console.error("请求失败:", err);
  1464. },
  1465. // 验证当前步骤的必填项
  1466. validateCurrentStep() {
  1467. var _a, _b;
  1468. let isValid = true;
  1469. switch (this.currentStep) {
  1470. case 1:
  1471. const basicFields = ["name", "gender", "phone", "idCard", "ethnic", "currentAddress"];
  1472. basicFields.forEach((field) => {
  1473. if (this.shouldValidateField(field) && !this.validateField(field, this.formData[field])) {
  1474. isValid = false;
  1475. }
  1476. });
  1477. if (this.shouldValidateField("threePeriod") && this.formData.gender === "女" && this.threePeriodIndex === -1) {
  1478. this.formErrors.threePeriod = "请选择三期状态";
  1479. isValid = false;
  1480. }
  1481. if (this.shouldValidateField("height") && this.formData.height) {
  1482. isValid = this.validateField("height", this.formData.height) && isValid;
  1483. }
  1484. if (this.shouldValidateField("weight") && this.formData.weight) {
  1485. isValid = this.validateField("weight", this.formData.weight) && isValid;
  1486. }
  1487. if (this.shouldValidateField("expectedSalary") && this.formData.expectedSalary) {
  1488. isValid = this.validateField("expectedSalary", this.formData.expectedSalary) && isValid;
  1489. }
  1490. break;
  1491. case 3:
  1492. if (this.hasUnsavedFamilyMemberForm()) {
  1493. if (!this.autoSaveFamilyMember()) {
  1494. isValid = false;
  1495. break;
  1496. }
  1497. }
  1498. console.log(this.familyMembers.length);
  1499. if (this.familyMembers.length == 0) {
  1500. common_vendor.index.showToast({
  1501. title: "请至少添加一位家庭成员",
  1502. icon: "none"
  1503. });
  1504. isValid = false;
  1505. }
  1506. break;
  1507. case 5:
  1508. if (this.hasUnsavedEducationForm()) {
  1509. if (!this.autoSaveEducation()) {
  1510. isValid = false;
  1511. break;
  1512. }
  1513. }
  1514. if (this.educationList.length === 0) {
  1515. common_vendor.index.showToast({
  1516. title: "请至少添加一项教育经历",
  1517. icon: "none"
  1518. });
  1519. isValid = false;
  1520. }
  1521. break;
  1522. case 6:
  1523. if (this.shouldValidateField("skills") && !((_a = this.formData.skills) == null ? void 0 : _a.trim())) {
  1524. this.formErrors.skills = "请描述您的专业技能";
  1525. isValid = false;
  1526. }
  1527. if (this.shouldValidateField("training") && !((_b = this.formData.training) == null ? void 0 : _b.trim())) {
  1528. this.formErrors.training = "请描述您的培训经历";
  1529. isValid = false;
  1530. }
  1531. break;
  1532. case 8:
  1533. if (this.hasUnsavedWorkForm()) {
  1534. if (!this.autoSaveWork()) {
  1535. isValid = false;
  1536. break;
  1537. }
  1538. }
  1539. if (this.workList.length === 0) {
  1540. common_vendor.index.showToast({
  1541. title: "请至少添加一项工作经历",
  1542. icon: "none"
  1543. });
  1544. isValid = false;
  1545. }
  1546. break;
  1547. }
  1548. return isValid;
  1549. },
  1550. // Add method to fetch user data
  1551. fetchUserData() {
  1552. this.isLoading = true;
  1553. const userInfo = common_vendor.index.getStorageSync("userInfo") ? JSON.parse(common_vendor.index.getStorageSync("userInfo")) : {};
  1554. const openid = userInfo.openid;
  1555. if (!openid) {
  1556. common_vendor.index.showToast({
  1557. title: "用户信息获取失败,请重新登录",
  1558. icon: "none"
  1559. });
  1560. this.isLoading = false;
  1561. return;
  1562. }
  1563. common_vendor.index.request({
  1564. url: `${common_config.apiBaseUrl}/api/wechat/user/get_full_info?tenant_id=${common_vendor.index.getStorageSync("tenant_id") || JSON.parse(common_vendor.index.getStorageSync("userInfo")).tenant_id || 1}&openid=${openid}`,
  1565. method: "GET",
  1566. success: (res) => {
  1567. this.showPromiseModal = true;
  1568. this.populateFormData(res.data.data);
  1569. },
  1570. fail: (err) => {
  1571. },
  1572. complete: () => {
  1573. this.isLoading = false;
  1574. this.$nextTick(() => {
  1575. this.ensureValidStep();
  1576. });
  1577. }
  1578. });
  1579. },
  1580. // Add method to populate form data with fetched data
  1581. populateFormData(data) {
  1582. const { user_info, profile, educations, work_experiences, family_members } = data;
  1583. if (user_info) {
  1584. this.formData.name = user_info.name || "";
  1585. this.formData.gender = user_info.gender_text || "";
  1586. this.genderIndex = this.genderOptions.findIndex((item) => item === this.formData.gender);
  1587. this.formData.idCard = user_info.id_card || "";
  1588. this.formData.phone = user_info.phone || "";
  1589. this.formData.email = user_info.email || "";
  1590. }
  1591. if (profile) {
  1592. this.formData.political = profile.political_status || "";
  1593. this.politicalIndex = this.politicalOptions.findIndex((item) => item === this.formData.political);
  1594. this.formData.ethnic = profile.ethnicity || "";
  1595. this.ethnicIndex = this.ethnicOptions.findIndex((item) => item === this.formData.ethnic);
  1596. this.formData.height = profile.height || "";
  1597. this.formData.weight = profile.weight || "";
  1598. this.formData.nativePlace = profile.native_place || "";
  1599. this.formData.residence = profile.household_location || "";
  1600. this.formData.currentAddress = profile.current_address || "";
  1601. this.formData.marriage = profile.marital_status_text || "";
  1602. this.marriageIndex = this.marriageOptions.findIndex((item) => item === this.formData.marriage);
  1603. if (this.formData.gender === "女" && profile.female_status !== void 0) {
  1604. const femaleStatusMap = { 0: "无", 1: "孕期", 2: "产期", 3: "哺乳期" };
  1605. this.formData.threePeriod = femaleStatusMap[profile.female_status] || "无";
  1606. this.threePeriodIndex = this.threePeriodOptions.findIndex((item) => item === this.formData.threePeriod);
  1607. }
  1608. this.formData.expectedSalary = profile.expected_salary || "";
  1609. this.formData.emergencyContact = profile.emergency_contact || "";
  1610. this.formData.emergencyPhone = profile.emergency_phone || "";
  1611. this.formData.hobby = profile.specialties || "";
  1612. this.formData.motto = profile.life_motto || "";
  1613. const sourceTypeMap = {
  1614. 1: "school",
  1615. 2: "social",
  1616. 3: "social",
  1617. 4: "social",
  1618. 5: "social"
  1619. };
  1620. const socialSourceMap = {
  1621. 2: "BOSS",
  1622. 3: "zhilian",
  1623. 4: "liepin",
  1624. 5: "other"
  1625. };
  1626. this.formData.sourceType = sourceTypeMap[profile.recruitment_source] || "social";
  1627. if (this.formData.sourceType === "social") {
  1628. this.formData.socialSource = socialSourceMap[profile.recruitment_source] || "";
  1629. if (this.formData.socialSource === "other") {
  1630. this.formData.otherSocialSource = profile.recruitment_source_detail || "";
  1631. }
  1632. } else if (this.formData.sourceType === "school") {
  1633. this.formData.otherSchoolSource = profile.recruitment_source_detail || "";
  1634. }
  1635. }
  1636. if (educations && educations.length > 0) {
  1637. this.educationList = educations.map((edu) => {
  1638. const degreeMap = {
  1639. 1: "高中",
  1640. 2: "大专",
  1641. 3: "本科",
  1642. 4: "硕士",
  1643. 5: "博士"
  1644. };
  1645. return {
  1646. startTime: edu.start_date || "",
  1647. endTime: edu.end_date || "",
  1648. schoolName: edu.school_name || "",
  1649. major: edu.major || "",
  1650. degree: degreeMap[edu.degree] || ""
  1651. };
  1652. });
  1653. }
  1654. if (work_experiences && work_experiences.length > 0) {
  1655. this.workList = work_experiences.map((work) => {
  1656. return {
  1657. startTime: work.start_date || "",
  1658. endTime: work.end_date || "",
  1659. companyName: work.company_name || "",
  1660. department: work.department || "",
  1661. employeeCount: work.company_size || "",
  1662. position: work.position || "",
  1663. monthlySalary: work.monthly_salary || "",
  1664. supervisor: work.supervisor_name || "",
  1665. supervisorPhone: work.supervisor_phone || ""
  1666. };
  1667. });
  1668. }
  1669. if (family_members && family_members.length > 0) {
  1670. this.familyMembers = family_members.map((member) => {
  1671. return {
  1672. relation: member.relation || "",
  1673. name: member.name || "",
  1674. workplaceOrAddress: member.workplace || "",
  1675. position: member.position || "",
  1676. phone: member.phone || "",
  1677. isEmergencyContact: member.isEmergencyContact || false
  1678. };
  1679. });
  1680. }
  1681. },
  1682. // 处理紧急联系人开关变化
  1683. handleEmergencyContactChange(e) {
  1684. this.familyMemberForm.isEmergencyContact = e.detail.value;
  1685. if (e.detail.value) {
  1686. this.formData.emergencyContact = this.familyMemberForm.name;
  1687. this.formData.emergencyPhone = this.familyMemberForm.phone;
  1688. }
  1689. },
  1690. // 添加重置教育经历错误信息的方法
  1691. resetEducationErrors() {
  1692. this.educationErrors = {
  1693. startTime: "",
  1694. endTime: "",
  1695. schoolName: "",
  1696. major: "",
  1697. degree: ""
  1698. };
  1699. },
  1700. // 添加通用验证方法
  1701. validateField(fieldName, value) {
  1702. const rule = this.validationRules[fieldName];
  1703. if (!rule)
  1704. return true;
  1705. if (!this.shouldValidateField(fieldName)) {
  1706. return true;
  1707. }
  1708. this.formErrors[fieldName] = "";
  1709. if (rule.required && !value) {
  1710. this.formErrors[fieldName] = rule.message;
  1711. return false;
  1712. }
  1713. if (rule.pattern && value && !rule.pattern.test(value)) {
  1714. this.formErrors[fieldName] = rule.message;
  1715. return false;
  1716. }
  1717. return true;
  1718. },
  1719. validateExpectedSalary(e) {
  1720. const value = e.detail.value;
  1721. console.log(value);
  1722. if (value === "") {
  1723. this.formData.expectedSalary = "";
  1724. this.formErrors.expectedSalary = "";
  1725. return;
  1726. }
  1727. let num = parseFloat(value);
  1728. if (isNaN(num)) {
  1729. this.formErrors.expectedSalary = "请输入有效的数字";
  1730. return;
  1731. }
  1732. if (num < 0) {
  1733. num = 0;
  1734. this.formErrors.expectedSalary = "薪资不能小于0";
  1735. } else if (num > 1e5) {
  1736. num = 1e5;
  1737. this.formErrors.expectedSalary = "薪资不能超过100000";
  1738. }
  1739. this.formData.expectedSalary = num.toString();
  1740. },
  1741. validateEmployeeCount(e) {
  1742. const value = e.detail.value;
  1743. if (value === "") {
  1744. this.workForm.employeeCount = "";
  1745. this.workErrors.employeeCount = "";
  1746. return;
  1747. }
  1748. let num = parseInt(value);
  1749. if (isNaN(num)) {
  1750. this.workErrors.employeeCount = "请输入有效的数字";
  1751. return;
  1752. }
  1753. if (num < 0) {
  1754. num = 0;
  1755. this.workErrors.employeeCount = "人数不能小于0";
  1756. } else if (num > 1e4) {
  1757. num = 1e4;
  1758. this.workErrors.employeeCount = "人数不能超过10000";
  1759. }
  1760. this.workForm.employeeCount = num.toString();
  1761. },
  1762. validateMonthlySalary(e) {
  1763. const value = e.detail.value;
  1764. if (value === "") {
  1765. this.workForm.monthlySalary = "";
  1766. this.workErrors.monthlySalary = "";
  1767. return;
  1768. }
  1769. let num = parseInt(value);
  1770. if (isNaN(num)) {
  1771. this.workErrors.monthlySalary = "请输入有效的数字";
  1772. return;
  1773. }
  1774. if (num < 0) {
  1775. num = 0;
  1776. this.workErrors.monthlySalary = "月总收入不能小于0";
  1777. } else if (num > 1e5) {
  1778. num = 1e5;
  1779. this.workErrors.monthlySalary = "月总收入不能超过100000";
  1780. } else {
  1781. this.workErrors.monthlySalary = "";
  1782. }
  1783. this.workForm.monthlySalary = num.toString();
  1784. },
  1785. // 添加手机号验证方法
  1786. validatePhone(e) {
  1787. const value = e.detail.value;
  1788. if (value.length > 11) {
  1789. this.formData.phone = value.slice(0, 11);
  1790. }
  1791. if (value && !/^1[3-9]\d{0,9}$/.test(value)) {
  1792. this.formErrors.phone = "请输入正确的手机号码";
  1793. } else {
  1794. this.formErrors.phone = "";
  1795. }
  1796. },
  1797. // 检查是否有未保存的家庭成员表单
  1798. hasUnsavedFamilyMemberForm() {
  1799. return this.familyMemberForm.relation || this.familyMemberForm.name || this.familyMemberForm.workplaceOrAddress || this.familyMemberForm.position || this.familyMemberForm.phone;
  1800. },
  1801. // 检查是否有未保存的教育经历表单
  1802. hasUnsavedEducationForm() {
  1803. return this.educationForm.startTime || this.educationForm.endTime || this.educationForm.schoolName || this.educationForm.major || this.educationForm.degree;
  1804. },
  1805. // 检查是否有未保存的工作经历表单
  1806. hasUnsavedWorkForm() {
  1807. return this.workForm.startTime || this.workForm.endTime || this.workForm.companyName || this.workForm.department || this.workForm.position || this.workForm.employeeCount || this.workForm.monthlySalary || this.workForm.supervisor || this.workForm.supervisorPhone;
  1808. },
  1809. // 自动保存家庭成员
  1810. autoSaveFamilyMember() {
  1811. this.resetFamilyMemberErrors();
  1812. let isValid = true;
  1813. if (this.shouldValidateField("relation", "family") && !this.familyMemberForm.relation) {
  1814. this.familyMemberErrors.relation = "请输入称谓";
  1815. isValid = false;
  1816. }
  1817. if (this.shouldValidateField("name", "family") && !this.familyMemberForm.name) {
  1818. this.familyMemberErrors.name = "请输入姓名";
  1819. isValid = false;
  1820. }
  1821. if (!isValid) {
  1822. common_vendor.index.showToast({
  1823. title: "请完善家庭成员必填信息",
  1824. icon: "none"
  1825. });
  1826. return false;
  1827. }
  1828. if (this.isEditing) {
  1829. this.familyMembers[this.editingIndex] = { ...this.familyMemberForm };
  1830. this.isEditing = false;
  1831. this.editingIndex = -1;
  1832. } else {
  1833. this.familyMembers.push({ ...this.familyMemberForm });
  1834. }
  1835. this.resetFamilyMemberForm();
  1836. common_vendor.index.showToast({
  1837. title: "已自动保存",
  1838. icon: "success",
  1839. duration: 1500
  1840. });
  1841. return true;
  1842. },
  1843. // 自动保存教育经历
  1844. autoSaveEducation() {
  1845. this.resetEducationErrors();
  1846. let isValid = true;
  1847. if (this.shouldValidateField("startTime", "education") && !this.educationForm.startTime) {
  1848. this.educationErrors.startTime = "请选择开始时间";
  1849. isValid = false;
  1850. }
  1851. if (this.shouldValidateField("endTime", "education") && !this.educationForm.endTime) {
  1852. this.educationErrors.endTime = "请选择结束时间";
  1853. isValid = false;
  1854. }
  1855. if (this.shouldValidateField("schoolName", "education") && !this.educationForm.schoolName) {
  1856. this.educationErrors.schoolName = "请输入学校名称";
  1857. isValid = false;
  1858. }
  1859. if (this.shouldValidateField("major", "education") && !this.educationForm.major) {
  1860. this.educationErrors.major = "请输入专业";
  1861. isValid = false;
  1862. }
  1863. if (this.shouldValidateField("degree", "education") && !this.educationForm.degree) {
  1864. this.educationErrors.degree = "请选择学历";
  1865. isValid = false;
  1866. }
  1867. if (!isValid) {
  1868. common_vendor.index.showToast({
  1869. title: "请完善教育经历必填信息",
  1870. icon: "none"
  1871. });
  1872. return false;
  1873. }
  1874. if (this.isEditingEducation) {
  1875. this.educationList[this.editingEducationIndex] = { ...this.educationForm };
  1876. this.isEditingEducation = false;
  1877. this.editingEducationIndex = -1;
  1878. } else {
  1879. this.educationList.push({ ...this.educationForm });
  1880. }
  1881. this.educationForm = {
  1882. startTime: "",
  1883. endTime: "",
  1884. schoolName: "",
  1885. major: "",
  1886. degree: ""
  1887. };
  1888. this.degreeIndex = -1;
  1889. common_vendor.index.showToast({
  1890. title: "已自动保存",
  1891. icon: "success",
  1892. duration: 1500
  1893. });
  1894. return true;
  1895. },
  1896. // 自动保存工作经历
  1897. autoSaveWork() {
  1898. this.workErrors = {
  1899. startTime: "",
  1900. endTime: "",
  1901. companyName: "",
  1902. department: "",
  1903. position: "",
  1904. employeeCount: "",
  1905. monthlySalary: "",
  1906. supervisor: "",
  1907. supervisorPhone: ""
  1908. };
  1909. let isValid = true;
  1910. if (this.shouldValidateField("startTime", "work") && !this.workForm.startTime) {
  1911. this.workErrors.startTime = "请选择开始时间";
  1912. isValid = false;
  1913. }
  1914. if (this.shouldValidateField("endTime", "work") && !this.workForm.endTime) {
  1915. this.workErrors.endTime = "请选择结束时间";
  1916. isValid = false;
  1917. }
  1918. if (this.shouldValidateField("companyName", "work") && !this.workForm.companyName) {
  1919. this.workErrors.companyName = "请输入单位名称";
  1920. isValid = false;
  1921. }
  1922. if (this.shouldValidateField("employeeCount", "work") && !this.workForm.employeeCount) {
  1923. this.workErrors.employeeCount = "请输入单位人数";
  1924. isValid = false;
  1925. }
  1926. if (this.shouldValidateField("department", "work") && !this.workForm.department) {
  1927. this.workErrors.department = "请输入任职部门";
  1928. isValid = false;
  1929. }
  1930. if (this.shouldValidateField("position", "work") && !this.workForm.position) {
  1931. this.workErrors.position = "请输入担任职务";
  1932. isValid = false;
  1933. }
  1934. if (this.shouldValidateField("employeeCount", "work") && !this.workForm.employeeCount) {
  1935. this.workErrors.employeeCount = "请输入单位人数";
  1936. isValid = false;
  1937. }
  1938. if (this.shouldValidateField("monthlySalary", "work") && !this.workForm.monthlySalary) {
  1939. this.workErrors.monthlySalary = "请输入月总收入";
  1940. isValid = false;
  1941. }
  1942. if (!isValid) {
  1943. common_vendor.index.showToast({
  1944. title: "请完善工作经历必填信息",
  1945. icon: "none"
  1946. });
  1947. return false;
  1948. }
  1949. if (this.isEditingWork) {
  1950. this.workList[this.editingWorkIndex] = { ...this.workForm };
  1951. this.isEditingWork = false;
  1952. this.editingWorkIndex = -1;
  1953. } else {
  1954. this.workList.push({ ...this.workForm });
  1955. }
  1956. this.workForm = {
  1957. startTime: "",
  1958. endTime: "",
  1959. companyName: "",
  1960. department: "",
  1961. employeeCount: "",
  1962. position: "",
  1963. monthlySalary: "",
  1964. supervisor: "",
  1965. supervisorPhone: ""
  1966. };
  1967. common_vendor.index.showToast({
  1968. title: "已自动保存",
  1969. icon: "success",
  1970. duration: 1500
  1971. });
  1972. return true;
  1973. },
  1974. // 自动保存所有未保存的表单
  1975. autoSaveAllUnsavedForms() {
  1976. if (this.hasUnsavedFamilyMemberForm()) {
  1977. this.autoSaveFamilyMember();
  1978. }
  1979. if (this.hasUnsavedEducationForm()) {
  1980. this.autoSaveEducation();
  1981. }
  1982. if (this.hasUnsavedWorkForm()) {
  1983. this.autoSaveWork();
  1984. }
  1985. }
  1986. },
  1987. // 添加监听器来清除错误信息
  1988. watch: {
  1989. "formData.name": function(newVal) {
  1990. if (newVal && this.formErrors.name) {
  1991. this.formErrors.name = "";
  1992. }
  1993. },
  1994. "formData.idCard": function(newVal) {
  1995. if (newVal && this.formErrors.idCard) {
  1996. this.formErrors.idCard = "";
  1997. }
  1998. },
  1999. "formData.phone": function(newVal) {
  2000. if (newVal && this.formErrors.phone) {
  2001. this.formErrors.phone = "";
  2002. }
  2003. },
  2004. "formData.gender": function(newVal) {
  2005. if (newVal && this.formErrors.gender) {
  2006. this.formErrors.gender = "";
  2007. }
  2008. },
  2009. "formData.ethnic": function(newVal) {
  2010. if (newVal && this.formErrors.ethnic) {
  2011. this.formErrors.ethnic = "";
  2012. }
  2013. },
  2014. "formData.currentAddress": function(newVal) {
  2015. if (newVal && this.formErrors.currentAddress) {
  2016. this.formErrors.currentAddress = "";
  2017. }
  2018. },
  2019. "formData.height": function(newVal) {
  2020. if (newVal && this.formErrors.height) {
  2021. this.formErrors.height = "";
  2022. }
  2023. },
  2024. "formData.weight": function(newVal) {
  2025. if (newVal && this.formErrors.weight) {
  2026. this.formErrors.weight = "";
  2027. }
  2028. },
  2029. "formData.expectedSalary": function(newVal) {
  2030. if (newVal && this.formErrors.expectedSalary) {
  2031. this.formErrors.expectedSalary = "";
  2032. }
  2033. },
  2034. "familyMemberForm.relation": function(newVal) {
  2035. if (newVal)
  2036. this.familyMemberErrors.relation = "";
  2037. },
  2038. "familyMemberForm.name": function(newVal) {
  2039. if (newVal)
  2040. this.familyMemberErrors.name = "";
  2041. },
  2042. "familyMemberForm.phone": function(newVal) {
  2043. if (newVal)
  2044. this.familyMemberErrors.phone = "";
  2045. },
  2046. /* 'familyMemberForm.workplaceOrAddress': function(newVal) {
  2047. if (newVal) this.familyMemberErrors.workplaceOrAddress = '';
  2048. },
  2049. 'familyMemberForm.position': function(newVal) {
  2050. if (newVal) this.familyMemberErrors.position = '';
  2051. }, */
  2052. "workForm.companyName": function(newVal) {
  2053. if (newVal && this.workErrors.companyName) {
  2054. this.workErrors.companyName = "";
  2055. }
  2056. },
  2057. "workForm.department": function(newVal) {
  2058. if (newVal && this.workErrors.department) {
  2059. this.workErrors.department = "";
  2060. }
  2061. },
  2062. "workForm.position": function(newVal) {
  2063. if (newVal && this.workErrors.position) {
  2064. this.workErrors.position = "";
  2065. }
  2066. },
  2067. "workForm.employeeCount": function(newVal) {
  2068. if (newVal && this.workErrors.employeeCount) {
  2069. this.workErrors.employeeCount = "";
  2070. }
  2071. },
  2072. "workForm.monthlySalary": function(newVal) {
  2073. if (newVal && this.workErrors.monthlySalary) {
  2074. this.workErrors.monthlySalary = "";
  2075. }
  2076. },
  2077. "workForm.supervisor": function(newVal) {
  2078. if (newVal && this.workErrors.supervisor) {
  2079. this.workErrors.supervisor = "";
  2080. }
  2081. },
  2082. // 'workForm.supervisorPhone': function(newVal) {
  2083. // if (newVal && this.workErrors.supervisorPhone) {
  2084. // this.workErrors.supervisorPhone = '';
  2085. // }
  2086. // },
  2087. "formData.training": function(newVal) {
  2088. if (newVal && this.formErrors.training) {
  2089. this.formErrors.training = "";
  2090. }
  2091. },
  2092. "educationForm.startTime": function(newVal) {
  2093. if (newVal)
  2094. this.educationErrors.startTime = "";
  2095. },
  2096. "educationForm.endTime": function(newVal) {
  2097. if (newVal)
  2098. this.educationErrors.endTime = "";
  2099. },
  2100. "educationForm.schoolName": function(newVal) {
  2101. if (newVal)
  2102. this.educationErrors.schoolName = "";
  2103. },
  2104. "educationForm.major": function(newVal) {
  2105. if (newVal)
  2106. this.educationErrors.major = "";
  2107. },
  2108. "educationForm.degree": function(newVal) {
  2109. if (newVal)
  2110. this.educationErrors.degree = "";
  2111. },
  2112. // 添加对表单字段的实时验证
  2113. "formData": {
  2114. handler(newVal) {
  2115. const currentStepFields = {
  2116. 1: ["name", "gender", "phone", "idCard", "ethnic", "currentAddress", "height", "weight", "expectedSalary"],
  2117. 6: ["skills", "training"]
  2118. }[this.currentStep];
  2119. if (currentStepFields) {
  2120. currentStepFields.forEach((field) => {
  2121. if (newVal[field] !== void 0 && this.shouldValidateField(field)) {
  2122. this.validateField(field, newVal[field]);
  2123. }
  2124. });
  2125. }
  2126. },
  2127. deep: true
  2128. }
  2129. }
  2130. };
  2131. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  2132. return common_vendor.e({
  2133. a: $data.isLoading
  2134. }, $data.isLoading ? {} : {}, {
  2135. b: $data.showPromiseModal
  2136. }, $data.showPromiseModal ? {
  2137. c: $data.promiseChecked,
  2138. d: common_vendor.o((...args) => $options.togglePromiseChecked && $options.togglePromiseChecked(...args)),
  2139. e: !$data.promiseChecked,
  2140. f: common_vendor.o((...args) => $options.confirmPromise && $options.confirmPromise(...args))
  2141. } : {}, {
  2142. g: $data.currentStep === 1
  2143. }, $data.currentStep === 1 ? common_vendor.e({
  2144. h: $options.showNameField
  2145. }, $options.showNameField ? common_vendor.e({
  2146. i: $data.formErrors.name ? 1 : "",
  2147. j: $data.formData.name,
  2148. k: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
  2149. l: $data.formErrors.name
  2150. }, $data.formErrors.name ? {
  2151. m: common_vendor.t($data.formErrors.name)
  2152. } : {}) : {}, {
  2153. n: $options.showGenderField
  2154. }, $options.showGenderField ? common_vendor.e({
  2155. o: common_vendor.t($data.genderOptions[$data.genderIndex] || "请选择性别"),
  2156. p: $data.formErrors.gender ? 1 : "",
  2157. q: common_vendor.o((...args) => $options.bindGenderChange && $options.bindGenderChange(...args)),
  2158. r: $data.genderIndex,
  2159. s: $data.genderOptions,
  2160. t: $data.formErrors.gender
  2161. }, $data.formErrors.gender ? {
  2162. v: common_vendor.t($data.formErrors.gender)
  2163. } : {}) : {}, {
  2164. w: $data.formData.gender === "女"
  2165. }, $data.formData.gender === "女" ? common_vendor.e({
  2166. x: common_vendor.t($data.threePeriodOptions[$data.threePeriodIndex] || "请选择"),
  2167. y: common_vendor.o((...args) => $options.bindThreePeriodChange && $options.bindThreePeriodChange(...args)),
  2168. z: $data.threePeriodIndex,
  2169. A: $data.threePeriodOptions,
  2170. B: $data.formErrors.threePeriod ? 1 : "",
  2171. C: $data.formErrors.threePeriod
  2172. }, $data.formErrors.threePeriod ? {
  2173. D: common_vendor.t($data.formErrors.threePeriod)
  2174. } : {}) : {}, {
  2175. E: $options.showPhoneField
  2176. }, $options.showPhoneField ? common_vendor.e({
  2177. F: $data.formErrors.phone ? 1 : "",
  2178. G: common_vendor.o([($event) => $data.formData.phone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  2179. H: $data.formData.phone,
  2180. I: $data.formErrors.phone
  2181. }, $data.formErrors.phone ? {
  2182. J: common_vendor.t($data.formErrors.phone)
  2183. } : {}) : {}, {
  2184. K: $options.showIdCardField
  2185. }, $options.showIdCardField ? common_vendor.e({
  2186. L: $data.formErrors.idCard ? 1 : "",
  2187. M: $data.formData.idCard,
  2188. N: common_vendor.o(($event) => $data.formData.idCard = $event.detail.value),
  2189. O: $data.formErrors.idCard
  2190. }, $data.formErrors.idCard ? {
  2191. P: common_vendor.t($data.formErrors.idCard)
  2192. } : {}) : {}, {
  2193. Q: $options.showEthnicField
  2194. }, $options.showEthnicField ? common_vendor.e({
  2195. R: common_vendor.t($data.ethnicOptions[$data.ethnicIndex] || "请选择民族"),
  2196. S: $data.formErrors.ethnic ? 1 : "",
  2197. T: common_vendor.o((...args) => $options.bindEthnicChange && $options.bindEthnicChange(...args)),
  2198. U: $data.ethnicIndex,
  2199. V: $data.ethnicOptions,
  2200. W: $data.formErrors.ethnic
  2201. }, $data.formErrors.ethnic ? {
  2202. X: common_vendor.t($data.formErrors.ethnic)
  2203. } : {}) : {}, {
  2204. Y: $options.showHeightField
  2205. }, $options.showHeightField ? {
  2206. Z: common_vendor.o([($event) => $data.formData.height = $event.detail.value, ($event) => $options.handleInput($event, "height", 2)]),
  2207. aa: common_vendor.o(($event) => $options.handleBlur("height")),
  2208. ab: $data.formData.height
  2209. } : {}, {
  2210. ac: $options.showWeightField
  2211. }, $options.showWeightField ? {
  2212. ad: common_vendor.o([($event) => $data.formData.weight = $event.detail.value, ($event) => $options.handleInput($event, "weight", 2)]),
  2213. ae: common_vendor.o(($event) => $options.handleBlur("weight")),
  2214. af: $data.formData.weight
  2215. } : {}, {
  2216. ag: $options.showCurrentAddress
  2217. }, $options.showCurrentAddress ? common_vendor.e({
  2218. ah: $data.formErrors.currentAddress ? 1 : "",
  2219. ai: $data.formData.currentAddress,
  2220. aj: common_vendor.o(($event) => $data.formData.currentAddress = $event.detail.value),
  2221. ak: $data.formErrors.currentAddress
  2222. }, $data.formErrors.currentAddress ? {
  2223. al: common_vendor.t($data.formErrors.currentAddress)
  2224. } : {}) : {}, {
  2225. am: $options.showResidence
  2226. }, $options.showResidence ? {
  2227. an: $data.formData.residence,
  2228. ao: common_vendor.o(($event) => $data.formData.residence = $event.detail.value)
  2229. } : {}, {
  2230. ap: $options.showMarriageIndex
  2231. }, $options.showMarriageIndex ? {
  2232. aq: common_vendor.t($data.marriageOptions[$data.marriageIndex] || "请选择婚育状况"),
  2233. ar: common_vendor.o((...args) => $options.bindMarriageChange && $options.bindMarriageChange(...args)),
  2234. as: $data.marriageIndex,
  2235. at: $data.marriageOptions
  2236. } : {}, {
  2237. av: $options.showExpectedSalary
  2238. }, $options.showExpectedSalary ? common_vendor.e({
  2239. aw: common_vendor.o((...args) => $options.validateExpectedSalary && $options.validateExpectedSalary(...args)),
  2240. ax: $data.formErrors.expectedSalary ? 1 : "",
  2241. ay: $data.formData.expectedSalary,
  2242. az: common_vendor.o(($event) => $data.formData.expectedSalary = $event.detail.value),
  2243. aA: $data.formErrors.expectedSalary
  2244. }, $data.formErrors.expectedSalary ? {
  2245. aB: common_vendor.t($data.formErrors.expectedSalary)
  2246. } : {}) : {}) : {}, {
  2247. aC: $data.currentStep === 3
  2248. }, $data.currentStep === 3 ? common_vendor.e({
  2249. aD: $data.familyMembers.length > 0
  2250. }, $data.familyMembers.length > 0 ? {
  2251. aE: common_vendor.f($data.familyMembers, (member, index, i0) => {
  2252. return common_vendor.e({
  2253. a: common_vendor.t(index + 1),
  2254. b: common_vendor.o(($event) => $options.editFamilyMember(index), index),
  2255. c: common_vendor.o(($event) => $options.deleteFamilyMember(index), index)
  2256. }, $options.showFamilyRelationField ? {
  2257. d: common_vendor.t(member.relation)
  2258. } : {}, $options.showFamilyNameField ? {
  2259. e: common_vendor.t(member.name)
  2260. } : {}, $options.showFamilyWorkplaceField ? {
  2261. f: common_vendor.t(member.workplaceOrAddress)
  2262. } : {}, $options.showFamilyPositionField ? {
  2263. g: common_vendor.t(member.position)
  2264. } : {}, $options.showFamilyPhoneField ? {
  2265. h: common_vendor.t(member.phone)
  2266. } : {}, {
  2267. i: common_vendor.t(member.isEmergencyContact ? "是" : "否"),
  2268. j: index
  2269. });
  2270. }),
  2271. aF: $options.showFamilyRelationField,
  2272. aG: $options.showFamilyNameField,
  2273. aH: $options.showFamilyWorkplaceField,
  2274. aI: $options.showFamilyPositionField,
  2275. aJ: $options.showFamilyPhoneField
  2276. } : {}, {
  2277. aK: common_vendor.t($data.isEditing ? "编辑家庭成员" : "添加家庭成员"),
  2278. aL: $data.isEditing
  2279. }, $data.isEditing ? {
  2280. aM: common_vendor.o((...args) => $options.cancelEdit && $options.cancelEdit(...args))
  2281. } : {}, {
  2282. aN: $options.showFamilyRelationField
  2283. }, $options.showFamilyRelationField ? common_vendor.e({
  2284. aO: $data.familyMemberErrors.relation ? 1 : "",
  2285. aP: $data.familyMemberForm.relation,
  2286. aQ: common_vendor.o(($event) => $data.familyMemberForm.relation = $event.detail.value),
  2287. aR: $data.familyMemberErrors.relation
  2288. }, $data.familyMemberErrors.relation ? {
  2289. aS: common_vendor.t($data.familyMemberErrors.relation)
  2290. } : {}) : {}, {
  2291. aT: $options.showFamilyNameField
  2292. }, $options.showFamilyNameField ? common_vendor.e({
  2293. aU: $data.familyMemberErrors.name ? 1 : "",
  2294. aV: $data.familyMemberForm.name,
  2295. aW: common_vendor.o(($event) => $data.familyMemberForm.name = $event.detail.value),
  2296. aX: $data.familyMemberErrors.name
  2297. }, $data.familyMemberErrors.name ? {
  2298. aY: common_vendor.t($data.familyMemberErrors.name)
  2299. } : {}) : {}, {
  2300. aZ: $options.showFamilyWorkplaceField
  2301. }, $options.showFamilyWorkplaceField ? {
  2302. ba: $data.familyMemberForm.workplaceOrAddress,
  2303. bb: common_vendor.o(($event) => $data.familyMemberForm.workplaceOrAddress = $event.detail.value)
  2304. } : {}, {
  2305. bc: $options.showFamilyPositionField
  2306. }, $options.showFamilyPositionField ? {
  2307. bd: $data.familyMemberForm.position,
  2308. be: common_vendor.o(($event) => $data.familyMemberForm.position = $event.detail.value)
  2309. } : {}, {
  2310. bf: $options.showFamilyPhoneField
  2311. }, $options.showFamilyPhoneField ? common_vendor.e({
  2312. bg: common_vendor.o([($event) => $data.familyMemberForm.phone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  2313. bh: $data.familyMemberErrors.phone ? 1 : "",
  2314. bi: $data.familyMemberForm.phone,
  2315. bj: $data.familyMemberErrors.phone
  2316. }, $data.familyMemberErrors.phone ? {
  2317. bk: common_vendor.t($data.familyMemberErrors.phone)
  2318. } : {}) : {}, {
  2319. bl: $options.showFamilyisEmergency
  2320. }, $options.showFamilyisEmergency ? {
  2321. bm: $data.familyMemberForm.isEmergencyContact,
  2322. bn: common_vendor.o((...args) => $options.handleEmergencyContactChange && $options.handleEmergencyContactChange(...args))
  2323. } : {}, {
  2324. bo: common_vendor.t($data.isEditing ? "✓" : "+"),
  2325. bp: common_vendor.o((...args) => $options.saveFamilyMember && $options.saveFamilyMember(...args)),
  2326. bq: common_vendor.t($data.isEditing ? "保存修改" : "添加成员")
  2327. }) : {}, {
  2328. br: $data.currentStep === 5
  2329. }, $data.currentStep === 5 ? common_vendor.e({
  2330. bs: $data.educationList.length > 0
  2331. }, $data.educationList.length > 0 ? {
  2332. bt: common_vendor.f($data.educationList, (edu, index, i0) => {
  2333. return common_vendor.e({
  2334. a: common_vendor.t(index === 0 ? "第一学历" : "最高学历"),
  2335. b: common_vendor.o(($event) => $options.editEducation(index), index),
  2336. c: common_vendor.o(($event) => $options.deleteEducation(index), index)
  2337. }, $options.showEducationTimeField ? {
  2338. d: common_vendor.t(edu.startTime),
  2339. e: common_vendor.t(edu.endTime)
  2340. } : {}, $options.showEducationSchoolField ? {
  2341. f: common_vendor.t(edu.schoolName)
  2342. } : {}, $options.showEducationMajorField ? {
  2343. g: common_vendor.t(edu.major)
  2344. } : {}, $options.showEducationDegreeField ? {
  2345. h: common_vendor.t(edu.degree)
  2346. } : {}, {
  2347. i: index
  2348. });
  2349. }),
  2350. bv: $options.showEducationTimeField,
  2351. bw: $options.showEducationSchoolField,
  2352. bx: $options.showEducationMajorField,
  2353. by: $options.showEducationDegreeField
  2354. } : {}, {
  2355. bz: $data.educationList.length < 2 || $data.isEditingEducation
  2356. }, $data.educationList.length < 2 || $data.isEditingEducation ? common_vendor.e({
  2357. bA: common_vendor.t($data.isEditingEducation ? "编辑教育经历" : $data.educationList.length === 0 ? "添加第一学历" : "添加最高学历"),
  2358. bB: $data.isEditingEducation
  2359. }, $data.isEditingEducation ? {
  2360. bC: common_vendor.o((...args) => $options.cancelEditEducation && $options.cancelEditEducation(...args))
  2361. } : {}, {
  2362. bD: $options.showEducationTimeField
  2363. }, $options.showEducationTimeField ? common_vendor.e({
  2364. bE: common_vendor.t($data.educationForm.startTime || "开始时间"),
  2365. bF: $options.defaultEducationStartTime,
  2366. bG: common_vendor.o((...args) => $options.bindStartTimeChange && $options.bindStartTimeChange(...args)),
  2367. bH: $data.educationErrors.startTime ? 1 : "",
  2368. bI: common_vendor.t($data.educationForm.endTime || "结束时间"),
  2369. bJ: $options.defaultEducationEndTime,
  2370. bK: common_vendor.o((...args) => $options.bindEndTimeChange && $options.bindEndTimeChange(...args)),
  2371. bL: $data.educationErrors.endTime ? 1 : "",
  2372. bM: $data.educationErrors.startTime
  2373. }, $data.educationErrors.startTime ? {
  2374. bN: common_vendor.t($data.educationErrors.startTime)
  2375. } : {}, {
  2376. bO: $data.educationErrors.endTime
  2377. }, $data.educationErrors.endTime ? {
  2378. bP: common_vendor.t($data.educationErrors.endTime)
  2379. } : {}) : {}, {
  2380. bQ: $options.showEducationSchoolField
  2381. }, $options.showEducationSchoolField ? common_vendor.e({
  2382. bR: $data.educationErrors.schoolName ? 1 : "",
  2383. bS: $data.educationForm.schoolName,
  2384. bT: common_vendor.o(($event) => $data.educationForm.schoolName = $event.detail.value),
  2385. bU: $data.educationErrors.schoolName
  2386. }, $data.educationErrors.schoolName ? {
  2387. bV: common_vendor.t($data.educationErrors.schoolName)
  2388. } : {}) : {}, {
  2389. bW: $options.showEducationMajorField
  2390. }, $options.showEducationMajorField ? common_vendor.e({
  2391. bX: $data.educationErrors.major ? 1 : "",
  2392. bY: $data.educationForm.major,
  2393. bZ: common_vendor.o(($event) => $data.educationForm.major = $event.detail.value),
  2394. ca: $data.educationErrors.major
  2395. }, $data.educationErrors.major ? {
  2396. cb: common_vendor.t($data.educationErrors.major)
  2397. } : {}) : {}, {
  2398. cc: $options.showEducationDegreeField
  2399. }, $options.showEducationDegreeField ? common_vendor.e({
  2400. cd: common_vendor.t($data.degreeOptions[$data.degreeIndex] || "请选择学历"),
  2401. ce: common_vendor.o((...args) => $options.bindDegreeChange && $options.bindDegreeChange(...args)),
  2402. cf: $data.degreeIndex,
  2403. cg: $data.degreeOptions,
  2404. ch: $data.educationErrors.degree ? 1 : "",
  2405. ci: $data.educationErrors.degree
  2406. }, $data.educationErrors.degree ? {
  2407. cj: common_vendor.t($data.educationErrors.degree)
  2408. } : {}) : {}, {
  2409. ck: common_vendor.t($data.isEditingEducation ? "✓" : "+"),
  2410. cl: common_vendor.o((...args) => $options.saveEducation && $options.saveEducation(...args)),
  2411. cm: common_vendor.t($data.isEditingEducation ? "保存修改" : "添加学历")
  2412. }) : {}) : {}, {
  2413. cn: $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField)
  2414. }, $data.currentStep === 6 && ($options.showRequireTrainingInfoField || $options.showRequireProfessionalSkillsField) ? common_vendor.e({
  2415. co: $options.showRequireTrainingInfoField
  2416. }, $options.showRequireTrainingInfoField ? {} : {}, {
  2417. cp: $options.showRequireTrainingInfoField
  2418. }, $options.showRequireTrainingInfoField ? common_vendor.e({
  2419. cq: $data.formErrors.skills ? 1 : "",
  2420. cr: $data.formData.skills,
  2421. cs: common_vendor.o(($event) => $data.formData.skills = $event.detail.value),
  2422. ct: $data.formErrors.skills
  2423. }, $data.formErrors.skills ? {
  2424. cv: common_vendor.t($data.formErrors.skills)
  2425. } : {}) : {}, {
  2426. cw: $options.showRequireProfessionalSkillsField
  2427. }, $options.showRequireProfessionalSkillsField ? {} : {}, {
  2428. cx: $options.showRequireProfessionalSkillsField
  2429. }, $options.showRequireProfessionalSkillsField ? common_vendor.e({
  2430. cy: $data.formErrors.training ? 1 : "",
  2431. cz: $data.formData.training,
  2432. cA: common_vendor.o(($event) => $data.formData.training = $event.detail.value),
  2433. cB: $data.formErrors.training
  2434. }, $data.formErrors.training ? {
  2435. cC: common_vendor.t($data.formErrors.training)
  2436. } : {}) : {}) : {}, {
  2437. cD: $data.currentStep === 8
  2438. }, $data.currentStep === 8 ? common_vendor.e({
  2439. cE: $data.workList.length > 0
  2440. }, $data.workList.length > 0 ? {
  2441. cF: common_vendor.f($data.workList, (work, index, i0) => {
  2442. return common_vendor.e({
  2443. a: common_vendor.t(index + 1),
  2444. b: common_vendor.o(($event) => $options.editWork(index), index),
  2445. c: common_vendor.o(($event) => $options.deleteWork(index), index)
  2446. }, $options.showWorkTimeField ? {
  2447. d: common_vendor.t(work.startTime),
  2448. e: common_vendor.t(work.endTime)
  2449. } : {}, $options.showWorkCompanyField ? {
  2450. f: common_vendor.t(work.companyName)
  2451. } : {}, $options.showWorkDepartmentField ? {
  2452. g: common_vendor.t(work.department)
  2453. } : {}, $options.showWorkEmployeeCountField ? {
  2454. h: common_vendor.t(work.employeeCount)
  2455. } : {}, $options.showWorkPositionField ? {
  2456. i: common_vendor.t(work.position)
  2457. } : {}, $options.showWorkMonthlySalary ? {
  2458. j: common_vendor.t(work.monthlySalary)
  2459. } : {}, $options.showWorkSupervisor ? {
  2460. k: common_vendor.t(work.supervisor)
  2461. } : {}, $options.showWorkSupervisorPhone ? {
  2462. l: common_vendor.t(work.supervisorPhone)
  2463. } : {}, {
  2464. m: index
  2465. });
  2466. }),
  2467. cG: $options.showWorkTimeField,
  2468. cH: $options.showWorkCompanyField,
  2469. cI: $options.showWorkDepartmentField,
  2470. cJ: $options.showWorkEmployeeCountField,
  2471. cK: $options.showWorkPositionField,
  2472. cL: $options.showWorkMonthlySalary,
  2473. cM: $options.showWorkSupervisor,
  2474. cN: $options.showWorkSupervisorPhone
  2475. } : {}, {
  2476. cO: $data.workList.length < 2 || $data.isEditingWork
  2477. }, $data.workList.length < 2 || $data.isEditingWork ? common_vendor.e({
  2478. cP: common_vendor.t($data.isEditingWork ? "编辑工作经历" : "添加工作经历"),
  2479. cQ: $data.isEditingWork
  2480. }, $data.isEditingWork ? {
  2481. cR: common_vendor.o((...args) => $options.cancelEditWork && $options.cancelEditWork(...args))
  2482. } : {}, {
  2483. cS: $options.showWorkTimeField
  2484. }, $options.showWorkTimeField ? common_vendor.e({
  2485. cT: common_vendor.t($data.workForm.startTime || "开始时间"),
  2486. cU: $options.defaultWorkStartTime,
  2487. cV: common_vendor.o((...args) => $options.bindWorkStartTimeChange && $options.bindWorkStartTimeChange(...args)),
  2488. cW: $data.workErrors.startTime ? 1 : "",
  2489. cX: common_vendor.t($data.workForm.endTime || "结束时间"),
  2490. cY: $options.defaultWorkEndTime,
  2491. cZ: common_vendor.o((...args) => $options.bindWorkEndTimeChange && $options.bindWorkEndTimeChange(...args)),
  2492. da: $data.workErrors.endTime ? 1 : "",
  2493. db: $data.workErrors.startTime
  2494. }, $data.workErrors.startTime ? {
  2495. dc: common_vendor.t($data.workErrors.startTime)
  2496. } : {}, {
  2497. dd: $data.workErrors.endTime
  2498. }, $data.workErrors.endTime ? {
  2499. de: common_vendor.t($data.workErrors.endTime)
  2500. } : {}) : {}, {
  2501. df: $options.showWorkCompanyField
  2502. }, $options.showWorkCompanyField ? common_vendor.e({
  2503. dg: $data.workErrors.companyName ? 1 : "",
  2504. dh: $data.workForm.companyName,
  2505. di: common_vendor.o(($event) => $data.workForm.companyName = $event.detail.value),
  2506. dj: $data.workErrors.companyName
  2507. }, $data.workErrors.companyName ? {
  2508. dk: common_vendor.t($data.workErrors.companyName)
  2509. } : {}) : {}, {
  2510. dl: $options.showWorkEmployeeCountField
  2511. }, $options.showWorkEmployeeCountField ? common_vendor.e({
  2512. dm: $data.workErrors.employeeCount ? 1 : "",
  2513. dn: common_vendor.o((...args) => $options.validateEmployeeCount && $options.validateEmployeeCount(...args)),
  2514. dp: $data.workForm.employeeCount,
  2515. dq: common_vendor.o(($event) => $data.workForm.employeeCount = $event.detail.value),
  2516. dr: $data.workErrors.employeeCount
  2517. }, $data.workErrors.employeeCount ? {
  2518. ds: common_vendor.t($data.workErrors.employeeCount)
  2519. } : {}) : {}, {
  2520. dt: $options.showWorkDepartmentField
  2521. }, $options.showWorkDepartmentField ? common_vendor.e({
  2522. dv: $data.workErrors.department ? 1 : "",
  2523. dw: $data.workForm.department,
  2524. dx: common_vendor.o(($event) => $data.workForm.department = $event.detail.value),
  2525. dy: $data.workErrors.department
  2526. }, $data.workErrors.department ? {
  2527. dz: common_vendor.t($data.workErrors.department)
  2528. } : {}) : {}, {
  2529. dA: $options.showWorkPositionField
  2530. }, $options.showWorkPositionField ? common_vendor.e({
  2531. dB: $data.workErrors.position ? 1 : "",
  2532. dC: $data.workForm.position,
  2533. dD: common_vendor.o(($event) => $data.workForm.position = $event.detail.value),
  2534. dE: $data.workErrors.position
  2535. }, $data.workErrors.position ? {
  2536. dF: common_vendor.t($data.workErrors.position)
  2537. } : {}) : {}, {
  2538. dG: $options.showWorkMonthlySalary
  2539. }, $options.showWorkMonthlySalary ? common_vendor.e({
  2540. dH: $data.workErrors.monthlySalary ? 1 : "",
  2541. dI: common_vendor.o([($event) => $data.workForm.monthlySalary = $event.detail.value, (...args) => $options.validateMonthlySalary && $options.validateMonthlySalary(...args)]),
  2542. dJ: $data.workForm.monthlySalary,
  2543. dK: $data.workErrors.monthlySalary
  2544. }, $data.workErrors.monthlySalary ? {
  2545. dL: common_vendor.t($data.workErrors.monthlySalary)
  2546. } : {}) : {}, {
  2547. dM: $options.showWorkSupervisor
  2548. }, $options.showWorkSupervisor ? common_vendor.e({
  2549. dN: $data.workForm.supervisor,
  2550. dO: common_vendor.o(($event) => $data.workForm.supervisor = $event.detail.value),
  2551. dP: $data.workErrors.supervisor
  2552. }, $data.workErrors.supervisor ? {
  2553. dQ: common_vendor.t($data.workErrors.supervisor)
  2554. } : {}) : {}, {
  2555. dR: $options.showWorkSupervisorPhone
  2556. }, $options.showWorkSupervisorPhone ? common_vendor.e({
  2557. dS: common_vendor.o([($event) => $data.workForm.supervisorPhone = $event.detail.value, (...args) => $options.validatePhone && $options.validatePhone(...args)]),
  2558. dT: $data.workForm.supervisorPhone,
  2559. dU: $data.workErrors.supervisorPhone
  2560. }, $data.workErrors.supervisorPhone ? {
  2561. dV: common_vendor.t($data.workErrors.supervisorPhone)
  2562. } : {}) : {}, {
  2563. dW: common_vendor.t($data.isEditingWork ? "✓" : "+"),
  2564. dX: common_vendor.o((...args) => $options.saveWork && $options.saveWork(...args)),
  2565. dY: common_vendor.t($data.isEditingWork ? "保存修改" : "添加工作经历")
  2566. }) : {}) : {}, {
  2567. dZ: $options.showPrevButton
  2568. }, $options.showPrevButton ? {
  2569. ea: common_vendor.o((...args) => $options.prevStep && $options.prevStep(...args))
  2570. } : {}, {
  2571. eb: $options.showSubmitButton
  2572. }, $options.showSubmitButton ? {
  2573. ec: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args))
  2574. } : {
  2575. ed: common_vendor.o((...args) => $options.nextStep && $options.nextStep(...args))
  2576. });
  2577. }
  2578. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  2579. wx.createPage(MiniProgramPage);