From 04dd65b222c5a87341969c1f9fe1c50f91bdf494 Mon Sep 17 00:00:00 2001 From: hly <2783385703@qq.com> Date: Wed, 27 Aug 2025 10:47:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B7=A5=E7=A7=8D=E9=80=89=E6=8B=A9):=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E9=80=89=E5=B7=A5=E7=A7=8D=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在JobTypePicker组件中添加multiple属性以支持多选 - 修改onJobTypeConfirm方法处理多选和单选的不同情况 - 重构getJobTypeTextById方法以支持多选回显 - 新增findJobTypeById方法用于递归查找工种 - 更新首页副标题为动态配置项 --- pages/index/index.vue | 2 +- pages_order/work/addResume.vue | 49 ++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 3b8a64f..81bc2d0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -6,7 +6,7 @@ {{ configList.config_app_name }} - 专注特种行业首招 + {{ configList.home_sub_title }} diff --git a/pages_order/work/addResume.vue b/pages_order/work/addResume.vue index 4990252..f476d55 100644 --- a/pages_order/work/addResume.vue +++ b/pages_order/work/addResume.vue @@ -146,7 +146,7 @@ - + @@ -404,25 +404,52 @@ // 工种选择确认回调 onJobTypeConfirm(jobTypeResult) { // 显示工种文本给用户看 - this.selectedJobType = jobTypeResult.selectedJobType.name - // 传给后端的是ID - this.form.typeId = jobTypeResult.selectedId - this.form.typeId_dictText = jobTypeResult.selectedJobType.name + this.selectedJobType = jobTypeResult.fullJobType + // 传给后端的是ID或ID数组 + if (jobTypeResult.selectedIds && jobTypeResult.selectedIds.length > 0) { + // 多选模式,传ID数组的字符串形式 + this.form.typeId = jobTypeResult.selectedIds.join(',') + } else { + // 单选模式,传单个ID + this.form.typeId = jobTypeResult.selectedId + } + this.form.typeId_dictText = jobTypeResult.fullJobType }, // 根据ID获取工种文本(用于回显) - getJobTypeTextById(id) { - if (!id) return '' + getJobTypeTextById(idOrIds) { + if (!idOrIds) return '' + // 如果是多个ID(逗号分隔) + if (typeof idOrIds === 'string' && idOrIds.includes(',')) { + const ids = idOrIds.split(',') + const jobTypeTexts = [] + + ids.forEach(id => { + const jobType = this.findJobTypeById(id.trim()) + if (jobType) { + jobTypeTexts.push(jobType.name) + } + }) + + return jobTypeTexts.join(',') + } else { + // 单个ID + const jobType = this.findJobTypeById(idOrIds) + return jobType ? jobType.name : '' + } + }, + // 递归查找工种 + findJobTypeById(id) { // 在一级工种中查找 for (let jobType of this.jobTypeList) { if (jobType.id == id) { - return jobType.name + return jobType } } - // 如果没找到,返回空字符串 - // 实际项目中可能需要异步获取下级工种进行查找 - return '' + // 如果没找到,需要异步获取下级工种进行查找 + // 这里简化处理,实际项目中可能需要更复杂的缓存机制 + return null }, }, }