wupengfei
2025-03-21 1bbd7061dac79cacf5513234a04cac8ba0be5c6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<template>
  <Category :category="industryList" @change="change" class="position-select-view">
    <CategoryPane :max="max" :categoryChild="categoryChild" :multiple="multiple" v-model="model">
    </CategoryPane>
  </Category>
</template>
 
<script setup lang="ts">
import { useAllSearchSettingList, useSearchSettingType } from '@12333/hooks';
import Category from './Category.vue';
import CategoryPane from './CategoryPane.vue';
import { reactive, computed, watch } from 'vue';
import { SearchType } from '@12333/constants';
 
defineOptions({
  name: 'PositionSelectView',
});
 
type Props = {
  multiple?: boolean;
  max?: number;
};
 
const props = withDefaults(defineProps<Props>(), {
  multiple: true,
});
 
const model = defineModel<string[]>();
 
const state = reactive({
  provinceIndex: 0,
});
 
const { allSearchSettingList: positionList } = useAllSearchSettingList({
  searchType: SearchType.Position,
});
const { searchSettingTypeList: industryList } = useSearchSettingType({
  searchType: SearchType.IndustryCategory,
});
 
const categoryChild = computed(() => {
  if (!industryList.value.length) {
    return [];
  }
  return positionList.value?.filter(
    (x) => x.parentName === industryList.value[state.provinceIndex].name
  );
});
 
const change = (index: number) => {
  state.provinceIndex = index;
};
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.position-select-view {
  .nut-category__cateList {
    height: 100%;
 
    & > .h5-div {
      height: 100%;
      overflow-y: auto;
    }
 
    .nut-category__cateList-scroll {
      height: 100%;
      width: auto;
    }
  }
 
  .nut-category-pane {
    height: 100%;
    overflow-y: auto;
    flex: 1;
    min-width: 0;
  }
}
</style>