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="filter">
<div class="select addTimeBox">
<a-range-picker
style="width: 100%"
format="YYYY-MM-DD"
separator="至"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
<div class="select">
<a-input
style="width: 100%; height: 40px; border-radius: 8px"
placeholder="请输入文章名称"
allowClear
showSearch
v-model:value="title"
>
</a-input>
</div>
@@ -26,15 +19,16 @@
placeholder="请输入创建者"
allowClear
showSearch
v-model:value="createName"
>
</a-input>
</div>
<div style="display: flex; margin-bottom: 20px">
<div class="btnn btn1">
<div class="btnn btn1" @click="getTableData">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
<div class="btn btn2">
<div class="btn btn2" @click="resetClick">
<div class="search"></div>
<div class="btnText">重置</div>
</div>
@@ -42,7 +36,7 @@
</div>
<!-- 以下为导出按钮 -->
<div class="btns">
<div class="btn btn3">
<div class="btn btn3" @click="exportAll">
<div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出</div>
</div>
@@ -55,7 +49,40 @@
:loading="tableLoading"
:scroll="{ x: 700 }"
: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>
<div class="tableBox">
<div class="pa">
@@ -76,116 +103,196 @@
</div>
</template>
<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 {
name: "ArticlE",
setup() {
const state = reactive({
tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数
tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数
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([
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
]);
const res = await api.boeuArticlePageList(params);
if (res) {
state.tableLoading = false;
state.tableDataTotal = res.data.total;
const list =res.data.rows?.map((item)=>{
return {
...item,
key:item.id
}
})
tableData.value = list;
}
};
const resetClick = () => {
state.createName = "";
state.title = "";
getTableData();
};
let tableData = ref([]);
// cloumns 表头
const columns = ref([
{
title: "文章名称",
dataIndex: "age",
dataIndex: "title",
ellipsis: true,
key: "manager",
key: "title",
align: "center",
},
{
title: "归属组织",
dataIndex: "manager",
dataIndex: "orgName",
ellipsis: true,
key: "manager",
key: "orgName",
align: "center",
},
{
title: "浏览量",
dataIndex: "manager",
dataIndex: "views",
ellipsis: true,
key: "manager",
key: "views",
align: "center",
},
{
title: "评论数",
dataIndex: "manager",
dataIndex: "comments",
ellipsis: true,
key: "manager",
key: "comments",
align: "center",
},
{
title: "分享量",
dataIndex: "manager",
dataIndex: "shares",
ellipsis: true,
key: "manager",
key: "shares",
align: "center",
},
{
title: "点赞量",
dataIndex: "manager",
dataIndex: "praises",
ellipsis: true,
key: "manager",
key: "praises",
align: "center",
},
{
title: "收藏数",
dataIndex: "manager",
dataIndex: "favorites",
ellipsis: true,
key: "manager",
key: "favorites",
align: "center",
},
{
title: "发布时间",
dataIndex: "manager",
dataIndex: "publishTime",
ellipsis: true,
key: "manager",
key: "publishTime",
align: "center",
},
{
title: "文章状态",
dataIndex: "manager",
dataIndex: "status",
ellipsis: true,
key: "manager",
key: "status",
align: "center",
},
{
title: "创建人",
dataIndex: "manager",
dataIndex: "sysCreateBy",
ellipsis: true,
key: "manager",
key: "sysCreateBy",
align: "center",
},
]);
// table选中
const onSelectChange = (selectedRowKeys) => {
state.selectedRowKeys = selectedRowKeys;
};
//table 分页事件
const changePagination = (page) => {
state.pageNo = page;
getTableData();
};
onMounted(() => {
getTableData();
state.tableLoading = true;
});
return {
...toRefs(state),
dayjs,
onSelectChange,
resetClick,
tableData,
columns,
changePagination,
getTableData,
exportAll,
};
},
};
@@ -205,31 +312,8 @@ export default {
.select {
margin-right: 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 {
padding: 0px 26px 0px 26px;
height: 38px;

View File

@@ -9,21 +9,31 @@
placeholder="请输入课程名称"
allowClear
showSearch
v-model:value="name"
>
</a-input>
</div>
<div class="select">
<a-select
<a-cascader
:options="option"
placeholder="请选择组织"
v-model:value="orgId"
:allowClear="allowClear"
style="width: 100%"
placeholder="请选择归属组织"
allowClear
></a-select>
:fieldNames="{
label: 'name',
value: 'id',
children: 'treeChildList',
}"
>
</a-cascader>
</div>
<div class="select">
<a-select
style="width: 100%"
placeholder="请选择分类"
allowClear
v-model:value="type"
></a-select>
</div>
<div class="select">
@@ -32,23 +42,16 @@
placeholder="请输入创建者"
allowClear
showSearch
v-model:value="createName"
>
</a-input>
</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 class="btnn btn1">
<div class="btnn btn1" @click="getTableData">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
<div class="btn btn2">
<div class="btn btn2" @click="resetClick">
<div class="search"></div>
<div class="btnText">重置</div>
</div>
@@ -56,15 +59,15 @@
</div>
<!-- 以下为导出按钮 -->
<div class="btns">
<div class="btn btn3">
<div class="btn btn3" @click="exportList">
<div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出列表信息</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 class="btnText">导出详细信息</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 class="btnText">开课数据导出</div>
</div>
@@ -72,12 +75,37 @@
<!-- 以下为table表格 -->
<div class="tableBox">
<a-table
rowKey="boeCourseId"
:columns="columns"
:data-source="tableData"
:loading="tableLoading"
:scroll="{ x: 700 }"
: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>
<div class="tableBox">
<div class="pa">
@@ -98,184 +126,222 @@
</div>
</template>
<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 {
name: "CurriculuM",
setup() {
const state = reactive({
tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数
tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数
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" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
{ name: "0000255", manager: "565656" },
]);
};
//请求组织接口
const getOrgList = async () => {
const res = await api.userGetUserOrg({});
if (res) {
state.option = res.data?.result?.list;
state.orgId = res.data?.result?.treeNodeList;
state.resetOrgId = res.data?.result?.treeNodeList;
res.data?.result?.userType === 1
? (state.allowClear = true)
: (state.allowClear = false);
getTableData();
}
};
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 表头
const columns = ref([
{
title: "编号",
dataIndex: "age",
dataIndex: "id",
ellipsis: true,
key: "manager",
key: "id",
align: "center",
width: 80,
},
{
title: "课程名称",
dataIndex: "age",
dataIndex: "name",
ellipsis: true,
key: "manager",
key: "name",
align: "center",
width: 120,
},
{
title: "类型",
dataIndex: "manager",
dataIndex: "courseType",
ellipsis: true,
key: "manager",
key: "courseType",
align: "center",
width: 80,
},
{
title: "归属组织",
dataIndex: "manager",
dataIndex: "organizationName",
ellipsis: true,
key: "manager",
key: "organizationName",
align: "center",
width: 120,
},
{
title: "归属路径图",
dataIndex: "manager",
dataIndex: "routerName",
ellipsis: true,
key: "manager",
key: "routerName",
align: "center",
width: 120,
},
{
title: "归属项目",
dataIndex: "manager",
dataIndex: "projectName",
ellipsis: true,
key: "manager",
key: "projectName",
align: "center",
width: 120,
},
{
title: "一级分类",
dataIndex: "manager",
dataIndex: "oneType",
ellipsis: true,
key: "manager",
key: "oneType",
align: "center",
width: 120,
},
{
title: "二级分类",
dataIndex: "manager",
dataIndex: "twoType",
ellipsis: true,
key: "manager",
key: "twoType",
align: "center",
width: 120,
},
{
title: "三级分类",
dataIndex: "manager",
dataIndex: "threeType",
ellipsis: true,
key: "manager",
key: "threeType",
align: "center",
width: 120,
},
{
title: "授课教师",
dataIndex: "manager",
dataIndex: "teacher",
ellipsis: true,
key: "manager",
key: "teacher",
align: "center",
width: 120,
},
{
title: "开课次数",
dataIndex: "manager",
dataIndex: "classTotal",
ellipsis: true,
key: "manager",
key: "classTotal",
align: "center",
width: 120,
},
{
title: "学习总人数",
dataIndex: "manager",
dataIndex: "learnerNumber",
ellipsis: true,
key: "manager",
key: "learnerNumber",
align: "center",
width: 120,
},
{
title: "评论数",
dataIndex: "manager",
dataIndex: "commentTotal",
ellipsis: true,
key: "manager",
key: "commentTotal",
align: "center",
width: 120,
},
{
title: "点赞数",
dataIndex: "manager",
dataIndex: "likesTotal",
ellipsis: true,
key: "manager",
key: "likesTotal",
align: "center",
width: 120,
},
{
title: "收藏数",
dataIndex: "manager",
dataIndex: "collectionsTotal",
ellipsis: true,
key: "manager",
key: "collectionsTotal",
align: "center",
width: 120,
},
{
title: "平均评分",
dataIndex: "manager",
dataIndex: "score",
ellipsis: true,
key: "manager",
key: "score",
align: "center",
width: 120,
},
{
title: "发布时间",
dataIndex: "manager",
dataIndex: "publishTime",
ellipsis: true,
key: "manager",
key: "publishTime",
align: "center",
width: 140,
},
{
title: "课程状态",
dataIndex: "manager",
dataIndex: "publishStatus",
ellipsis: true,
key: "manager",
key: "publishStatus",
align: "center",
width: 120,
},
{
title: "创建人",
dataIndex: "manager",
dataIndex: "createName",
ellipsis: true,
key: "manager",
key: "createName",
align: "center",
width: 120,
},
@@ -286,21 +352,210 @@ export default {
width: 150,
align: "center",
fixed: "right",
customRender: () => {
return <a>导出详细信息</a>;
customRender: (record) => {
return (
<a
onClick={() => {
exportDetailClick(record.record.boeCourseId);
}}
>
导出详细信息
</a>
);
},
},
]);
//table 分页事件
const changePagination = (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 {
...toRefs(state),
exportPlanList,
exportDetail,
exportList,
getTableData,
tableData,
columns,
changePagination,
getOrgList,
resetClick,
onSelectChange,
exportDetailClick,
getOption,
};
},
};
@@ -320,29 +575,7 @@ export default {
.select {
margin-right: 20px;
margin-bottom: 20px;
width: calc((100% - 76px - 370px) / 5);
}
.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;
}
width: calc((100% - 76px - 240px) / 4);
}
.btn {

View File

@@ -651,24 +651,25 @@ export default {
createName: state.creator,
projectName: state.name,
});
const fun = (arr) => {
const list = arr.map((item) => {
let children;
if (item?.reportProjectOverview?.length) {
children = fun(item.reportProjectOverview);
}
return {
key: item.boeProjectInfoId,
children: children,
...item,
};
});
return list;
};
tableData.value = fun(res.data.rows);
state.tableDataTotal = res.data.total;
state.tableLoading = false;
if (res) {
const fun = (arr) => {
const list = arr.map((item) => {
let children;
if (item?.reportProjectOverview?.length) {
children = fun(item.reportProjectOverview);
}
return {
key: item.boeProjectInfoId,
children: children,
...item,
};
});
return list;
};
tableData.value = fun(res.data.rows);
state.tableDataTotal = res.data.total;
state.tableLoading = false;
}
}
};
const searchClick = () => {

View File

@@ -3,27 +3,38 @@
<div class="project">
<!-- 以下为顶部搜索框 -->
<div class="filter">
<div class="select">
<div class="select">
<a-input
style="width: 100%; height: 40px; border-radius: 8px"
placeholder="请输入项目名称"
allowClear
showSearch
v-model:value="projectName"
>
</a-input>
</div>
<div class="select">
<a-select
<a-cascader
:options="option"
placeholder="请选择组织"
v-model:value="orgId"
:allowClear="allowClear"
style="width: 100%"
placeholder="请选择归属组织"
allowClear
></a-select>
:fieldNames="{
label: 'name',
value: 'id',
children: 'treeChildList',
}"
>
</a-cascader>
</div>
<div class="select">
<div class="select">
<a-select
style="width: 100%"
placeholder="项目状态"
allowClear
:options="stateOptions"
v-model:value="status"
></a-select>
</div>
<div class="select">
@@ -32,23 +43,16 @@
placeholder="请输入创建者"
allowClear
showSearch
v-model:value="createName"
>
</a-input>
</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 class="btnn btn1">
<div class="btnn btn1" @click="getTableData">
<div class="search"></div>
<div class="btnText">搜索</div>
</div>
<div class="btn btn2">
<div class="btn btn2" @click="reset">
<div class="search"></div>
<div class="btnText">重置</div>
</div>
@@ -56,11 +60,15 @@
</div>
<!-- 以下为导出按钮 -->
<div class="btns">
<div class="btn btn3">
<div class="btn btn3" @click="exportAllClick">
<div><img src="../../assets/svg/export.png" alt="" /></div>
<div class="btnText">导出列表信息</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 class="btnText">导出详细信息</div>
</div>
@@ -73,7 +81,81 @@
:loading="tableLoading"
:scroll="{ x: 700 }"
: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>
<div class="tableBox">
<div class="pa">
@@ -94,172 +176,378 @@
</div>
</template>
<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 {
name: "ProjecT",
setup() {
const state = reactive({
tableLoading: false, // table加载图标
tableDataTotal: 12, // 数据总条数
tableDataTotal: 0, // 数据总条数
pageSize: 10, // 每页条数
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([
{
key: 1,
name: "John Brown sr.",
age: 60,
address: "New York No. 1 Lake Park",
children: [
{
key: 11,
name: "John Brown",
age: 42,
address: "New York No. 2 Lake Park",
},
{
key: 12,
name: "John Brown jr.",
age: 30,
address: "New York No. 3 Lake Park",
children: [
{
key: 121,
name: "Jimmy Brown",
age: 16,
address: "New York No. 3 Lake Park",
},
],
},
{
key: 13,
name: "Jim Green sr.",
age: 72,
address: "London No. 1 Lake Park",
children: [
{
key: 131,
name: "Jim Green",
age: 42,
address: "London No. 2 Lake Park",
children: [
{
key: 1311,
name: "Jim Green jr.",
age: 25,
address: "London No. 3 Lake Park",
},
{
key: 1312,
name: "Jimmy Green sr.",
age: 18,
address: "London No. 4 Lake Park",
},
],
},
],
},
],
},
{
key: 2,
name: "Joe Black",
age: 32,
address: "Sidney No. 1 Lake Park",
},
]);
let tableData = ref([]);
// table选中
const onSelectChange = (selectedRowKeys) => {
state.selectedRowKeys = selectedRowKeys;
};
//请求组织接口
const getOrgList = async () => {
const res = await api.userGetUserOrg({});
if (res) {
state.option = res.data?.result?.list;
state.orgId = res.data?.result?.treeNodeList;
state.resetOrgId = res.data?.result?.treeNodeList;
res.data?.result?.userType === 1
? (state.allowClear = true)
: (state.allowClear = false);
getTableData();
}
};
const reset = async () => {
state.tableLoading = true;
state.orgId = state.resetOrgId;
state.pageNo = 1;
state.pageSize = 10;
state.projectName = "";
state.createName = "";
state.status = null;
getTableData();
};
// 获取table数据
const getTableData = async () => {
state.tableLoading = true;
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;
const res = await api.boeuProjectPageList(params);
if (res) {
const fun = (arr) => {
const list = arr.map((item) => {
let children;
if (item?.reportProjectOverview?.length) {
children = fun(item.reportProjectOverview);
}
return {
key: item.boeProjectInfoId,
children: children,
...item,
};
});
return list;
};
tableData.value = fun(res.data.rows);
state.tableDataTotal = res.data.total;
state.tableLoading = false;
}
};
//table 分页事件
const changePagination = (page) => {
state.pageNo = page;
getTableData();
};
// cloumns 表头
const columns = ref([
{
title: "项目名称",
dataIndex: "name",
title: "名称",
dataIndex: "projectName",
key: "projectName",
width: 120,
ellipsis: true,
key: "manager",
align: "left",
fixed: "left",
},
{
title: "编号",
dataIndex: "age",
title: "归属组织",
dataIndex: "sourceBelongName",
ellipsis: true,
key: "manager",
key: "sourceBelongName",
width: 120,
align: "center",
fixed: "left",
},
{
title: "项目分类",
dataIndex: "age",
title: "分类",
dataIndex: "trainingType",
ellipsis: true,
key: "manager",
align: "center",
},
{
title: "资源归属",
dataIndex: "manager",
ellipsis: true,
key: "manager",
key: "trainingType",
width: 120,
align: "center",
fixed: "left",
},
{
title: "阶段总数",
dataIndex: "manager",
dataIndex: "stageTotal",
ellipsis: true,
key: "manager",
key: "stageTotal",
width: 120,
align: "center",
},
{
title: "任务总数",
dataIndex: "manager",
dataIndex: "taskTotal",
ellipsis: true,
key: "manager",
key: "taskTotal",
width: 120,
align: "center",
},
{
title: "参加人数",
dataIndex: "manager",
title: "学习人数",
dataIndex: "startLearnerTotal",
ellipsis: true,
key: "manager",
key: "startLearnerTotal",
width: 120,
align: "center",
},
{
title: "参与人数",
dataIndex: "participantsTotal",
ellipsis: true,
key: "participantsTotal",
width: 120,
align: "center",
},
{
title: "完成人数",
dataIndex: "manager",
dataIndex: "peopleCompletedTotal",
ellipsis: true,
key: "manager",
key: "peopleCompletedTotal",
width: 120,
align: "center",
},
{
title: "项目时间",
dataIndex: "proTime",
ellipsis: true,
key: "proTime",
width: 120,
align: "center",
},
{
title: "发布时间",
dataIndex: "manager",
dataIndex: "publishTime",
ellipsis: true,
key: "manager",
key: "publishTime",
width: 120,
align: "center",
},
{
title: "项目状态",
dataIndex: "manager",
title: "状态",
dataIndex: "status",
ellipsis: true,
key: "manager",
key: "projectStatus",
width: 120,
align: "center",
},
{
title: "创建人",
dataIndex: "manager",
dataIndex: "createName",
ellipsis: true,
key: "manager",
width: 120,
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 changePagination = (page) => {
state.pageNo = page;
const exportOnly = async (id) => {
axios({
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 {
...toRefs(state),
getOrgList,
tableData,
dayjs,
columns,
changePagination,
getTableData,
reset,
onSelectChange,
exportDetailClick,
exportAllClick,
};
},
};
@@ -279,29 +567,7 @@ export default {
.select {
margin-right: 20px;
margin-bottom: 20px;
width: calc((100% - 76px - 370px) / 5);
}
.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;
}
width: calc((100% - 76px - 240px) / 4);
}
.btn {