---项目经理 和 组织树异步加载

This commit is contained in:
yuping
2022-12-29 18:58:49 +08:00
parent 5d18b7061b
commit daf8d29570
2 changed files with 60 additions and 24 deletions

View File

@@ -28,7 +28,7 @@
<a-form-item label="姓名">
<a-input
v-model:value="nameSearch.keyword"
style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
@change="peopleName"
@@ -67,6 +67,8 @@
allow-clear
tree-default-expand-all
:tree-data="treeData"
:loading="orgLoading"
:load-data="onLoadData"
v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys"
:fieldNames="{
@@ -393,12 +395,10 @@
</template>
<script setup>
import {computed, defineEmits, defineProps, ref, watch} from "vue";
import {useStore} from "vuex";
import {useBoeApiPage} from "@/api/request";
import {AUDIENCE_LIST, USER_LIST} from "@/api/ThirdApi";
import {request, useBoeApi, useBoeApiPage} from "@/api/request";
import {AUDIENCE_LIST, ORG_CHILD_LIST, ORG_LIST, USER_LIST} from "@/api/ThirdApi";
import {saveStu} from "@/api/index1";
const store = useStore();
const emit = defineEmits({});
const props = defineProps({
type: Number,
@@ -457,7 +457,14 @@ const {
// const {
// data: orgData,
// fetch: searchOrg,
// } = useBoeApi(ORG_LIST, searchOrgName.value)
// } = useBoeApiPage(ORG_LIST, searchOrgName.value)
const {
data: treeData,
loading: orgLoading,
} = useBoeApi(ORG_LIST, {keyword: ''}, {
init: true,
result: (res) => res.result.map(e => ({...e,isLeaf:false})),
})
const {
data: audiData,
fetch: searchAudi,
@@ -578,9 +585,13 @@ const closeDrawer = () => {
visiable.value = false;
stuData.value = [];
nameSearch.value.keyword = "";
};
function onLoadData(treeNode){
return request(ORG_CHILD_LIST, {keyword:'',orgId:treeNode.id}).then(r => {
treeNode.dataRef.treeChildList = r.result.directChildList
treeData.value = [...treeData.value]
})
}
const closeChangeModal = () => {
stageVisible.value = false;
};
@@ -588,9 +599,9 @@ const openDrawer = () => {
visiable.value = true;
};
//获取组织树
const treeData = computed(() => {
return store.state.orgtreeList ? store.state.orgtreeList : [];
});
// const treeData = computed(() => {
// return store.state.orgtreeList ? store.state.orgtreeList : [];
// });
function onSearchStu() {
nameSearch.value.page = 1;
@@ -654,6 +665,7 @@ const auditChangePagination = (page) => {
audienceName.value.page = page;
searchAudi();
};
//重置
function peopleName(name) {
console.log('people-name', name.target.value)