<script setup>
import { listDept } from '@/api/system/dept'
const props = defineProps({
    modelValue: {
        type: [String, Number],
        default: ''
    }
});

const { proxy } = getCurrentInstance()
const emit = defineEmits(['update:modelValue']);
const model = computed({
    get() {
        return props.modelValue;
    },
    set(val) {
        emit('update:modelValue', val);
    }
});
const departmentList = ref([]);
function getDepartmentListFun() {
    listDept().then((response) => {
        departmentList.value = proxy.handleTree(response.data, "deptId")
    });
}
getDepartmentListFun();
</script>

<template>
    <el-cascader :options="departmentList" style="width: 100%;" v-model="model" :props="{
        children: 'children',
        label: 'deptName',
        value: 'deptId'
    }" @change="(val) => {
        console.log('111', val);

    }" placeholder="请选择所属部门" />
</template>