qa-prevention-xgf-app/components/department/department.vue

78 lines
1.6 KiB
Vue
Raw Permalink Normal View History

2025-05-23 14:37:33 +08:00
<template>
<next-tree
ref="nextTreeRef"
check-strictly
func-mode="radio"
select-parent
:if-search="false"
:tree-data="treeData"
:is-show-clear="isShowClear"
theme-color="#3377ff"
page-height="92vh"
2025-07-21 15:32:28 +08:00
label-key="name"
value-key="departmentId"
children-key="list"
2025-05-23 14:37:33 +08:00
@confirm="fnTreeConfirm"
2025-07-19 10:03:05 +08:00
@cancel="$emit('update:visible', false)"
2025-05-23 14:37:33 +08:00
/>
</template>
<script>
2025-07-21 15:32:28 +08:00
import {getTree} from "@/api";
2025-05-23 14:37:33 +08:00
export default {
props: {
visible: {
type: Boolean,
required: true,
},
value: {
type: String,
default: "",
},
isShowClear: {
type: Boolean,
default: false,
},
2025-07-21 15:32:28 +08:00
type:{
type: String,
default: "2",
},
corpId:{
type: String,
default: "",
}
2025-05-23 14:37:33 +08:00
},
data() {
return {
treeData: []
}
},
async mounted() {
await this.fnGetData();
this.$watch("visible", (newVal) => {
if (newVal) {
this.$refs.nextTreeRef && this.$refs.nextTreeRef._show();
this.$refs.nextTreeRef && this.$refs.nextTreeRef.checkedFunc(this.value);
} else this.$refs.nextTreeRef && this.$refs.nextTreeRef._hide();
}, {immediate: true})
},
methods: {
fnTreeConfirm(event) {
this.$emit("confirm", event);
this.$emit("update:visible", false);
},
async fnGetData() {
2025-07-21 15:32:28 +08:00
const resData = await getTree({
2025-05-23 14:37:33 +08:00
loading: false,
2025-07-21 15:32:28 +08:00
getDepByCorpType:1,
corpTypeList:[0,2]
2025-05-23 14:37:33 +08:00
});
2025-07-21 15:32:28 +08:00
this.treeData = resData.deptTree ;
2025-05-23 14:37:33 +08:00
}
},
}
</script>
<style scoped lang="scss"></style>