院校招录专业-加入内部录取方式字段

This commit is contained in:
zhouwentao 2024-06-07 17:30:25 +08:00
parent c46eb07a9f
commit c1ae3394f9
1 changed files with 64 additions and 10 deletions

View File

@ -52,11 +52,9 @@
</a-form-item>
</a-col>
<a-col :span="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:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="exportXls" style="margin: 8px">导出</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</a-row>
</a-form>
@ -94,7 +92,7 @@ import {defHttp} from '/@/utils/http/axios';
import {JVxeColumn, JVxeTypes} from '/@/components/jeecg/JVxeTable/types';
import {useMessage} from '/@/hooks/web/useMessage';
import { useListPage } from '/@/hooks/system/useListPage';
import {XLSX_FILE_SUFFIX, XLSX_MIME_TYPE} from "@/hooks/system/useMethods";
const labelCol = reactive({
xs: {span: 24},
sm: {span: 7},
@ -200,23 +198,35 @@ const columns = ref<JVxeColumn[]>([
type: JVxeTypes.input,
},
{
title: '录取方式缩写(文x专y)',
title: '录取方式缩写(用于筛选条件)',
key: 'rulesEnrollProbabilitySx',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取方式(文*x+专*y)',
title: '对外录取方式',
key: 'rulesEnrollProbability',
width: 150,
type: JVxeTypes.input,
},
{
title: '录取概率计算规则运算符',
title: '对外录取方式运算符',
key: 'probabilityOperator',
width: 150,
type: JVxeTypes.input,
},
{
title: '内部录取方式',
key: 'privateRulesEnrollProbability',
width: 150,
type: JVxeTypes.input,
},
{
title: '内部录取方式运算符',
key: 'privateProbabilityOperator',
width: 150,
type: JVxeTypes.input,
},
{
title: '批次',
key: 'batch',
@ -312,6 +322,7 @@ enum Api {
//
saveAll = '/yx/yxSchoolMajor/saveBatch',
deleteBatch = '/yx/yxSchoolMajor/deleteBatch',
exportXls = '/yx/yxSchoolMajor/exportXls',
}
loadData();
@ -465,6 +476,49 @@ function handlePageChange(event) {
function handleSelectRowChange(event) {
selectedRows.value = event.selectedRows;
}
/**
* 导出xls
* @param name
* @param url
*/
async function exportXls(isXlsx = false) {
let name = ''
let selections = ''
if (selectedRows.value) {
selectedRows.value.forEach(i=>{
selections+=i.id+","
})
console.log(selectedRows.value)
}
const data = await defHttp.get({ url: Api.exportXls, params: {selections:selections}, responseType: 'blob', timeout: 60000 }, { isTransformResponse: false });
if (!data) {
createMessage.warning('文件下载失败');
return;
}
if (!name || typeof name != 'string') {
name = '导出文件';
}
let blobOptions = { type: 'application/vnd.ms-excel' };
let fileSuffix = '.xls';
if (isXlsx === true) {
blobOptions['type'] = XLSX_MIME_TYPE;
fileSuffix = XLSX_FILE_SUFFIX;
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], blobOptions), name + fileSuffix);
} else {
let url = window.URL.createObjectURL(new Blob([data], blobOptions));
let link = document.createElement('a');
link.style.display = 'none';
link.href = url;
link.setAttribute('download', name + fileSuffix);
document.body.appendChild(link);
link.click();
document.body.removeChild(link); //
window.URL.revokeObjectURL(url); //blob
}
}
</script>
<style scoped></style>