Merge branch 'main' of https://gitea.fengyingkj.top/zhaichao/education
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -22,16 +22,37 @@
|
||||
<el-input v-model="searchForm.zjhm" placeholder="请输入证件号码" clearable />
|
||||
</el-form-item>
|
||||
<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 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 label="籍贯">
|
||||
<el-input v-model="searchForm.jg" placeholder="请输入籍贯" clearable />
|
||||
</el-form-item>
|
||||
<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-col>
|
||||
|
||||
@@ -44,7 +65,14 @@
|
||||
<el-input v-model="searchForm.sfzh" placeholder="请输入身份证号" clearable />
|
||||
</el-form-item>
|
||||
<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 label="本科毕业院校">
|
||||
<el-input v-model="searchForm.bkbyyx" placeholder="请输入本科毕业院校" clearable />
|
||||
@@ -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 = []
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
<el-card shadow="never" class="search-card">
|
||||
<el-form :model="searchForm" label-width="90px" class="search-form">
|
||||
<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-form-item label="教材名称">
|
||||
<el-input v-model="searchForm.mc" placeholder="请输入教材名称" clearable />
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user