mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 19:36:46 +08:00
1128 lines
33 KiB
Vue
1128 lines
33 KiB
Vue
<!-- eslint-disable vue/no-parsing-error -->
|
||
<!-- eslint-disable vue/require-v-for-key -->
|
||
<template>
|
||
<div class="CommonStudent">
|
||
<a-drawer :visible="visiable" class="drawerStyle ProjCheckship CommonStudent" placement="right" width="80%">
|
||
<div class="drawerMain" id="ProjCheckship" style="">
|
||
<div class="header"
|
||
style="display: flex;justify-content: space-between;align-items: center;height: 55px;border-bottom: 1px solid #f0f0f0;margin-bottom: 20px;">
|
||
<div class="headerTitle">
|
||
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || title }}
|
||
</div>
|
||
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
|
||
@click="closeDrawer" />
|
||
</div>
|
||
<div style="display: flex; overflow-x: auto; overflow-y: auto">
|
||
<div class="tabs" style="min-width: 800px">
|
||
<a-tabs v-model:activeKey="activeKey">
|
||
<a-tab-pane v-if="infoType" :key="4" tab="项目内学员">
|
||
<div :style="{ height: screenHeight - 235 + 'px' }">
|
||
<div>
|
||
<a-form-item label="姓名:">
|
||
<a-input v-model:value="projectParams.studentName"
|
||
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="STUDENT_LIST"
|
||
v-model:params="projectParams" v-model:selectedRows="projectSelectRows" type="checkbox"></BaseTable>
|
||
</div>
|
||
</div>
|
||
</a-tab-pane>
|
||
<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 :style="{
|
||
height: screenHeight - 180 + 'px',
|
||
overflowY: 'auto',
|
||
}" style="border: 1px solid #f0f0f0">
|
||
<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="page"
|
||
:request="useBoeApiUserInfoPage" v-model:params="nameSearch" v-model:selectedRows="stuSelectRows"
|
||
type="checkbox"></BaseTable>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-tab-pane>
|
||
<a-tab-pane v-if="!selectStu" :key="2" tab="添加组织">
|
||
<div :style="{ height: screenHeight - 235 + 'px' }">
|
||
<div class="tab2">
|
||
<a-form-item label="组织:">
|
||
<a-input v-model:value="searchOrgName.keyword"
|
||
style="width: 230px; height: 40px; border-radius: 8px" placeholder="请输入组织" @click="orgValue" />
|
||
<a-button type="primary" @click="searchOrg" style="margin-left: 20px; border-radius: 4px">
|
||
<template #icon>
|
||
<SearchOutlined />
|
||
</template>
|
||
搜索
|
||
</a-button>
|
||
<a-button type="primary" @click="resetOrg" style="margin-left: 20px; border-radius: 4px">重置
|
||
</a-button>
|
||
</a-form-item>
|
||
</div>
|
||
<div class="boeTree">
|
||
<a-tree v-model:selectedKeys="selectedOrgKeys"
|
||
:tree-data="searchOrgName.keyword ? orgData : treeOrgData" @select="onOrgSelectChange"
|
||
:loading="orgOrgLoading" :load-data="onLoadOrgData" :fieldNames="{
|
||
children: 'treeChildList',
|
||
key: 'id',
|
||
title: 'name',
|
||
value: 'name',
|
||
}" row-key="id" :row-selection="orgRowSelection" multiple>
|
||
</a-tree>
|
||
</div>
|
||
</div>
|
||
</a-tab-pane>
|
||
<a-tab-pane v-if="!selectStu" :key="3" tab="受众关联">
|
||
<div :style="{ height: screenHeight - 235 + 'px' }">
|
||
<div>
|
||
<a-form-item label="受众名称:">
|
||
<a-input v-model:value="audienceName.keyword" style="width: 260px; height: 40px; border-radius: 8px"
|
||
placeholder="请输入受众名称" />
|
||
<a-button type="primary" @click="searchAudi" style="margin-left: 20px; border-radius: 4px">
|
||
<template #icon>
|
||
<SearchOutlined />
|
||
</template>
|
||
搜索
|
||
</a-button>
|
||
<a-button type="primary" @click="resetAudienceInfo" style="margin-left: 20px; border-radius: 4px">
|
||
重置
|
||
</a-button>
|
||
</a-form-item>
|
||
</div>
|
||
<div class="tableBox tabb">
|
||
<BaseTable ref="auditTableRef" :columns="audiColums" :url="AUDIENCE_LIST" page-key="page"
|
||
:request="useBoeApiAuditPage" v-model:params="audienceName" v-model:selectedRows="auditSelectRows"
|
||
v-model:selectedRowKeys="auditSelectRowKeys" type="checkbox"></BaseTable>
|
||
</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">
|
||
<div class="selecteds" v-if="infoType">
|
||
<div class="person">项目内学员</div>
|
||
<div v-for="(item, i) in projectSelectRows" :key="i">
|
||
<div v-if="i < 11">
|
||
<div class="chose">
|
||
{{ item.studentName }}
|
||
<div class="ch" @click="auditTableRef.remove(i)"></div>
|
||
</div>
|
||
</div>
|
||
<div v-else>
|
||
<div v-if="person">
|
||
<div class="chose">
|
||
{{ item.studentName }}
|
||
<div class="ch" @click="auditTableRef.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">收起<</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">收起<</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="!selectStu" class="selecteds">
|
||
<div class="dept">添加组织</div>
|
||
<div v-for="(item, i) in deptList" :key="i">
|
||
<div v-if="i < 11">
|
||
<div class="chose1">
|
||
<div class="span">{{ item.name }}</div>
|
||
<div class="ch1" @click="orgDel(i)" style="cursor: pointer;"></div>
|
||
</div>
|
||
</div>
|
||
<div v-else>
|
||
<div v-if="dept">
|
||
<div class="chose1">
|
||
<div class="span">{{ item.name }}</div>
|
||
<div class="ch1" @click="orgDel(i)"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="!dept && deptList.length > 10" class="ifsw">
|
||
<div @click="dept = !dept" class="“sw”">查看更多></div>
|
||
</div>
|
||
<div v-if="dept && deptList.length > 10" class="ifsw">
|
||
<div @click="dept = !dept" class="sw">收起<</div>
|
||
</div>
|
||
</div>
|
||
<!--受众-->
|
||
<div v-if="!selectStu" class="selecteds">
|
||
<div class="group">受众关联</div>
|
||
<div v-for="(item, i) in auditSelectRows" :key="i">
|
||
<div v-if="i < 11">
|
||
<div class="chose2">
|
||
<div class="span">{{ item.audienceName }}</div>
|
||
<div class="ch2" @click="auditTableRef.remove(i)"></div>
|
||
</div>
|
||
</div>
|
||
<div v-else>
|
||
<div v-if="group">
|
||
<div class="chose2">
|
||
<div class="span">{{ item.audienceName }}</div>
|
||
<div class="ch2" @click="auditTableRef.remove(i)"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="!group && auditSelectRows.length > 10" class="ifsw">
|
||
<div @click="group = !group" class="“sw”">查看更多></div>
|
||
</div>
|
||
<div v-if="group && auditSelectRows.length > 10" class="ifsw">
|
||
<div @click="group = !group" class="sw">收起<</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="btnnq">
|
||
<button class="btn2" @click="closeDrawer">取消</button>
|
||
<button class="btn2" @click="submitAuth">推荐</button>
|
||
</div>
|
||
</div>
|
||
</a-drawer>
|
||
<!-- 推荐按钮的提示 -->
|
||
<a-modal :maskClosable="false" v-model:visible="state.recBtnvisible" width="450px" title="提醒" @ok="handleOk">
|
||
<div class="remModal">
|
||
<div class="remModal-words">
|
||
<div>您已选择案例:<span class="wordsColor">{{ id.length }}</span> 篇</div>
|
||
<div class="wordsColor" @click="edit('article')">去修改>></div>
|
||
</div>
|
||
<div class="remModal-words" style="margin-bottom: 30px;">
|
||
<div>您已选择学员:<span class="wordsColor">{{ count }}</span> 人</div>
|
||
<div class="wordsColor" @click="edit()">去修改>></div>
|
||
</div>
|
||
<a-form ref="formRef" :model="formState" :rules="rules" :label-col="{ span: 5 }">
|
||
<a-form-item label="推荐组织:" name="name">
|
||
<a-input ref="orgName" v-model:value="formState.name" />
|
||
</a-form-item>
|
||
</a-form>
|
||
</div>
|
||
</a-modal>
|
||
|
||
<a-button @click="openDrawer" type="link">
|
||
<slot></slot>
|
||
</a-button>
|
||
</div>
|
||
<a-modal :style="{ padding: 0, position: 'relative', right: '-20%' }" :closable="true" :visible="stageVisible"
|
||
:footer="null" centered="true" @ok="handleStageOk" wrapClassName="changeModal">
|
||
<div class="con">
|
||
<div class="header">
|
||
<div class="inhe">
|
||
<div class="tz">{{ type === 1 ? "选择阶段" : "添加学员到关卡" }}</div>
|
||
<div class="mg" @click="closeChangeModal"></div>
|
||
</div>
|
||
</div>
|
||
<div class="mid">
|
||
<div class="inher">
|
||
<div class="select">
|
||
<a-select style="width: 400px" :placeholder="type === 1 ? '选择阶段' : '选择关卡'" v-model:value="stageId"
|
||
className="cus-select">
|
||
<a-select-option v-for="(item, i) in stageIds" :key="i" :value="item.id">{{ item.name || "默认" }}
|
||
</a-select-option>
|
||
</a-select>
|
||
</div>
|
||
<span style="color: #999999; margin-left: 10px"><minus-circle-outlined />已在其他关卡的学员,不会被添加到该关卡</span>
|
||
<div class="btn" style="margin-top: 50px">
|
||
<button class="sameb btn1" @click="closeChangeModal" style="cursor: pointer">
|
||
取消
|
||
</button>
|
||
<button class="sameb btn2" @click="handleDialogOk" style="cursor: pointer">
|
||
确定
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</a-modal>
|
||
</template>
|
||
<script setup>
|
||
import { message } from "ant-design-vue";
|
||
import { computed, defineEmits, defineProps, ref, watch, onMounted, reactive, nextTick } from "vue";
|
||
import { boeRequest, useBoeApi, useBoeApiPage, useBoeApiUserInfoPage, useBoeApiAuditPage } from "@/api/request";
|
||
import {
|
||
ORG_CHILD_LIST,
|
||
ORG_LIST,
|
||
USER_LIST_PAGE,
|
||
AUDIENCE_LIST,
|
||
} from "@/api/ThirdApi";
|
||
import dialog from "@/utils/dialog";
|
||
import BaseTable from "@/components/common/BaseTable";
|
||
import { STUDENT_LIST } from "@/api/apis";
|
||
// 推荐接口
|
||
import { caseRecommend, userList } from '@/api/case'
|
||
|
||
const emit = defineEmits({});
|
||
const props = defineProps({
|
||
type: Number,
|
||
infoType: Number,
|
||
infoId: Number,
|
||
id: Array,
|
||
title: {
|
||
type: String,
|
||
default: "",
|
||
},
|
||
clear: {
|
||
type: Boolean,
|
||
default: false,
|
||
},
|
||
selectStu: {
|
||
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,
|
||
},
|
||
});
|
||
|
||
|
||
const projectSelectKeys = ref([]);
|
||
const projectSelectRows = ref([]);
|
||
const stuSelectRows = ref([]);
|
||
const auditSelectRows = ref([]);
|
||
const auditSelectRowKeys = ref([]);
|
||
const deptList = ref([]);
|
||
const member = ref(false);
|
||
const dept = ref(false);
|
||
const projectStuTableRef = ref();
|
||
const stuTableRef = ref();
|
||
const projectParams = ref({ pid: props.infoId, type: props.infoType, studentName: "" });
|
||
|
||
const getProjectStu = () => projectStuTableRef.value.fetch();
|
||
const resetProjectStu = () => {
|
||
console.log(111);
|
||
|
||
console.log(props.id);
|
||
|
||
projectParams.value.studentName = "";
|
||
projectStuTableRef.value.reset();
|
||
};
|
||
|
||
const person = ref(false);
|
||
const group = ref(false);
|
||
const visiable = ref(false);
|
||
const activeKey = ref(props.infoType ? 4 : 1);
|
||
const stageVisible = ref(false);
|
||
const stageId = ref();
|
||
|
||
const nameSearch = ref({
|
||
keyword: "",
|
||
departId: null,
|
||
});
|
||
const stuTreeSelectKeys = ref([]);
|
||
const stuTreeExpandedKeys = ref([]);
|
||
const audienceName = ref({
|
||
keyword: "",
|
||
});
|
||
const searchOrgName = ref({
|
||
keyword: "",
|
||
page: 1,
|
||
pageSize: 10,
|
||
});
|
||
const stageIds = computed(() => props.stage);
|
||
|
||
const { data: orgData, fetch: searchOrg } = 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: treeOrgData, loading: orgOrgLoading } = useBoeApi(
|
||
ORG_LIST,
|
||
{ keyword: "" },
|
||
{
|
||
init: true,
|
||
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
|
||
}
|
||
);
|
||
|
||
const projectStuColumns = ref([
|
||
{
|
||
title: "姓名",
|
||
dataIndex: "studentName",
|
||
key: "studentName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "工号",
|
||
dataIndex: "studentUserNo",
|
||
key: "studentUserNo",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "归属组织",
|
||
dataIndex: "studentOrgName",
|
||
key: "studentOrgName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "部门",
|
||
dataIndex: "studentDepartName",
|
||
key: "studentDepartName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
]);
|
||
const stuColumns = ref([
|
||
{
|
||
title: "姓名",
|
||
dataIndex: "realName",
|
||
key: "realName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "工号",
|
||
dataIndex: "userNo",
|
||
key: "userNo",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "归属组织",
|
||
dataIndex: "orgName",
|
||
key: "orgName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "部门",
|
||
dataIndex: "departName",
|
||
key: "departName",
|
||
width: 80,
|
||
align: "center",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
]);
|
||
const audiColums = ref([
|
||
{
|
||
title: "受众名称",
|
||
dataIndex: "audienceName",
|
||
key: "audienceName",
|
||
width: 30,
|
||
align: "left",
|
||
className: "h",
|
||
ellipsis: true,
|
||
},
|
||
{
|
||
title: "人数",
|
||
dataIndex: "totalMember",
|
||
key: "totalMember",
|
||
width: 30,
|
||
align: "center",
|
||
className: "h",
|
||
},
|
||
{
|
||
title: "类型",
|
||
dataIndex: "audienceType",
|
||
key: "audienceType",
|
||
width: 40,
|
||
align: "center",
|
||
className: "h",
|
||
},
|
||
]);
|
||
const orgSelectKeys = ref([]);
|
||
const auditTableRef = ref();
|
||
const screenHeight = ref(document.body.clientHeight);
|
||
// 推荐弹出框
|
||
const formRef = ref();
|
||
const formState = reactive({
|
||
name: undefined,
|
||
});
|
||
|
||
const rules = {
|
||
name: {
|
||
required: true,
|
||
message: '请输入推荐组织名称',
|
||
},
|
||
};
|
||
// 定义后来的变量
|
||
const state = reactive({
|
||
recBtnvisible: false,//显示还是隐藏
|
||
})
|
||
|
||
const orgRowSelection = computed(() => ({
|
||
columnWidth: 20,
|
||
selectedRowKeys: orgSelectKeys.value,
|
||
onChange: onOrgSelectChange,
|
||
preserveSelectedRowKeys: true,
|
||
}));
|
||
// 去修改
|
||
const edit = (type) => {
|
||
if (type == 'article') {
|
||
visiable.value = false;
|
||
}
|
||
formState.name = undefined
|
||
state.recBtnvisible = false
|
||
}
|
||
|
||
|
||
const closeDrawer = () => {
|
||
deleteDepSelect();
|
||
visiable.value = false;
|
||
nameSearch.value.keyword = "";
|
||
selectedOrgKeys.value = [];
|
||
|
||
counts.value = 0
|
||
keysId.value = []
|
||
};
|
||
|
||
function searchAudi() {
|
||
auditTableRef.value.reset(audienceName.value);
|
||
}
|
||
|
||
function onLoadData(treeNode) {
|
||
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||
(r) => {
|
||
treeNode.dataRef.treeChildList = r.result.directChildList;
|
||
treeData.value = [...treeData.value];
|
||
}
|
||
);
|
||
}
|
||
|
||
function onLoadOrgData(treeNode) {
|
||
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||
(r) => {
|
||
treeNode.dataRef.treeChildList = r.result.directChildList;
|
||
treeOrgData.value = [...treeOrgData.value];
|
||
}
|
||
);
|
||
}
|
||
|
||
const closeChangeModal = () => {
|
||
stageVisible.value = false;
|
||
};
|
||
const openDrawer = () => {
|
||
if (!props.id.length) {
|
||
message.warning('请选择最少一个案例推送!!!')
|
||
return
|
||
}
|
||
visiable.value = true;
|
||
};
|
||
|
||
function onSearchStu() {
|
||
console.log(props.id);
|
||
|
||
stuTableRef.value.reset(nameSearch.value);
|
||
}
|
||
|
||
function stuStuOrgSelect(e) {
|
||
nameSearch.value.departId = e.join("");
|
||
stuTableRef.value.fetch();
|
||
}
|
||
|
||
const selectedOrgKeys = ref([]);
|
||
|
||
watch(selectedOrgKeys, () => {
|
||
// console.log("selectedKeys", selectedOrgKeys);
|
||
});
|
||
|
||
function orgDel(i) {
|
||
// 移除的时候删除人数
|
||
listData.departId = deptList.value[i].id
|
||
httpList(false)
|
||
orgSelectKeys.value = orgSelectKeys.value.filter(e => e !== deptList.value[i].id);
|
||
selectedOrgKeys.value.splice(i, 1);
|
||
deptList.value.splice(i, 1);
|
||
}
|
||
|
||
// 传递的参数
|
||
const listData = reactive({
|
||
departId: '',
|
||
keyword: "",
|
||
page: 1,
|
||
pageSize: 10,
|
||
})
|
||
|
||
const keysId = ref([])
|
||
const counts = ref(0)
|
||
const addOrMinus = ref(false)
|
||
|
||
const onOrgSelectChange = async (e, l) => {
|
||
const uniqueElements = keysId.value.filter(element => !e.includes(element))
|
||
.concat(e.filter(element => !keysId.value.includes(element)));
|
||
|
||
|
||
if (keysId.value.length < e.length) {
|
||
addOrMinus.value = true
|
||
} else {
|
||
addOrMinus.value = false
|
||
}
|
||
keysId.value = e
|
||
listData.departId = uniqueElements[0]
|
||
|
||
orgRowSelection.value = e;
|
||
deptList.value = l.selectedNodes;
|
||
httpList(addOrMinus.value)
|
||
}
|
||
const httpList = (addOrMinus) => {
|
||
userList(listData).then((res) => {
|
||
if (res.status == 200) {
|
||
if (!addOrMinus) {
|
||
counts.value -= res.data.result.totalElement
|
||
} else {
|
||
counts.value += res.data.result.totalElement
|
||
}
|
||
}
|
||
console.log(counts.value);
|
||
})
|
||
}
|
||
|
||
const resetStu = () => {
|
||
nameSearch.value.keyword = "";
|
||
stuTableRef.value.reset({ keyword: "", departId: null });
|
||
};
|
||
//清空选择部门信息
|
||
const deleteDepSelect = () => {
|
||
stuSelectRows.value = [];
|
||
selectedOrgKeys.value = [];
|
||
projectSelectKeys.value = [];
|
||
formState.name = undefined;
|
||
};
|
||
//重置组织
|
||
const resetOrg = () => {
|
||
searchOrgName.value = { keyword: "" };
|
||
};
|
||
//重置受众
|
||
const resetAudienceInfo = () => {
|
||
audienceName.value.keyword = "";
|
||
auditTableRef.value.reset({ keyword: "" });
|
||
};
|
||
|
||
//推荐按钮
|
||
const orgName = ref()
|
||
const submitAuth = async () => {
|
||
state.recBtnvisible = true
|
||
await nextTick()
|
||
orgName.value.focus();
|
||
};
|
||
const handleOk = () => {
|
||
formRef.value.validate().then(() => {
|
||
if (props.type === 2) {
|
||
stageVisible.value = true;
|
||
} else {
|
||
handleDialogOk();
|
||
}
|
||
})
|
||
}
|
||
|
||
// 总人数
|
||
const count = computed(() => {
|
||
return (auditSelectRows.value?.reduce((acc, item) => acc + item.totalMember, 0) || 0) + stuSelectRows.value.length + counts.value;
|
||
})
|
||
function handleDialogOk() {
|
||
// if (auditSelectRowKeys.value.length || deptList.value.length) {
|
||
// dialog({ content: "您选择了组织或受众,此添加为异步添加,请稍后手动刷新学员!", ok: handleStageOk });
|
||
// return;
|
||
// }
|
||
console.log(props.id, '选择案例的id');
|
||
console.log(stuSelectRows.value, '快速选人的id');
|
||
console.log(count.value);
|
||
|
||
|
||
|
||
|
||
handleStageOk();
|
||
}
|
||
//清空计数,关闭弹窗
|
||
const clear = () => {
|
||
counts.value = 0
|
||
keysId.value = []
|
||
state.recBtnvisible = false
|
||
stageVisible.value = false;
|
||
visiable.value = false;
|
||
}
|
||
|
||
function handleStageOk() {
|
||
if (props.type === 1 && props.groupId && (props.groupMemberCount < (props.groupMemberNumber * 1 + projectSelectRows.value.length + stuSelectRows.value.length))) {
|
||
return message.warning("添加小组学员超过最大值");
|
||
}
|
||
nameSearch.value.keyword = "";
|
||
caseRecommend({
|
||
launchType: 1,
|
||
casesIdList: props.id,
|
||
recommendOrgName: formState.name,
|
||
pushUserIdList: stuSelectRows.value.map((stu) => stu.id),
|
||
groupIds: auditSelectRows.value?.map((e) => e.id),
|
||
deptIds: deptList.value?.map((e) => e.id),
|
||
}).then(response => {
|
||
if (response?.status !== 200) {
|
||
throw new Error("Failed to load response data");
|
||
}
|
||
return response;
|
||
}).then(() => {
|
||
message.success("推荐成功");
|
||
emit("finash", true);
|
||
deleteDepSelect();
|
||
clear()
|
||
}).catch(() => {
|
||
deleteDepSelect();
|
||
clear()
|
||
message.error("推荐失败");
|
||
})
|
||
// saveStu({
|
||
// targetId: props.id,
|
||
// type: props.type,
|
||
// clear: props.clear,
|
||
// deptIds: deptList.value?.map((e) => e.id),
|
||
// stageId: stageId.value,
|
||
// groupIds: auditSelectRows.value?.map((e) => e.id),
|
||
// studentList: stuSelectRows.value,
|
||
// projectList: projectSelectRows.value,
|
||
// groupName: props.groupName,
|
||
// groupId: props.groupId,
|
||
// }).then(() => {
|
||
// deleteDepSelect();
|
||
// emit("finash", true);
|
||
// });
|
||
}
|
||
|
||
// 搜索受众值发生变化
|
||
function orgValue(value) {
|
||
console.log("", value.target.value);
|
||
searchOrgName.value.keyword = value.target.value;
|
||
}
|
||
|
||
watch(visiable, () => {
|
||
orgSelectKeys.value = [];
|
||
deptList.value = [];
|
||
audienceName.value.keyword = "";
|
||
nameSearch.value.departId = null;
|
||
stuTreeExpandedKeys.value = [];
|
||
stuTreeSelectKeys.value = [];
|
||
activeKey.value = props.isGroup ? 4 : 1;
|
||
|
||
projectParams.value.studentName = "";
|
||
nameSearch.value.keyword = "";
|
||
searchOrgName.value.keyword = "";
|
||
audienceName.value.keyword = "";
|
||
|
||
if (!visiable.value) {
|
||
auditTableRef.value && auditTableRef.value.clear();
|
||
auditTableRef.value && auditTableRef.value.reset({ keyword: "" });
|
||
stuTableRef.value && stuTableRef.value.clear();
|
||
stuTableRef.value && stuTableRef.value.reset({ keyword: "", departId: null });
|
||
projectStuTableRef.value && projectStuTableRef.value.clear();
|
||
projectStuTableRef.value && projectStuTableRef.value.reset({ pid: props.infoId, type: props.infoType, studentName: "" });
|
||
}
|
||
});
|
||
</script>
|
||
<style lang="scss">
|
||
.CommonStudent {
|
||
min-height: 40px;
|
||
}
|
||
|
||
// 推荐按钮的弹出框
|
||
.remModal {
|
||
height: 100%;
|
||
width: 100%;
|
||
padding: 0 24px;
|
||
margin-top: 30px;
|
||
|
||
.remModal-words {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 10px;
|
||
|
||
.wordsColor {
|
||
color: #4ea6ff;
|
||
}
|
||
}
|
||
}
|
||
|
||
.btnnq {
|
||
height: 72px;
|
||
width: 100%;
|
||
position: absolute;
|
||
background-color: #fff;
|
||
bottom: 0;
|
||
left: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
|
||
|
||
.btn1 {
|
||
width: 100px;
|
||
height: 40px;
|
||
border: 1px solid #4ea6ff;
|
||
border-radius: 8px;
|
||
color: #4ea6ff;
|
||
background-color: #fff;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.btn2 {
|
||
cursor: pointer;
|
||
width: 100px;
|
||
height: 40px;
|
||
background: #4ea6ff;
|
||
border-radius: 8px;
|
||
border: 0;
|
||
margin-left: 15px;
|
||
color: #fff;
|
||
}
|
||
}
|
||
|
||
.CommonStudent>.ant-drawer-content-wrapper {
|
||
min-width: 1200px !important;
|
||
width: 1200px !important;
|
||
}
|
||
|
||
.CommonStudent {
|
||
.ant-btn-primary {
|
||
background-color: #4ea6ff !important;
|
||
}
|
||
|
||
.cus-select {
|
||
height: 40px;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.tableBox .ant-table-row .ant-table-cell {
|
||
height: 48px;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
color: #4f5156;
|
||
line-height: 29px;
|
||
padding: 0px;
|
||
}
|
||
|
||
.tableBox .ant-table-thead tr th {
|
||
font-size: 14px;
|
||
}
|
||
|
||
.ant-tabs-tabpane {
|
||
height: 100%;
|
||
}
|
||
|
||
.ant-tabs {
|
||
overflow: visible;
|
||
}
|
||
|
||
.right1 {
|
||
border-left: 1px solid #f2f6fe;
|
||
margin-left: 20px;
|
||
|
||
.onerow {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-right: 40px;
|
||
flex-wrap: wrap;
|
||
|
||
width: 100%;
|
||
|
||
.onleft {
|
||
display: flex;
|
||
text-align: center;
|
||
|
||
.already {
|
||
color: rgba(51, 51, 51, 1);
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
margin-left: 32px;
|
||
white-space: nowrap;
|
||
// margin-bottom: 20px;
|
||
}
|
||
|
||
.count {
|
||
color: #4ea6ff;
|
||
font-size: 16px;
|
||
margin: 0 6px;
|
||
}
|
||
|
||
.peo {
|
||
color: rgba(51, 51, 51, 1);
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
}
|
||
}
|
||
|
||
.clbox {
|
||
margin-right: 50px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
width: 104px;
|
||
height: 32px;
|
||
border-radius: 4px;
|
||
background: #4ea6ff;
|
||
|
||
.colose {
|
||
width: 16px;
|
||
height: 16px;
|
||
// border-radius: 8px;
|
||
// background: #ffffff;
|
||
// position: relative;
|
||
background-image: url(../../assets/images/basicinfo/ch.png);
|
||
background-size: 100%;
|
||
margin-right: 4px;
|
||
}
|
||
|
||
.allclear {
|
||
color: rgba(255, 255, 255, 1);
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.selecteds {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-left: 32px;
|
||
|
||
.person {
|
||
width: 100%;
|
||
margin-top: 20px;
|
||
border-top: 1px solid #f2f6fe;
|
||
}
|
||
|
||
.chose {
|
||
width: 64px;
|
||
height: 24px;
|
||
margin-top: 25px;
|
||
margin-right: 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 2px;
|
||
border: 1px solid rgba(56, 139, 225, 1);
|
||
color: rgba(56, 139, 225, 1);
|
||
font-size: 12px;
|
||
position: relative;
|
||
|
||
.ch {
|
||
position: absolute;
|
||
width: 18px;
|
||
height: 18px;
|
||
background-image: url(../../assets/images/basicinfo/ch.png);
|
||
right: -8px;
|
||
top: -8px;
|
||
}
|
||
}
|
||
|
||
.ifsw {
|
||
display: flex;
|
||
align-items: end;
|
||
justify-content: center;
|
||
color: #4ea6ff;
|
||
}
|
||
|
||
.sw {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
text-align: justify;
|
||
color: #4ea6ff;
|
||
margin-top: 23px;
|
||
margin-left: 10px;
|
||
}
|
||
|
||
.dept {
|
||
width: 100%;
|
||
margin-top: 30px;
|
||
border-top: 1px solid #f2f6fe;
|
||
}
|
||
|
||
.chose1 {
|
||
//width: 90px;
|
||
height: 24px;
|
||
margin-top: 25px;
|
||
margin-right: 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 2px;
|
||
border: 1px solid rgba(56, 139, 225, 1);
|
||
color: rgba(56, 139, 225, 1);
|
||
font-size: 12px;
|
||
position: relative;
|
||
|
||
.span {
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.ch1 {
|
||
position: absolute;
|
||
width: 18px;
|
||
height: 18px;
|
||
background-image: url(../../assets/images/basicinfo/ch.png);
|
||
right: -8px;
|
||
top: -8px;
|
||
}
|
||
}
|
||
|
||
.group {
|
||
width: 100%;
|
||
margin-top: 30px;
|
||
border-top: 1px solid #f2f6fe;
|
||
}
|
||
|
||
.chose2 {
|
||
//width: 120px;
|
||
height: 24px;
|
||
margin-top: 25px;
|
||
margin-right: 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 2px;
|
||
border: 1px solid rgba(56, 139, 225, 1);
|
||
color: rgba(56, 139, 225, 1);
|
||
font-size: 12px;
|
||
position: relative;
|
||
|
||
.span {
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.ch2 {
|
||
position: absolute;
|
||
width: 18px;
|
||
height: 18px;
|
||
background-image: url(../../assets/images/basicinfo/ch.png);
|
||
right: -8px;
|
||
top: -8px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|