提交专业力必修

This commit is contained in:
Pengxiansen
2025-01-23 14:51:49 +08:00
parent d0176acb45
commit 990380ac1a
23 changed files with 2226 additions and 2238 deletions

View File

@@ -4,14 +4,14 @@
<div class="CommonStudent">
<a-drawer
:visible="visiable"
class="drawerStyle ProjCheckship CommonStudent"
class="drawerStyle CommonStudent"
placement="right"
width="60%"
>
<div class="drawerMain" id="ProjCheckship" style="">
<div class="drawerMain">
<div class="header">
<div class="headerTitle">
{{ { 1: "添加学员", 2: "添加学员", 3: "添加学员" }[type] || title }}
{{ title }}
</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
@@ -22,45 +22,6 @@
<div class="drawer-content" style="">
<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">
@@ -140,98 +101,6 @@
</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="pageNo"
v-model:params="audienceName"
:request="useTotalPage"
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">
@@ -244,37 +113,6 @@
:style="{ 'max-height': screenHeight - 235 + 'px' }"
style="overflow-y: auto; padding-bottom: 10px"
>
<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">收起&lt;</div>
</div>
</div>
<div class="selecteds">
<div class="person">快速选人</div>
<div v-for="(item, i) in stuSelectRows" :key="i">
@@ -300,67 +138,12 @@
<div @click="person = !person" class="sw">收起&lt;</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">收起&lt;</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">收起&lt;</div>
</div>
</div>
</div>
</div>
</div>
<div class="btnn">
<button class="btn2" @click="closeDrawer">取消</button>
<button class="btn2" @click="submitAuth">确定</button>
<button class="btn2" @click="confirm">确定</button>
</div>
</div>
</a-drawer>
@@ -368,87 +151,18 @@
<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 } from "vue";
import {
useNewRowsPageNoInit,
request,
useRequest,
useTotalPage,
} from "@/api/request";
import { saveStu } from "@/api/index1";
import { useNewRowsPageNoInit, request, useRequest } from "@/api/request";
import { assignPermissions } from "@/api/growthpath";
import dialog from "@/utils/dialog";
import BaseTable from "@/components/common/BaseTable";
import {
AUDIENCE_LIST,
ORG_CHILD_LIST,
ORG_LIST,
STUDENT_LIST,
USER_LIST_PAGE,
} from "@/api/apis";
import { ORG_CHILD_LIST, ORG_LIST, USER_LIST_PAGE } from "@/api/apis";
const emit = defineEmits({});
const emit = defineEmits(["confirm"]);
const props = defineProps({
type: Number,
infoType: Number,
infoId: Number,
id: String,
title: {
@@ -459,10 +173,6 @@ const props = defineProps({
type: Boolean,
default: false,
},
selectStu: {
type: Boolean,
default: false,
},
selectOne: {
type: Boolean,
default: false,
@@ -501,33 +211,13 @@ const props = defineProps({
},
});
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 = () => {
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 activeKey = ref(1);
const nameSearch = ref({
keyword: "",
@@ -535,65 +225,11 @@ const nameSearch = ref({
});
const stuTreeSelectKeys = ref([]);
const stuTreeExpandedKeys = ref([]);
const audienceName = ref({
keyword: "",
});
const searchOrgName = ref({
keyword: "",
pageNo: 1,
pageSize: 10,
});
const stageIds = computed(() => props.stage);
const { data: orgData, fetchData: searchOrg } = useRequest(
ORG_LIST,
searchOrgName.value
);
const { data: treeData, loading: orgLoading } = useRequest(ORG_LIST, {
keyword: "",
});
const { data: treeOrgData, loading: orgOrgLoading } = useRequest(ORG_LIST, {
keyword: "",
});
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: "姓名",
@@ -632,47 +268,15 @@ const stuColumns = ref([
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",
},
]);
const orgSelectKeys = ref([]);
const auditTableRef = ref();
const screenHeight = ref(document.body.clientHeight);
const orgRowSelection = computed(() => ({
columnWidth: 20,
selectedRowKeys: orgSelectKeys.value,
onChange: onOrgSelectChange,
preserveSelectedRowKeys: true,
}));
const closeDrawer = () => {
deleteDepSelect();
visiable.value = false;
nameSearch.value.keyword = "";
selectedOrgKeys.value = [];
};
function searchAudi() {
auditTableRef.value.reset(audienceName.value);
}
function onLoadData(treeNode) {
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
@@ -682,18 +286,6 @@ function onLoadData(treeNode) {
);
}
function onLoadOrgData(treeNode) {
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
treeNode.dataRef.treeChildList = r.data;
treeOrgData.value = [...treeOrgData.value];
}
);
}
const closeChangeModal = () => {
stageVisible.value = false;
};
const openDrawer = () => {
visiable.value = true;
};
@@ -707,25 +299,6 @@ function stuStuOrgSelect(e) {
stuTableRef.value.fetch();
}
const selectedOrgKeys = ref([]);
watch(selectedOrgKeys, () => {
console.log("selectedKeys", selectedOrgKeys);
});
function orgDel(i) {
orgSelectKeys.value = orgSelectKeys.value.filter(
(e) => e !== deptList.value[i].id
);
selectedOrgKeys.value.splice(i, 1);
deptList.value.splice(i, 1);
}
function onOrgSelectChange(e, l) {
orgRowSelection.value = e;
deptList.value = l.selectedNodes;
}
const resetStu = () => {
nameSearch.value.keyword = "";
stuTableRef.value.reset({ keyword: "", departId: "" });
@@ -733,104 +306,28 @@ const resetStu = () => {
//清空选择部门信息
const deleteDepSelect = () => {
stuSelectRows.value = [];
selectedOrgKeys.value = [];
projectSelectKeys.value = [];
};
//重置组织
const resetOrg = () => {
searchOrgName.value = { keyword: "" };
};
//重置受众
const resetAudienceInfo = () => {
audienceName.value.keyword = "";
auditTableRef.value.reset({ keyword: "" });
};
//确定添加授权
const submitAuth = () => {
if (props.type === 2) {
stageVisible.value = true;
} else {
handleDialogOk();
}
};
function handleDialogOk() {
if (auditSelectRowKeys.value.length || deptList.value.length) {
dialog({
content: "您选择了组织或受众,此添加为异步添加,请稍后手动刷新学员!",
ok: handleStageOk,
});
return;
}
handleStageOk();
}
function handleStageOk() {
if (
props.type === 1 &&
props.groupId &&
props.groupMemberCount <
props.groupMemberNumber * 1 +
projectSelectRows.value.length +
stuSelectRows.value.length
) {
return message.warning("添加小组学员超过最大值");
}
stageVisible.value = false;
const confirm = () => {
visiable.value = false;
emit("finash", false);
nameSearch.value.keyword = "";
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(() => {
message.success("授权成功");
deleteDepSelect();
emit("finash", true);
});
}
// 搜索受众值发生变化
function orgValue(value) {
console.log("", value.target.value);
searchOrgName.value.keyword = value.target.value;
}
emit("confirm", stuSelectRows.value);
};
watch(visiable, () => {
orgSelectKeys.value = [];
deptList.value = [];
audienceName.value.keyword = "";
nameSearch.value.departId = "";
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: "" });
projectStuTableRef.value && projectStuTableRef.value.clear();
projectStuTableRef.value &&
projectStuTableRef.value.reset({
pid: props.infoId,
type: props.infoType,
studentName: "",
});
}
});
</script>
@@ -1032,12 +529,6 @@ watch(visiable, () => {
}
}
.group {
width: 100%;
margin-top: 30px;
border-top: 1px solid #f2f6fe;
}
.chose2 {
//width: 120px;
height: 24px;