Files
fe-manage/src/views/evaluation/EvaDown.vue
2024-04-15 20:43:51 +08:00

331 lines
8.8 KiB
Vue

<template>
<div class="returneva">
<router-link to="/evaluationupload">
<div style="display: flex">
<img class="img2" src="../../assets/images/leveladd/back.png" />
<div class="return">返回</div>
</div>
</router-link>
</div>
<div class="evadown">
<div class="down_header">
<div class="down_header_title" @click="downloadAll">
<div class="down_header_btn" v-if="downloadShow">
<div class="btnText">全量下载</div>
</div>
</div>
<div class="down_header_title" style="display: flex;">
<div class="down_header_search">
<a-input
v-model:value="searchName"
placeholder="查询姓名或工号或导入者"
style="width: 270px; height: 40px; border-radius: 8px;margin-right: 14px;"
/>
</div>
<div class="down_header_btn btn1" @click="searchList">
<div class="search"></div>
<span class="btnText">搜索</span>
</div>
<div class="down_header_btn btn2" @click="searchNo">
<div class="search"></div>
<span class="btnText">重置</span>
</div>
</div>
</div>
<div class="tablelist">
<a-table
:columns="columns"
:data-source="tableData"
:loading="tableLoading"
:scroll="{ x: 'max-content' }"
:pagination="pagination"
>
<template #operation="{ record, column }">
<a-space>
<a-button type="link" v-if="downloadShow" @click="downloadItem(record)">
<a-tooltip>
<template #title>下载</template>
<span class="download"></span>
</a-tooltip>
</a-button>
<a-button type="link" v-if="deleteIds" @click="deleteItem(record)">
<a-tooltip>
<template #title>删除</template>
<span class="delete"></span>
</a-tooltip>
</a-button>
</a-space>
</template>
</a-table>
</div>
</div>
</template>
<script>
import { ref,onMounted, reactive,toRefs,computed,watch } from "vue";
import dialog from "@/utils/dialog";
import { getPage,deleteById } from "@/api/evaluation";
import { useRoute } from "vue-router";
import { message } from "ant-design-vue";
import { useStore } from "vuex";
import {boeRequest} from "@/api/request";
import {downLoadZip} from "@/utils/zipdownload";
export default {
name: "evadown",
components: {},
setup() {
const store = useStore();
const userInfo = computed(()=>store.state.userInfo)
const route = useRoute();
const state = reactive({
downloadShow: route.query.permission=='true'?true:false,
deleteIds: route.query.deleteIds=='true'?true:false,
searchName: '',
tableLoading: false,
tableData:[],
total: 0,
params: {
pageNo: 1,
pageSize: 10,
},
})
const columns = ref([
{
title: "姓名",
dataIndex: "studentName",
key: "studentName",
className: "h",
ellipsis: true,
align: "center",
width: 100,
},
{
title: "工号",
dataIndex: "workNum",
key: "workNum",
className: "h",
ellipsis: true,
align: "center",
width: 100,
},
{
title: "评测名称",
dataIndex: "evaluationName",
key: "evaluationName",
className: "h",
ellipsis: true,
align: "center",
width: 100,
},
{
title: "上传人",
dataIndex: "uploadName",
key: "uploadName",
className: "h",
ellipsis: true,
align: "center",
width: 100,
},
{
title: "上传日期",
dataIndex: "updateTime",
key: "updateTime",
className: "h",
ellipsis: true,
align: "center",
width: 100,
},
{
title: "操作",
width: "20%",
dataIndex: "operation",
key: "operation",
align: "center",
slots: { customRender: "operation" },
},
])
const pagination = computed(() => ({
total: state.total,
showSizeChanger: true,
showQuickJumper: false,
current: state.params.pageNo,
pageSize: state.params.pageSize,
onChange: changePagination,
}))
const changePagination = (page,pageSize) => {
state.params.pageNo = page
state.params.pageSize = pageSize
listData()
}
watch(()=>state.params.pageSize,(val)=>{
state.params.pageNo = 1
listData()
})
const downloadAll = (record) => {
if(state.total == 0){
message.info('请先上传报告')
return
}
// window.open(`/activityApi/evaluation/download?id=${route.query.id}`);
downLoadZip(`/evaluation/download?id=${route.query.id}`,route.query.name)
}
const listData = async () => {
state.tableLoading = true
await boeRequest('/activityApi/evaluation/detail/getPage post',{
pid:route.query.id,
pageNo: state.params.pageNo,
pageSize: state.params.pageSize,
searchParam:state.searchName
}).then((res)=>{
if(res.code === 200){
state.tableLoading = false
state.tableData = res.data.records,
state.total = res.data.total
}
})
// await getPage({
// pid:route.query.id,
// pageNo: state.params.pageNo,
// pageSize: state.params.pageSize,
// searchParam:state.searchName
// }).then((res) => {
// if(res.code === 200){
// state.tableLoading = false
// state.tableData = res.data.records,
// console.log(state.tableData,'data')
// state.total = res.data.total
// }
// })
}
const searchList = () => {
state.params.pageNo = 1
listData()
}
const searchNo = () => {
state.searchName = ''
state.params.pageNo = 1
listData()
}
const downloadItem = (record) => {
window.open(`/activityApi/evaluation/detail/downloadById?id=${record.id}`)
};
const deleteItem = (record) => {
dialog({
content: '请您确认是否要删除该报告?',
ok: () => {
deleteById({id:record.id,kid:record.kid,pid:route.query.id}).then((res)=>{
message.success('删除成功')
listData()
})
},
});
};
onMounted(() => {
listData()
})
return {
...toRefs(state),
columns,
deleteItem,
downloadItem,
pagination,
listData,
searchList,
searchNo,
downloadAll,
userInfo,
}
},
}
</script>
<style lang="scss" scoped>
.returneva{
position: absolute;
right: 0;
top: 139px;
.img2{
width: 42px;
height: 42px;
}
.return{
font-size: 14px;
margin-top: 10px;
margin-right: 102px;
}
}
.evadown {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
.down_header{
margin-left: 38px;
margin-right: 38px;
margin-top: 30px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.down_header_title{
margin-right: 20px;
margin-bottom: 20px;
.down_header_btn {
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%;
}
.btnText {
font-size: 14px;
font-weight: 400;
color: #ffffff;
line-height: 36px;
margin-left: 5px;
}
}
.btn1 {
.search {
width: 15px;
height: 17px;
background-image: url("../../assets/images/courseManage/search0.png");
}
}
.btn2 {
.search {
width: 16px;
height: 18px;
background-image: url("../../assets/images/courseManage/reset0.png");
}
}
}
}
.tablelist{
padding: 10px 35px;
.download{
width: 19px;
height: 20px;
background: url("../../assets/images/evaluation/download.png") no-repeat;
background-size: 100%;
}
.delete{
width: 19px;
height: 20px;
background: url("../../assets/images/evaluation/delete.png") no-repeat;
background-size: 100%;
}
}
}
</style>