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

下拉数据整合

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