mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 08:57:24 +08:00
handle duplicate static combine conditions
This commit is contained in:
@@ -125,8 +125,26 @@ export function checkAnyCombineBossRecommendFilterHasCondition(value) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatStaticCombineFilters(staticCombineRecommendJobFilterConditions) {
|
export function getStaticCombineFilterKey(condition) {
|
||||||
const result = staticCombineRecommendJobFilterConditions.map((condition) => {
|
const kAsO = {}
|
||||||
|
for (const key of Object.keys(condition ?? []).sort()) {
|
||||||
|
if (condition[key] === null || condition[key] === undefined) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
kAsO[key] = condition[key]
|
||||||
|
}
|
||||||
|
return JSON.stringify(kAsO)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatStaticCombineFilters(rawStaticCombineRecommendJobFilterConditions) {
|
||||||
|
rawStaticCombineRecommendJobFilterConditions = JSON.parse(JSON.stringify(rawStaticCombineRecommendJobFilterConditions))
|
||||||
|
const map = new Map()
|
||||||
|
for (const condition of rawStaticCombineRecommendJobFilterConditions ?? []) {
|
||||||
|
const key = getStaticCombineFilterKey(condition)
|
||||||
|
map.set(key, condition)
|
||||||
|
}
|
||||||
|
const conditions = Array.from(map.values())
|
||||||
|
const result = conditions.map((condition) => {
|
||||||
return {
|
return {
|
||||||
salaryList: condition.salary ? [condition.salary] : [],
|
salaryList: condition.salary ? [condition.salary] : [],
|
||||||
experienceList: condition.experience ? [condition.experience] : [],
|
experienceList: condition.experience ? [condition.experience] : [],
|
||||||
|
|||||||
@@ -4,7 +4,22 @@
|
|||||||
>添加条件</el-button
|
>添加条件</el-button
|
||||||
>
|
>
|
||||||
<div class="job-combo-filter" mt-8px>
|
<div class="job-combo-filter" mt-8px>
|
||||||
<el-table size="small" :data="props.modelValue" border :style="{ maxWidth: '100%' }">
|
<el-table
|
||||||
|
size="small"
|
||||||
|
:data="props.modelValue"
|
||||||
|
border
|
||||||
|
:style="{ maxWidth: '100%' }"
|
||||||
|
:row-style="
|
||||||
|
({ row }) => {
|
||||||
|
return {
|
||||||
|
backgroundColor:
|
||||||
|
duplicatedMap.get(getStaticCombineFilterKey(row))?.length > 1
|
||||||
|
? '#fcd4b7'
|
||||||
|
: 'transparent'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div lh-1.5em>
|
<div lh-1.5em>
|
||||||
列表中没有条件,将仅使用默认的“初始空条件”为您筛选职位<br />
|
列表中没有条件,将仅使用默认的“初始空条件”为您筛选职位<br />
|
||||||
@@ -149,6 +164,17 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
Array.from(duplicatedMap.values()).some((it) => {
|
||||||
|
return it.length > 1
|
||||||
|
})
|
||||||
|
"
|
||||||
|
color-orange
|
||||||
|
font-size-12px
|
||||||
|
>
|
||||||
|
列表中被橙色高亮的条件存在重复项,相关重复项将被合并,运行时遍历顺序以第一次出现为准
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -156,7 +182,9 @@
|
|||||||
import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-conditions-20241002.json'
|
import conditions from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-conditions-20241002.json'
|
||||||
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
import industryFilterExemption from '@geekgeekrun/geek-auto-start-chat-with-boss/internal-config/job-filter-industry-filter-exemption-20241002.json'
|
||||||
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
import { ArrowUp, ArrowDown, Delete, Plus } from '@element-plus/icons-vue'
|
||||||
import { PropType } from 'vue'
|
import { computed, PropType } from 'vue'
|
||||||
|
|
||||||
|
import { getStaticCombineFilterKey } from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@@ -210,6 +238,18 @@ function removeCondition(index) {
|
|||||||
props.modelValue?.splice(index, 1)
|
props.modelValue?.splice(index, 1)
|
||||||
// gtagRenderer('resume_work_exp_removed')
|
// gtagRenderer('resume_work_exp_removed')
|
||||||
}
|
}
|
||||||
|
const duplicatedMap = computed(() => {
|
||||||
|
const map = new Map()
|
||||||
|
for (const condition of props.modelValue ?? []) {
|
||||||
|
const key = getStaticCombineFilterKey(condition)
|
||||||
|
if (!map.has(key)) {
|
||||||
|
map.set(key, [])
|
||||||
|
}
|
||||||
|
const arr = map.get(key)
|
||||||
|
arr.push(condition)
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -961,7 +961,8 @@ import StaticCombineBossRecommendFilter from '@renderer/features/StaticCombineBo
|
|||||||
import { activeDescList } from '@geekgeekrun/geek-auto-start-chat-with-boss/constant.mjs'
|
import { activeDescList } from '@geekgeekrun/geek-auto-start-chat-with-boss/constant.mjs'
|
||||||
import {
|
import {
|
||||||
calculateTotalCombinations,
|
calculateTotalCombinations,
|
||||||
checkAnyCombineBossRecommendFilterHasCondition
|
checkAnyCombineBossRecommendFilterHasCondition,
|
||||||
|
formatStaticCombineFilters
|
||||||
} from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
} from '@geekgeekrun/geek-auto-start-chat-with-boss/combineCalculator.mjs'
|
||||||
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
import { gtagRenderer as baseGtagRenderer } from '@renderer/utils/gtag'
|
||||||
import defaultTargetCompanyListConf from '@geekgeekrun/geek-auto-start-chat-with-boss/default-config-file/target-company-list.json'
|
import defaultTargetCompanyListConf from '@geekgeekrun/geek-auto-start-chat-with-boss/default-config-file/target-company-list.json'
|
||||||
@@ -1039,11 +1040,12 @@ const currentAnyCombineRecommendJobFilterCombinationCount = computed(() => {
|
|||||||
if (
|
if (
|
||||||
formContent.value.combineRecommendJobFilterType === CombineRecommendJobFilterType.STATIC_COMBINE
|
formContent.value.combineRecommendJobFilterType === CombineRecommendJobFilterType.STATIC_COMBINE
|
||||||
) {
|
) {
|
||||||
const count = formContent.value.staticCombineRecommendJobFilterConditions.length
|
if (!formContent.value.staticCombineRecommendJobFilterConditions?.length) {
|
||||||
if (!count) {
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return count
|
return formatStaticCombineFilters(
|
||||||
|
formContent.value.staticCombineRecommendJobFilterConditions
|
||||||
|
)?.filter(Boolean).length
|
||||||
}
|
}
|
||||||
return calculateTotalCombinations(
|
return calculateTotalCombinations(
|
||||||
formContent.value.anyCombineRecommendJobFilter,
|
formContent.value.anyCombineRecommendJobFilter,
|
||||||
|
|||||||
Reference in New Issue
Block a user