Browse Source

feat(工种选择): 支持多选工种并优化相关逻辑

- 在JobTypePicker组件中添加multiple属性以支持多选
- 修改onJobTypeConfirm方法处理多选和单选的不同情况
- 重构getJobTypeTextById方法以支持多选回显
- 新增findJobTypeById方法用于递归查找工种
- 更新首页副标题为动态配置项
master
前端-胡立永 2 weeks ago
parent
commit
04dd65b222
2 changed files with 39 additions and 12 deletions
  1. +1
    -1
      pages/index/index.vue
  2. +38
    -11
      pages_order/work/addResume.vue

+ 1
- 1
pages/index/index.vue View File

@ -6,7 +6,7 @@
<view class="title">
{{ configList.config_app_name }}
<text>专注特种行业首招</text>
<text>{{ configList.home_sub_title }}</text>
</view>
<view class="top">


+ 38
- 11
pages_order/work/addResume.vue View File

@ -146,7 +146,7 @@
<AddressPicker ref="addressPicker" :multiple="true" :showSelectWholeCity="true" :onlyCity="false" @confirm="onAddressConfirm" />
<!-- 工种选择组件 -->
<JobTypePicker ref="jobTypePicker" @confirm="onJobTypeConfirm" />
<JobTypePicker ref="jobTypePicker" :multiple="true" @confirm="onJobTypeConfirm" />
</view>
</template>
@ -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
// IDID
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
},
},
}


Loading…
Cancel
Save