DBSD_ZJPT/jeecgboot-vue3/src/views/bl/lwKhclXz/LwkhclAllList.vue

434 lines
12 KiB
Vue

<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form
ref="formRef3"
@keyup.enter.native="searchQuery"
:model="queryParam"
:label-col="labelCol"
:wrapper-col="wrapperCol"
class="query-criteria"
>
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="ssyxmc">
<template #label><span title="院系名称">院系名称</span></template>
<j-input placeholder="请输入院系名称" v-model:value="queryParam.ssyxmc" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="ssxnzymc">
<template #label><span title="校内专业">校内专业</span></template>
<j-input placeholder="请输入校内专业" v-model:value="queryParam.ssxnzymc" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="xsxh">
<template #label><span title="学生学号">学生学号</span></template>
<j-input placeholder="请输入学生学号" v-model:value="queryParam.xsxh" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="xsxm">
<template #label><span title="学生姓名">学生姓名</span></template>
<j-input placeholder="请输入学生姓名" v-model:value="queryParam.xsxm" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="bylwTm">
<template #label><span title="论文题目">论文题目</span></template>
<j-input placeholder="请输入学生姓名" v-model:value="queryParam.bylwTm" allow-clear></j-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="bylwCj">
<template #label><span title="论文成绩">论文成绩</span></template>
<a-select placeholder="请选择论文成绩" v-model:value="queryParam.bylwCjPar">
<a-select-option value="">全部</a-select-option>
<a-select-option value="1">优秀</a-select-option>
<a-select-option value="2">良好</a-select-option>
<a-select-option value="3">中等</a-select-option>
<a-select-option value="4">及格</a-select-option>
<a-select-option value="5">不及格</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" style="text-align: right">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" style="margin-left: 8px"> 导出</a-button>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" class="table-style">
<template #tableTitle> </template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
</div>
</template>
<script lang="ts" name="lwKhclXz-lwKhclXz" setup>
import { ref, reactive, onMounted } from 'vue';
import { useListPage } from '/@/hooks/system/useListPage';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { columns, columns2, columns3, superQuerySchema } from './LwKhclXz.data';
import { listAll, deleteOne, deleteXkxxOne, batchDelete, getImportUrl, getExport2Url } from './LwKhclXz.api';
import { useUserStore } from '/@/store/modules/user';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { downloadFile, downloadFileLoacl } from '/@/utils/common/renderUtils';
import { getFileAccessHttpUrl } from '@/utils/common/compUtils';
import { encryptByBase64 } from '@/utils/cipher';
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
import dayjs from 'dayjs';
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
const globSetting = useGlobSetting();
const baseApiUrl = globSetting.domainUrl;
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const queryParam2 = ref<any>({});
const emit = defineEmits(['callback']);
const checkData = ref<any>([]);
const dataList = ref<any>([]);
const sfxk = ref<number>(0);
const lwinfo = reactive<any>({});
const docUrl = ref<string>('');
const activeKey = ref('1');
const ktbgUrl = ref<string>('');
const ktbgshyjUrl = ref<string>('');
const zqjcUrl = ref<string>('');
const lwzgUrl = ref<string>('');
const zdjldUrl = ref<string>('');
const jcbgUrl = ref<string>('');
let onlinePreviewDomain = '';
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
api: listAll,
columns: columns3,
canResize: false,
useSearchForm: false,
showActionColumn: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '论文考核材料',
url: getExport2Url,
params: queryParam,
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }] = tableContext;
//批量下载
async function batchHandleDown(record) {
console.log('🙍‍♂️', record);
// 毕业论文-学院-专业-学生姓名-学号
var downName =
'毕业论文-' +
record.value.ssyxmc +
'-' +
(record.value.ssxnzymc ? record.value.ssxnzymc : '') +
'-' +
record.value.xsxm +
'-' +
record.value.xsxh +
'';
var params = { id: record.value.id, downName };
console.log('🕵', params);
defHttp.post({ url: '/lwKhclXz/lwKhclXz/getLwBatchDown', params: { id: record.value.id, downName } }).then((res) => {
console.log('---------', res);
downloadFileLoacl(res.downLoadPath);
});
}
//下载
function handleDownload(record) {
downloadFile(record);
}
//预览
function handleYulan(record) {
console.log('😶', record);
var file = getFileAccessHttpUrl(record);
window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file)));
}
//查看论文材料
async function handleChakan(record) {
lwinfo.value = record;
sfxk.value = 2;
if (lwinfo.value.ktbg) {
var file1 = getFileAccessHttpUrl(record.ktbg);
ktbgUrl.value = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1));
} else {
ktbgUrl.value = '';
}
if (lwinfo.value.ktbgshyj) {
var file1 = getFileAccessHttpUrl(record.ktbgshyj);
ktbgshyjUrl.value = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1));
} else {
ktbgshyjUrl.value = '';
}
if (lwinfo.value.zqjc) {
var file1 = getFileAccessHttpUrl(record.zqjc);
zqjcUrl.value = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1));
} else {
zqjcUrl.value = '';
}
if (lwinfo.value.lwzg) {
var file1 = getFileAccessHttpUrl(record.lwzg);
lwzgUrl.value = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1));
} else {
lwzgUrl.value = '';
}
if (lwinfo.value.zdjld) {
var file1 = getFileAccessHttpUrl(record.zdjld);
zdjldUrl.value = 'https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1));
} else {
zdjldUrl.value = '';
}
if (lwinfo.value.ccjg) {
jcbgUrl.value = record.ccjg;
} else {
jcbgUrl.value = '';
}
}
const getViewFileDomain = () => defHttp.get({ url: '/sys/comment/getFileViewDomain' });
/**
* 初始化domain
*/
async function initViewDomain() {
if (!onlinePreviewDomain) {
onlinePreviewDomain = await getViewFileDomain();
}
if (!onlinePreviewDomain.startsWith('http')) {
onlinePreviewDomain = 'http://' + onlinePreviewDomain;
}
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '查看论文材料',
onClick: handleChakan.bind(null, record),
},
// {
// label: '考核评价材料',
// onClick: handleKhpjcl.bind(null, record),
// },
// {
// label: '学生原始材料',
// onClick: handleXsyscl.bind(null, record),
// },
];
}
//注册table数据
const labelCol = reactive({
xs: 24,
sm: 8,
xl: 8,
xxl: 8,
});
const wrapperCol = reactive({
xs: 24,
sm: 14,
});
const paginationProp = ref<any>({
total: 1,
current: 1,
pageSize: 10,
pageNo: 1,
});
/**
* 查询
*/
function searchQuery() {
reload();
}
//选课
function handleXuanke() {
sfxk.value = 1;
searchQuery2();
}
//选课提交
function handleXUanze(record) {
record.mainId = record.id;
record.id = null;
console.log('😰record----------', record);
defHttp
.post({
url: '/lwKhclXz/lwKhclXz/add',
params: record,
})
.then((res) => {
console.log('🤛', res);
});
xtsuccess();
}
//选课删除
async function handleDel(record) {
await deleteXkxxOne({ id: record.id }, xtsuccess);
}
function xtsuccess() {
//获取是否有选课信息
defHttp.get({ url: '/lwKhclXz/lwKhclXz/list', params: { pageSize: -1 } }).then((res) => {
console.log('🧛', res);
checkData.value = res.records;
});
searchQuery2();
}
/**
* 查询
*/
function searchQuery2() {
queryParam2.value.pageNo = paginationProp.value.current;
defHttp.get({ url: '/lwKhcl/lwKhcl/getXkList', params: { pageNo: paginationProp.value.current, ...queryParam2.value } }).then((res) => {
dataList.value = res.records;
paginationProp.value.total = res.total;
paginationProp.value.current = res.pageNo;
});
}
//翻页方法
async function onPageChange(record) {
console.log('👬', record);
paginationProp.value.current = record.current;
await searchQuery2();
}
//返回首页
function handleFanhui() {
init();
}
function init() {
//获取是否有选课信息
defHttp.get({ url: '/lwKhclXz/lwKhclXz/list', params: { pageSize: -1 } }).then((res) => {
console.log('🧛', res);
if (res.records.length == 0) {
sfxk.value = 0;
checkData.value = [];
} else {
sfxk.value = 999;
checkData.value = res.records;
paginationProp.value.total = res.records.total;
paginationProp.value.current = res.records.pages;
}
});
}
function init2() {
//获取是否有选课信息
defHttp.get({ url: '/lwKhclXz/lwKhclXz/list', params: { pageSize: -1 } }).then((res) => {
console.log('🧛', res);
if (res.records.length == 0) {
sfxk.value = 0;
checkData.value = [];
} else {
sfxk.value = 1;
checkData.value = res.records;
paginationProp.value.total = res.records.total;
paginationProp.value.current = res.records.pages;
searchQuery2();
}
});
}
// 自动请求并暴露内部方法
onMounted(() => {
init2();
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center;
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
.query-criteria {
padding-top: 22px;
border: 1px solid #eaeef6;
border-radius: 4px;
}
.query-criteria:hover {
border: 1px solid #c5d8ff;
box-shadow: 2px 2px 10px 2px #e8ecf4;
border-radius: 4px;
}
.table-style {
padding: 10px;
background: #fff;
border: 1px solid #eaeef6;
border-radius: 4px;
}
.table-style:hover {
border: 1px solid #e8ecf4;
box-shadow: 2px 2px 10px 2px #e8ecf4;
border-radius: 4px;
}
.xn-title {
font-size: 16px;
font-weight: 700;
}
.selection-title {
font-size: 18px;
font-weight: 700;
padding-left: 10px;
}
.seleciton-line {
background: #1890ff;
border-radius: 10px;
color: #1890ff;
}
.mbxtitle {
font-size: 22px;
line-height: 22px;
}
</style>