dbsd_kczx/src/views/kc/wjxCswj/WjxCswjStuList.vue

296 lines
9.0 KiB
Vue

<template>
<div style="background: #fff;height: calc(100vh - 225px);overflow-y: auto;overflow-x: hidden;margin: 10px 0;">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24" style="margin-top:-10px">
<a-col :lg="7">
<a-form-item label="测验名称">
<a-input placeholder="请输入测验名称" v-model:value="queryParam.title"></a-input>
</a-form-item>
</a-col>
<a-col :lg="7">
<a-form-item label="测验类型">
<a-select placeholder="请选择问卷状态" ref="select" v-model:value="queryParam.flag">
<a-select-option value="">全部</a-select-option>
<a-select-option value="-1">待提交</a-select-option>
<!-- <a-select-option value="0">待评分</a-select-option> -->
<a-select-option value="1">已完成</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<a-row>
<a-col :span="24" v-for="(item, index) in tableData" :key="index"
style="padding: 0px 0px 5px 5px;overflow:hidden;">
<div style="width: 100%; "></div>
<a-card style="height: 130px;border: 1px solid #eef1f2; border-radius:5px; margin:3px 5px">
<div class="rotate" :style="classFun(item.flag)">{{ getStatus(item.flag) }}</div>
<a-row style="top: -48px;position: relative;">
<a-col :lg="{ span: 0 }" :span="4" :push="20">
<div class="wczt-sm" :style="classFun_sm(item.flag)">{{ getStatus(item.flag) }}</div>
</a-col>
<a-col :span="24" style="margin-bottom: 10px;height:53px;overflow:hidden;">
<div style="font-size: 18px;font-weight: bold;">{{ item.title }}</div>
</a-col>
<a-col :span="24" class="zyCon">
<a-row>
<a-col :span="18" class="zyCon" style=" color: #666;">
时间:{{ dayjs(item.startTime).format('MM.DD HH-mm') }} - {{ dayjs(item.endTime).format('MM.DD HH-mm') }}
</a-col>
<a-col :span="6" style="text-align:center;">
<a-button type="primary" @click="handleDj(item, true)"
style="margin-left:5px;padding: 0px 8px;background:#1ab394;" v-if="item.flag == '-1'">开始测验</a-button>
<a-button type="primary" style="margin-left:5px;padding: 0px 8px;background:#1ab394;color:#ffffff"
v-if="item.flag == '0'" disabled>正在批卷</a-button>
<a-button type="primary" @click="handleDjjg(item)"
style="margin-left:5px;padding: 0px 8px;background:#1ab394;" v-if="item.flag == '1'">查看结果</a-button>
</a-col>
</a-row>
</a-col>
</a-row>
</a-card>
</a-col>
<a-col :span="24">
<div v-show="tableData.length > 0">
<a-pagination v-model="current" :total="total" @change="handlePageChange" :pageSize="pageSize"
style="text-align: right;" />
</div>
<div v-show="tableData.length == 0">
<a-empty />
</div>
</a-col>
</a-row>
<WjxWjxxTmlbDjModal ref="WjxWjxxTmlbDjModalPage" @success="handleSuccess"></WjxWjxxTmlbDjModal>
<WjxWjxxTmlbDjjgModal ref="WjxWjxxTmlbDjjgModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgModal>
</div>
</template>
<script lang="ts" name="wjxWjxx-wjxWjxx" setup>
import { ref, reactive, defineExpose, unref, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
import WjxWjxxTmlbDjModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjModal.vue'
import WjxWjxxTmlbDjjgModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgModal.vue'
import { useRouter } from "vue-router";
import { useMessage } from "/@/hooks/web/useMessage";
import dayjs from 'dayjs';
//当前路由信息
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh, xqxn, type, teano } = query;//获取传递参数
const { createMessage } = useMessage();
const APagination = Pagination;
const queryParam = ref<any>({});
const current = ref<number>(0);
const total = ref<number>(0);
const pageNo = ref<number>(0);
const pageSize = ref<number>(6);
const tableData = ref<any>([]);
const WjxWjxxTmlbDjModalPage = ref();
const WjxWjxxTmlbDjjgModalPage = ref();
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 答卷详情
*/
function handleDj(record: Recordable, isTesting = false) {
let timestamp = new Date().getTime();
let startTimestamp = Date.parse(record.startTime);
if (timestamp < startTimestamp) {
createMessage.error('还未到答卷时间!');
return;
}
let endTimestamp = Date.parse(record.endTime);
if (timestamp > endTimestamp) {
createMessage.error('答卷时间已过!');
return;
}
// WjxWjxxTmlbDjModalPage.value.disableSubmit = false;
// WjxWjxxTmlbDjModalPage.value.edit(record,false,"6",'xs');
// cytitle, cyid, cyatype, sfzd, sfbs
var url = "/site/studentDjcy?cytitle=" + record.title + "&cyid=" + record.id + "&cyatype=6&sfzd=0&sfbs=xs";
window.open(url, '_blank')
}
/**
* 答卷详情
*/
function handleDjjg(record: Recordable) {
WjxWjxxTmlbDjjgModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjjgModalPage.value.edit(record.djId, false);
}
function reload() {
queryParam.value.pageNo = current.value;
queryParam.value.pageSize = pageSize.value;
queryParam.value.rwbh = rwbh;
queryParam.value.xqxn = xqxn;
queryParam.value.teano = teano;
queryParam.value.atype = "6";
defHttp.get({ url: '/wjxWjxx/wjxWjxx/stuList', params: queryParam.value }).then(res => {
// console.log(`🚀 ~ defHttp.get ~ res:`, res)
total.value = res.total;
pageNo.value = res.pages;
current.value = res.current;
tableData.value = res.records;
});
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 查询
*/
function searchQuery() {
total.value = 1;
handlePageChange(1);
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
total.value = 1;
handlePageChange(1);
}
function handlePageChange(record) {
current.value = record;
reload();
}
onMounted(() => {
searchQuery();
});
function classFun(type) {
if (type == '-1') {
return 'background: linear-gradient(180deg, #63c4e4, #24a7d5);';
} else if (type == '0') {
return 'background: linear-gradient(180deg, #fea317, #ff7d28);';
} else if (type == '1') {
return 'background: linear-gradient(180deg, #fb8c7f, #f56670)';
}
}
function classFun_sm(type) {
if (type == '-1') {
return 'color: rgb(215, 72, 82);'; // 深红色
} else if (type == '0') {
return 'color: rgb(225, 95, 10);'; // 深橙色
} else if (type == '1') {
return 'color: rgb(5, 136, 182);'; // 深天蓝色
}
}
function getStatus(flag) {
if (flag == '-1') {
return "待提交";
} else if (flag == '0') {
return "待评分";
} else if (flag == '1') {
return "已完成";
}
}
</script>
<style lang="less" scoped>
.wczt-sm {
border-radius: 3px;
color: rgb(0, 0, 0);
/* 设置文字颜色为白色 */
font-weight: bold;
display: flex;
justify-content: center;
/* 水平居中 */
align-items: center;
/* 垂直居中 */
height: 100%;
/* 确保容器有高度,否则垂直居中可能不会按预期工作 */
text-align: center;
/* 如果有多行文本,保证它们也居中 */
}
.jeecg-basic-table-form-container {
padding: 0;
width: 99%;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust {
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
}
.jeecg-basic-table-form-container .ant-form {
padding: 12px 10px 0px 10px;
margin-bottom: 0px;
background-color: #fff;
border-radius: 2px;
}
.ellipsis {
overflow: hidden;
/* 确保超出容器的内容被裁剪 */
white-space: nowrap;
/* 确保文本在一行内显示 */
text-overflow: ellipsis;
/* 超出部分显示省略号 */
}
.zyCon {
line-height: 30px;
}
.rotate {
transform: rotate(45deg);
background: linear-gradient(90deg, #93d861, #8ddc53, #35c495);
color: #fff;
padding: 10px 10px 4px 10px;
position: relative;
top: -30px;
right: -406px;
text-align: center;
font-size: 12px;
}
</style>