|
@@ -0,0 +1,68 @@
|
|
|
+<template>
|
|
|
+ <div class="d-flex font-size-14">
|
|
|
+ <div v-for="val in items" :key="val.id" class="mr-5 cursor-pointer" :class="{'active': val.active}" @click="handleFirst(val)">{{ val.nameCn }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="mt-5 font-size-14">
|
|
|
+ <span
|
|
|
+ v-for="k in children"
|
|
|
+ :key="k.id"
|
|
|
+ class="d-inline-block mr-10 cursor-pointer color-666 mb-2"
|
|
|
+ :class="{'active': select.findIndex(e => e.id === k.id) !== -1}"
|
|
|
+ @click="handleSecond(k)"
|
|
|
+ >{{ k.nameCn }}</span>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+defineOptions({ name: 'search-screen-industry'})
|
|
|
+import { ref, watch } from 'vue'
|
|
|
+import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
+
|
|
|
+const emit = defineEmits(['select'])
|
|
|
+const props = defineProps({
|
|
|
+ selectData: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const items = ref([])
|
|
|
+const select = ref([])
|
|
|
+const children = ref([])
|
|
|
+getDict('positionTreeData', {}, 'positionTreeData').then(({ data }) => {
|
|
|
+ if (!data) return
|
|
|
+ items.value = data.map(e => {
|
|
|
+ e.active = false
|
|
|
+ return e
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => props.selectData,
|
|
|
+ (val) => {
|
|
|
+ select.value = val
|
|
|
+ },
|
|
|
+ { deep: true }
|
|
|
+)
|
|
|
+
|
|
|
+const handleFirst = (val) => {
|
|
|
+ items.value.forEach(e => e.active = false)
|
|
|
+ val.active = !val.active
|
|
|
+ children.value = val.children || []
|
|
|
+}
|
|
|
+
|
|
|
+const handleSecond = (val) => {
|
|
|
+ const index = select.value.findIndex(e => e.id === val.id)
|
|
|
+ if (index !== -1) {
|
|
|
+ select.value.splice(index, 1)
|
|
|
+ } else select.value.push(val)
|
|
|
+ emit('select', select.value)
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.active {
|
|
|
+ color: var(--v-primary-base);
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+</style>
|