提交 2022a97a authored 作者: matian's avatar matian

下拉数据整合

上级 1c4b6f5f
......@@ -59,3 +59,18 @@ export const industryCategory: Record<string, string> = {
'90': '其他'
}
export const industryCategoryList = Object.values(industryCategory).map(item => ({ label: item, value: item }))
// 学历
export const highGraduation = [
{ value: '1', label: '高中或以下' },
{ value: '2', label: '大专' },
{ value: '3', label: '本科' },
{ value: '4', label: '硕士研究生' },
{ value: '5', label: '博士' }
]
// 性别
export const sexList = [
{ value: '1', label: '女士' },
{ value: '2', label: '先生' },
{ value: '3', label: '未知' }
]
<script setup lang="ts">
import { allPrefixList, industryCategoryList } from '../prefix'
import { allPrefixList, industryCategoryList, sexList } from '../prefix'
import { useArea } from '@/composables/useArea'
import { ref } from 'vue'
import { getAlumniList, getClassList } from '../api'
const appList = ref()
......@@ -17,7 +16,7 @@ const classListItem = reactive<classList>({ loading: false, page: 1, total: 0, l
onMounted(() => {
handleGetClassList()
})
// 获取班级列表
const handleGetClassList = () => {
const params = {
page: classListItem.page,
......@@ -28,10 +27,12 @@ const handleGetClassList = () => {
}
getClassList(params).then((res: any) => {
classListItem.list = res.data.data
console.log(classListItem)
})
}
// 刷新页面
const handleFresh = () => {
appList.value?.refetch()
}
const listOptions = {
remote: {
httpRequest: getAlumniList,
......@@ -58,11 +59,7 @@ const listOptions = {
type: 'select',
prop: 'sex',
placeholder: '性别',
options: [
{ value: '0', label: '女士' },
{ value: '1', label: '先生' },
{ value: '2', label: '未知' }
]
options: sexList
},
{
prop: 'class_id',
......@@ -84,13 +81,12 @@ const listOptions = {
prop: 'sex',
align: 'center',
computed(row: any) {
if (row.row.sex === '0') {
return '女士'
} else if (row.row.sex === '1') {
return '先生'
} else if (row.row.sex === '2') {
return '未知'
}
return sexList.filter((item: any) => {
console.log(item, row.row, 'item')
if (item.value === row.row.sex) {
return item
}
})[0]?.label
}
},
{ label: '班级', prop: 'class.name', align: 'center' },
......@@ -100,11 +96,10 @@ const listOptions = {
align: 'center',
computed(row: any) {
return allPrefixList.filter((item: any) => {
console.log(item, row.row, 'item')
if (item.prefix === row.row.project_prefix) {
return item
}
})[0].name
})[0]?.name
}
},
{ label: '省份', prop: 'province', align: 'center' },
......@@ -114,9 +109,6 @@ const listOptions = {
{ label: '操作', slots: 'table-operate', width: 230, align: 'center' }
]
}
const handleFresh = () => {
appList.value.refetch()
}
</script>
<template>
......
<script setup lang="ts">
import { getAlumniView } from '../api'
import {allPrefixList} from '../prefix'
import { allPrefixList, highGraduation, sexList } from '../prefix'
const route = useRoute()
const detailList: any = ref({})
let project: any = ref([])
......@@ -8,6 +8,7 @@ let project: any = ref([])
onMounted(() => {
getAlumniDetail()
})
// 获取详情列表
const getAlumniDetail = () => {
const params: any = { id: route.query.id }
getAlumniView(params).then((res: any) => {
......@@ -16,22 +17,15 @@ const getAlumniDetail = () => {
project.value = allPrefixList.filter((item: any) => item.prefix === detailList.value.project_prefix)
})
}
const sex = computed(() => {
if (detailList.value.sex === '0') {
return '女士'
} else if (detailList.value.sex === '1') {
return '先生'
} else if (detailList.value.sex === '2') {
return '未知'
}
})
</script>
<template>
<AppCard title="校友详情">
<el-descriptions :column="3" title="基本信息">
<el-descriptions-item label="姓名:">{{ detailList?.username }}</el-descriptions-item>
<el-descriptions-item label="性别:">{{ sex }}</el-descriptions-item>
<el-descriptions-item label="性别:">
{{ sexList.filter(item => item.value === detailList?.sex)[0]?.label }}
</el-descriptions-item>
<el-descriptions-item label="出生日期:">{{ detailList?.birthday }}</el-descriptions-item>
<el-descriptions-item label="毕业院校:">
{{ detailList?.graduating_institution }}
......@@ -40,7 +34,7 @@ const sex = computed(() => {
{{ detailList?.specialty }}
</el-descriptions-item>
<el-descriptions-item label="最高学历:">
{{ detailList?.highest_qualification }}
{{ highGraduation.filter(item => item.value === detailList?.highest_qualification)[0]?.label }}
</el-descriptions-item>
<el-descriptions-item label="省份:">{{ detailList?.province }}</el-descriptions-item>
<el-descriptions-item label="城市:">{{ detailList?.city }}</el-descriptions-item>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论