feat: 文章,项目,课程接口联调

This commit is contained in:
mx00085@163.com
2023-03-28 18:09:48 +08:00
parent 76413d767a
commit e2740bf00e
5 changed files with 929 additions and 333 deletions

12
src/api/indexProject.js Normal file
View File

@@ -0,0 +1,12 @@
import http from "./configz";
import https from './confign'
// 请求组织接口
export const userGetUserOrg = (obj) => https.post('/user/getUserOrg', obj)
// 请求所属组织接口
export const userInfo = (obj) => https.post('/user/info', obj)
// 项目列表
export const boeuProjectPageList = (obj) => http.post('/boeu/project/pageList', obj)
// 文章列表
export const boeuArticlePageList = (obj) => http.post('/boeu/article/pageList', obj )
// 课程分页列表
export const boeuCourseListPageV2 = (obj) => http.post('/boeu/course/List/page/v2', obj )

View File

@@ -3,20 +3,13 @@
<div class="article"> <div class="article">
<!-- 以下为顶部搜索框 --> <!-- 以下为顶部搜索框 -->
<div class="filter"> <div class="filter">
<div class="select addTimeBox">
<a-range-picker
style="width: 100%"
format="YYYY-MM-DD"
separator="至"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
<div class="select"> <div class="select">
<a-input <a-input
style="width: 100%; height: 40px; border-radius: 8px" style="width: 100%; height: 40px; border-radius: 8px"
placeholder="请输入文章名称" placeholder="请输入文章名称"
allowClear allowClear
showSearch showSearch
v-model:value="title"
> >
</a-input> </a-input>
</div> </div>
@@ -26,15 +19,16 @@
placeholder="请输入创建者" placeholder="请输入创建者"
allowClear allowClear
showSearch showSearch
v-model:value="createName"
> >
</a-input> </a-input>
</div> </div>
<div style="display: flex; margin-bottom: 20px"> <div style="display: flex; margin-bottom: 20px">
<div class="btnn btn1"> <div class="btnn btn1" @click="getTableData">
<div class="search"></div> <div class="search"></div>
<div class="btnText">搜索</div> <div class="btnText">搜索</div>
</div> </div>
<div class="btn btn2"> <div class="btn btn2" @click="resetClick">
<div class="search"></div> <div class="search"></div>
<div class="btnText">重置</div> <div class="btnText">重置</div>
</div> </div>
@@ -42,7 +36,7 @@
</div> </div>
<!-- 以下为导出按钮 --> <!-- 以下为导出按钮 -->
<div class="btns"> <div class="btns">
<div class="btn btn3"> <div class="btn btn3" @click="exportAll">
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出</div> <div class="btnText">导出</div>
</div> </div>
@@ -55,7 +49,40 @@
:loading="tableLoading" :loading="tableLoading"
:scroll="{ x: 700 }" :scroll="{ x: 700 }"
:pagination="false" :pagination="false"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
> >
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'publishTime'">
<a-tooltip placement="topRight">
<template #title>
<span>{{
record.publishTime &&
dayjs(record.publishTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</template>
<span>{{
record.publishTime &&
dayjs(record.publishTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</a-tooltip>
</template>
<template v-if="column.key === 'status'">
<span>{{
record.status == "1"
? "草稿"
: record.status == "2"
? "已提交待审核"
: record.status == "3"
? "审核不通过"
: record.status == "9"
? "已发布"
: ""
}}</span>
</template>
</template>
</a-table> </a-table>
<div class="tableBox"> <div class="tableBox">
<div class="pa"> <div class="pa">
@@ -76,116 +103,196 @@
</div> </div>
</template> </template>
<script> <script>
import { ref, toRefs, reactive } from "vue"; import { ref, toRefs, reactive, onMounted } from "vue";
import * as api from "../../api/indexProject";
import dayjs from "dayjs";
import axios from "axios";
import Cookies from "vue-cookies";
import downLoad from "../../utils/downLoad";
import { message } from "ant-design-vue";
export default { export default {
name: "ArticlE", name: "ArticlE",
setup() { setup() {
const state = reactive({ const state = reactive({
tableLoading: false, // table加载图标 tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数 tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数 pageSize: 10, // 每页条数
pageNo: 1, //当前页码 pageNo: 1, //当前页码
createName: "", //创建者名称
title: "", // 文章名称
selectedRowKeys: [], // 选中的列
}); });
//导出
const exportAll = async () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "post",
url: "/report/boeu/article/exportAll",
data: { ids: state.selectedRowKeys },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "文章.xlsx");
},
(err) => {
message.error(err);
}
);
} else {
const params = { page: state.pageNo, size: state.pageSize };
if (state.title) {
params.title = state.title;
}
if (state.createName) {
params.createName = state.createName;
}
axios({
method: "post",
url: "/report/boeu/article/exportAll",
data: params,
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "文章.xlsx");
},
(err) => {
message.error(err);
}
);
}
};
// 表格数据 // 表格数据
// 表格数据 const getTableData = async () => {
state.tableLoading = true;
const params = { page: state.pageNo, size: state.pageSize };
if (state.title) {
params.title = state.title;
}
if (state.createName) {
params.createName = state.createName;
}
let tableData = ref([ const res = await api.boeuArticlePageList(params);
{ name: "0000255", manager: "565656" }, if (res) {
{ name: "0000255", manager: "565656" }, state.tableLoading = false;
{ name: "0000255", manager: "565656" }, state.tableDataTotal = res.data.total;
{ name: "0000255", manager: "565656" }, const list =res.data.rows?.map((item)=>{
{ name: "0000255", manager: "565656" }, return {
{ name: "0000255", manager: "565656" }, ...item,
{ name: "0000255", manager: "565656" }, key:item.id
{ name: "0000255", manager: "565656" }, }
{ name: "0000255", manager: "565656" }, })
{ name: "0000255", manager: "565656" }, tableData.value = list;
{ name: "0000255", manager: "565656" }, }
{ name: "0000255", manager: "565656" }, };
]); const resetClick = () => {
state.createName = "";
state.title = "";
getTableData();
};
let tableData = ref([]);
// cloumns 表头 // cloumns 表头
const columns = ref([ const columns = ref([
{ {
title: "文章名称", title: "文章名称",
dataIndex: "age", dataIndex: "title",
ellipsis: true, ellipsis: true,
key: "manager", key: "title",
align: "center", align: "center",
}, },
{ {
title: "归属组织", title: "归属组织",
dataIndex: "manager", dataIndex: "orgName",
ellipsis: true, ellipsis: true,
key: "manager", key: "orgName",
align: "center", align: "center",
}, },
{ {
title: "浏览量", title: "浏览量",
dataIndex: "manager", dataIndex: "views",
ellipsis: true, ellipsis: true,
key: "manager", key: "views",
align: "center", align: "center",
}, },
{ {
title: "评论数", title: "评论数",
dataIndex: "manager", dataIndex: "comments",
ellipsis: true, ellipsis: true,
key: "manager", key: "comments",
align: "center", align: "center",
}, },
{ {
title: "分享量", title: "分享量",
dataIndex: "manager", dataIndex: "shares",
ellipsis: true, ellipsis: true,
key: "manager", key: "shares",
align: "center", align: "center",
}, },
{ {
title: "点赞量", title: "点赞量",
dataIndex: "manager", dataIndex: "praises",
ellipsis: true, ellipsis: true,
key: "manager", key: "praises",
align: "center", align: "center",
}, },
{ {
title: "收藏数", title: "收藏数",
dataIndex: "manager", dataIndex: "favorites",
ellipsis: true, ellipsis: true,
key: "manager", key: "favorites",
align: "center", align: "center",
}, },
{ {
title: "发布时间", title: "发布时间",
dataIndex: "manager", dataIndex: "publishTime",
ellipsis: true, ellipsis: true,
key: "manager", key: "publishTime",
align: "center", align: "center",
}, },
{ {
title: "文章状态", title: "文章状态",
dataIndex: "manager", dataIndex: "status",
ellipsis: true, ellipsis: true,
key: "manager", key: "status",
align: "center", align: "center",
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "manager", dataIndex: "sysCreateBy",
ellipsis: true, ellipsis: true,
key: "manager", key: "sysCreateBy",
align: "center", align: "center",
}, },
]); ]);
// table选中
const onSelectChange = (selectedRowKeys) => {
state.selectedRowKeys = selectedRowKeys;
};
//table 分页事件 //table 分页事件
const changePagination = (page) => { const changePagination = (page) => {
state.pageNo = page; state.pageNo = page;
getTableData();
}; };
onMounted(() => {
getTableData();
state.tableLoading = true;
});
return { return {
...toRefs(state), ...toRefs(state),
dayjs,
onSelectChange,
resetClick,
tableData, tableData,
columns, columns,
changePagination, changePagination,
getTableData,
exportAll,
}; };
}, },
}; };
@@ -205,31 +312,8 @@ export default {
.select { .select {
margin-right: 20px; margin-right: 20px;
margin-bottom: 20px; margin-bottom: 20px;
width: calc((100% - 76px - 340px) / 3); width: calc((100% - 76px - 200px) / 2);
} }
.addTimeBox {
width: calc((100% - 76px - 340px) / 3 + 120px) !important;
position: relative;
display: flex;
align-items: center;
.addTime {
position: absolute;
z-index: 10;
margin-left: 10px;
color: rgba(0, 0, 0, 0.4);
}
// .ant-picker {
// padding-left: 85px;
// }
.ant-picker-range .ant-picker-active-bar {
margin-left: 85px;
}
}
.btn { .btn {
padding: 0px 26px 0px 26px; padding: 0px 26px 0px 26px;
height: 38px; height: 38px;

View File

@@ -9,21 +9,31 @@
placeholder="请输入课程名称" placeholder="请输入课程名称"
allowClear allowClear
showSearch showSearch
v-model:value="name"
> >
</a-input> </a-input>
</div> </div>
<div class="select"> <div class="select">
<a-select <a-cascader
:options="option"
placeholder="请选择组织"
v-model:value="orgId"
:allowClear="allowClear"
style="width: 100%" style="width: 100%"
placeholder="请选择归属组织" :fieldNames="{
allowClear label: 'name',
></a-select> value: 'id',
children: 'treeChildList',
}"
>
</a-cascader>
</div> </div>
<div class="select"> <div class="select">
<a-select <a-select
style="width: 100%" style="width: 100%"
placeholder="请选择分类" placeholder="请选择分类"
allowClear allowClear
v-model:value="type"
></a-select> ></a-select>
</div> </div>
<div class="select"> <div class="select">
@@ -32,23 +42,16 @@
placeholder="请输入创建者" placeholder="请输入创建者"
allowClear allowClear
showSearch showSearch
v-model:value="createName"
> >
</a-input> </a-input>
</div> </div>
<div class="select addTimeBox">
<a-range-picker
style="width: 100%"
format="YYYY-MM-DD"
separator="至"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
<div style="display: flex; margin-bottom: 20px"> <div style="display: flex; margin-bottom: 20px">
<div class="btnn btn1"> <div class="btnn btn1" @click="getTableData">
<div class="search"></div> <div class="search"></div>
<div class="btnText">搜索</div> <div class="btnText">搜索</div>
</div> </div>
<div class="btn btn2"> <div class="btn btn2" @click="resetClick">
<div class="search"></div> <div class="search"></div>
<div class="btnText">重置</div> <div class="btnText">重置</div>
</div> </div>
@@ -56,15 +59,15 @@
</div> </div>
<!-- 以下为导出按钮 --> <!-- 以下为导出按钮 -->
<div class="btns"> <div class="btns">
<div class="btn btn3"> <div class="btn btn3" @click="exportList">
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出列表信息</div> <div class="btnText">导出列表信息</div>
</div> </div>
<div class="btn btn3" style="margin-left: 20px"> <div class="btn btn3" style="margin-left: 20px" @click="exportDetail">
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出详细信息</div> <div class="btnText">导出详细信息</div>
</div> </div>
<div class="btn btn3" style="margin-left: 20px"> <div class="btn btn3" style="margin-left: 20px" @click="exportPlanList">
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">开课数据导出</div> <div class="btnText">开课数据导出</div>
</div> </div>
@@ -72,12 +75,37 @@
<!-- 以下为table表格 --> <!-- 以下为table表格 -->
<div class="tableBox"> <div class="tableBox">
<a-table <a-table
rowKey="boeCourseId"
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
:loading="tableLoading" :loading="tableLoading"
:scroll="{ x: 700 }" :scroll="{ x: 700 }"
:pagination="false" :pagination="false"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
> >
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'courseType'">
<span>{{
record.courseType == "0"
? "在线"
: record.courseType == "1"
? "面授"
: record.courseType
}}</span>
</template>
<template v-if="column.key === 'projectStatus'">
<span>{{
record.status == "0"
? "未发布"
: record.status == "1"
? "已发布"
: ""
}}</span>
</template>
</template>
</a-table> </a-table>
<div class="tableBox"> <div class="tableBox">
<div class="pa"> <div class="pa">
@@ -98,184 +126,222 @@
</div> </div>
</template> </template>
<script> <script>
import { ref, toRefs, reactive } from "vue"; import { ref, toRefs, reactive, onMounted } from "vue";
import * as api from "../../api/indexProject";
// import dayjs from "dayjs";
import axios from "axios";
import Cookies from "vue-cookies";
import downLoad from "../../utils/downLoad";
import { message } from "ant-design-vue";
export default { export default {
name: "CurriculuM", name: "CurriculuM",
setup() { setup() {
const state = reactive({ const state = reactive({
tableLoading: false, // table加载图标 tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数 tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数 pageSize: 10, // 每页条数
pageNo: 1, //当前页码 pageNo: 1, //当前页码
orgId: null,
resetOrgId: null,
name: "",
type: null,
createName: "",
allowClear: true,
option: [],
selectedRowKeys: [],
}); });
// 表格数据 // 分类选项接口
// 表格数据 const getOption = async () => {
let tableData = ref([ };
{ name: "0000255", manager: "565656" }, //请求组织接口
{ name: "0000255", manager: "565656" }, const getOrgList = async () => {
{ name: "0000255", manager: "565656" }, const res = await api.userGetUserOrg({});
{ name: "0000255", manager: "565656" }, if (res) {
{ name: "0000255", manager: "565656" }, state.option = res.data?.result?.list;
{ name: "0000255", manager: "565656" }, state.orgId = res.data?.result?.treeNodeList;
{ name: "0000255", manager: "565656" }, state.resetOrgId = res.data?.result?.treeNodeList;
{ name: "0000255", manager: "565656" }, res.data?.result?.userType === 1
{ name: "0000255", manager: "565656" }, ? (state.allowClear = true)
{ name: "0000255", manager: "565656" }, : (state.allowClear = false);
{ name: "0000255", manager: "565656" }, getTableData();
{ name: "0000255", manager: "565656" }, }
]); };
const getTableData = async () => {
state.tableLoading = true;
const params = {
name: state.name,
organizationId: state.orgId
? state.orgId[state.orgId.length - 1]
: null,
pageNo: state.pageNo,
pageSize: state.pageSize,
type: state.type,
createName: state.createName,
};
const res = await api.boeuCourseListPageV2(params);
if (res) {
tableData.value = res.data.rows;
state.tableDataTotal = res.data.total;
state.tableLoading = false;
}
};
let tableData = ref([]);
// table选中
const onSelectChange = (selectedRowKeys) => {
state.selectedRowKeys = selectedRowKeys;
};
// cloumns 表头 // cloumns 表头
const columns = ref([ const columns = ref([
{ {
title: "编号", title: "编号",
dataIndex: "age", dataIndex: "id",
ellipsis: true, ellipsis: true,
key: "manager", key: "id",
align: "center", align: "center",
width: 80, width: 80,
}, },
{ {
title: "课程名称", title: "课程名称",
dataIndex: "age", dataIndex: "name",
ellipsis: true, ellipsis: true,
key: "manager", key: "name",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "类型", title: "类型",
dataIndex: "manager", dataIndex: "courseType",
ellipsis: true, ellipsis: true,
key: "manager", key: "courseType",
align: "center", align: "center",
width: 80, width: 80,
}, },
{ {
title: "归属组织", title: "归属组织",
dataIndex: "manager", dataIndex: "organizationName",
ellipsis: true, ellipsis: true,
key: "manager", key: "organizationName",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "归属路径图", title: "归属路径图",
dataIndex: "manager", dataIndex: "routerName",
ellipsis: true, ellipsis: true,
key: "manager", key: "routerName",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "归属项目", title: "归属项目",
dataIndex: "manager", dataIndex: "projectName",
ellipsis: true, ellipsis: true,
key: "manager", key: "projectName",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "一级分类", title: "一级分类",
dataIndex: "manager", dataIndex: "oneType",
ellipsis: true, ellipsis: true,
key: "manager", key: "oneType",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "二级分类", title: "二级分类",
dataIndex: "manager", dataIndex: "twoType",
ellipsis: true, ellipsis: true,
key: "manager", key: "twoType",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "三级分类", title: "三级分类",
dataIndex: "manager", dataIndex: "threeType",
ellipsis: true, ellipsis: true,
key: "manager", key: "threeType",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "授课教师", title: "授课教师",
dataIndex: "manager", dataIndex: "teacher",
ellipsis: true, ellipsis: true,
key: "manager", key: "teacher",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "开课次数", title: "开课次数",
dataIndex: "manager", dataIndex: "classTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "classTotal",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "学习总人数", title: "学习总人数",
dataIndex: "manager", dataIndex: "learnerNumber",
ellipsis: true, ellipsis: true,
key: "manager", key: "learnerNumber",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "评论数", title: "评论数",
dataIndex: "manager", dataIndex: "commentTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "commentTotal",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "点赞数", title: "点赞数",
dataIndex: "manager", dataIndex: "likesTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "likesTotal",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "收藏数", title: "收藏数",
dataIndex: "manager", dataIndex: "collectionsTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "collectionsTotal",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "平均评分", title: "平均评分",
dataIndex: "manager", dataIndex: "score",
ellipsis: true, ellipsis: true,
key: "manager", key: "score",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "发布时间", title: "发布时间",
dataIndex: "manager", dataIndex: "publishTime",
ellipsis: true, ellipsis: true,
key: "manager", key: "publishTime",
align: "center", align: "center",
width: 140, width: 140,
}, },
{ {
title: "课程状态", title: "课程状态",
dataIndex: "manager", dataIndex: "publishStatus",
ellipsis: true, ellipsis: true,
key: "manager", key: "publishStatus",
align: "center", align: "center",
width: 120, width: 120,
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "manager", dataIndex: "createName",
ellipsis: true, ellipsis: true,
key: "manager", key: "createName",
align: "center", align: "center",
width: 120, width: 120,
}, },
@@ -286,21 +352,210 @@ export default {
width: 150, width: 150,
align: "center", align: "center",
fixed: "right", fixed: "right",
customRender: () => { customRender: (record) => {
return <a>导出详细信息</a>; return (
<a
onClick={() => {
exportDetailClick(record.record.boeCourseId);
}}
>
导出详细信息
</a>
);
}, },
}, },
]); ]);
//table 分页事件 //table 分页事件
const changePagination = (page) => { const changePagination = (page) => {
state.pageNo = page; state.pageNo = page;
getTableData()
};
onMounted(() => {
getOrgList();
state.tableLoading = true;
});
const resetClick = () => {
state.name = "";
state.orgId = state.resetOrgId;
state.pageNo = 1;
state.pageSize = 10;
state.type = null;
state.createName = "";
getTableData();
};
const exportList = () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "post",
url: "/report/boeu/course/list/export/v2",
data: { ids: state.selectedRowKeys },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "课程列表.xlsx");
},
(err) => {
message.error(err);
}
);
} else {
const params = {
name: state.name,
organizationId: state.orgId
? state.orgId[state.orgId.length - 1]
: null,
pageNo: state.pageNo,
pageSize: state.pageSize,
type: state.type,
createName: state.createName,
};
axios({
method: "post",
url: "/report/boeu/course/list/export/v2",
data: params,
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "课程列表.xlsx");
},
(err) => {
message.error(err);
}
);
}
};
const exportDetail = async () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "post",
url: "/report/boeu/course/list/detail/export/v2",
data: { ids: state.selectedRowKeys },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "课程详细信息.xlsx");
},
(err) => {
message.error(err);
}
);
} else {
const params = {
name: state.name,
organizationId: state.orgId
? state.orgId[state.orgId.length - 1]
: null,
pageNo: state.pageNo,
pageSize: state.pageSize,
type: state.type,
createName: state.createName,
};
axios({
method: "post",
url: "/report/boeu/course/list/detail/export/v2",
data: params,
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "课程详细信息.xlsx");
},
(err) => {
message.error(err);
}
);
}
};
const exportDetailClick = async (id) => {
axios({
method: "post",
url: "/report/boeu/course/list/detail/export/v2",
data: { ids: [id] },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "课程详细信息.xlsx");
},
(err) => {
message.error(err);
}
);
};
const exportPlanList = async () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "post",
url: "/report/boeu/course/plan/list/export/v2",
data: { ids: state.selectedRowKeys },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "开课数据.xlsx");
},
(err) => {
message.error(err);
}
);
} else {
const params = {
name: state.name,
organizationId: state.orgId
? state.orgId[state.orgId.length - 1]
: null,
pageNo: state.pageNo,
pageSize: state.pageSize,
type: state.type,
createName: state.createName,
};
axios({
method: "post",
url: "/report/boeu/course/plan/list/export/v2",
data: params,
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "开课数据.xlsx");
},
(err) => {
message.error(err);
}
);
}
}; };
return { return {
...toRefs(state), ...toRefs(state),
exportPlanList,
exportDetail,
exportList,
getTableData,
tableData, tableData,
columns, columns,
changePagination, changePagination,
getOrgList,
resetClick,
onSelectChange,
exportDetailClick,
getOption,
}; };
}, },
}; };
@@ -320,29 +575,7 @@ export default {
.select { .select {
margin-right: 20px; margin-right: 20px;
margin-bottom: 20px; margin-bottom: 20px;
width: calc((100% - 76px - 370px) / 5); width: calc((100% - 76px - 240px) / 4);
}
.addTimeBox {
width: calc((100% - 76px - 360px) / 5 + 120px) !important;
position: relative;
display: flex;
align-items: center;
.addTime {
position: absolute;
z-index: 10;
margin-left: 10px;
color: rgba(0, 0, 0, 0.4);
}
// .ant-picker {
// padding-left: 85px;
// }
.ant-picker-range .ant-picker-active-bar {
margin-left: 85px;
}
} }
.btn { .btn {

View File

@@ -651,7 +651,7 @@ export default {
createName: state.creator, createName: state.creator,
projectName: state.name, projectName: state.name,
}); });
if (res) {
const fun = (arr) => { const fun = (arr) => {
const list = arr.map((item) => { const list = arr.map((item) => {
let children; let children;
@@ -670,6 +670,7 @@ export default {
state.tableDataTotal = res.data.total; state.tableDataTotal = res.data.total;
state.tableLoading = false; state.tableLoading = false;
} }
}
}; };
const searchClick = () => { const searchClick = () => {
state.pageNo = 1; state.pageNo = 1;

View File

@@ -9,21 +9,32 @@
placeholder="请输入项目名称" placeholder="请输入项目名称"
allowClear allowClear
showSearch showSearch
v-model:value="projectName"
> >
</a-input> </a-input>
</div> </div>
<div class="select"> <div class="select">
<a-select <a-cascader
:options="option"
placeholder="请选择组织"
v-model:value="orgId"
:allowClear="allowClear"
style="width: 100%" style="width: 100%"
placeholder="请选择归属组织" :fieldNames="{
allowClear label: 'name',
></a-select> value: 'id',
children: 'treeChildList',
}"
>
</a-cascader>
</div> </div>
<div class="select"> <div class="select">
<a-select <a-select
style="width: 100%" style="width: 100%"
placeholder="项目状态" placeholder="项目状态"
allowClear allowClear
:options="stateOptions"
v-model:value="status"
></a-select> ></a-select>
</div> </div>
<div class="select"> <div class="select">
@@ -32,23 +43,16 @@
placeholder="请输入创建者" placeholder="请输入创建者"
allowClear allowClear
showSearch showSearch
v-model:value="createName"
> >
</a-input> </a-input>
</div> </div>
<div class="select addTimeBox">
<a-range-picker
style="width: 100%"
format="YYYY-MM-DD"
separator="至"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
<div style="display: flex; margin-bottom: 20px"> <div style="display: flex; margin-bottom: 20px">
<div class="btnn btn1"> <div class="btnn btn1" @click="getTableData">
<div class="search"></div> <div class="search"></div>
<div class="btnText">搜索</div> <div class="btnText">搜索</div>
</div> </div>
<div class="btn btn2"> <div class="btn btn2" @click="reset">
<div class="search"></div> <div class="search"></div>
<div class="btnText">重置</div> <div class="btnText">重置</div>
</div> </div>
@@ -56,11 +60,15 @@
</div> </div>
<!-- 以下为导出按钮 --> <!-- 以下为导出按钮 -->
<div class="btns"> <div class="btns">
<div class="btn btn3"> <div class="btn btn3" @click="exportAllClick">
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出列表信息</div> <div class="btnText">导出列表信息</div>
</div> </div>
<div class="btn btn3" style="margin-left: 20px"> <div
class="btn btn3"
style="margin-left: 20px"
@click="exportDetailClick"
>
<div><img src="../../assets/svg/export.png" alt="" /></div> <div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出详细信息</div> <div class="btnText">导出详细信息</div>
</div> </div>
@@ -73,7 +81,81 @@
:loading="tableLoading" :loading="tableLoading"
:scroll="{ x: 700 }" :scroll="{ x: 700 }"
:pagination="false" :pagination="false"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
> >
<template #bodyCell="{ column, record }">
<!-- 项目状态 -->
<template v-if="column.key === 'projectStatus'">
<span>{{
record.reportProjectOverview.length > 0
? "-"
: record.status == "0"
? "-"
: record.status == "1"
? "提交待审核"
: record.status == "2"
? "审核通过"
: record.status == "3"
? "已经发布"
: record.status == "4"
? "发布"
: record.status == "-1"
? "已结束"
: record.status == "-2"
? "删除"
: record.status == "-3"
? "撤回审核"
: record.status == "-4"
? "撤回发布"
: record.status == "-5"
? "拒绝"
: record.status == "-6"
? "撤回已结束"
: ""
}}</span>
</template>
<template v-if="column.key === 'publishTime'">
<a-tooltip placement="topRight">
<template #title>
<span>{{
record.publishTime &&
dayjs(record.publishTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</template>
<span>{{
record.publishTime &&
dayjs(record.publishTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</a-tooltip>
</template>
<template v-if="column.key === 'proTime'">
<a-tooltip placement="topRight">
<template #title>
<span
>{{
record.beginTime &&
dayjs(record.beginTime).format("YYYY-MM-DD HH:mm:ss")
}}~{{
record.endTime &&
dayjs(record.endTime).format("YYYY-MM-DD HH:mm:ss")
}}</span
>
</template>
<span
>{{
record.beginTime &&
dayjs(record.beginTime).format("YYYY-MM-DD HH:mm:ss")
}}~{{
record.endTime &&
dayjs(record.endTime).format("YYYY-MM-DD HH:mm:ss")
}}</span
>
</a-tooltip>
</template>
</template>
</a-table> </a-table>
<div class="tableBox"> <div class="tableBox">
<div class="pa"> <div class="pa">
@@ -94,172 +176,378 @@
</div> </div>
</template> </template>
<script> <script>
import { ref, toRefs, reactive } from "vue"; import { ref, toRefs, reactive, onMounted } from "vue";
import * as api from "../../api/indexProject";
import dayjs from "dayjs";
import axios from "axios";
import Cookies from "vue-cookies";
import downLoad from "../../utils/downLoad";
import { message } from "ant-design-vue";
export default { export default {
name: "ProjecT", name: "ProjecT",
setup() { setup() {
const state = reactive({ const state = reactive({
tableLoading: false, // table加载图标 tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数 tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数 pageSize: 10, // 每页条数
pageNo: 1, //当前页码 pageNo: 1, //当前页码
allowClear: false,
option: [],
orgId: null,
resetOrgId: [],
projectName: "",
createName: "",
selectedRowKeys: [], // 选中的列
status: null,
stateOptions: [
{
label: "草稿",
value: 0,
},
{
label: "提交待审核",
value: 1,
},
{
label: "审核通过",
value: 2,
},
{
label: "已经发布",
value: 3,
},
{
label: "发布",
value: 4,
},
{
label: "已结束",
value: -1,
},
{
label: "删除",
value: -2,
},
{
label: "撤回审核",
value: -3,
},
{
label: "撤回发布",
value: -4,
},
{
label: "拒绝",
value: -5,
},
{
label: "撤回已结束",
value: -6,
},
],
}); });
const exportAllClick = async () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "get",
url: "/report/boeu/project/export",
params: { ids: `${state.selectedRowKeys}` },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then((res) => {
downLoad(res.data, "项目.xlsx");
});
} else {
const params = {};
params.status = state.status;
params.orgId = state.orgId;
params.createName = state.createName;
params.projectName = state.projectName;
params.page = state.pageNo;
params.size = state.pageSize;
params.orgId = state.orgId ? state.orgId[state.orgId.length - 1] : null;
axios({
method: "post",
url: "/report/boeu/project/exportAll",
data: { params },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "项目详情.xlsx");
},
(err) => {
message.error(err);
}
);
}
};
// 导出详情接口
const exportDetailClick = async () => {
if (state.selectedRowKeys.length > 0) {
axios({
method: "post",
url: "/report/boeu/project/exportDetailAll",
data: { ids: state.selectedRowKeys },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "项目详情.xlsx");
},
(err) => {
message.error(err);
}
);
} else {
const params = {};
params.status = state.status;
params.orgId = state.orgId;
params.createName = state.createName;
params.projectName = state.projectName;
params.page = state.pageNo;
params.size = state.pageSize;
params.orgId = state.orgId ? state.orgId[state.orgId.length - 1] : null;
axios({
method: "post",
url: "/report/boeu/project/exportDetailAll",
data: { params },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then(
(res) => {
downLoad(res.data, "项目详情.xlsx");
},
(err) => {
message.error(err);
}
);
}
};
// 表格数据 // 表格数据
// 表格数据 let tableData = ref([]);
let tableData = ref([ // table选中
{ const onSelectChange = (selectedRowKeys) => {
key: 1, state.selectedRowKeys = selectedRowKeys;
name: "John Brown sr.", };
age: 60, //请求组织接口
address: "New York No. 1 Lake Park", const getOrgList = async () => {
children: [ const res = await api.userGetUserOrg({});
{ if (res) {
key: 11, state.option = res.data?.result?.list;
name: "John Brown", state.orgId = res.data?.result?.treeNodeList;
age: 42, state.resetOrgId = res.data?.result?.treeNodeList;
address: "New York No. 2 Lake Park", res.data?.result?.userType === 1
}, ? (state.allowClear = true)
{ : (state.allowClear = false);
key: 12, getTableData();
name: "John Brown jr.", }
age: 30, };
address: "New York No. 3 Lake Park", const reset = async () => {
children: [ state.tableLoading = true;
{ state.orgId = state.resetOrgId;
key: 121, state.pageNo = 1;
name: "Jimmy Brown", state.pageSize = 10;
age: 16, state.projectName = "";
address: "New York No. 3 Lake Park", state.createName = "";
}, state.status = null;
], getTableData();
}, };
{ // 获取table数据
key: 13, const getTableData = async () => {
name: "Jim Green sr.", state.tableLoading = true;
age: 72, const params = {};
address: "London No. 1 Lake Park", params.status = state.status;
children: [ params.orgId = state.orgId;
{ params.createName = state.createName;
key: 131, params.projectName = state.projectName;
name: "Jim Green", params.page = state.pageNo;
age: 42, params.size = state.pageSize;
address: "London No. 2 Lake Park", params.orgId = state.orgId ? state.orgId[state.orgId.length - 1] : null;
children: [ const res = await api.boeuProjectPageList(params);
{ if (res) {
key: 1311, const fun = (arr) => {
name: "Jim Green jr.", const list = arr.map((item) => {
age: 25, let children;
address: "London No. 3 Lake Park", if (item?.reportProjectOverview?.length) {
}, children = fun(item.reportProjectOverview);
{ }
key: 1312, return {
name: "Jimmy Green sr.", key: item.boeProjectInfoId,
age: 18, children: children,
address: "London No. 4 Lake Park", ...item,
}, };
], });
}, return list;
], };
}, tableData.value = fun(res.data.rows);
], state.tableDataTotal = res.data.total;
}, state.tableLoading = false;
{ }
key: 2, };
name: "Joe Black", //table 分页事件
age: 32, const changePagination = (page) => {
address: "Sidney No. 1 Lake Park", state.pageNo = page;
}, getTableData();
]); };
// cloumns 表头 // cloumns 表头
const columns = ref([ const columns = ref([
{ {
title: "项目名称", title: "名称",
dataIndex: "name", dataIndex: "projectName",
key: "projectName",
width: 120,
ellipsis: true, ellipsis: true,
key: "manager",
align: "left", align: "left",
fixed: "left",
}, },
{ {
title: "编号", title: "归属组织",
dataIndex: "age", dataIndex: "sourceBelongName",
ellipsis: true, ellipsis: true,
key: "manager", key: "sourceBelongName",
width: 120,
align: "center", align: "center",
fixed: "left",
}, },
{ {
title: "项目分类", title: "分类",
dataIndex: "age", dataIndex: "trainingType",
ellipsis: true, ellipsis: true,
key: "manager", key: "trainingType",
align: "center", width: 120,
},
{
title: "资源归属",
dataIndex: "manager",
ellipsis: true,
key: "manager",
align: "center", align: "center",
fixed: "left",
}, },
{ {
title: "阶段总数", title: "阶段总数",
dataIndex: "manager", dataIndex: "stageTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "stageTotal",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "任务总数", title: "任务总数",
dataIndex: "manager", dataIndex: "taskTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "taskTotal",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "参加人数", title: "学习人数",
dataIndex: "manager", dataIndex: "startLearnerTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "startLearnerTotal",
width: 120,
align: "center",
},
{
title: "参与人数",
dataIndex: "participantsTotal",
ellipsis: true,
key: "participantsTotal",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "完成人数", title: "完成人数",
dataIndex: "manager", dataIndex: "peopleCompletedTotal",
ellipsis: true, ellipsis: true,
key: "manager", key: "peopleCompletedTotal",
width: 120,
align: "center",
},
{
title: "项目时间",
dataIndex: "proTime",
ellipsis: true,
key: "proTime",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "发布时间", title: "发布时间",
dataIndex: "manager", dataIndex: "publishTime",
ellipsis: true, ellipsis: true,
key: "manager", key: "publishTime",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "项目状态", title: "状态",
dataIndex: "manager", dataIndex: "status",
ellipsis: true, ellipsis: true,
key: "manager", key: "projectStatus",
width: 120,
align: "center", align: "center",
}, },
{ {
title: "创建人", title: "创建人",
dataIndex: "manager", dataIndex: "createName",
ellipsis: true, ellipsis: true,
key: "manager", key: "manager",
width: 120,
align: "center", align: "center",
}, },
{
title: "操作",
dataIndex: "operation",
key: "operation",
width: 150,
align: "center",
fixed: "right",
customRender: (record) => {
return (
<a
onClick={() => {
exportOnly(record.record.boeProjectInfoId);
}}
>
导出学习记录
</a>
);
},
},
]); ]);
//table 分页事件 const exportOnly = async (id) => {
const changePagination = (page) => { axios({
state.pageNo = page; method: "post",
url: "/report/boeu/project/exportDetailAll",
data: { ids: [id] },
responseType: "blob",
headers: {
token: Cookies.get("token"),
},
}).then((res) => {
downLoad(res.data, "项目详情.xlsx");
});
}; };
onMounted(() => {
getOrgList();
state.tableLoading = true;
});
return { return {
...toRefs(state), ...toRefs(state),
getOrgList,
tableData, tableData,
dayjs,
columns, columns,
changePagination, changePagination,
getTableData,
reset,
onSelectChange,
exportDetailClick,
exportAllClick,
}; };
}, },
}; };
@@ -279,29 +567,7 @@ export default {
.select { .select {
margin-right: 20px; margin-right: 20px;
margin-bottom: 20px; margin-bottom: 20px;
width: calc((100% - 76px - 370px) / 5); width: calc((100% - 76px - 240px) / 4);
}
.addTimeBox {
width: calc((100% - 76px - 360px) / 5 + 120px) !important;
position: relative;
display: flex;
align-items: center;
.addTime {
position: absolute;
z-index: 10;
margin-left: 10px;
color: rgba(0, 0, 0, 0.4);
}
// .ant-picker {
// padding-left: 85px;
// }
.ant-picker-range .ant-picker-active-bar {
margin-left: 85px;
}
} }
.btn { .btn {