diff --git a/frontend/src/assets/styles/variables.scss b/frontend/src/assets/styles/variables.scss index 0c8cb1db0..aa399c4d9 100644 --- a/frontend/src/assets/styles/variables.scss +++ b/frontend/src/assets/styles/variables.scss @@ -19,7 +19,7 @@ $base-menu-light-background:#ffffff; $base-sub-menu-background: #084c3f; $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 // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass diff --git a/frontend/src/views/student/studentInfo/index.vue b/frontend/src/views/student/studentInfo/index.vue index 9f651aa98..80a7c082d 100644 --- a/frontend/src/views/student/studentInfo/index.vue +++ b/frontend/src/views/student/studentInfo/index.vue @@ -22,16 +22,37 @@ - + + + - + + + - + + + @@ -44,7 +65,14 @@ - + + + @@ -216,6 +244,12 @@ import { updateStudentRecord, delStudentRecord } 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 { name: 'StudentInfoIndex', @@ -227,6 +261,10 @@ export default { xh: '', xm: '', xb: '', zjhm: '', zzmm: '', mz: '', jg: '', xw: '', ybzb: '', sfzh: '', whcd: '', bkbyyx: '', bq: '', lxdh: '', txdz: '' }, + politicalStatusOptions: [], + nationOptions: [], + degreeOptions: [], + educationLevelOptions: [], // ==================== 数据表格 ==================== loading: false, @@ -272,10 +310,57 @@ export default { gradesLoading: false } }, + created() { + this.loadStudentDictionaries() + }, mounted() { this.loadData() }, 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() { return { @@ -297,6 +382,7 @@ export default { const data = res.data || {} this.tableData = data.records || [] this.pagination.total = data.total || 0 + this.mergeExistingDictionaryOptions() this.loading = false }).catch(() => { this.tableData = [] diff --git a/frontend/src/views/textbook/index.vue b/frontend/src/views/textbook/index.vue index 2ae46e4ad..d409d92fa 100644 --- a/frontend/src/views/textbook/index.vue +++ b/frontend/src/views/textbook/index.vue @@ -7,11 +7,6 @@ - - - - - @@ -804,7 +799,7 @@ export default { // ==================== 查询表单(仅后端 Mapper 支持的字段) ==================== searchForm: { - bh: '', mc: '', zz: '', cbs: '', isbn: '', + mc: '', zz: '', cbs: '', isbn: '', jcfl: '', jclx: '', ty: false }, @@ -951,7 +946,7 @@ export default { // ==================== 列表加载 ==================== buildQuery() { const params = {} - ;['bh', 'mc', 'zz', 'cbs', 'isbn', 'jcfl', 'jclx'].forEach(key => { + ;['mc', 'zz', 'cbs', 'isbn', 'jcfl', 'jclx'].forEach(key => { const value = this.searchForm[key] if (value !== '' && value !== null && value !== undefined) { params[key] = String(value).trim() @@ -988,7 +983,7 @@ export default { handleReset() { this.searchForm = { - bh: '', mc: '', zz: '', cbs: '', isbn: '', + mc: '', zz: '', cbs: '', isbn: '', jcfl: '', jclx: '', ty: false } this.pageNum = 1