This commit is contained in:
Xubx 2024-10-17 14:19:04 +08:00
parent ccd3305924
commit aaedf72cf3
3 changed files with 544 additions and 291 deletions

View File

@ -67,6 +67,10 @@
getCollegeRate: '/cet/getRateByCollege', getCollegeRate: '/cet/getRateByCollege',
getAllRate: '/cet/getAllRate', getAllRate: '/cet/getAllRate',
getCollegeMajor: '/cet/getCollegeMajor', getCollegeMajor: '/cet/getCollegeMajor',
getMajor: '/cet/getMajorByCollege',
getMajorRate: '/cet/getRateByMajor',
getRateByMajor: '/cet/getRateByMajor', getRateByMajor: '/cet/getRateByMajor',
}, },
map1loading: false, map1loading: false,
@ -114,6 +118,8 @@
this.oneentrydate = '2017'; this.oneentrydate = '2017';
} }
this.query(query, college, [this.oneentrydate]); this.query(query, college, [this.oneentrydate]);
this.majorPassRate();
this.gradePassRate();
}, },
async majorQuery() { async majorQuery() {
if (this.majorentrydate.length == 0) { if (this.majorentrydate.length == 0) {
@ -254,32 +260,108 @@
}; };
myChart.setOption(collegeOption); myChart.setOption(collegeOption);
}, },
// //
majorPassRate() { async majorPassRate() {
var myChart = echarts.init(document.getElementById('map3')); var myChart = echarts.init(document.getElementById('map3'));
var option = { const name = '西语学院';
//let entrydate = this.oneentrydate.map((item) => item.value);
//console.log(entrydata, 'entrydata');
let queryParams = {
college: [[name]],
entrydate: [this.oneentrydate],
level: 'cet4',
};
let url = this.Url.getMajorRate;
console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams });
console.log(myChart, 'mychart');
if (!result) {
return;
}
console.log(result.data, 'result');
//result = result.data[name];
// result.data
const majors = Object.keys(result.data); //
const passRates = majors.map((major) => {
const entries = result.data[major];
return entries.length > 0 ? parseFloat(entries[0].passRate) : 0; //
});
let xData = majors.map((label) => label.split('').join('\n')); //x
var majorOption = {
tooltip: {
trigger: 'item',
conginee: false,
//
itemStytle: {
fontSize: 100,
},
formatter: function (params) {
// %
return `${params.marker}${params.name} ${params.value}%`;
},
},
title: { title: {
text: '西语学院各专业四级通过率', text: name + '各专业四级通过率',
textStyle: { textStyle: {
fontSize: 14, fontSize: 14,
}, },
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['英语', '翻译', '法语', '葡萄牙语', '西班牙语'], data: xData,
axisLabel: {
interval: 0, //x
//rotate: -10, //30
},
//data: result.map((item) => item.major),
//data: ['', '', '', '', '西'],
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
}, },
series: [ series: [
{ {
data: [200, 150, 80, 70, 110, 130], label: {
show: true,
fontSize: 14,
overflow: 'truncate',
position: 'top',
formatter: function (params) {
//
return params.value + '%';
},
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
//
label: {
show: false,
fontSize: 14,
fontWeight: 'bold',
},
},
data: passRates,
//data: result.map((item) => item.passRate),
//data: [200, 150, 80, 70, 110, 130],
type: 'bar', type: 'bar',
}, },
], ],
animationDurationUpdate: 500,
}; };
myChart.setOption(option); myChart.setOption(majorOption);
}, },
dataChart(data, tab) { dataChart(data, tab) {
let seriesData = []; let seriesData = [];
let xData = []; let xData = [];
@ -531,6 +613,7 @@
}, },
]; ];
myChart.setOption(option, true); myChart.setOption(option, true);
// 使 // 使
myChart.on('click', async (params) => { myChart.on('click', async (params) => {
let name = params.name; let name = params.name;
@ -620,6 +703,98 @@
// this.college = [params]; // this.college = [params];
// this.query(tab, this.college, this.entrydate); // this.query(tab, this.college, this.entrydate);
//
let querMajorParam = {
college: [[name]],
entrydate: [this.oneentrydate],
level: 'cet4',
};
let urlMajor = this.Url.getMajorRate;
console.log(querMajorParam, 'querMajorParam');
let resultMajor = await defHttp.post({ url: urlMajor, data: querMajorParam });
console.log(myChart, 'mychart');
if (!resultMajor) {
return;
}
console.log(resultMajor.data, 'resultMajor');
//result = result.data[name];
// result.data
const majors = Object.keys(resultMajor.data); //
const passRates = majors.map((major) => {
const entries = resultMajor.data[major];
return entries.length > 0 ? parseFloat(entries[0].passRate) : 0; //
});
xData = majors.map((label) => label.split('').join('\n')); //x
var majorOption = {
tooltip: {
trigger: 'item',
conginee: false,
//
itemStytle: {
fontSize: 100,
},
},
title: {
text: name + '各专业四级通过率',
textStyle: {
fontSize: 14,
},
},
xAxis: {
type: 'category',
data: xData,
axisLabel: {
interval: 0, //x
//rotate: -10, //30
},
//data: result.map((item) => item.major),
//data: ['', '', '', '', '西'],
},
yAxis: {
type: 'value',
},
series: [
{
//
label: {
show: true,
fontSize: 14,
overflow: 'truncate',
position: 'top',
formatter: function (params) {
//
return params.value + '%';
},
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
//
label: {
show: false,
fontSize: 14,
fontWeight: 'bold',
},
},
data: passRates,
//data: result.map((item) => item.passRate),
//data: [200, 150, 80, 70, 110, 130],
type: 'bar',
},
],
animationDurationUpdate: 500,
};
console.log(majorOption, 'majorOption');
var map3Chart = echarts.init(document.getElementById('map3'));
map3Chart.setOption(majorOption, true);
} }
}); });
}, },

View File

@ -83,6 +83,9 @@
getCollege: '/cet/getCollege', getCollege: '/cet/getCollege',
getRate: '/cet/getRateByAllBatch', getRate: '/cet/getRateByAllBatch',
getCollegeMajor: '/cet/getCollegeMajor', getCollegeMajor: '/cet/getCollegeMajor',
getRateByMajor: '/cet/getgetRateByMajor',
getRateByMajorAndLastestBatch: '/cet/getRateByMajorAndLastestBatch',
getRateByEntryDate: '/cet/getRateByEntryDate',
}, },
loading: false, loading: false,
collegeOptions: [], collegeOptions: [],
@ -182,86 +185,39 @@
myChart.setOption(option); myChart.setOption(option);
}, },
//--- //--
draPieChart_Pass() { async draPieChart_Participate() {
//console.log(this.passRatePie); console.log(this.collegeMajor, 'collegeMajor');
//console.log('piedata', piedata); let college = this.collegeMajor[0];
let myChart = echarts.init(document.getElementById('pass_Piechart')); let major = this.collegeMajor[1];
console.log(college, major, 'college major');
let option = {
tooltip: {
trigger: '',
conginee: false,
//
itemStytle: {
fontSize: 100,
},
},
title: {
//text: '/',
left: 'left',
top: '0%',
textStyle: {
fontSize: 14,
},
},
legend: {
top: '5%',
left: 'center',
},
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [
{
name: '学院/专业每个批次通过人数饼图',
type: 'pie',
radius: ['0', '100%'],
top: 80,
itemStyle: {
borderRadius: 5,
borderColor: '#fff',
borderWideth: 2,
},
label: {
show: true,
fontSize: 14,
overflow: 'truncate',
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
label: {
show: true,
fontSize: 15,
fontWeight: 'bold',
},
},
data: [
{ value: 1048, name: '计算机' },
{ value: 735, name: '东语' },
{ value: 580, name: '物理' },
{ value: 484, name: '大数据' },
{ value: 300, name: '树莓' },
],
},
],
};
myChart.setOption(option);
},
//---
draPieChart_Participate() {
//console.log(this.passRatePie);
//console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('participate_Piechart')); let myChart = echarts.init(document.getElementById('participate_Piechart'));
let queryParams = {
college: college,
major: major,
level: 'cet4',
};
let url = this.Url.getRateByMajorAndLastestBatch;
console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams });
if (!result) {
return;
}
console.log(result.data, 'result');
// 使 API
let chartData = result.data.map((item) => ({
name: item.entryDate + '级',
value: item.passRate,
}));
let option = { let option = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
conginee: false, //conginee: false,
// //
itemStytle: { itemStytle: {
// //
@ -272,14 +228,14 @@
fontSize: 100, fontSize: 100,
}, },
}, },
// title: { title: {
// text: '/', text: '最新批次每一年级的通过率饼图',
// left: 'top', left: 'top',
// top: '0%', top: '0%',
// textStyle: { textStyle: {
// fontSize: 12, fontSize: 12,
// }, },
// }, },
legend: { legend: {
top: '5%', top: '5%',
left: 'center', left: 'center',
@ -302,7 +258,7 @@
color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'], color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
series: [ series: [
{ {
name: '学院/专业该批次通过人数饼图', name: college + '/' + major + '该批次通过人数饼图',
type: 'pie', type: 'pie',
radius: ['50%', '100%'], radius: ['50%', '100%'],
center: ['50%', '50%'], center: ['50%', '50%'],
@ -337,13 +293,7 @@
fontWeight: 'bold', fontWeight: 'bold',
}, },
}, },
data: [ data: chartData,
{ value: 1048, name: '计算机' },
{ value: 735, name: '东语' },
{ value: 580, name: '物理' },
{ value: 484, name: '大数据' },
{ value: 300, name: '树莓' },
],
}, },
{ {
type: 'pie', type: 'pie',
@ -366,13 +316,7 @@
tooltip: { tooltip: {
show: false, show: false,
}, },
data: [ data: chartData,
{ value: 1048, name: '计算机' },
{ value: 735, name: '东语' },
{ value: 580, name: '物理' },
{ value: 484, name: '大数据' },
{ value: 300, name: '树莓' },
],
}, },
], ],
}; };
@ -386,6 +330,142 @@
}); });
}, },
//--/
async draPieChart_Pass() {
//console.log(this.passRatePie);
//console.log('piedata', piedata);
let myChart = echarts.init(document.getElementById('pass_Piechart'));
let college = this.collegeMajor[0];
let major = this.collegeMajor[1];
let queryParams = {
college: college,
major: major,
level: 'cet4',
};
let url = this.Url.getRateByEntryDate;
console.log(queryParams, 'queryParams');
let result = await defHttp.post({ url: url, data: queryParams });
if (!result) {
return;
}
console.log(result, 'result');
// result
let xData = result.data.map((item) => item.entryDate); // X
let values = result.data.map((item) => item.passRate); //
console.log(xData, values, 'xData values');
let option = {
grid: {
left: '15%', //
top: '20%', //
right: '10%', //
bottom: '10%', //
},
tooltip: {
trigger: 'item',
formatter: function (params) {
// %
return `${params.marker}${params.name} ${params.value}%`;
},
},
title: {
text: college + '/' + '每个年级的通过率柱状图',
left: 'left',
top: '0%',
textStyle: {
fontSize: 14,
},
},
xAxis: {
type: 'category',
data: xData,
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}%', // Y
},
},
series: [
{
data: values,
type: 'bar',
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)',
},
label: {
show: true, //
position: 'top', //
formatter: '{c}%', //
},
},
],
};
//let option = {
// tooltip: {
// trigger: 'item',
// conginee: false,
// //
// itemStytle: {
// fontSize: 100,
// },
// },
// title: {
// text: '/',
// left: 'left',
// top: '0%',
// textStyle: {
// fontSize: 14,
// },
// },
// legend: {
// top: '5%',
// left: 'center',
// },
// color: ['#b3cde0', '#6497b1', '#005b96', '#03396c', '#e5e5e5'],
// series: [
// {
// name: '/',
// type: 'pie',
// radius: ['0', '100%'],
// top: 80,
// itemStyle: {
// borderRadius: 5,
// borderColor: '#fff',
// borderWideth: 2,
// },
// label: {
// show: true,
// fontSize: 14,
// overflow: 'truncate',
// },
// emphasis: {
// itemStyle: {
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowColor: 'rgba(0, 0, 0, 0.5)',
// },
// label: {
// show: true,
// fontSize: 15,
// fontWeight: 'bold',
// },
// },
// data: [
// { value: 1048, name: '' },
// { value: 735, name: '' },
// { value: 580, name: '' },
// { value: 484, name: '' },
// { value: 300, name: '' },
// ],
// },
// ],
//};
myChart.setOption(option);
},
// //
async getBatch() { async getBatch() {
const getBatch = await defHttp.get({ url: this.Url.getBatch }); const getBatch = await defHttp.get({ url: this.Url.getBatch });
@ -440,6 +520,7 @@
level: 'cet4', level: 'cet4',
}; };
data = await defHttp.get({ url: this.Url.getRate, params }); data = await defHttp.get({ url: this.Url.getRate, params });
console.log(data, 'data');
} finally { } finally {
this.loading = false; this.loading = false;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -1,206 +1,203 @@
<template> <template>
<div style="background: #ececec; padding-top: 0px;padding-left: 20px;padding-right: 20px;padding-bottom: 20px;"> <div style="background: #ececec; padding-top: 0px; padding-left: 20px; padding-right: 20px; padding-bottom: 20px">
    <a-card title="考场座位查询" :bordered="false">    
<a-row> <a-card title="考场座位查询" :bordered="false">
<a-col :span="5"> <a-row>
<locationaTree ref="locationaTrees" :height="700" @onSelect="onSelect"></locationaTree> <a-col :span="5">
</a-col> <locationaTree ref="locationaTrees" :height="700" @on-select="onSelect" />
<a-col :span="19"> </a-col>
<!--引用表格--> <a-col :span="19">
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <!--引用表格-->
<!--插槽:table标题--> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle> <!--插槽:table标题-->
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <template #tableTitle>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
@click="onImportXls">导入</j-upload-button> <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay> <template #overlay>
<a-menu> <a-menu>
<a-menu-item key="1" @click="batchHandleDelete"> <a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon> <Icon icon="ant-design:delete-outlined" />
删除 删除
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>
<a-button>批量操作 <a-button
<Icon icon="mdi:chevron-down"></Icon> >批量操作
</a-button> <Icon icon="mdi:chevron-down" />
</a-dropdown> </a-button>
<!-- 高级查询 --> </a-dropdown>
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> <!-- 高级查询 -->
</template> <super-query :config="superQueryConfig" @search="handleSuperQuery" />
<!--操作栏--> </template>
<template #action="{ record }"> <!--操作栏-->
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <template #action="{ record }">
</template> <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
<!--字段回显插槽--> </template>
<template v-slot:bodyCell="{ column, record, index, text }"> <!--字段回显插槽-->
</template> <template #bodyCell="{ column, record, index, text }"> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->
<CetLocationModal @register="registerModal" @success="handleSuccess"></CetLocationModal> <CetLocationModal @register="registerModal" @success="handleSuccess" />
</a-col> </a-col>
</a-row> </a-row>
</a-card> </a-card>
</div> </div>
</template> </template>
<script lang="ts" name="CET-cetLocation" setup> <script lang="ts" name="CET-cetLocation" setup>
import { ref, reactive, computed, unref } from 'vue'; import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage' import { useListPage } from '/@/hooks/system/useListPage';
import CetLocationModal from './components/CetLocationModal.vue' import CetLocationModal from './components/CetLocationModal.vue';
import locationaTree from './components/locationaTree.vue' import locationaTree from './components/locationaTree.vue';
import { columns, searchFormSchema, superQuerySchema } from './CetLocation.data'; import { columns, searchFormSchema, superQuerySchema } from './CetLocation.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CetLocation.api'; import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CetLocation.api';
import { downloadFile } from '/@/utils/common/renderUtils'; import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]); const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore(); const userStore = useUserStore();
//model //model
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: { tableProps: {
title: 'cet_location', title: 'cet_location',
api: list, api: list,
columns, columns,
canResize: false, canResize: false,
formConfig: { formConfig: {
//labelWidth: 120, //labelWidth: 120,
schemas: searchFormSchema, schemas: searchFormSchema,
autoSubmitOnEnter: true, autoSubmitOnEnter: true,
showAdvancedButton: true, showAdvancedButton: true,
fieldMapToNumber: [ fieldMapToNumber: [],
], fieldMapToTime: [],
fieldMapToTime: [ },
], actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
}, },
actionColumn: { exportConfig: {
width: 120, name: 'cet_location',
fixed: 'right' url: getExportUrl,
params: queryParam,
}, },
beforeFetch: (params) => { importConfig: {
return Object.assign(params, queryParam); url: getImportUrl,
success: handleSuccess,
}, },
}, });
exportConfig: {
name: "cet_location",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
// //
const superQueryConfig = reactive(superQuerySchema); const superQueryConfig = reactive(superQuerySchema);
/** /**
* 高级查询事件 * 高级查询事件
*/ */
function handleSuperQuery(params) { function handleSuperQuery(params) {
Object.keys(params).map((k) => { Object.keys(params).map((k) => {
queryParam[k] = params[k]; queryParam[k] = params[k];
}); });
reload(); reload();
} }
/* /*
* 树查询 * 树查询
*/ */
function onSelect(selectedRowKeys) { function onSelect(selectedRowKeys) {
// //
selectedRowKeys = selectedRowKeys.join(',') selectedRowKeys = selectedRowKeys.join(',');
console.log(selectedRowKeys) console.log(selectedRowKeys);
queryParam.id = selectedRowKeys queryParam.id = selectedRowKeys;
reload() reload();
} }
/** /**
* 新增事件 * 新增事件
*/ */
function handleAdd() { function handleAdd() {
openModal(true, { openModal(true, {
isUpdate: false, isUpdate: false,
showFooter: true, showFooter: true,
}); });
} }
/** /**
* 编辑事件 * 编辑事件
*/ */
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, {
record, record,
isUpdate: true, isUpdate: true,
showFooter: true, showFooter: true,
}); });
} }
/** /**
* 详情 * 详情
*/ */
function handleDetail(record: Recordable) { function handleDetail(record: Recordable) {
openModal(true, { openModal(true, {
record, record,
isUpdate: true, isUpdate: true,
showFooter: false, showFooter: false,
}); });
} }
/** /**
* 删除事件 * 删除事件
*/ */
async function handleDelete(record) { async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess); await deleteOne({ id: record.id }, handleSuccess);
} }
/** /**
* 批量删除事件 * 批量删除事件
*/ */
async function batchHandleDelete() { async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
} }
/** /**
* 成功回调 * 成功回调
*/ */
function handleSuccess() { function handleSuccess() {
(selectedRowKeys.value = []) && reload(); (selectedRowKeys.value = []) && reload();
} }
/** /**
* 操作栏 * 操作栏
*/ */
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ {
label: '编辑', label: '编辑',
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
} },
] ];
} }
/** /**
* 下拉操作栏 * 下拉操作栏
*/ */
function getDropDownAction(record) { function getDropDownAction(record) {
return [ return [
{ {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, { },
label: '删除', {
popConfirm: { label: '删除',
title: '是否确认删除', popConfirm: {
confirm: handleDelete.bind(null, record), title: '是否确认删除',
placement: 'topLeft', confirm: handleDelete.bind(null, record),
} placement: 'topLeft',
} },
] },
} ];
}
</script> </script>
<style scoped></style> <style scoped></style>