dbsd_kczx/src/views/zy/zyInfo/ZyInfoList.vue

310 lines
10 KiB
Vue
Raw Normal View History

2024-05-06 19:41:47 +08:00
<template>
2024-05-07 09:57:47 +08:00
<div style="background: #fff;height: 97%;margin: 10px 0;">
2024-05-06 19:41:47 +08:00
<!--查询区域-->
<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="8">
<a-form-item label="作业名称">
2024-05-20 23:01:32 +08:00
<j-input placeholder="请输入作业名称" v-model:value="queryParam.title"></j-input>
2024-05-06 19:41:47 +08:00
</a-form-item>
</a-col>
2024-05-10 20:01:34 +08:00
<!-- <a-col :lg="8">
2024-05-06 19:41:47 +08:00
<a-form-item label="类型">
<j-dict-select-tag placeholder="请选择类型" v-model:value="queryParam.zyType" dictCode="zy_type"/>
</a-form-item>
2024-05-10 20:01:34 +08:00
</a-col> -->
2024-05-07 09:57:47 +08:00
<a-col :lg="8">
<a-form-item label="状态">
<j-dict-select-tag placeholder="请选择状态" v-model:value="queryParam.zyStatus" dictCode="zy_status"/>
</a-form-item>
</a-col>
2024-05-10 20:01:34 +08:00
<!-- <a-col :lg="8">
2024-05-07 09:57:47 +08:00
<a-form-item label="学年学期">
<a-input placeholder="请输入学年学期" v-model:value="queryParam.xnxq"></a-input>
</a-form-item>
2024-05-10 20:01:34 +08:00
</a-col> -->
2024-05-06 19:41:47 +08:00
<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>
2024-05-07 09:57:47 +08:00
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd" style="margin-left: 8px"> 新增</a-button>
2024-05-06 19:41:47 +08:00
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
2024-05-07 09:57:47 +08:00
<a-row>
2024-05-08 16:04:27 +08:00
<a-col :span="8" v-for="(item, index) in tableData" :key="index" style="padding: 0px 0px 10px 5px;overflow:hidden;">
<div style="width: 100%; height: 20px; background-color: rgb(28, 132, 198);"></div>
2024-05-13 20:13:07 +08:00
<a-card style="height: 240px;border: 1px solid rgb(28, 132, 198);">
2024-05-10 20:01:34 +08:00
<div class="rotate" :style="classFun(item.zyStatus)">{{item.zyStatus_dictText}}</div>
2024-05-08 16:04:27 +08:00
<a-row style="top: -48px;position: relative;">
<a-col :span="24" style="margin-bottom: 10px;height:53px;overflow:hidden;" :title="item.title">
2024-05-10 20:01:34 +08:00
<div style="font-size: 18px;font-weight: bold;">{{item.title}}</div>
2024-05-08 16:04:27 +08:00
</a-col>
<a-col :span="24" class="zyCon">时间{{item.startTime}} - {{item.endTime}}</a-col>
2024-05-10 20:01:34 +08:00
<a-col :span="24" class="zyCon"><div style="float:left">{{item.xnxq}}</div><div style="float:right;" @click="openXkrs(item)"><a>{{item.xkxs}}人选课</a></div></a-col>
2024-05-13 20:13:07 +08:00
<a-col :span="24" class="zyCon"><div style="float:left">未提交{{item.wtjnum?item.wtjnum:0}};</div><div style="float:right;" >已提交{{item.ytjnum?item.ytjnum:0}}</div></a-col>
2024-05-08 16:04:27 +08:00
<a-col :span="24" style="text-align:center;margin-top:20px;">
<a-button type="primary" @click="handleEdit(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==0">编辑</a-button>
<a-button type="primary" @click="handleFabu(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==0">发布</a-button>
2024-05-21 17:53:16 +08:00
<a-button type="primary" @click="handleDelete(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==0">删除</a-button>
<a-button type="primary" @click="handleDetail(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">作业详情</a-button>
<a-button type="primary" @click="handleZyxx(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">查看作业</a-button>
2024-05-13 16:29:57 +08:00
<!-- <a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">上传</a-button> -->
2024-05-07 09:57:47 +08:00
</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>
2024-05-06 19:41:47 +08:00
<ZyInfoModal ref="registerModal" @success="handleSuccess"></ZyInfoModal>
2024-05-07 09:57:47 +08:00
<ZyInfoStudentListModal ref="ZyInfoStudentListModalPage"></ZyInfoStudentListModal>
<ZyInfoStudentModal ref="ZyInfoStudentModalPage"></ZyInfoStudentModal>
2024-05-10 20:01:34 +08:00
<XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal>
2024-05-06 19:41:47 +08:00
</div>
</template>
<script lang="ts" name="zyInfo-zyInfo" setup>
2024-05-07 09:57:47 +08:00
import { ref, reactive, onMounted,unref } from 'vue';
import { list, deleteOne } from './ZyInfo.api';
2024-05-06 19:41:47 +08:00
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
2024-05-07 09:57:47 +08:00
import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
import { useRouter } from 'vue-router';
2024-05-20 23:01:32 +08:00
import { JInput } from '/@/components/Form';
2024-05-10 20:01:34 +08:00
import ZyInfoModal from './components/ZyInfoModal.vue';
import ZyInfoStudentListModal from '/@/views/zy/zyInfoStudent/ZyInfoStudentListModal.vue';
import ZyInfoStudentModal from '/@/views/zy/zyInfoStudent/components/ZyInfoStudentModal.vue';
import XxhbbksListModal from '/@/views/kc/xxhbbks/XxhbbksListModal.vue';
2024-05-07 09:57:47 +08:00
2024-05-06 19:41:47 +08:00
2024-05-07 09:57:47 +08:00
//当前路由信息
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
2024-05-08 16:04:27 +08:00
const { rwbh,xqxn,type } = query;//获取传递参数
2024-05-07 09:57:47 +08:00
const APagination = Pagination;
const { createConfirm,createMessage } = useMessage();
2024-05-06 19:41:47 +08:00
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
2024-05-07 09:57:47 +08:00
const ZyInfoStudentListModalPage = ref();
const ZyInfoStudentModalPage = ref();
2024-05-10 20:01:34 +08:00
const XxhbbksListModalPage = ref();
2024-05-07 09:57:47 +08:00
const current = ref<number>(0);
const total = ref<number>(0);
const pageNo = ref<number>(0);
const pageSize = ref<number>(6);
const tableData = ref<any>([]);
2024-05-06 19:41:47 +08:00
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
2024-05-10 20:01:34 +08:00
function classFun(type){
if(type == '0'){
return "background: #a7a6a6";
}else if(type == '1'){
return "background: #18a689";
}
}
2024-05-06 19:41:47 +08:00
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
2024-05-07 09:57:47 +08:00
2024-05-10 20:01:34 +08:00
//查看作业信息
2024-05-07 09:57:47 +08:00
function handleZyxx(record){
ZyInfoStudentListModalPage.value.disableSubmit = true;
ZyInfoStudentListModalPage.value.init(record);
}
2024-05-10 20:01:34 +08:00
//上传作业附件
2024-05-07 09:57:47 +08:00
function handleShangchuan(record){
ZyInfoStudentModalPage.value.disableSubmit = false;
2024-05-08 16:04:27 +08:00
var param = {mainId:record.id,zyfj:record.filePath}
2024-05-07 09:57:47 +08:00
ZyInfoStudentModalPage.value.edit(param);
}
2024-05-10 20:01:34 +08:00
//获取选课人数
function openXkrs(record){
console.log(`🚀 ~ openXkrs ~ record:`, record)
ZyInfoStudentModalPage.value.disableSubmit = true;
XxhbbksListModalPage.value.init(record);
}
2024-05-06 19:41:47 +08:00
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
2024-05-07 09:57:47 +08:00
2024-05-10 20:01:34 +08:00
//发布作业
2024-05-07 09:57:47 +08:00
async function handleFabu(record){
createConfirm({
iconType: 'warning',
title: '确认发布',
content: '是否发布作业数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
var url = "/zyInfo/zyInfo/edit";
var params = {id:record.id,zyStatus:'1'};
defHttp.post({ url: url, params }).then((res) => {
2024-05-13 16:29:57 +08:00
handleZySuccess(record.id);
2024-05-07 09:57:47 +08:00
});
}
});
2024-05-06 19:41:47 +08:00
}
2024-05-07 09:57:47 +08:00
2024-05-06 19:41:47 +08:00
/**
* 成功回调
*/
function handleSuccess() {
2024-05-07 09:57:47 +08:00
reload()
2024-05-06 19:41:47 +08:00
}
2024-05-13 16:29:57 +08:00
function handleZySuccess(zyid){
setTimeout(()=>{handleSuccess()}, 1500);
var url = "/zyInfo/zyInfo/editStudent";
defHttp.get({ url: url, params:{id:zyid} }).then((res) => {
});
}
2024-05-06 19:41:47 +08:00
/**
* 查询
*/
function searchQuery() {
2024-05-21 17:53:16 +08:00
queryParam.value.pageNo = 1;
2024-05-06 19:41:47 +08:00
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
2024-05-21 17:53:16 +08:00
queryParam.value.pageNo = 1;
2024-05-06 19:41:47 +08:00
//刷新数据
reload();
}
2024-05-07 09:57:47 +08:00
function reload(){
queryParam.value.pageNo = pageNo;
queryParam.value.pageSize = pageSize;
queryParam.value.rwbh = rwbh;
2024-05-08 16:04:27 +08:00
queryParam.value.xqxn = xqxn;
2024-05-10 20:01:34 +08:00
// queryParam.value.sflssj = '0';
2024-05-08 16:04:27 +08:00
queryParam.value.column="startTime";
queryParam.value.order="asc";
2024-05-07 09:57:47 +08:00
defHttp.get({ url: '/zyInfo/zyInfo/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;
});
}
2024-05-06 19:41:47 +08:00
2024-05-07 09:57:47 +08:00
function handlePageChange(record){
pageNo.value = record;
searchQuery();
}
2024-05-06 19:41:47 +08:00
2024-05-07 09:57:47 +08:00
onMounted(() => {
searchQuery();
});
2024-05-06 19:41:47 +08:00
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
2024-05-08 16:04:27 +08:00
padding: 0;
2024-05-06 19:41:47 +08:00
.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
}
}
2024-05-08 16:04:27 +08:00
.jeecg-basic-table-form-container .ant-form {
padding: 12px 10px 0px 10px;
margin-bottom: 0px;
background-color: #fff;
border-radius: 2px;
}
.ellipsis {
2024-05-07 09:57:47 +08:00
overflow: hidden; /* 确保超出容器的内容被裁剪 */
white-space: nowrap; /* 确保文本在一行内显示 */
text-overflow: ellipsis; /* 超出部分显示省略号 */
}
2024-05-08 16:04:27 +08:00
.zyCon{
line-height: 30px;
}
.rotate {
transform: rotate(45deg);
2024-05-10 20:01:34 +08:00
// background: rgb(28, 132, 198);
2024-05-08 16:04:27 +08:00
color: #fff;
padding: 19px 10px 3px 10px;
position: relative;
top: -54px;
right: -131px;
text-align: center;
font-size: 11px;
}
2024-05-06 19:41:47 +08:00
</style>