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

373 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div style="background: #fff;height: calc(100vh - 255px);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">
<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="测验状态">
<j-dict-select-tag placeholder="请选择测验状态" v-model:value="queryParam.qpublish" dictCode="zy_status"/>
<!-- <a-select placeholder="请选择问卷状态" ref="select" v-model:value="queryParam.qpublish">
<a-select-option value="">全部</a-select-option>
<a-select-option value="0">待发布</a-select-option>
<a-select-option value="1">已发布</a-select-option>
<a-select-option value="2">已完成</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-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> -->
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd" style="margin-left: 8px">新增</a-button>
<a-button type="primary" @click="handleTiku('6')" style="margin-left: 8px">题库</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<a-row>
<a-col :span="8" v-for="(item, index) in tableData" :key="index" style="padding: 0px 0px 5px 5px;overflow:hidden;">
<div style="width: 100%; height: 20px; background-color: rgb(28, 132, 198);"></div>
<a-card style="height: 256px;border: 1px solid rgb(28, 132, 198);">
<div class="rotate" :style="classFun(item.qpublish)">{{item.qpublish_dictText}}</div>
<a-row style="top: -48px;position: relative;">
<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="24" class="zyCon">时间:{{dayjs(item.startTime).format('YYYY.MM.DD')}} - {{dayjs(item.endTime).format('YYYY.MM.DD')}}</a-col>
</a-row>
</a-col>
<a-col :span="24" class="zyCon">
<a-row>
<a-col :span="12" class="zyCon">{{item.xqxn}}</a-col>
<a-col :span="12" class="zyCon"><div style="float:right;" @click="openXkrs(item)"><a>{{item.xkrs}}人选课</a></div></a-col>
</a-row>
</a-col>
<a-col :span="24" class="zyCon">
<a-row>
<a-col :span="12" class="zyCon"><div style="float:left;" @click="handleDjjgs(item,'0')" v-if="item.wwcrs>0"><a>未提交:{{item.wwcrs}}人</a></div></a-col>
<a-col :span="12" class="zyCon"><div style="float:right;" @click="handleDjjgs(item,'1')" v-if="item.ywcrs>0"><a>已提交:{{item.ywcrs}}人</a></div></a-col>
</a-row>
</a-col>
<a-col :span="24" style="text-align:center;margin-top:8px;">
<a-button type="primary" @click="handleEdit(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==0">设置试卷</a-button>
<a-button type="primary" @click="handleFabu(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==0">发布试卷</a-button>
<a-button type="primary" @click="handleDelete(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==0">删除试卷</a-button>
<a-button type="primary" @click="handlePeizhi(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==0">编辑题目</a-button>
<a-button type="primary" @click="handlePeizhiXq(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==0">预览题目</a-button>
<a-button type="primary" @click="handleDetail(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==1||item.qpublish==2">试卷详情</a-button>
<a-button type="primary" @click="handlePeizhiXq(item)" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==1||item.qpublish==2">预览题目</a-button>
<a-button type="primary" @click="handleDjjgs(item,'')" style="margin-left:5px;margin-bottom:5px;padding: 0px 4px;background:rgb(28, 132, 198);" v-if="item.qpublish==1||item.qpublish==2">测验结果</a-button>
</a-col>
<!-- <a-col :span="24" style="text-align:center;margin-top:20px;">-->
<!-- <a-button type="primary" @click="handleDj(item)" style="margin-left:5px;padding: 0px 8px;background:rgb(28, 132, 198);" v-if="item.qpublish==1">答卷</a-button>-->
<!-- <a-button type="primary" @click="handleDjjg(item)" style="margin-left:5px;padding: 0px 8px;background:rgb(28, 132, 198);" v-if="item.qpublish==1">查看答卷</a-button>-->
<!-- </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>
<!-- 表单区域 -->
<WjxWjxxModal ref="registerModal" @success="handleSuccess"></WjxWjxxModal>
<WjxWjxxTmlbModal ref="WjxWjxxTmlbModalPage" @success="handleSuccess"></WjxWjxxTmlbModal>
<WjxWjxxTmlbDjModal ref="WjxWjxxTmlbDjModalPage" @success="handleSuccess"></WjxWjxxTmlbDjModal>
<WjxWjxxTmlbDjjgsModal ref="WjxWjxxTmlbDjjgsModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgsModal>
<XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal>
<TikuListModal ref="TikuListModalPage"></TikuListModal>
</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 { list ,deleteOne } from '/@/views/kc/wjxWjxx/WjxWjxx.api';
import {useRouter} from "vue-router";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import WjxWjxxModal from '/@/views/kc/wjxWjxx/components/WjxWjxxModal.vue'
import WjxWjxxTmlbModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbModal.vue'
import WjxWjxxTmlbDjModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjModal.vue'
import WjxWjxxTmlbDjjgsModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgsModal.vue'
import XxhbbksListModal from '/@/views/kc/xxhbbks/XxhbbksListModal.vue';
import {useMessage} from "/@/hooks/web/useMessage";
import TikuListModal from '/@/views/kc/wjxWjxxTmlb/TikuListModal.vue';
import dayjs from 'dayjs';
//当前路由信息
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh,xqxn,typa } = query;//获取传递参数
const { createConfirm } = 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 registerModal = ref();
const WjxWjxxTmlbModalPage = ref();
const WjxWjxxTmlbDjModalPage = ref();
const WjxWjxxTmlbDjjgsModalPage = ref()
const WjxWjxxTmlbDjjgsDcModalPage = ref();
const XxhbbksListModalPage = ref();
const TikuListModalPage = ref();
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
//题库类型6作业1问卷
function handleTiku(wjLeixing){
var record = {wjLeixing}
TikuListModalPage.value.disableSubmit = true;
TikuListModalPage.value.init(record);
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add("6");
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 获取选课人数
*/
function openXkrs(record){
// console.log(`🚀 ~ openXkrs ~ record:`, record)
XxhbbksListModalPage.value.disableSubmit = true;
XxhbbksListModalPage.value.init(record);
}
/**
* 配置
*/
function handlePeizhi(record: Recordable) {
WjxWjxxTmlbModalPage.value.disableSubmit = false;
WjxWjxxTmlbModalPage.value.edit(record,"6");
}
/**
* 配置详情
*/
function handlePeizhiXq(record: Recordable) {
WjxWjxxTmlbDjModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjModalPage.value.edit(record,true,"6",'ls');
}
// /**
// * 答卷详情
// */
// function handleDj(record: Recordable) {
// WjxWjxxTmlbDjModalPage.value.disableSubmit = false;
// WjxWjxxTmlbDjModalPage.value.edit(record,false);
// }
// /**
// * 答卷详情
// */
// function handleDjjg(record: Recordable) {
// WjxWjxxTmlbDjjgModalPage.value.disableSubmit = true;
// WjxWjxxTmlbDjjgModalPage.value.edit(record,false);
// }
/**
* 学生答卷列表
*/
function handleDjjgs(record: Recordable,flag) {
WjxWjxxTmlbDjjgsModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjjgsModalPage.value.edit(record,flag);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 发布
*/
function handleFabu(record: Recordable) {
createConfirm({
iconType: 'warning',
title: '发布测验',
content: '是否发布此测验?',
okText: '确认',
cancelText: '取消',
onOk: () => {
defHttp.get({ url: '/wjxWjxx/wjxWjxx/fbwj', params: { id: record.id,wjlx: "6" } }).then(res => {
handleSuccess();
});
}
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
createConfirm({
iconType: 'warning',
title: '删除',
content: '是否删除此测验?',
okText: '确认',
cancelText: '取消',
onOk: () => {
deleteOne({ id: record.id }, handleSuccess2);
}
});
}
function reload(){
queryParam.value.pageNo = current.value;
queryParam.value.pageSize = pageSize.value;
queryParam.value.rwbh = rwbh;
queryParam.value.xqxn = xqxn;
queryParam.value.atype = "6";
defHttp.get({ url: '/wjxWjxx/wjxWjxx/list', 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 handleSuccess2() {
total.value = 1;
handlePageChange(1);
}
/**
* 成功回调,用于增加、修改、发布和撤回
*/
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 == '0'){
return "background: #fe1a1a";
}else if(type == '1'){
return "background: #c6c209";
}else if(type == '2'){
return "background: #18a689";
}
}
</script>
<style lang="less" scoped>
.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: rgb(28, 132, 198);
color: #fff;
padding: 19px 10px 3px 10px;
position: relative;
top: -54px;
right: -131px;
text-align: center;
font-size: 11px;
}
</style>