-
+
-
+
{{ data.organizationalStructureName }}
@@ -36,7 +38,7 @@
-
+
@@ -53,12 +55,10 @@ import CompanyDetail from "@/components/organizationalStructure/CompanyDetail.vu
const queryType = reactive({
chooseName: ""
});
-const chooseId = ref(0);
const deptId = ref(0);
const companyId = ref(0);
const showDept = ref(false);
const showCompany = ref(false);
-const organizationStructureType = ref(0);
let selectItem = reactive({
type: -1,
value: "0"
@@ -67,16 +67,12 @@ const loading = ref(false);
const dataList = ref([]);
const tree = ref([]);
const selectNodeKey = ref("")
-const isSearch = ref(false);
const expandedKeys = ref([]);
const defaultProps = {
value: "value",
label: "organizationalStructureName",
children: "children",
isLeaf: (data) => {
- // if (data.isLeaf) {
- // return true
- // }
}
};
const emit = defineEmits();
@@ -90,39 +86,18 @@ const _value = computed({
}
});
-const getList = (flag, type) => {
- let params = {}
- if (flag === 1) {
- isSearch.value = true;
- params = {
- chooseId: 0,
- type: 0,
- chooseName: queryType.chooseName
- }
- selectItem = {
- type: -1,
- value: "0"
- };
- } else {
- params = {
- chooseId: chooseId.value,
- type: organizationStructureType.value,
- chooseName: queryType.chooseName
- }
+const getList = () => {
+ let params = {
+ chooseId: 0,
+ type: 0,
+ chooseName: queryType.chooseName
}
+ selectItem = {
+ type: -1,
+ value: "0"
+ };
getOrganizationStructure(params).then(res => {
- if (selectItem.type === -1) {
- dataList.value = res.data;
- } else if (type === 2) {
- selectItem.children = [...res.data]
- if (res.data.length === 0) {
- selectItem.isLeaf = true
- // selectItem.children = [{
- // type: 2
- // }
- }
- }
- console.log(selectItem.children,"selectItem.children")
+ dataList.value = res.data;
});
};
const init = () => {
@@ -131,11 +106,30 @@ const init = () => {
value: "0"
};
dataList.value = [];
- chooseId.value = 0;
expandedKeys.value = [];
queryType.chooseName = ""
- getList();
};
+
+async function handleLoad(node, resolve, reject) {
+ let data = node.data
+ let params
+ if (data.organizationalStructureId) {
+ params = {
+ chooseId: data.organizationalStructureId,
+ type: data.type
+ }
+ } else {
+ params = {
+ chooseId: 0,
+ type: 0,
+ }
+ }
+ let result = await getOrganizationStructure(params).then(res => {
+ return res.data
+ })
+ resolve(result)
+}
+
const handleClick = (item, data) => {
selectNodeKey.value = item.value
if (item.type === 1) {
@@ -145,41 +139,25 @@ const handleClick = (item, data) => {
showDept.value = true
})
deptId.value = item.organizationalStructureId
- }else{
+ } else {
showDept.value = false
showCompany.value = false
nextTick(() => {
showCompany.value = true
})
- companyId.value=item.organizationalStructureId
+ companyId.value = item.organizationalStructureId
}
selectItem = item;
- if (isSearch.value) {
- queryType.chooseName = ""
- chooseId.value = item.organizationalStructureId;
- getList('', 2);
- return;
- } else {
- //渲染子节点用户或部门及用户数据
- if (data.expanded) {
- if (expandedKeys.value.indexOf(item.value) === -1) {
- expandedKeys.value.push(item.value);
- organizationStructureType.value = item.type
- chooseId.value = item.organizationalStructureId;
- getList('', 2);
- return;
- }
- }
- }
};
init()