This commit is contained in:
Pengxiansen
2025-02-13 17:33:57 +08:00
parent c5467438b7
commit 4ca65ea584
25 changed files with 3877 additions and 618 deletions

View File

@@ -2,217 +2,267 @@
<!-- eslint-disable vue/require-v-for-key -->
<template>
<div class="CommonStudent">
<a-drawer
:visible="visiable"
class="drawerStyle CommonStudent"
placement="right"
width="60%"
>
<div class="drawerMain">
<div class="header">
<div class="headerTitle">
{{ title }}
</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div class="drawer-content" style="">
<div class="tabs" style="min-width: 800px">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane :key="1" tab="快速选人">
<div :style="{ height: screenHeight - 235 + 'px' }">
<div class="tab1">
<a-form-item label="姓名">
<a-input
v-model:value="nameSearch.keyword"
style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
/>
<a-button
type="primary"
@click="onSearchStu"
style="margin-left: 20px; border-radius: 4px"
>
<template #icon>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
type="primary"
@click="resetStu"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</div>
<div
class="chooseLeft"
style="display: grid; grid-template-columns: 250px auto"
<div class="drawer-content" style="">
<div class="tabs" style="min-width: 800px">
<a-tabs v-model:activeKey="activeKey">
<template v-if="type == 2">
<a-tab-pane :key="2" tab="项目内学员">
<div :style="{ height: screenHeight - 235 + 'px' }">
<div>
<a-form-item label="姓名:">
<a-input
v-model:value="projectParams.userNickName"
style="width: 260px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
/>
<a-button
type="primary"
@click="getProjectStu"
style="margin-left: 20px; border-radius: 4px"
>
<template #icon>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
type="primary"
@click="resetProjectStu"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</div>
<div class="tableBox tabb">
<BaseTable
ref="projectStuTableRef"
:columns="projectStuColumns"
:url="GROWTH_STUDENT_LIST"
v-model:params="projectParams"
v-model:selectedRows="projectSelectRows"
:request="growthRequest"
type="checkbox"
></BaseTable>
</div>
</div>
</a-tab-pane>
</template>
<a-tab-pane :key="1" tab="快速选人">
<div :style="{ height: screenHeight - 235 + 'px' }">
<div class="tab1">
<a-form-item label="姓名">
<a-input
v-model:value="nameSearch.keyword"
style="width: 270px; height: 40px; border-radius: 8px"
placeholder="请输入姓名"
/>
<a-button
type="primary"
@click="onSearchStu"
style="margin-left: 20px; border-radius: 4px"
>
<div
:style="{
height: screenHeight - 180 + 'px',
overflowY: 'auto',
<template #icon>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button
type="primary"
@click="resetStu"
style="margin-left: 20px; border-radius: 4px"
>重置
</a-button>
</a-form-item>
</div>
<div
class="chooseLeft"
style="display: grid; grid-template-columns: 250px auto"
>
<div style="border: 1px solid #f0f0f0">
<div class="tree" style="margin: 10px 4px 0 10px">
<a-tree
allow-clear
tree-default-expand-all
:tree-data="treeData"
:load-data="onLoadData"
v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
style="border: 1px solid #f0f0f0"
@select="stuStuOrgSelect"
>
<div class="tree" style="margin: 10px 4px 220px 10px">
<a-tree
allow-clear
tree-default-expand-all
:tree-data="treeData"
:loading="orgLoading"
:load-data="onLoadData"
v-model:selectedKeys="stuTreeSelectKeys"
v-model:expandedKeys="stuTreeExpandedKeys"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
@select="stuStuOrgSelect"
>
</a-tree>
</div>
</div>
<div
class="tableBox tabb"
style="
margin: 0px 4px 120px 10px;
border: 1px solid #f0f0f0;
"
>
<BaseTable
ref="stuTableRef"
:columns="stuColumns"
:url="USER_LIST_PAGE"
pageKey="pageNo"
v-model:params="nameSearch"
:request="useNewRowsPageNoInit"
v-model:selectedRows="stuSelectRows"
type="checkbox"
></BaseTable>
</div>
</a-tree>
</div>
</div>
</a-tab-pane>
</a-tabs>
</div>
<div class="right1" style="min-width: 200px">
<div class="onerow">
<div class="onleft">
<div class="already">已选</div>
</div>
</div>
<div
:style="{ 'max-height': screenHeight - 235 + 'px' }"
style="overflow-y: auto; padding-bottom: 10px"
>
<div class="selecteds">
<div class="person">快速选人</div>
<div v-for="(item, i) in stuSelectRows" :key="i">
<div v-if="i < 11">
<div class="chose">
{{ item.realName }}
<div class="ch" @click="stuTableRef.remove(i)"></div>
</div>
</div>
<div v-else>
<div v-if="person">
<div class="chose">
{{ item.realName }}
<div class="ch" @click="stuTableRef.remove(i)"></div>
</div>
</div>
</div>
</div>
<div v-if="!person && stuSelectRows.length > 10" class="ifsw">
<div @click="person = !person" class="“sw”">查看更多></div>
</div>
<div v-if="person && stuSelectRows.length > 10" class="ifsw">
<div @click="person = !person" class="sw">收起&lt;</div>
<div
class="tableBox tabb"
style="margin: 0px 4px 0 10px; border: 1px solid #f0f0f0"
>
<BaseTable
ref="stuTableRef"
:columns="stuColumns"
:url="USER_LIST_PAGE"
pageKey="pageNo"
v-model:params="nameSearch"
:request="useNewRowsPageNoInit"
v-model:selectedRows="stuSelectRows"
type="checkbox"
></BaseTable>
</div>
</div>
</div>
</a-tab-pane>
</a-tabs>
</div>
<div class="right1" style="min-width: 200px">
<div class="onerow">
<div class="onleft">
<div class="already">已选</div>
</div>
</div>
<div class="btnn">
<button class="btn2" @click="closeDrawer">取消</button>
<button class="btn2" @click="confirm">确定</button>
<div
:style="{ 'max-height': screenHeight - 235 + 'px' }"
style="overflow-y: auto; padding-bottom: 10px"
>
<div class="selecteds" v-if="type == 2">
<div class="person">项目内学员</div>
<div v-for="(item, i) in projectSelectRows" :key="i">
<div v-if="i < 11">
<div class="chose">
{{ item.userNickName }}
<div class="ch" @click="projectStuTableRef.remove(i)"></div>
</div>
</div>
<div v-else>
<div v-if="person">
<div class="chose">
{{ item.userNickName }}
<div class="ch" @click="projectStuTableRef.remove(i)"></div>
</div>
</div>
</div>
</div>
<div v-if="!member && projectSelectRows?.length > 10" class="ifsw">
<div @click="member = !member" class="“sw”">查看更多></div>
</div>
<div v-if="member && projectSelectRows?.length > 10" class="ifsw">
<div @click="member = !member" class="sw">收起&lt;</div>
</div>
</div>
<div class="selecteds">
<div class="person">快速选人</div>
<div v-for="(item, i) in stuSelectRows" :key="i">
<div v-if="i < 11">
<div class="chose">
{{ item.realName }}
<div class="ch" @click="stuTableRef.remove(i)"></div>
</div>
</div>
<div v-else>
<div v-if="person">
<div class="chose">
{{ item.realName }}
<div class="ch" @click="stuTableRef.remove(i)"></div>
</div>
</div>
</div>
</div>
<div v-if="!person && stuSelectRows.length > 10" class="ifsw">
<div @click="person = !person" class="“sw”">查看更多></div>
</div>
<div v-if="person && stuSelectRows.length > 10" class="ifsw">
<div @click="person = !person" class="sw">收起&lt;</div>
</div>
</div>
</div>
</div>
</a-drawer>
<a-button @click="openDrawer" type="link">
<slot></slot>
</a-button>
</div>
<div class="btnn">
<button class="btn2" @click="closeDrawer">取消</button>
<button class="btn2" @click="confirm">确定</button>
</div>
</div>
</template>
<script setup>
import { message } from "ant-design-vue";
import { computed, defineEmits, defineProps, ref, watch } from "vue";
import { useNewRowsPageNoInit, request, useRequest } from "@/api/request";
import { computed, defineEmits, defineProps, ref, watch, onMounted } from "vue";
import {
useNewRowsPageNoInit,
request,
useRequest,
growthRequest,
} from "@/api/request";
import { assignPermissions } from "@/api/growthpath";
import dialog from "@/utils/dialog";
import BaseTable from "@/components/common/BaseTable";
import { ORG_CHILD_LIST, ORG_LIST, USER_LIST_PAGE } from "@/api/apis";
import {
ORG_CHILD_LIST,
ORG_LIST,
USER_LIST_PAGE,
GROWTH_STUDENT_LIST,
} from "@/api/apis";
const emit = defineEmits(["confirm"]);
const emit = defineEmits(["confirm", "close"]);
const props = defineProps({
infoId: Number,
id: String,
title: {
growthId: {
type: String,
default: "",
},
clear: {
type: Boolean,
default: false,
},
selectOne: {
type: Boolean,
default: false,
},
stage: {
type: Array,
default: () => [],
},
isGroup: {
type: Boolean,
default: false,
},
projectId: {
type: Number,
default: null,
},
groupId: {
type: Number,
default: null,
},
groupName: {
type: String,
default: null,
},
groupMemberCount: {
type: Number,
default: null,
},
groupMemberNumber: {
type: Number,
default: null,
},
activeKey1: {
type: String,
default: null,
type: {
type: [String, Number],
default: 1,
},
});
const projectSelectKeys = ref([]);
const projectStuTableRef = ref(null);
// 项目内学员获取列表
const getProjectStu = () => projectStuTableRef.value.fetch();
// 项目内学员列表重置
const resetProjectStu = () => {
projectParams.value.userNickName = "";
projectStuTableRef.value.reset();
projectParams.value.growthId = props.growthId;
};
// 项目内学员勾选项
const projectSelectRows = ref([]);
// 项目内学员筛选
const projectParams = ref({
growthId: props.growthId,
userNickName: "",
});
const projectStuColumns = ref([
{
title: "姓名",
dataIndex: "userNickName",
key: "userNickName",
width: 80,
align: "center",
className: "h",
ellipsis: true,
},
{
title: "工号",
dataIndex: "username",
key: "username",
width: 80,
align: "center",
className: "h",
ellipsis: true,
},
{
title: "归属组织",
dataIndex: "orgName",
key: "orgName",
width: 80,
align: "center",
className: "h",
ellipsis: true,
},
]);
const stuSelectRows = ref([]);
const dept = ref(false);
const stuTableRef = ref();
const person = ref(false);
@@ -226,8 +276,11 @@ const nameSearch = ref({
const stuTreeSelectKeys = ref([]);
const stuTreeExpandedKeys = ref([]);
const { data: treeData, loading: orgLoading } = useRequest(ORG_LIST, {
const treeData = ref([]);
request(ORG_LIST, {
keyword: "",
}).then((res) => {
treeData.value = res.data;
});
const stuColumns = ref([
@@ -273,8 +326,8 @@ const screenHeight = ref(document.body.clientHeight);
const closeDrawer = () => {
deleteDepSelect();
visiable.value = false;
nameSearch.value.keyword = "";
emit("close");
};
function onLoadData(treeNode) {
@@ -286,10 +339,6 @@ function onLoadData(treeNode) {
);
}
const openDrawer = () => {
visiable.value = true;
};
function onSearchStu() {
stuTableRef.value.reset(nameSearch.value);
}
@@ -306,22 +355,20 @@ const resetStu = () => {
//清空选择部门信息
const deleteDepSelect = () => {
stuSelectRows.value = [];
projectSelectKeys.value = [];
projectSelectRows.value = [];
};
//确定添加授权
const confirm = () => {
visiable.value = false;
emit("confirm", stuSelectRows.value);
emit("confirm", stuSelectRows.value, projectSelectRows.value);
};
watch(visiable, () => {
onMounted(() => {
orgSelectKeys.value = [];
nameSearch.value.departId = "";
stuTreeExpandedKeys.value = [];
stuTreeSelectKeys.value = [];
activeKey.value = props.isGroup ? 4 : 1;
nameSearch.value.keyword = "";