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

366 lines
13 KiB
Vue
Raw Normal View History

2024-07-23 15:24:38 +08:00
<template>
<div style="margin-top:20px;">
<!--查询区域-->
<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="作业名称">
<j-input placeholder="请输入作业名称" v-model:value="queryParam.title"></j-input>
</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>
<!--引用表格-->
<BasicTable @register="registerTable" style="margin-top:-20px;">
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #wwsftgaction="{text,record}">
<span v-if="record.wwcc=='0'">-</span>
<span v-else>
<template v-if="record.wwfilestateid=='3'">
<span :title="record.wwmessage?record.wwmessage:'暂无原因,请联系管理员'" style="color:red;">检测失败</span>
</template>
<template v-else>
<span v-if="text=='通过'" style="color: green;padding: 5px 15px;cursor:pointer" title="通过(点击可查看对比结果)" @click="handleYulan(record.wwpaperviewurl)">{{record.wwxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;cursor:pointer" title="未通过(点击可查看对比结果)" @click="handleYulan(record.wwpaperviewurl)">{{record.wwxsl}}%</span>
<span v-else-if="text&&text.indexOf('失败')>-1" style="color: red;padding: 5px 15px;cursor:pointer" :title="text">{{text}}</span>
<span v-else>
<span v-if="record.filePath">检测中</span>
<span v-else>未提交</span>
</span>
</template>
</span>
</template>
<template #nwsftgaction="{text,record}">
<span v-if="record.nwcc=='0'">-</span>
<span v-else>
<template v-if="record.zyfilestateid=='3'">
<span :title="record.zymessage?record.zymessage:'暂无原因,请联系管理员'" style="color:red;">检测失败</span>
</template>
<template v-else>
<span v-if="text=='通过'" style="color: green;padding: 5px 15px;cursor:pointer" title="通过(点击可查看对比结果)" @click="handleYulan(record.zypaperviewurl)">{{record.nwxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;cursor:pointer" title="未通过(点击可查看对比结果)" @click="handleYulan(record.zypaperviewurl)">{{record.nwxsl}}%</span>
<span v-else-if="text&&text.indexOf('失败')>-1" style="color: red;padding: 5px 15px;cursor:pointer" :title="text">{{text}}</span>
<span v-else>
<span v-if="record.filePath">检测中</span>
<span v-else>未提交</span>
</span>
</template>
</span>
</template>
<template #aigcsftgaction="{text,record}">
<span v-if="record.aigccc=='0'">-</span>
<span v-else>
<template v-if="record.aigcfilestateid=='3'">
<span :title="record.aigcmessage?record.aigcmessage:'暂无原因,请联系管理员'" style="color:red;">检测失败</span>
</template>
<template v-else>
<span v-if="text=='通过'" style="color: green;padding: 5px 15px;cursor:pointer" title="通过(点击可查看对比结果)" @click="handleYulan(record.aigcpaperviewurl)">{{record.aigcxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;cursor:pointer" title="未通过(点击可查看对比结果)" @click="handleYulan(record.aigcpaperviewurl)">{{record.aigcxsl}}%</span>
<span v-else-if="text&&text.indexOf('失败')>-1" style="color: red;padding: 5px 15px;cursor:pointer" :title="text">{{text}}</span>
<span v-else>
<span v-if="record.filePath">检测中</span>
<span v-else>未提交</span>
</span>
</template>
</span>
</template>
<template #xnsftgaction="{text,record}">
<span v-if="record.xncc=='0'">-</span>
<span v-else>
<template v-if="record.xxfilestateid=='3'">
<span :title="record.xxmessage?record.xxmessage:'暂无原因,请联系管理员'" style="color:red;">检测失败</span>
</template>
<template v-else>
<span v-if="text=='通过'" style="color: green;padding: 5px 15px;cursor:pointer" title="通过(点击可查看对比结果)" @click="handleYulan(record.xxpaperviewurl)">{{record.xnxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;cursor:pointer" title="未通过(点击可查看对比结果)" @click="handleYulan(record.xxpaperviewurl)">{{record.xnxsl}}%</span>
<span v-else-if="text&&text.indexOf('失败')>-1" style="color: red;padding: 5px 15px;cursor:pointer" :title="text">{{text}}</span>
<span v-else>
<span v-if="record.filePath">检测中</span>
<span v-else>未提交</span>
</span>
</template>
</span>
</template>
</BasicTable>
<!-- 表单区域 -->
<ZyInfoDetailModal ref="registerModal" @success="handleSuccess"></ZyInfoDetailModal>
<ZyInfoStudentListModal ref="ZyInfoStudentListModalPage"></ZyInfoStudentListModal>
<ZyInfoStudentModal ref="ZyInfoStudentModalPage" @success="handleSuccess"></ZyInfoStudentModal>
<XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal>
</div>
</template>
<script lang="ts" name="zyInfoStudent-zyInfoStudent" setup>
import { ref, reactive,defineExpose,unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columnsStu } from '/@/views/zy/zyInfoStudent/ZyInfoStudent.data';
import { stuList, deleteOne, batchDelete, getImportUrl, getExportUrl,batchFabu } from '/@/views/zy/zyInfoStudent/ZyInfoStudent.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
// import ZyInfoStudentModal from '/@/views/zy/zyInfoStudent/components/ZyInfoStudentModal.vue'
// import SzybStudentModal from '/@/views/zy/zyInfoStudent/components/SzybStudentModal.vue';
// import ZyInfoStudentScoreModal from '/@/views/zy/zyInfoStudent/components/ZyInfoStudentScoreModal.vue'
import ZyInfoDetailModal from './components/ZyInfoDetailModal.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';
import { useGlobSetting } from '/@/hooks/setting';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { JInput } from '/@/components/Form';
import { useRouter } from 'vue-router';
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh,xqxn,type,teano } = query;//获取传递参数
const { createMessage } = useMessage();
const globSetting = useGlobSetting();
const baseApiUrl = globSetting.domainUrl;
const queryParam = ref<any>({rwbh,xqxn,teano,zyStatus:'1,2,3,4'});
const mainId = ref<string>('');
const toggleSearchStatus = ref<boolean>(false);
// const registerModal = ref();
// const registerScoreModal = ref();
// const SzybStudentModalpage = ref();
const registerModal = ref();
const ZyInfoStudentListModalPage = ref();
const ZyInfoStudentModalPage = ref();
const XxhbbksListModalPage = ref();
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
api: stuList,
columns:columnsStu,
canResize:false,
useSearchForm: false,
actionColumn: {
width: '150px',
fixed: 'right',
},
showTableSetting: true,
defSort: {
field: 'name',
order: 'ascend',
},
beforeFetch: (params) => {
params.column = 'createTime',params.order = 'desc';//新生成的默认不带排序
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: "学生作业信息",
url: getExportUrl,
params: () => {
return Object.assign({},queryParam.value);
}
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
//上传作业附件
function handleShangchuan(record){
let timestamp = new Date().getTime();
let startTimestamp = Date.parse(record.startTime);
if(timestamp<startTimestamp){
createMessage.error('还未到提交作业时间!');
return;
}
let endTimestamp = Date.parse(record.endTime+" 23:59:59");
if(timestamp>endTimestamp){
createMessage.error('提交作业时间已过!');
return;
}
ZyInfoStudentModalPage.value.disableSubmit = false;
var param = {id:record.stuId,zyfj:record.filePath}
ZyInfoStudentModalPage.value.edit(param);
// createConfirm({
// iconType: 'warning',
// title: '确认上传',
// content: '作业上传后,不可修改,请仔细检查后提交',
// okText: '确认',
// cancelText: '取消',
// onOk: () => {
// ZyInfoStudentModalPage.value.disableSubmit = false;
// var param = {id:record.stuId,zyfj:record.filePath}
// ZyInfoStudentModalPage.value.edit(param);
// }
// });
}
//预览
function handlePreview(record){
var url2 = getFileAccessHttpUrl(record.stuPdfPath)
let url = baseApiUrl+"/generic/web/viewer.html?file="+encodeURIComponent(url2);
window.open(url,"_blank")
}
function handleDownload(record){
downloadFile(record.stuFilePath)
}
/**
* 成功回调
*/
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function handleDown(text){
downloadFile(text);
}
/**
* 操作栏
*/
function getTableAction(record) {
// <a-button type="primary" @click="handleDetail(item)" style="margin-left:5px;background:rgb(28, 132, 198);">详情</a-button>
// <a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="!item.stuFilePath">上传</a-button>
// <a-button type="primary" @click="handleDownload(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.stuFilePath">下载</a-button>
// <a-button type="primary" @click="handlePreview(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.stuFilePath">预览</a-button>
if(record.filePath){
var list = [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '下载',
onClick: handleDownload.bind(null, record),
},
{
label: '预览',
onClick: handlePreview.bind(null, record),
},
];
return list;
}else{
var list = [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '上传',
onClick: handleShangchuan.bind(null, record),
},
];
return list;
}
}
function handleYulan(text){
window.open(text,"_blank")
}
/**
* 查询
*/
function searchQuery() {
selectedRowKeys.value = [];
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
queryParam.value.mainId = mainId;
//刷新数据
reload();
}
function init(record){
selectedRowKeys.value = [];
queryParam.value = {};
queryParam.value.mainId = record.id;
queryParam.value.queryType = record.queryType;
mainId.value = record.id;
reload();
}
defineExpose({
init,
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.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
}
}
</style>