dbsd_kczx/src/views/zy/zyInfoStudent/ZyInfoStudentList.vue

470 lines
16 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>
<!--查询区域-->
<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.studentName"></j-input>
</a-form-item>
</a-col>
<a-col :lg="8">
<a-form-item label="学生学号">
<j-input placeholder="请输入学生学号" v-model:value="queryParam.createBy"></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-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" style="margin-left: 8px"> 导出</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection" style="margin-top:-20px;">
<template #tableTitle>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleFabu">
<Icon icon="ant-design:delete-outlined"></Icon>
发布评分
</a-menu-item>
</a-menu>
</template>
<a-button type="primary">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
<span style="font-size: 16px;font-weight:blod;color:b9b6b6;width:100%;">温馨提醒: 非高峰期预计30分钟内返回检测结果高峰期预计时间会更长请您耐心等待</span>
</template>
<!--操作栏-->
<template #action="{ record }">
<!-- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(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;" title="通过" @click="handleYulan(record.wwpaperviewurl)">{{record.wwxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;" title="未通过" @click="handleYulan(record.wwpaperviewurl)">{{record.wwxsl}}%</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;" title="通过" @click="handleYulan(record.zypaperviewurl)">{{record.nwxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;" title="未通过" @click="handleYulan(record.zypaperviewurl)">{{record.nwxsl}}%</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;" title="通过" @click="handleYulan(record.aigcpaperviewurl)">{{record.aigcxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;" title="未通过" @click="handleYulan(record.aigcpaperviewurl)">{{record.aigcxsl}}%</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;" title="通过" @click="handleYulan(record.xxpaperviewurl)">{{record.xnxsl}}%</span>
<span v-else-if="text=='未通过'" style="color: red;padding: 5px 15px;" title="未通过" @click="handleYulan(record.xxpaperviewurl)">{{record.xnxsl}}%</span>
<span v-else>
<span v-if="record.filePath">检测中</span>
<span v-else>未提交</span>
</span>
</template>
</span>
</template>
<!--<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>-->
<!-- <template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template> -->
<!-- <template #fileZxSlot="{text,record}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="yulanFile(text)">预览</a-button>
</template> -->
</BasicTable>
<!-- 表单区域 -->
<ZyInfoStudentModal ref="registerModal" @success="handleSuccess"></ZyInfoStudentModal>
<ZyInfoStudentScoreModal ref="registerScoreModal" @success="handleSuccess"></ZyInfoStudentScoreModal>
<SzybStudentModal ref="SzybStudentModalpage" @success="handleSuccess"></SzybStudentModal>
</div>
</template>
<script lang="ts" name="zyInfoStudent-zyInfoStudent" setup>
import { ref, reactive,defineExpose } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './ZyInfoStudent.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,batchFabu } from './ZyInfoStudent.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ZyInfoStudentModal from './components/ZyInfoStudentModal.vue'
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import SzybStudentModal from '/@/views/zy/zyInfoStudent/components/SzybStudentModal.vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import ZyInfoStudentScoreModal from '/@/views/zy/zyInfoStudent/components/ZyInfoStudentScoreModal.vue'
import { useGlobSetting } from '/@/hooks/setting';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { JInput } from '/@/components/Form';
const { createMessage } = useMessage();
const globSetting = useGlobSetting();
const baseApiUrl = globSetting.domainUrl;
const queryParam = ref<any>({});
const mainId = ref<string>('');
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerScoreModal = ref();
const SzybStudentModalpage = ref();
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
api: list,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: '300px',
// fixed: 'right',
},
beforeFetch: (params) => {
params.column = '',params.order = '';//新生成的默认不带排序
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 yulanFile(record){
// let url = "https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(getFileAccessHttpUrl(text));
// let url = "https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(getFileAccessHttpUrl(text));
// let url = "https://view.xdocin.com/view?src="+encodeURIComponent('https://view.xdocin.com/demo/view.docx');
// window.open(url,"_blank")
var url2 = getFileAccessHttpUrl(record.pdfPath)
console.log(`🚀 ~ openPdf ~ url2:`, url2)
let url = baseApiUrl+"/generic/web/viewer.html?file="+encodeURIComponent(url2);
window.open(url,"_blank")
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
function handleScore(record: Recordable) {
registerScoreModal.value.disableSubmit = false;
registerScoreModal.value.edit(record);
}
function handleBohui(record: Recordable){
defHttp.post({url:'/zyInfoStudent/zyInfoStudent/editBohui',params:{id:record.id}}).then(res =>{
handleSuccess()
})
}
function handleScoreFabu(record: Recordable){
//判断
if(!record.score){
createMessage.warn('请填写评分!');
return;
}
defHttp.post({url:'/zyInfoStudent/zyInfoStudent/editFabu',params:{id:record.id,scoreFabu:'1'}}).then(res =>{
handleSuccess()
})
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
//存档类型
function handleSzyb(record: Recordable){
SzybStudentModalpage.value.disabled = false;
SzybStudentModalpage.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
async function batchHandleFabu() {
await batchFabu({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function handleDown(text){
downloadFile(text);
}
/**
* 操作栏
*/
function getTableAction(record) {
if(record.filePath){
if(record.scoreFabu=='1'){
var list = [
{
label: '设置样本',
onClick: handleSzyb.bind(null, record),
},
{
label: '作业',
onClick: handleDown.bind(null, record.filePath),
},
{
label: '预览',
onClick: yulanFile.bind(null, record),
},
];
return list;
}else{
var list = [
{
label: '驳回',
onClick: handleBohui.bind(null, record),
},
{
label: '评分',
onClick: handleScore.bind(null, record),
},
{
label: '发布评分',
onClick: handleScoreFabu.bind(null, record),
},
{
label: '作业',
onClick: handleDown.bind(null, record.filePath),
},
{
label: '预览',
onClick: yulanFile.bind(null, record),
},
];
return list;
}
}else{
var list = [ ];
return list;
}
}
function handleYulan(text){
window.open(text,"_blank")
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
var list = [];
if(record.filePath){
list.push({
label: '作业下载',
onClick: handleDown.bind(null, record.filePath),
});
list.push({
label: '作业预览',
onClick: yulanFile.bind(null, record),
});
}
if(record.wwpaperdownurl){
list.push({
label: '外网结果下载',
onClick: handleDown.bind(null, record.wwpaperdownurl),
});
list.push({
label: '外网结果预览',
onClick: handleYulan.bind(null, record.wwpaperviewurl),
});
}
if(record.zypaperdownurl){
list.push({
label: '作业结果下载',
onClick: handleDown.bind(null, record.zypaperdownurl),
});
list.push({
label: '作业结果预览',
onClick: handleYulan.bind(null, record.zypaperviewurl),
});
}
if(record.aigcpaperdownurl){
list.push({
label: 'aigc结果下载',
onClick: handleDown.bind(null, record.aigcpaperdownurl),
});
list.push({
label: 'aigc结果预览',
onClick: handleYulan.bind(null, record.aigcpaperviewurl),
});
}
if(record.xxpaperdownurl){
list.push({
label: '学校结果下载',
onClick: handleDown.bind(null, record.xxpaperdownurl),
});
list.push({
label: '学校结果预览',
onClick: handleYulan.bind(null, record.xxpaperviewurl),
});
}
return list;
}
/**
* 查询
*/
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;
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>