This commit is contained in:
2026-08-26 17:54:25 +08:00
3 changed files with 94 additions and 13 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ $base-menu-light-background:#ffffff;
$base-sub-menu-background: #084c3f; $base-sub-menu-background: #084c3f;
$base-sub-menu-hover: rgba(255,255,255,.10); $base-sub-menu-hover: rgba(255,255,255,.10);
$base-sidebar-width: 200px; $base-sidebar-width: 240px;
// the :export directive is the magic sauce for webpack // the :export directive is the magic sauce for webpack
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
@@ -22,16 +22,37 @@
<el-input v-model="searchForm.zjhm" placeholder="请输入证件号码" clearable /> <el-input v-model="searchForm.zjhm" placeholder="请输入证件号码" clearable />
</el-form-item> </el-form-item>
<el-form-item label="政治面貌"> <el-form-item label="政治面貌">
<el-input v-model="searchForm.zzmm" placeholder="请输入政治面貌" clearable /> <el-select v-model="searchForm.zzmm" placeholder="请选择政治面貌" clearable filterable class="full-width">
<el-option
v-for="item in politicalStatusOptions"
:key="item.dictCode || item.dictValue"
:label="item.dictLabel"
:value="item.dictLabel"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="民族"> <el-form-item label="民族">
<el-input v-model="searchForm.mz" placeholder="请输入民族" clearable /> <el-select v-model="searchForm.mz" placeholder="请选择民族" clearable filterable class="full-width">
<el-option
v-for="item in nationOptions"
:key="item.dictCode || item.dictValue"
:label="item.dictLabel"
:value="item.dictLabel"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="籍贯"> <el-form-item label="籍贯">
<el-input v-model="searchForm.jg" placeholder="请输入籍贯" clearable /> <el-input v-model="searchForm.jg" placeholder="请输入籍贯" clearable />
</el-form-item> </el-form-item>
<el-form-item label="学位"> <el-form-item label="学位">
<el-input v-model="searchForm.xw" placeholder="请输入学位" clearable /> <el-select v-model="searchForm.xw" placeholder="请选择学位" clearable filterable class="full-width">
<el-option
v-for="item in degreeOptions"
:key="item.dictCode || item.dictValue"
:label="item.dictLabel"
:value="item.dictLabel"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -44,7 +65,14 @@
<el-input v-model="searchForm.sfzh" placeholder="请输入身份证号" clearable /> <el-input v-model="searchForm.sfzh" placeholder="请输入身份证号" clearable />
</el-form-item> </el-form-item>
<el-form-item label="文化程度"> <el-form-item label="文化程度">
<el-input v-model="searchForm.whcd" placeholder="请输入文化程度" clearable /> <el-select v-model="searchForm.whcd" placeholder="请选择文化程度" clearable filterable class="full-width">
<el-option
v-for="item in educationLevelOptions"
:key="item.dictCode || item.dictValue"
:label="item.dictLabel"
:value="item.dictLabel"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="本科毕业院校"> <el-form-item label="本科毕业院校">
<el-input v-model="searchForm.bkbyyx" placeholder="请输入本科毕业院校" clearable /> <el-input v-model="searchForm.bkbyyx" placeholder="请输入本科毕业院校" clearable />
@@ -216,6 +244,12 @@ import {
updateStudentRecord, updateStudentRecord,
delStudentRecord delStudentRecord
} from "@/api/studentRecords/studentRecords" } from "@/api/studentRecords/studentRecords"
import { getDicts } from '@/api/system/dict/data'
const POLITICAL_STATUS_DICT_CODE = 'sys_political_status'
const NATION_DICT_CODE = 'nation_type'
const DEGREE_DICT_CODE = 'sys_degree_type'
const EDUCATION_LEVEL_DICT_CODE = 'sys_edu_level'
export default { export default {
name: 'StudentInfoIndex', name: 'StudentInfoIndex',
@@ -227,6 +261,10 @@ export default {
xh: '', xm: '', xb: '', zjhm: '', zzmm: '', mz: '', jg: '', xw: '', xh: '', xm: '', xb: '', zjhm: '', zzmm: '', mz: '', jg: '', xw: '',
ybzb: '', sfzh: '', whcd: '', bkbyyx: '', bq: '', lxdh: '', txdz: '' ybzb: '', sfzh: '', whcd: '', bkbyyx: '', bq: '', lxdh: '', txdz: ''
}, },
politicalStatusOptions: [],
nationOptions: [],
degreeOptions: [],
educationLevelOptions: [],
// ==================== 数据表格 ==================== // ==================== 数据表格 ====================
loading: false, loading: false,
@@ -272,10 +310,57 @@ export default {
gradesLoading: false gradesLoading: false
} }
}, },
created() {
this.loadStudentDictionaries()
},
mounted() { mounted() {
this.loadData() this.loadData()
}, },
methods: { methods: {
/** 加载学员基础信息字典,业务字段按字典标签查询和提交。 */
async loadStudentDictionaries() {
const emptyResponse = { data: [] }
const [politicalStatusResponse, nationResponse, degreeResponse, educationLevelResponse] =
await Promise.all([
getDicts(POLITICAL_STATUS_DICT_CODE).catch(() => emptyResponse),
getDicts(NATION_DICT_CODE).catch(() => emptyResponse),
getDicts(DEGREE_DICT_CODE).catch(() => emptyResponse),
getDicts(EDUCATION_LEVEL_DICT_CODE).catch(() => emptyResponse)
])
this.politicalStatusOptions = politicalStatusResponse.data || []
this.nationOptions = nationResponse.data || []
this.degreeOptions = degreeResponse.data || []
this.educationLevelOptions = educationLevelResponse.data || []
this.mergeExistingDictionaryOptions()
},
/** 字典缺项时保留列表已有值,避免历史数据无法作为查询条件。 */
mergeExistingDictionaryOptions() {
this.politicalStatusOptions = this.mergeFieldOptions(this.politicalStatusOptions, 'zzmm')
this.nationOptions = this.mergeFieldOptions(this.nationOptions, 'mz')
this.degreeOptions = this.mergeFieldOptions(this.degreeOptions, 'xw')
this.educationLevelOptions = this.mergeFieldOptions(this.educationLevelOptions, 'whcd')
},
mergeFieldOptions(dictionaryOptions, fieldName) {
const options = dictionaryOptions.slice()
const existingLabels = new Set(options.map(item => String(item.dictLabel)))
this.tableData.forEach(row => {
const value = row[fieldName]
if (value === '' || value === null || value === undefined || existingLabels.has(String(value))) {
return
}
options.push({
dictLabel: String(value),
dictValue: String(value)
})
existingLabels.add(String(value))
})
return options
},
/** 创建空白表单 */ /** 创建空白表单 */
createEmptyForm() { createEmptyForm() {
return { return {
@@ -297,6 +382,7 @@ export default {
const data = res.data || {} const data = res.data || {}
this.tableData = data.records || [] this.tableData = data.records || []
this.pagination.total = data.total || 0 this.pagination.total = data.total || 0
this.mergeExistingDictionaryOptions()
this.loading = false this.loading = false
}).catch(() => { }).catch(() => {
this.tableData = [] this.tableData = []
+3 -8
View File
@@ -7,11 +7,6 @@
<el-card shadow="never" class="search-card"> <el-card shadow="never" class="search-card">
<el-form :model="searchForm" label-width="90px" class="search-form"> <el-form :model="searchForm" label-width="90px" class="search-form">
<el-row :gutter="0"> <el-row :gutter="0">
<el-col :span="6">
<el-form-item label="编号">
<el-input v-model="searchForm.bh" placeholder="请输入编号" clearable />
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="教材名称"> <el-form-item label="教材名称">
<el-input v-model="searchForm.mc" placeholder="请输入教材名称" clearable /> <el-input v-model="searchForm.mc" placeholder="请输入教材名称" clearable />
@@ -804,7 +799,7 @@ export default {
// ==================== 查询表单(仅后端 Mapper 支持的字段) ==================== // ==================== 查询表单(仅后端 Mapper 支持的字段) ====================
searchForm: { searchForm: {
bh: '', mc: '', zz: '', cbs: '', isbn: '', mc: '', zz: '', cbs: '', isbn: '',
jcfl: '', jclx: '', ty: false jcfl: '', jclx: '', ty: false
}, },
@@ -951,7 +946,7 @@ export default {
// ==================== 列表加载 ==================== // ==================== 列表加载 ====================
buildQuery() { buildQuery() {
const params = {} const params = {}
;['bh', 'mc', 'zz', 'cbs', 'isbn', 'jcfl', 'jclx'].forEach(key => { ;['mc', 'zz', 'cbs', 'isbn', 'jcfl', 'jclx'].forEach(key => {
const value = this.searchForm[key] const value = this.searchForm[key]
if (value !== '' && value !== null && value !== undefined) { if (value !== '' && value !== null && value !== undefined) {
params[key] = String(value).trim() params[key] = String(value).trim()
@@ -988,7 +983,7 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
bh: '', mc: '', zz: '', cbs: '', isbn: '', mc: '', zz: '', cbs: '', isbn: '',
jcfl: '', jclx: '', ty: false jcfl: '', jclx: '', ty: false
} }
this.pageNum = 1 this.pageNum = 1