This commit is contained in:
zhoutianchi
2026-02-27 18:03:20 +08:00
parent 9f138bfe89
commit 0aa10b71a1
5 changed files with 56 additions and 41 deletions

View File

@@ -123,7 +123,7 @@ export function useTable(options?: BasicTableProps) {
};
// 覆盖默认值
const state = mergeDefaultOptions(defaultOptions, options);
const state = mergeDefaultOptions(defaultOptions, options || {});
/**
* 发起分页查询,并设置表格数据和分页信息

View File

@@ -1,9 +1,8 @@
<template>
<div class="mod-config">
<basic-container>
<div >
<el-form :inline="true" :model="dataForm" @keyup.enter="handleFilter" ref="searchFormRef">
<el-form-item label="招生计划" prop="groupId">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" size="small">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" >
<el-option
v-for="item in planList"
:key="item.id"
@@ -14,10 +13,10 @@
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" size="small"
<el-button icon="Search" type="primary"
@click="handleFilter">查询
</el-button>
<el-button icon="Delete" type="default" plain size="small"
<el-button icon="Delete" type="default" plain
@click="resetForm">清空
</el-button>
</el-form-item>
@@ -27,27 +26,24 @@
<el-button icon="Download" type="warning" size="small" @click="dataExportHandle">导出</el-button>
</el-form-item>
</el-form>
<div class="avue-crud">
<el-table :data="dataList" border stripe v-loading="dataListLoading"
:summary-method="getSummaries" show-summary
:summary-method="getSummaries" show-summary height="700"
>
<el-table-column align="center" header-align="center" prop="provinceName" label="省市" />
<el-table-column align="center" header-align="center" prop="peopleNum" label="人数" />
<el-table-column align="center" header-align="center" prop="peopleRate" label="占比" />
</el-table>
<chart ref="typeEchartBarRef" style="width:100%;margin-top:80px" :options="chartOption" theme="macarons"></chart>
<!-- <chart ref="typeEchartBarRef" style="width:100%;margin-top:80px" :options="chartOption" theme="macarons"></chart>-->
</div>
</basic-container>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import axios from 'axios'
import { getAreaStatic } from "@/api/recruit/recruitstudentsignup"
import { getList } from "@/api/recruit/recruitstudentplangroup"
import { getAreaStatic } from '/@/api/recruit/recruitstudentsignup'
import { getList } from '/@/api/recruit/recruitstudentplangroup'
// 响应式数据
const dataForm = reactive({
@@ -65,11 +61,13 @@ const typeEchartBarRef = ref()
// 初始化
const init = () => {
getList().then((data: any) => {
planList.value = data.data
planList.value = Array.isArray(data?.data) ? data.data : []
if (planList.value.length > 0) {
dataForm.groupId = planList.value[0].id
}
getDataList()
}).catch(() => {
planList.value = []
})
}
@@ -79,8 +77,26 @@ const getDataList = () => {
dataForm.degreeOfEducation = '1'
dataListLoading.value = true
getAreaStatic(dataForm).then((response: any) => {
dataList.value = response.data
chartOption.value = response.data.option
const res = response?.data
// 兼容:接口可能返回 { data: [], option: {} } 或直接返回数组
dataList.value = Array.isArray(res) ? res : (res?.data || res?.records || res?.list || [])
const rawOption = Array.isArray(res) ? null : (res?.option ?? null)
// 确保 chart 的 option 合法series[].data 必须为数组,避免 .includes 报错
if (rawOption && typeof rawOption === 'object') {
const option = { ...rawOption }
if (Array.isArray(option.series)) {
option.series = option.series.map((s: any) => ({
...s,
data: Array.isArray(s?.data) ? s.data : []
}))
}
if (option.data !== undefined && !Array.isArray(option.data)) {
option.data = []
}
chartOption.value = option
} else {
chartOption.value = {}
}
dataListLoading.value = false
}).catch(() => {
dataListLoading.value = false

View File

@@ -1,9 +1,8 @@
<template>
<div class="mod-config">
<basic-container>
<div>
<el-form :inline="true" :model="dataForm" @keyup.enter="handleFilter" ref="searchFormRef">
<el-form-item label="招生计划" prop="groupId">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" size="small">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" >
<el-option
v-for="item in planList"
:key="item.id"
@@ -14,30 +13,26 @@
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" size="small"
<el-button icon="Search" type="primary"
@click="handleFilter">查询
</el-button>
<el-button icon="Delete" type="default" plain size="small"
<el-button icon="Delete" type="default" plain
@click="resetForm">清空
</el-button>
</el-form-item>
</el-form>
<el-form>
<el-form-item>
<el-button icon="Download" type="warning" size="small" @click="dataExportHandle">导出</el-button>
<el-button icon="Download" type="warning" @click="dataExportHandle">导出</el-button>
</el-form-item>
</el-form>
<div class="avue-crud">
<el-table :data="dataList" border stripe v-loading="dataListLoading"
:summary-method="getSummaries" show-summary
>
<el-table :data="dataList" border stripe v-loading="dataListLoading" height="700"
:summary-method="getSummaries" show-summary>
<el-table-column align="center" header-align="center" prop="deptName" label="部门" />
<el-table-column align="center" header-align="center" prop="allNum" label="合计" />
<el-table-column align="center" header-align="center" prop="schoolNum" label="学校推荐" />
<el-table-column align="center" header-align="center" prop="contantNum" label="联系人" />
</el-table>
</div>
</basic-container>
</div>
</template>

View File

@@ -1,9 +1,8 @@
<template>
<div class="mod-config">
<basic-container>
<el-form :inline="true" :model="dataForm" @keyup.enter="handleFilter" ref="searchFormRef">
<el-form-item label="招生计划" prop="groupId">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划" size="small">
<el-select v-model="dataForm.groupId" filterable placeholder="请选择招生计划">
<el-option
v-for="item in planList"
:key="item.id"
@@ -14,17 +13,17 @@
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" size="small"
<el-button icon="Search" type="primary"
@click="handleFilter">查询
</el-button>
<el-button icon="Delete" type="default" plain size="small"
<el-button icon="Delete" type="default" plain
@click="resetForm">清空
</el-button>
</el-form-item>
</el-form>
<el-form>
<el-form-item>
<el-button icon="Download" type="warning" size="small" @click="dataExportHandle">导出</el-button>
<el-button icon="Download" type="warning" @click="dataExportHandle">导出</el-button>
</el-form-item>
</el-form>
<div class="avue-crud">
@@ -40,7 +39,6 @@
<el-table-column align="center" header-align="center" prop="allNum" label="高中+技职校" />
</el-table>
</div>
</basic-container>
</div>
</template>

View File

@@ -62,7 +62,7 @@
<el-table-column prop="minScore" header-align="center" align="center" label="最低分" />
<el-table-column prop="avgScore" header-align="center" align="center" label="平均分" />
<el-table-column prop="majorPeopleNum" header-align="center" align="center" label="专业人数" />
<el-table-column prop="avgScoreDB" header-align="center" align="center" label="均分对比" />
<!-- <el-table-column prop="avgScoreDB" header-align="center" align="center" label="均分对比" />-->
</el-table>
</div>
</div>
@@ -76,12 +76,13 @@ import { useDict } from '/@/hooks/dict'
import { juniorlneStatic } from '/@/api/recruit/recruitstudentsignup'
import { getList } from '/@/api/recruit/recruitstudentplangroup'
import { getDeptListByLevelTwo } from '/@/api/basic/basicdept'
import {getDictsByTypes} from "/@/api/admin/dict";
// 消息提示 hooks
const message = useMessage()
// 字典
const { getTypeValue } = useDict()
// const { useDict } = useDict()
// 引用
const searchFormRef = ref()
@@ -104,17 +105,22 @@ const queryForm = reactive({
// 使用 table hook 获取样式
const { tableStyle, downBlobFile } = useTable()
const queryDictData=()=>{
getDictsByTypes(['basic_major_years']).then((res:any)=>{
majorYears.value = res.data.basic_major_years || []
})
}
// 初始化
const init = async () => {
try {
const [deptResponse, majorYearsRes, planData] = await Promise.all([
queryDictData()
const [deptResponse, planData] = await Promise.all([
getDeptListByLevelTwo(),
getTypeValue('basic_major_years'),
getList()
])
deptCodes.value = deptResponse.data || []
majorYears.value = majorYearsRes.data || []
planList.value = planData.data || []
if (planList.value.length > 0) {