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

71 lines
1.5 KiB
Vue
Raw 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-19 10:03:05 +08:00
label-key="DEPARTMENT_NAME"
value-key="DEPARTMENT_ID"
children-key="nodes"
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>
import {getDepartmentTree} from "@/api";
export default {
props: {
visible: {
type: Boolean,
required: true,
},
value: {
type: String,
default: "",
},
isShowClear: {
type: Boolean,
default: false,
},
},
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() {
const resData = await getDepartmentTree({
loading: false,
2025-07-19 10:03:05 +08:00
// postMethod: 'application/json',
TYPE:'2',
CORP_ID:this.$store.getters.getUserInfo.CORPINFO_ID,
2025-05-23 14:37:33 +08:00
});
2025-07-19 10:03:05 +08:00
this.treeData = resData.tree.tree;
2025-05-23 14:37:33 +08:00
}
},
}
</script>
<style scoped lang="scss"></style>