-- fix bug

This commit is contained in:
yuping
2023-03-03 19:23:23 +08:00
parent 55b0c887b4
commit 8b6e5201ce
4 changed files with 144 additions and 88 deletions

View File

@@ -1,14 +1,15 @@
//学员列表带分页 //学员列表带分页
export const USER_LIST_PAGE = '/userbasic/user/list post' export const USER_LIST_PAGE = "/userbasic/user/list post";
//学员列表 没有分页数据 只能通过名称检索 速度较快 //学员列表 没有分页数据 只能通过名称检索 速度较快
export const USER_LIST = '/userbasic/user/searchList post' export const USER_LIST = "/userbasic/user/searchList post";
export const ORG_LIST = '/userbasic/org/list post' export const ORG_LIST = "/userbasic/org/list post";
export const ORG_CHILD_LIST = '/userbasic/org/info post' export const ORG_CHILD_LIST = "/userbasic/org/info post";
// export const AUDIENCE_LIST = '/userbasic/audience/list post' // export const AUDIENCE_LIST = '/userbasic/audience/list post'
//当前用户可以查看的受众接口 //当前用户可以查看的受众接口
export const AUDIENCE_LIST = '/userbasic/audience/userAudiencesFilter post' export const AUDIENCE_LIST = "/userbasic/audience/userAudiencesFilter post";
export const USER_PERMISSION = '/userbasic/permission/listByUser post' export const USER_PERMISSION = "/userbasic/permission/listByUser post";
export const CASE_PAGE = '/systemapi/xboe/m/boe/cases/pagelist post formData' export const CASE_PAGE = "/systemapi/xboe/m/boe/cases/pagelist post formData";
export const EXAM_PAPER_PAGE = '/systemapi/xboe/m/exam/paper/querylist post formData' export const EXAM_PAPER_PAGE = "/systemapi/xboe/m/exam/paper/querylist post formData";
export const TEST_PAGE = '/api/b1/system/quiz/quiz-list post formData' export const TEST_PAGE = "/api/b1/system/quiz/quiz-list post formData";
export const ONLINE_PAGE = '/systemapi/xboe/m/course/manage/pagelist post formData' export const ONLINE_PAGE = "/systemapi/xboe/m/course/manage/pagelist post formData";
export const ONLINE_COURSE_DEL = (id, courseId) => `/systemapi/xboe/school/study/course/delete-signup?id=${id}&couserId=${courseId} post`;

View File

@@ -237,7 +237,7 @@ export function useRequest(_url, params = {}, init = true) {
}; };
} }
export async function boeRequest(_url, params) { export async function boeRequest(_url, params = {}) {
const s = _url.split(' ') const s = _url.split(' ')
let url = s[0] let url = s[0]
const method = s[1]?.toLowerCase() || 'get' const method = s[1]?.toLowerCase() || 'get'

View File

@@ -1,14 +1,14 @@
<template> <template>
<a-modal <a-modal
:visible="visiable" :visible="visiable"
:centered="true" :centered="true"
width="70%" width="70%"
title="学员管理" title="学员管理"
@cancel="closeDrawer" @cancel="closeDrawer"
> >
<div class="header-content"> <div class="header-content">
<div style="font-size: 16px"> <div style="font-size: 16px">
{{formData.name}} 课程 {{ formData.name }} 课程
</div> </div>
<div> <div>
<span style="color:#999">内容分类</span>12312 <span style="color:#999">内容分类</span>12312
@@ -22,24 +22,24 @@
</div> </div>
<div class="TableStudent"> <div class="TableStudent">
<a-row <a-row
type="flex" type="flex"
gutter="12" gutter="12"
style="padding-left: 20px; margin-right: 0px" style="padding-left: 20px; margin-right: 0px"
> >
<a-col> <a-col>
<a-form-item title="学员名称:"> <a-form-item title="学员名称:">
<a-input <a-input
class="cus-input" class="cus-input"
v-model:value="searchParams.studentName" v-model:value="searchParams.studentName"
placeholder="请输入学员名称" placeholder="请输入学员名称"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col> <a-col>
<a-button <a-button
class="cus-btn" class="cus-btn"
style="background: #4ea6ff; color: #fff; width: 100px" style="background: #4ea6ff; color: #fff; width: 100px"
@click="searchStu" @click="searchStu"
> >
<template #icon><img style="margin-right: 10px" src="../../assets/images/courseManage/search0.png"/> <template #icon><img style="margin-right: 10px" src="../../assets/images/courseManage/search0.png"/>
</template> </template>
@@ -55,17 +55,17 @@
</a-row> </a-row>
<a-row <a-row
type="flex" type="flex"
gutter="12" gutter="12"
style="padding-left: 20px; margin-right: 0px" style="padding-left: 20px; margin-right: 0px"
> >
<a-col :span="1.5"> <a-col :span="1.5">
<CommonStudent <CommonStudent
:type="type" :type="type"
title="添加在线课学员" title="添加在线课学员"
:id="id" :id="formData.id"
@finash="submitCall" @finash="submitCall"
:stage="stage" :stage="stage"
> >
<a-button class="cus-btn" style="background: #4ea6ff; color: #fff"> <a-button class="cus-btn" style="background: #4ea6ff; color: #fff">
<template #icon><img style="margin-right: 10px" src="../../assets/images/courseManage/add0.png"/> <template #icon><img style="margin-right: 10px" src="../../assets/images/courseManage/add0.png"/>
@@ -77,17 +77,16 @@
</a-row> </a-row>
<div style="margin-top: 20px"> <div style="margin-top: 20px">
<a-table <a-table
:columns="columns" :columns="columns"
:data-source="studentList" :data-source="studentList"
:pagination="stuPagination" :pagination="stuPagination"
:loading="loading" :loading="loading"
row-key="id" row-key="id"
:row-selection="stuRowSelection"
> >
<template #action="{ record }"> <template #action="{ record }">
<a-space :size="2"> <a-space :size="2">
<slot name="extension" v-bind:data="{ record }"></slot> <slot name="extension" v-bind:data="{ record }"></slot>
<a-button v-if="checkPer(permissions)" @click="del(record.id)" type="link" danger>删除</a-button> <a-button v-if="checkPer(permissions)" @click="del(record.courseStuId)" type="link" danger>删除</a-button>
</a-space> </a-space>
</template> </template>
</a-table> </a-table>
@@ -96,22 +95,20 @@
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import {computed, createVNode, defineExpose, defineProps, ref, watch} from "vue"; import {computed, defineExpose, defineProps, ref, watch} from "vue";
import {usePage} from "@/api/request"; import {boeRequest, usePage} from "@/api/request";
import {STUDENT_LIST} from "@/api/apis"; import {STUDENT_LIST} from "@/api/apis";
import {delStudentList} from "@/api/index1";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
import {Modal} from "ant-design-vue";
import CommonStudent from "@/components/student/CommonStudent"; import CommonStudent from "@/components/student/CommonStudent";
import {checkPer} from "@/utils/utils"; import {checkPer} from "@/utils/utils";
import dialog from "@/utils/dialog";
import {ONLINE_COURSE_DEL} from "@/api/ThirdApi";
const props = defineProps({ const props = defineProps({
permissions: { permissions: {
type: String, type: String,
default: '' default: ""
}, },
type: Number, type: Number,
id: String,
stage: { stage: {
type: Array, type: Array,
default: () => [], default: () => [],
@@ -128,20 +125,20 @@ const initParams = {
studentName: "", studentName: "",
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
type: props.type || '', type: props.type || "",
types: props.types, types: props.types,
pid: props.id || '', pid: props.id || "",
} };
const searchParams = ref(initParams) const searchParams = ref(initParams);
const searchName = ref('') const searchName = ref("");
const columns = ref([ const columns = ref([
{ {
title: "姓名", title: "姓名",
dataIndex: "studentName", dataIndex: "studentName",
key: "studentName", key: "studentName",
width: 30, width: 50,
align: "center", align: "center",
ellipsis: true, ellipsis: true,
}, },
@@ -161,19 +158,89 @@ const columns = ref([
align: "center", align: "center",
ellipsis: true, ellipsis: true,
}, },
{
title: "岗位",
dataIndex: "studentJobName",
key: "studentJobName",
width: 80,
align: "center",
ellipsis: true,
},
{
title: "Band",
dataIndex: "studentBandDesc",
key: "studentBandDesc",
width: 80,
align: "center",
ellipsis: true,
},
{
title: "报名状态",
dataIndex: "studentDepartName",
key: "studentDepartName",
width: 80,
align: "center",
ellipsis: true,
customRender: () => "已报名",
},
{
title: "加入方式",
dataIndex: "studentDepartName",
key: "studentDepartName",
width: 80,
align: "center",
ellipsis: true,
customRender: () => "手动加入",
},
{
title: "数据来源",
dataIndex: "id",
key: "id",
width: 80,
align: "center",
ellipsis: true,
customRender: () => "-",
},
{
title: "评估状态",
dataIndex: "status",
key: "status",
width: 80,
align: "center",
ellipsis: true,
customRender: () => "-",
},
{
title: "考试成绩",
dataIndex: "score",
key: "score",
width: 80,
align: "center",
ellipsis: true,
customRender: ({ record: { score } }) => score || "-",
},
{
title: "状态",
dataIndex: "status",
key: "status",
width: 80,
align: "center",
ellipsis: true,
customRender: ({ record: { status } }) => status ? "已完成" : "未开始",
},
{ {
title: "操作", title: "操作",
dataIndex: "operation", dataIndex: "operation",
key: "operation", key: "operation",
width: 50, width: 50,
align: "center", align: "center",
slots: {customRender: "action"}, slots: { customRender: "action" },
}, },
]) ]);
const formData = ref({}) const formData = ref({});
const {data: studentList, fetch: searchStu, total, loading} = usePage(STUDENT_LIST, searchParams) const { data: studentList, fetch: searchStu, total, loading } = usePage(STUDENT_LIST, searchParams, false);
const stuPagination = computed(() => ({ const stuPagination = computed(() => ({
total: total.value, total: total.value,
@@ -183,23 +250,13 @@ const stuPagination = computed(() => ({
onChange: changePagination onChange: changePagination
})); }));
const stuSelectKeys = ref([]);
const stuRowSelection = computed(() => ({
columnWidth: 20,
selectedRowKeys: stuSelectKeys.value,
onChange: onStuSelectChange,
preserveSelectedRowKeys: true,
}));
function onStuSelectChange(e) {
stuSelectKeys.value = e;
}
const openDrawer = (raw) => { const openDrawer = (raw) => {
console.log(raw); console.log(raw);
formData.value = raw searchParams.value.pid = raw.id;
formData.value = raw;
visiable.value = true; visiable.value = true;
searchStu();
}; };
const changePagination = (page) => { const changePagination = (page) => {
@@ -207,20 +264,17 @@ const changePagination = (page) => {
}; };
function del(id) { function del(id) {
Modal.confirm({ dialog({ content: "确定删除?", ok: async () => {
title: () => '确定删除?',
icon: () => createVNode(ExclamationCircleOutlined),
content: () => '数据删除后不可恢复!',
okText: () => '确定',
okType: 'danger',
cancelText: () => '取消',
onOk() {
if (id) { if (id) {
loading.value = true loading.value = true;
delStudentList({ids: [id]}).then(() => searchStu()) await boeRequest(ONLINE_COURSE_DEL(id, formData.value.id))
searchStu()
} }
}, }});
}); }
function submitCall(flag) {
flag && searchStu();
} }
const closeDrawer = () => { const closeDrawer = () => {
@@ -228,13 +282,13 @@ const closeDrawer = () => {
}; };
function reset() { function reset() {
searchParams.value = initParams searchParams.value = initParams;
searchName.value = '' searchName.value = "";
} }
watch(visiable, () => { watch(visiable, () => {
visiable.value && searchStu() visiable.value && searchStu();
searchParams.value = initParams searchParams.value = initParams;
}); });
defineExpose({ defineExpose({
@@ -242,7 +296,7 @@ defineExpose({
loading, loading,
closeDrawer, closeDrawer,
openDrawer openDrawer
}) });
</script> </script>
<style lang="scss"> <style lang="scss">
.header-content { .header-content {

View File

@@ -32,6 +32,7 @@ const stuRef = ref()
onMounted(() => { onMounted(() => {
window.openSelectStu = stuRef.value.openDrawer window.openSelectStu = stuRef.value.openDrawer
}) })
</script> </script>
<style lang="scss"> <style lang="scss">
.courseManage { .courseManage {