DBSD_ZJPT/jeecgboot-vue3/src/views/bl/xxhbjwxtscwjxx/KhpjclList.vue

311 lines
7.3 KiB
Vue
Raw Normal View History

2024-10-24 12:55:39 +08:00
<template>
<div class="p-2">
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection" class="table-style">
<template #tableTitle>
<a-button type="primary" v-if="selectedRowKeys.length > 0" @click="batchHandleDown"> 批量下载 </a-button>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<!-- 表单区域 -->
<XxhbjwxtscwjxxModal ref="registerModal" @success="handleSuccess"></XxhbjwxtscwjxxModal>
</div>
</template>
<script lang="ts" name="xxhbjwxtscwjxx-xxhbjwxtscwjxx" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './Xxhbjwxtscwjxx.data';
import { khcllist, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Xxhbjwxtscwjxx.api';
import { downloadFile,downloadFileLoacl } from '/@/utils/common/renderUtils';
import XxhbjwxtscwjxxModal from './components/XxhbjwxtscwjxxModal.vue';
import { useUserStore } from '/@/store/modules/user';
import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
import dayjs from 'dayjs';
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const jxrwInfo = reactive<any>({kcmc:''});
import { getFileAccessHttpUrl } from '@/utils/common/compUtils';
import { encryptByBase64 } from '@/utils/cipher';
import { defHttp } from '/@/utils/http/axios';
const emit = defineEmits(['callback']);
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
api: khcllist,
columns,
canResize: false,
useSearchForm: false,
// showActionColumn: false,
actionColumn: {
width: 320,
// fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '教务系统上传文件信息',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4,
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
// 高级查询配置
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
function handleFanhui() {
emit('callback');
}
/**
* 新增事件
*/
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);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 批量下载事件
*/
async function batchHandleDown() {
var downName = '《'+jxrwInfo?.value.kcmc+'》考核评价材料'+dayjs().format('YYYYMMDDHHmmss')+"";
defHttp.post({ url: "/xxhbjwxtscwjxx/xxhbjwxtscwjxx/getBatchDown", params: { downPath: selectedRowKeys.value,downName } }).then((res) => {
console.log(res);
downloadFileLoacl(res.path);
});
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 预览
*/
function handleYulan(record) {
var file1 = getFileAccessHttpUrl(record.path.replaceAll(" ","").replaceAll("","(").replaceAll("",")"));
if(file1){
console.log("filename--->",file1)
defHttp.post({ url: '/sys/common/ycxz',params:{fileName:file1+","} }).then((res) => {});
}
console.log("ktbgUrl1--->",file1)
window.open('https://jxdd.nenu.edu.cn/onlinePreview/onlinePreview?url=' + encodeURIComponent(encryptByBase64(file1)),"_blank");
}
/**
* 下载
*/
function handleDown(record) {
downloadFile(record.path.replaceAll(" ","").replaceAll("","(").replaceAll("",")"));
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '查看',
onClick: handleYulan.bind(null, record),
},
{
label: '下载',
onClick: handleDown.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'xxhbjwxtscwjxx:xxhbjwxtscwjxx:delete',
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//刷新数据
reload();
}
function init(record) {
queryParam.kcrwdm = record.kcrwdm;
// queryParam.fjtype = '课程考核合理性审核记录单,课程目标达成情况评价报告,课程考核质量评价单,期未考试-试题(或内容及要求),期末考试-评分标准,历次过程性考核-内容及要求(或试题),历次过程性考核-评分标准';
queryParam.fjtype = '历次过程性考核-评分标准,历次过程性考核-内容及要求(或试题),课程考核合理性审核记录单,期末考试-评分标准,期未考试-试题(或内容及要求),课程考核质量评价单,课程目标达成情况评价报告';
// 平时成绩
// 期末成绩
// 期中成绩
// 实践成绩
jxrwInfo.value = record;
reload();
}
defineExpose({
init,
});
</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%;
}
}
.selection-title{
font-size:18px;
font-weight: 700;
padding-left:10px;
}
.seleciton-line{
background: #1890ff;
border-radius:10px ;
color: #1890ff;
}
.header-title{
font-size: 16px;
color: #666;
}
.query-criteria{
padding:10px 10px 15px 10px;
border:1px solid #e4e9f2;
border-radius:4px;
}
.query-criteria:hover{
border:1px solid #e4e9f2;
box-shadow: 2px 2px 10px 2px #e4e9f2;
border-radius:4px;
}
.table-style{
padding: 10px;
background: #fff;
border:1px solid #e4e9f2;
border-radius:4px;
}
.table-style:hover{
border:1px solid #e4e9f2;
box-shadow: 2px 2px 10px 2px #e4e9f2;
border-radius:4px;
}
.ant-table-wrapper .ant-table.ant-table-middle{
font-size: 18px;
}
.mbxtitle{
font-size: 22px;line-height: 22px
}
</style>