|
@@ -10,7 +10,20 @@
|
|
|
@close="close"
|
|
|
>
|
|
|
<template #left>
|
|
|
- <OrganizationalTree @select="handleSelect" />
|
|
|
+ <OrganizationalTree v-if="userType !== 3" @select="handleSelect" />
|
|
|
+ <div v-else style="overflow-y: scroll">
|
|
|
+ <BasicTree
|
|
|
+ expandOnSearch
|
|
|
+ :expanded-keys="treeExpandedKeys"
|
|
|
+ :auto-expand-parent="autoExpandParent"
|
|
|
+ @expand="onExpand"
|
|
|
+ title="班级列表"
|
|
|
+ :fieldNames="{ title: 'name', key: 'id' }"
|
|
|
+ search
|
|
|
+ :treeData="treeData"
|
|
|
+ @select="handleTreeSelect"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<!-- 已选 -->
|
|
|
<Selected
|
|
@@ -28,7 +41,7 @@
|
|
|
<div class="list-page-box" v-if="data.visible && data.list.length > 0">
|
|
|
<UserCard
|
|
|
:class="data.selectedIds.includes(item.id) ? 'picked' : 'not-picked'"
|
|
|
- :disabled="props.disabledIds && props.disabledIds.includes(item.id) ? true : false"
|
|
|
+ :disabled="props.disabledIds && props.disabledIds.includes(item.id)"
|
|
|
v-for="(item, index) in data.list"
|
|
|
:key="index"
|
|
|
:item="item"
|
|
@@ -62,10 +75,11 @@
|
|
|
import { UserInfo } from '/@/api/system/user/model';
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
- import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import { getStudentmanagerMajorGradeClassTree } from '/@/services/apis/StudentManagerController';
|
|
|
+ import BasicTree from '/@/components/Tree/src/Tree.vue';
|
|
|
const { t } = useI18n();
|
|
|
- const defaultSelectName = ref('');
|
|
|
-
|
|
|
+ const treeExpandedKeys = ref<any[]>([]);
|
|
|
+ const autoExpandParent = ref(true);
|
|
|
const emits = defineEmits(['change', 'changeNames', 'close']);
|
|
|
const props = withDefaults(
|
|
|
defineProps<{
|
|
@@ -73,7 +87,7 @@
|
|
|
disabledIds?: Array<string>;
|
|
|
multiple?: Boolean;
|
|
|
visible?: Boolean;
|
|
|
- userType?: string;
|
|
|
+ userType?: Number;
|
|
|
}>(),
|
|
|
{
|
|
|
selectedIds: () => {
|
|
@@ -84,6 +98,7 @@
|
|
|
},
|
|
|
},
|
|
|
);
|
|
|
+ const treeData = ref<any[]>([]);
|
|
|
let data: {
|
|
|
visible: boolean;
|
|
|
multiSelect: boolean;
|
|
@@ -94,6 +109,7 @@
|
|
|
searchConfig: {
|
|
|
keyword: string;
|
|
|
deptId: string;
|
|
|
+ classId: string;
|
|
|
};
|
|
|
} = reactive({
|
|
|
visible: false,
|
|
@@ -113,11 +129,14 @@
|
|
|
});
|
|
|
|
|
|
const paramRef = computed(() => {
|
|
|
+ console.log(data.searchConfig);
|
|
|
+
|
|
|
return {
|
|
|
limit: data.page.current,
|
|
|
size: data.page.pageSize,
|
|
|
departmentId: data.searchConfig.deptId,
|
|
|
keyword: data.searchConfig.keyword,
|
|
|
+ classId: data.searchConfig.classId,
|
|
|
userType: props.userType,
|
|
|
};
|
|
|
});
|
|
@@ -129,12 +148,36 @@
|
|
|
},
|
|
|
);
|
|
|
|
|
|
- onMounted(() => {
|
|
|
+ onMounted(async () => {
|
|
|
if (props.selectedIds && Array.isArray(props.selectedIds)) {
|
|
|
data.selectedIds = cloneDeep(props.selectedIds);
|
|
|
- getSelectedList();
|
|
|
+ await getSelectedList();
|
|
|
+ }
|
|
|
+ if (props.userType === 3) {
|
|
|
+ treeData.value = await getStudentmanagerMajorGradeClassTree({});
|
|
|
+ console.log(treeData.value);
|
|
|
}
|
|
|
});
|
|
|
+ const onExpand = (keys: string[]) => {
|
|
|
+ treeExpandedKeys.value = keys;
|
|
|
+ autoExpandParent.value = false;
|
|
|
+ };
|
|
|
+ function handleTreeSelect(e, { node }) {
|
|
|
+ console.log(node);
|
|
|
+ if (node.treeType !== 4) {
|
|
|
+ treeExpandedKeys.value = e;
|
|
|
+ autoExpandParent.value = true;
|
|
|
+ if (node.expanded) {
|
|
|
+ console.log(node);
|
|
|
+ treeExpandedKeys.value = [node.parentId];
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ data.page.current = 1;
|
|
|
+ data.searchConfig.classId = e[0];
|
|
|
+ data.searchConfig.keyword = '';
|
|
|
+ getList();
|
|
|
+ }
|
|
|
async function show() {
|
|
|
data.selectedIds = [];
|
|
|
data.selectedList = [];
|
|
@@ -233,7 +276,11 @@
|
|
|
}
|
|
|
function handleSelect(deptId = '') {
|
|
|
data.page.current = 1;
|
|
|
- data.searchConfig.deptId = deptId;
|
|
|
+ if (props.userType === 3) {
|
|
|
+ data.searchConfig.classId = deptId[0];
|
|
|
+ } else {
|
|
|
+ data.searchConfig.deptId = deptId;
|
|
|
+ }
|
|
|
data.searchConfig.keyword = '';
|
|
|
getList();
|
|
|
}
|