You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.8 KiB
86 lines
1.8 KiB
|
1 year ago
|
<!--
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2024-09-12 10:03:22
|
||
|
|
@ 备注: 行政组织选择
|
||
|
|
-->
|
||
|
|
<script lang='ts' setup>
|
||
|
|
import { orgInfo } from '@/api/hr/org/type'
|
||
|
|
import { getOrgTreeList } from '@/api/hr/org/index'
|
||
|
|
|
||
|
|
const props = withDefaults(
|
||
|
|
defineProps<{
|
||
|
|
modelValue?: string
|
||
|
|
disabled?: boolean
|
||
|
|
}>(),
|
||
|
|
{}
|
||
|
|
)
|
||
|
|
const emits = defineEmits<{
|
||
|
|
(e: 'update:modelValue', value: string): void
|
||
|
|
}>()
|
||
|
|
const value = computed({
|
||
|
|
get: () => {
|
||
|
|
return props.modelValue*1
|
||
|
|
},
|
||
|
|
set: (newVal: any) => {
|
||
|
|
emits('update:modelValue', newVal)
|
||
|
|
// let newValJson:criteriaForPeopleList[] = JSON.parse(newVal)
|
||
|
|
// if(newValJson.length > 0){
|
||
|
|
// let userAry = new Array
|
||
|
|
// let userKeyAry = new Array
|
||
|
|
// newValJson.forEach(item =>{
|
||
|
|
// userAry.push(item.name+"("+item.number+")")
|
||
|
|
// userKeyAry.push(item.userkey.toString())
|
||
|
|
// })
|
||
|
|
// emits('update:modelValue', userAry.join(','))
|
||
|
|
// // userlist.value = userAry.join(',')
|
||
|
|
// //
|
||
|
|
// }else{
|
||
|
|
// emits('update:modelValue', "")
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
});
|
||
|
|
const orgTreeList = ref<orgInfo[]>();
|
||
|
|
const orgTreeLoading = ref(false); //加载行政组织树
|
||
|
|
const orgTreeProps ={
|
||
|
|
children: 'child',
|
||
|
|
label: 'name',
|
||
|
|
} //行政组织树对照值
|
||
|
|
|
||
|
|
function haveOrgTreeInfo(){
|
||
|
|
orgTreeLoading.value = true;
|
||
|
|
getOrgTreeList({})
|
||
|
|
.then(({ data })=>{
|
||
|
|
orgTreeList.value = data
|
||
|
|
}).finally(()=>{orgTreeLoading.value = false;})
|
||
|
|
}
|
||
|
|
|
||
|
|
onBeforeMount(() => {
|
||
|
|
haveOrgTreeInfo();
|
||
|
|
})
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
onMounted(() => {
|
||
|
|
// console.log("value---1--》",value.value,props.modelValue)
|
||
|
|
nextTick(() => {})
|
||
|
|
})
|
||
|
|
</script>
|
||
|
|
<template>
|
||
|
|
<el-tree-select
|
||
|
|
v-bind="$props"
|
||
|
|
v-model="value"
|
||
|
|
v-loading="orgTreeLoading"
|
||
|
|
node-key="id"
|
||
|
|
:props="orgTreeProps"
|
||
|
|
:data="orgTreeList"
|
||
|
|
check-strictly
|
||
|
|
:render-after-expand="false"
|
||
|
|
/>
|
||
|
|
</template>
|
||
|
|
<style lang='scss' scoped>
|
||
|
|
|
||
|
|
</style>
|