--fix 选择组织

This commit is contained in:
yuping
2023-01-30 13:20:12 +08:00
parent aee5aa2299
commit 119db319f0

View File

@@ -11,7 +11,7 @@
<div class="drawerMain" id="ProjCheckship" style=""> <div class="drawerMain" id="ProjCheckship" style="">
<div class="header"> <div class="header">
<div class="headerTitle"> <div class="headerTitle">
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || "" }} {{ {1: "添加学员", 2: "添加学员", 3: "添加学员"}[type] || "" }}
</div> </div>
<img <img
style="width: 29px; height: 29px; cursor: pointer" style="width: 29px; height: 29px; cursor: pointer"
@@ -38,7 +38,7 @@
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
> >
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined/>
</template> </template>
搜索 搜索
</a-button> </a-button>
@@ -99,7 +99,7 @@
</div> </div>
</div> </div>
</a-tab-pane> </a-tab-pane>
<!-- <a-tab-pane :key="2" tab="添加组织"> <a-tab-pane :key="2" tab="添加组织">
<div :style="{ height: screenHeight - 235 + 'px' }"> <div :style="{ height: screenHeight - 235 + 'px' }">
<div class="tab2"> <div class="tab2">
<a-form-item label="组织:"> <a-form-item label="组织:">
@@ -114,21 +114,24 @@
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
> >
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined/>
</template> </template>
搜索 搜索
</a-button> </a-button>
<a-button <a-button
@click="resetOrg" @click="resetOrg"
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
>重置</a-button >重置
</a-button
> >
</a-form-item> </a-form-item>
</div> </div>
<div class="boeTree"> <div class="boeTree">
<a-tree <a-tree
:tree-data="searchOrgName.keyword ? orgData : treeData" :tree-data="searchOrgName.keyword ? orgData : treeOrgData"
@select="onOrgSelectChange" @select="onOrgSelectChange"
:loading="orgOrgLoading"
:load-data="onLoadOrgData"
:fieldNames="{ :fieldNames="{
children: 'treeChildList', children: 'treeChildList',
key: 'id', key: 'id',
@@ -142,7 +145,7 @@
</a-tree> </a-tree>
</div> </div>
</div> </div>
</a-tab-pane> --> </a-tab-pane>
<a-tab-pane :key="3" tab="受众关联"> <a-tab-pane :key="3" tab="受众关联">
<div :style="{ height: screenHeight - 235 + 'px' }"> <div :style="{ height: screenHeight - 235 + 'px' }">
<div> <div>
@@ -158,7 +161,7 @@
style="margin-left: 20px; border-radius: 4px" style="margin-left: 20px; border-radius: 4px"
> >
<template #icon> <template #icon>
<SearchOutlined /> <SearchOutlined/>
</template> </template>
搜索 搜索
</a-button> </a-button>
@@ -224,28 +227,31 @@
> >
<div @click="person = !person" class="sw">收起&lt;</div> <div @click="person = !person" class="sw">收起&lt;</div>
</div> </div>
<!--组织--> <div class="dept">添加组织</div>
<!-- <div class="dept">添加组织</div>--> <div v-for="(item,i) in selectsData.deptList">
<!-- <div v-for="(item,i) in selectsData.deptList" >--> <div v-if="i<11">
<!-- <div v-if="i<11">--> <div class="chose1">
<!-- <div class="chose1">--> <div class="span"> {{ item.name }}</div>
<!-- <div class="span"> {{ item.name }}</div>--> <div class="ch1" @click="orgDel(i)"></div>
<!-- <div class="ch1" @click="orgDel(i)"></div>--> </div>
<!-- </div>--> </div>
<!-- </div>--> <div v-else>
<!-- <div v-else> --> <div v-if="dept">
<!-- <div v-if ="dept">--> <div class="chose1">
<!-- <div class="chose1">--> <div class="span"> {{ item.name }}</div>
<!-- <div class="span"> {{ item.name }}</div>--> <div class="ch1" @click="orgDel(i)"></div>
<!-- <div class="ch1" @click="orgDel(i)"></div>--> </div>
<!-- </div>--> </div>
<!-- </div>-->
<!-- --> </div>
<!-- </div>-->
<!-- --> </div>
<!-- </div>--> <div v-if="!dept && selectsData.deptList.length >10" class="ifsw">
<!-- <div v-if="!dept && selectsData.deptList.length >10" class="ifsw"><div @click="dept = !dept" class=sw>查看更多></div></div>--> <div @click="dept = !dept" class=sw>查看更多></div>
<!-- <div v-if="dept && selectsData.deptList.length >10" class="ifsw" ><div @click="dept = !dept" class="sw"> 收起&lt; </div></div>--> </div>
<div v-if="dept && selectsData.deptList.length >10" class="ifsw">
<div @click="dept = !dept" class="sw"> 收起&lt;</div>
</div>
<!--受众--> <!--受众-->
<div class="group">受众关联</div> <div class="group">受众关联</div>
<div v-for="(item, i) in selectsData.groupList"> <div v-for="(item, i) in selectsData.groupList">
@@ -375,7 +381,7 @@
</a-select> </a-select>
</div> </div>
<span style="color: #999999; margin-left: 10px" <span style="color: #999999; margin-left: 10px"
><minus-circle-outlined />已在其他关卡的学员不会被添加到该关卡</span ><minus-circle-outlined/>已在其他关卡的学员不会被添加到该关卡</span
> >
<div class="btn" style="margin-top: 50px"> <div class="btn" style="margin-top: 50px">
<button <button
@@ -399,15 +405,15 @@
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { computed, defineEmits, defineProps, ref, watch } from "vue"; import {computed, defineEmits, defineProps, ref, watch} from "vue";
import { request, useBoeApi, useBoeApiPage } from "@/api/request"; import {request, useBoeApi, useBoeApiPage} from "@/api/request";
import { import {
AUDIENCE_LIST, AUDIENCE_LIST,
ORG_CHILD_LIST, ORG_CHILD_LIST,
ORG_LIST, ORG_LIST,
USER_LIST, USER_LIST,
} from "@/api/ThirdApi"; } from "@/api/ThirdApi";
import { saveStu } from "@/api/index1"; import {saveStu} from "@/api/index1";
const emit = defineEmits({}); const emit = defineEmits({});
const props = defineProps({ const props = defineProps({
@@ -444,11 +450,11 @@ const audienceName = ref({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
}); });
// const searchOrgName = ref({ const searchOrgName = ref({
// keyword: '', keyword: '',
// page: 1, page: 1,
// pageSize: 10 pageSize: 10
// }) })
const stageIds = computed(() => props.stage); const stageIds = computed(() => props.stage);
const { const {
data: stuData, data: stuData,
@@ -464,18 +470,27 @@ const {
totalPage: (res) => res.result.totalPage, totalPage: (res) => res.result.totalPage,
total: (res) => res.result.totalElement, total: (res) => res.result.totalElement,
}); });
// const { const {
// data: orgData, data: orgData,
// fetch: searchOrg, fetch: searchOrg,
// } = useBoeApiPage(ORG_LIST, searchOrgName.value) } = useBoeApiPage(ORG_LIST, searchOrgName.value)
const { data: treeData, loading: orgLoading } = useBoeApi( const {data: treeData, loading: orgLoading} = useBoeApi(
ORG_LIST, ORG_LIST,
{ keyword: "" }, {keyword: ""},
{ {
init: true, init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })), result: (res) => res.result.map((e) => ({...e, isLeaf: false})),
} }
); );
const {data: treeOrgData, loading: orgOrgLoading} = useBoeApi(
ORG_LIST,
{keyword: ""},
{
init: true,
result: (res) => res.result.map((e) => ({...e, isLeaf: false})),
}
);
const { const {
data: audiData, data: audiData,
fetch: searchAudi, fetch: searchAudi,
@@ -487,7 +502,7 @@ const {
} = useBoeApiPage(AUDIENCE_LIST, audienceName.value, { } = useBoeApiPage(AUDIENCE_LIST, audienceName.value, {
init: true, init: true,
result: (res) => result: (res) =>
res.result.audienceList.map((e) => ({ ...e, id: e.id + "" })), res.result.audienceList.map((e) => ({...e, id: e.id + ""})),
totalPage: (res) => res.result.totalPage, totalPage: (res) => res.result.totalPage,
total: (res) => res.result.totalElement, total: (res) => res.result.totalElement,
}); });
@@ -599,14 +614,25 @@ const closeDrawer = () => {
stuData.value = []; stuData.value = [];
nameSearch.value.keyword = ""; nameSearch.value.keyword = "";
}; };
function onLoadData(treeNode) { function onLoadData(treeNode) {
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then( return request(ORG_CHILD_LIST, {keyword: "", orgId: treeNode.id}).then(
(r) => { (r) => {
treeNode.dataRef.treeChildList = r.result.directChildList; treeNode.dataRef.treeChildList = r.result.directChildList;
treeData.value = [...treeData.value]; treeData.value = [...treeData.value];
} }
); );
} }
function onLoadOrgData(treeNode) {
return request(ORG_CHILD_LIST, {keyword: "", orgId: treeNode.id}).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeOrgData.value = [...treeOrgData.value];
}
);
}
const closeChangeModal = () => { const closeChangeModal = () => {
stageVisible.value = false; stageVisible.value = false;
}; };
@@ -702,9 +728,9 @@ const deleteDepSelect = () => {
stuSelectKeys.value = []; stuSelectKeys.value = [];
}; };
//重置组织 //重置组织
// const resetOrg = () => { const resetOrg = () => {
// searchOrgName.value = {keyword: '', page: 1, pageSize: 10} searchOrgName.value = {keyword: '', page: 1, pageSize: 10}
// }; };
//重置受众 //重置受众
const resetAudienceInfo = () => { const resetAudienceInfo = () => {
audienceName.value.keyword = ""; audienceName.value.keyword = "";