From 591a3742e98ad926c88059b8fe8eabd3a8630c25 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期四, 13 二月 2025 13:59:10 +0800 Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobMiniApp --- packages/components/src/AreaTreeSelect/PositionSelectView.vue | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/packages/components/src/AreaTreeSelect/PositionSelectView.vue b/packages/components/src/AreaTreeSelect/PositionSelectView.vue new file mode 100644 index 0000000..048754e --- /dev/null +++ b/packages/components/src/AreaTreeSelect/PositionSelectView.vue @@ -0,0 +1,78 @@ +<template> + <Category :category="provinceList" @change="change" class="position-select-view"> + <CategoryPane :max="max" :categoryChild="categoryChild" :multiple="multiple" v-model="model"> + </CategoryPane> + </Category> +</template> + +<script setup lang="ts"> +import { useAllAreaList } from '@12333/hooks'; +import Category from './Category.vue'; +import CategoryPane from './CategoryPane.vue'; +import { reactive, computed, watch } from 'vue'; + +defineOptions({ + name: 'PositionSelectView', +}); + +type Props = { + multiple?: boolean; + max?: number; +}; + +const props = withDefaults(defineProps<Props>(), { + multiple: true, +}); + +const model = defineModel<number[]>(); + +const state = reactive({ + provinceIndex: 0, +}); + +const { areaTreeList } = useAllAreaList(); + +const provinceList = computed(() => areaTreeList.value.map((x) => ({ ...x, name: x.areaName }))); + +const categoryChild = computed(() => { + if (!provinceList.value.length) { + return []; + } + return provinceList.value[state.provinceIndex].children.map((x) => ({ + ...x, + name: x.areaName, + value: x.areaCode, + })); +}); + +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> -- Gitblit v1.9.1