6 changed files with 128 additions and 1 deletions
@ -0,0 +1,101 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-05 09:26:54 |
||||
|
@ 备注: 搜索用部门 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { orgAndPeople } from "@/api/displayboardapi/types"; |
||||
|
import { getPeopleKey, getUserCont } from "@/api/hr/people/index"; |
||||
|
import { govthree } from "@/api/opk/opk/api"; |
||||
|
|
||||
|
const props = withDefaults( |
||||
|
defineProps<{ |
||||
|
modelValue: any; // 子表和弹性布局时时有传 |
||||
|
}>(), |
||||
|
{} |
||||
|
); |
||||
|
const emits = defineEmits(["update:modelValue"]); |
||||
|
const orgList = ref<orgAndPeople[]>(); |
||||
|
const orgLoading = ref(false); |
||||
|
const orgTree = { |
||||
|
label: "name", |
||||
|
children: "child", |
||||
|
}; |
||||
|
|
||||
|
const value = computed({ |
||||
|
get() { |
||||
|
console.log("行政组织-1--》", props.modelValue); |
||||
|
if ( |
||||
|
props.modelValue != "" && |
||||
|
props.modelValue != undefined && |
||||
|
props.modelValue != null |
||||
|
) { |
||||
|
return props.modelValue * 1; |
||||
|
} else { |
||||
|
return props.modelValue; |
||||
|
} |
||||
|
}, |
||||
|
set(newVal: any) { |
||||
|
emits("update:modelValue", newVal); |
||||
|
// updateModel(newVal) |
||||
|
return newVal; |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
orgLoading.value = true; |
||||
|
getUserCont() |
||||
|
.then((data: any) => { |
||||
|
let orgId = data.data.organization * 1; |
||||
|
let companyId = data.data.company * 1; |
||||
|
if (companyId == null || companyId == "" || companyId == "0" || companyId == 0) { |
||||
|
companyId = 309; |
||||
|
} |
||||
|
if (orgId == null || orgId == "" || orgId == "0" || orgId == 0) { |
||||
|
orgId = ""; |
||||
|
} |
||||
|
nextTick(() => { |
||||
|
govthree({ id: companyId, all: 1 }) |
||||
|
.then(({ data }) => { |
||||
|
orgList.value = data; |
||||
|
if ( |
||||
|
Number.isNaN(value.value) || |
||||
|
isNaN(value.value) || |
||||
|
value.value == null || |
||||
|
value.value == "" || |
||||
|
value.value == "0" || |
||||
|
value.value == 0 || |
||||
|
value.value == undefined |
||||
|
) { |
||||
|
nextTick(() => { |
||||
|
value.value = orgId; |
||||
|
console.log("行政组织---》", orgId, value.value); |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
orgLoading.value = false; |
||||
|
}); |
||||
|
}); |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
orgLoading.value = false; |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-tree-select |
||||
|
v-loading="orgLoading" |
||||
|
element-loading-text="Loading..." |
||||
|
v-model="value" |
||||
|
:data="orgList" |
||||
|
:props="orgTree" |
||||
|
:render-after-expand="false" |
||||
|
:filterable="true" |
||||
|
node-key="id" |
||||
|
clearable |
||||
|
check-strictly |
||||
|
style="width: 140px" |
||||
|
/> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
Loading…
Reference in new issue