mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
566 lines
14 KiB
Vue
566 lines
14 KiB
Vue
<template>
|
||
<!-- 案例! -->
|
||
<div class="caseess">
|
||
<!-- 以下为顶部搜索框 -->
|
||
<div class="filter">
|
||
<div class="select">
|
||
<a-input
|
||
style="width: 100%; height: 40px; border-radius: 8px"
|
||
placeholder="请输入案例名称"
|
||
allowClear
|
||
showSearch
|
||
v-model:value="title"
|
||
>
|
||
</a-input>
|
||
</div>
|
||
<div class="select">
|
||
<a-input
|
||
style="width: 100%; height: 40px; border-radius: 8px"
|
||
placeholder="请输入作者名称"
|
||
allowClear
|
||
showSearch
|
||
v-model:value="author"
|
||
>
|
||
</a-input>
|
||
</div>
|
||
<div class="select">
|
||
<a-range-picker
|
||
v-model:value="publishTime"
|
||
type="date"
|
||
valueFormat="YYYY-MM-DD"
|
||
:placeholder="['发布开始时间','结束时间']"
|
||
style="width: 100%; margin-right: 0px"
|
||
/>
|
||
</div>
|
||
<div class="select">
|
||
<a-cascader
|
||
change-on-select
|
||
:options="option"
|
||
v-model:value="orgId"
|
||
style="width: 100%"
|
||
placeholder="请选择归属组织"
|
||
:allowClear="allowClear"
|
||
:fieldNames="{
|
||
label: 'orgName',
|
||
value: 'organizationId',
|
||
children: 'childList',
|
||
}"
|
||
>
|
||
</a-cascader>
|
||
</div>
|
||
<div style="display: flex; margin-bottom: 20px">
|
||
<div class="btnzx btnzx1" @click="searchData">
|
||
<div class="search"></div>
|
||
<div class="btnzText">搜索</div>
|
||
</div>
|
||
<div class="btnzx btnzx1" @click="reset">
|
||
<div class="search"></div>
|
||
<div class="btnzText">重置</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- 以下为导出按钮 -->
|
||
<div class="btnzs">
|
||
<div class="btnz btnz3" @click="exportAllbtnz">
|
||
<div>
|
||
<img src="../../assets/images/coursewareManage/export1.png" alt="" />
|
||
</div>
|
||
<div class="btnzText">导出</div>
|
||
</div>
|
||
</div>
|
||
<!-- 以下为table表格 -->
|
||
<div class="tableBox">
|
||
<a-table
|
||
rowKey="id"
|
||
: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 === 'sysCreateTime'">
|
||
<a-tooltip placement="topRight">
|
||
<template #title>
|
||
<span>{{
|
||
record.sysCreateTime &&
|
||
dayjs(record.sysCreateTime).format("YYYY-MM-DD HH:mm:ss")
|
||
}}</span>
|
||
</template>
|
||
<span>{{
|
||
record.sysCreateTime &&
|
||
dayjs(record.sysCreateTime).format("YYYY-MM-DD HH:mm:ss")
|
||
}}</span>
|
||
</a-tooltip>
|
||
</template>
|
||
</template>
|
||
</a-table>
|
||
<div class="tableBox">
|
||
<div class="pa">
|
||
<a-pagination
|
||
v-if="tableDataTotal > 10"
|
||
:showSizeChanger="false"
|
||
showQuickJumper="true"
|
||
hideOnSinglePage="true"
|
||
:pageSize="pageSize"
|
||
v-model:current="pageNo"
|
||
:total="tableDataTotal"
|
||
class="pagination"
|
||
@change="changePagination"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import dayjs from "dayjs";
|
||
import { ref, toRefs, reactive, onMounted } from "vue";
|
||
import { message } from "ant-design-vue";
|
||
import * as api from "../../api/indexOvervoew";
|
||
import downLoad from "../../utils/downLoad";
|
||
import Cookies from "vue-cookies";
|
||
import axios from "axios";
|
||
export default {
|
||
name: "CaseesS",
|
||
setup() {
|
||
const state = reactive({
|
||
tableLoading: false, // table加载图标
|
||
tableDataTotal: 0, // 数据总条数
|
||
pageSize: 10, // 每页条数
|
||
pageNo: 1, //当前页码
|
||
idList: [],
|
||
title: "",
|
||
author: "",
|
||
authorName: "",
|
||
publishTime: "", // 发布时间
|
||
selectedRowKeys: [],
|
||
orgId: null, // 状态值
|
||
option: [], // 组织列表
|
||
allowClear: true,
|
||
resetOrgId: [],
|
||
});
|
||
// 表格数据
|
||
let tableData = ref([]);
|
||
// table选中
|
||
const onSelectChange = (selectedRowKeys, record) => {
|
||
state.selectedRowKeys = selectedRowKeys;
|
||
state.id = record?.map((item) => {
|
||
return item.id;
|
||
});
|
||
};
|
||
//请求组织接口
|
||
const getOrgList = async () => {
|
||
//todo 获取用户角色列表,判断里面是否有system-admin
|
||
// let roleList = store.state.userInfo.roleList;
|
||
const res = await api.userGetUserOrg();
|
||
if (res) {
|
||
state.option = res.data?.result.orgTreeList;
|
||
state.orgId = res.data?.result.treeNodeList;
|
||
state.resetOrgId = res.data?.result.treeNodeList;
|
||
state.allowClear = true;
|
||
getTableData();
|
||
}
|
||
};
|
||
// cloumns 表头
|
||
const columns = ref([
|
||
// {
|
||
// title: "编号",
|
||
// dataIndex: "num",
|
||
// ellipsis: true,
|
||
// key: "num",
|
||
// align: "center",
|
||
// },
|
||
{
|
||
title: "案例名称",
|
||
dataIndex: "title",
|
||
ellipsis: true,
|
||
key: "title",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "归属组织",
|
||
dataIndex: "orgDomain",
|
||
ellipsis: true,
|
||
key: "orgDomain",
|
||
align: "center",
|
||
},
|
||
// {
|
||
// title: "案例分类",
|
||
// dataIndex: "majorType1",
|
||
// ellipsis: true,
|
||
// key: "majorType1",
|
||
// align: "center",
|
||
// },
|
||
{
|
||
title: "专业分类",
|
||
dataIndex: "majorType",
|
||
ellipsis: true,
|
||
key: "majorType",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "浏览量",
|
||
dataIndex: "views",
|
||
ellipsis: true,
|
||
key: "views",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "点赞量",
|
||
dataIndex: "praises",
|
||
ellipsis: true,
|
||
key: "praises",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "评论数",
|
||
dataIndex: "comments",
|
||
ellipsis: true,
|
||
key: "comments",
|
||
align: "center",
|
||
},
|
||
// {
|
||
// title: "分享量",
|
||
// dataIndex: "shares",
|
||
// ellipsis: true,
|
||
// key: "shares",
|
||
// align: "center",
|
||
// },
|
||
{
|
||
title: "收藏数",
|
||
dataIndex: "favorites",
|
||
ellipsis: true,
|
||
key: "favorites",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "发布时间",
|
||
dataIndex: "sysCreateTime",
|
||
ellipsis: true,
|
||
key: "sysCreateTime",
|
||
align: "center",
|
||
},
|
||
{
|
||
title: "创建人/作者",
|
||
dataIndex: "authorName",
|
||
ellipsis: true,
|
||
key: "authorName",
|
||
align: "center",
|
||
},
|
||
// {
|
||
// title: "状态",
|
||
// dataIndex: "caseScope",
|
||
// ellipsis: true,
|
||
// key: "caseScope",
|
||
// align: "center",
|
||
// },
|
||
]);
|
||
// table 分页事件
|
||
const changePagination = (page) => {
|
||
state.pageNo = page;
|
||
getTableData();
|
||
};
|
||
// 获取数据
|
||
const getTableData = async () => {
|
||
state.tableLoading = true;
|
||
const res = await api.boeuCasePlatePageList({
|
||
page: state.pageNo,
|
||
size: state.pageSize,
|
||
orgId: state.orgId ? state.orgId[state.orgId.length - 1] : null,
|
||
title: state.title,
|
||
author: state.author,
|
||
authorName: state.authorName,
|
||
// publishTime: state.publishTime,
|
||
startTime: typeof state.publishTime[0] === 'undefined' ? null : state.publishTime[0]+ " 00:00:00",
|
||
endTime: typeof state.publishTime[0] === 'undefined' ? null : state.publishTime[1]+ " 23:59:59",
|
||
boeRouterInfoName: state.boeRouterInfoName,
|
||
});
|
||
if (res) {
|
||
console.log(res.data, "res.data");
|
||
state.tableDataTotal = res.data.result.total;
|
||
const list = res.data.result.rows?.map((item) => {
|
||
return {
|
||
key: item.id,
|
||
...item,
|
||
};
|
||
});
|
||
tableData.value = list;
|
||
state.tableLoading = false;
|
||
}
|
||
};
|
||
// 重置按钮
|
||
const reset = async () => {
|
||
state.selectedRowKeys = [];
|
||
state.tableLoading = true;
|
||
state.title = "";
|
||
state.authorName = "";
|
||
state.author = "";
|
||
state.publishTime = [];
|
||
getTableData();
|
||
};
|
||
const searchData = async () => {
|
||
state.pageNo = 1;
|
||
state.pageSize = 10;
|
||
getTableData();
|
||
};
|
||
// 导出列表信息
|
||
const exportAllbtnz = async () => {
|
||
if (state.selectedRowKeys?.length > 0) {
|
||
axios({
|
||
method: "post",
|
||
url: "/report/boeu/case/exportList",
|
||
data: { idList: 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,
|
||
title: state.title,
|
||
author: state.author,
|
||
// publishTime: state.publishTime,
|
||
startTime: typeof state.publishTime[0] === 'undefined' ? null : state.publishTime[0]+ " 00:00:00",
|
||
endTime: typeof state.publishTime[0] === 'undefined' ? null : state.publishTime[1]+ " 23:59:59",
|
||
};
|
||
axios({
|
||
method: "post",
|
||
url: "/report/boeu/case/exportList",
|
||
data: params,
|
||
responseType: "blob",
|
||
headers: {
|
||
token: Cookies.get("token"),
|
||
},
|
||
}).then((res) => {
|
||
downLoad(res.data, "案例列表.xlsx");
|
||
}),
|
||
(err) => {
|
||
message.error(err);
|
||
};
|
||
}
|
||
};
|
||
onMounted(() => {
|
||
getOrgList();
|
||
// getTableData();
|
||
state.tableLoading = true;
|
||
});
|
||
return {
|
||
...toRefs(state),
|
||
searchData,
|
||
tableData,
|
||
columns,
|
||
dayjs,
|
||
changePagination,
|
||
exportAllbtnz,
|
||
onSelectChange,
|
||
getTableData,
|
||
reset,
|
||
};
|
||
},
|
||
};
|
||
</script>
|
||
<style lang="scss">
|
||
.caseess {
|
||
width: 100%;
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
.filter {
|
||
margin-left: 38px;
|
||
margin-right: 20px;
|
||
margin-top: 30px;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
.select {
|
||
margin-right: 20px;
|
||
margin-bottom: 20px;
|
||
width: calc((100% - 76px - 240px) / 4);
|
||
}
|
||
|
||
.btnz {
|
||
padding: 0px 26px 0px 26px;
|
||
height: 38px;
|
||
background: rgba(64, 158, 255, 0);
|
||
border-radius: 8px;
|
||
border: 1px solid rgba(64, 158, 255, 1);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
cursor: pointer;
|
||
|
||
.search {
|
||
background-size: 100%;
|
||
}
|
||
|
||
.btnzText {
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
color: rgba(64, 158, 255, 1);
|
||
line-height: 36px;
|
||
margin-left: 5px;
|
||
}
|
||
}
|
||
|
||
.btnzx {
|
||
padding: 0px 26px 0px 26px;
|
||
height: 38px;
|
||
background: #4ea6ff;
|
||
border-radius: 8px;
|
||
border: 1px solid rgba(64, 158, 255, 1);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
cursor: pointer;
|
||
|
||
.search {
|
||
background-size: 100%;
|
||
}
|
||
|
||
.btnzText {
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
color: #ffffff;
|
||
line-height: 36px;
|
||
margin-left: 5px;
|
||
}
|
||
}
|
||
|
||
.btnzx1 {
|
||
.search {
|
||
width: 15px;
|
||
height: 17px;
|
||
background-image: url("../../assets/images/courseManage/search0.png");
|
||
}
|
||
}
|
||
|
||
.btnzx2 {
|
||
background: #4ea6ff;
|
||
.search {
|
||
width: 16px;
|
||
height: 18px;
|
||
background-image: url("../../assets/images/courseManage/reset0.png");
|
||
}
|
||
.btnzText {
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.btnzx1:hover {
|
||
background: rgba(64, 158, 255, 0.76);
|
||
|
||
.search {
|
||
background-image: url("../../assets/images/courseManage/search0.png");
|
||
}
|
||
|
||
.btnzText {
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.btnzx1:active {
|
||
background: #0982ff;
|
||
}
|
||
|
||
.btnzx2:hover {
|
||
background: rgba(64, 158, 255, 0.76);
|
||
}
|
||
|
||
.btnzx2:active {
|
||
background: #0982ff;
|
||
}
|
||
}
|
||
.tableBox {
|
||
margin: 20px 38px 30px;
|
||
|
||
.ant-table-thead > tr > th {
|
||
background-color: #eff4fc;
|
||
}
|
||
}
|
||
.btnzs {
|
||
display: flex;
|
||
margin-left: 38px;
|
||
// flex-wrap: wrap;
|
||
.btnz {
|
||
padding: 0px 26px 0px 26px;
|
||
height: 38px;
|
||
background: white;
|
||
border-radius: 8px;
|
||
border: 1px solid rgba(64, 158, 255, 1);
|
||
display: flex;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
justify-content: center;
|
||
margin-right: 14px;
|
||
flex-shrink: 0;
|
||
|
||
.search {
|
||
background-size: 100%;
|
||
}
|
||
|
||
.btnzText {
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
color: #4ea6ff;
|
||
line-height: 36px;
|
||
margin-left: 5px;
|
||
}
|
||
}
|
||
|
||
.btnz3 {
|
||
margin-right: 0px;
|
||
background: #4ea6ff;
|
||
.search {
|
||
width: 17px;
|
||
height: 18px;
|
||
background-image: url("../../assets/images/courseManage/add0.png");
|
||
}
|
||
.btnzText {
|
||
color: #ffffff;
|
||
}
|
||
}
|
||
|
||
.btnz3:hover {
|
||
// background: rgba(64, 158, 255, 0.76);
|
||
background: rgba(64, 158, 255, 0.76);
|
||
}
|
||
|
||
.btnz3:active {
|
||
background: #0982ff;
|
||
}
|
||
}
|
||
|
||
.tableBox {
|
||
margin: 20px 38px 30px;
|
||
|
||
.ant-table-thead > tr > th {
|
||
background-color: #eff4fc;
|
||
}
|
||
}
|
||
.tableBox {
|
||
padding-bottom: 20px;
|
||
|
||
.pa {
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: center;
|
||
}
|
||
}
|
||
}
|
||
</style>
|