提交 a77721dd authored 作者: matian's avatar matian

fix:修改班级不显示问题

上级 9090d9d4
......@@ -18,3 +18,13 @@ export function getAlumniList(params?: {
export function getAlumniView(params: { id: string }) {
return httpRequest.get(`/api/hr/admin/v1/alumni-tenant/${params.id}`, { params })
}
// 获取班级列表
export function getClassList(params: {
page?: number
limit?: number
project_prefix: string
id: string
name: string
}) {
return httpRequest.get(`/api/hr/admin/v1/classes`, { params })
}
<script setup lang="ts">
import { useInfiniteScroll } from '@vueuse/core'
import { ref } from 'vue'
import { getAlumniList } from '../api'
import { getAlumniList, getClassList } from '../api'
const appList = ref()
const listOptions = {
remote: {
httpRequest: getAlumniList,
params: {
project_prefix: '',
username: '',
sex: '',
class_id: '',
province: '',
city: '',
industry: '',
workplace: ''
}
},
filters: [
{ type: 'input', prop: 'username', placeholder: '姓名' },
{
type: 'select',
prop: 'sex',
placeholder: '性别',
options: [
{ value: '0', label: '女士' },
{ value: '1', label: '先生' },
{ value: '2', label: '未知' }
]
},
{ type: 'input', prop: 'class_id', placeholder: '班级' },
{ type: 'input', prop: 'province', placeholder: '省份' },
{ type: 'input', prop: 'city', placeholder: '城市' },
{ type: 'input', prop: 'industry', placeholder: '所在行业' },
{ type: 'input', prop: 'workplace', placeholder: '工作单位' }
],
columns: [
{ label: '姓名', prop: 'username', align: 'center' },
{
label: '性别',
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 '未知'
}
interface classList {
loading: boolean
page: number
total: number
list: any[]
}
const classListItem = reactive<classList>({ loading: false, page: 1, total: 0, list: [] })
onMounted(() => {
handleGetClassList()
})
const handleGetClassList = () => {
const params = {
page: classListItem.page,
limit: 10000,
project_prefix: '',
id: '',
name: ''
}
getClassList(params).then((res: any) => {
classListItem.list = res.data.data
console.log(classListItem)
})
}
const listOptions = $computed(() => {
return {
remote: {
httpRequest: getAlumniList,
params: {
project_prefix: '',
username: '',
sex: '',
class_id: '',
province: '',
city: '',
industry: '',
workplace: ''
}
},
{ label: '班级', prop: 'name', align: 'center' },
{ label: '省份', prop: 'province', align: 'center' },
{ label: '城市', prop: 'city', align: 'center' },
{ label: '所在行业', prop: 'industry', align: 'center' },
{ label: '工作单位', prop: 'workplace', align: 'center' },
{ label: '操作', slots: 'table-operate', width: 230, align: 'center' }
]
filters: [
{ type: 'input', prop: 'username', placeholder: '姓名' },
{
type: 'select',
prop: 'sex',
placeholder: '性别',
options: [
{ value: '0', label: '女士' },
{ value: '1', label: '先生' },
{ value: '2', label: '未知' }
]
},
{
prop: 'class_id',
slots: 'filter-class'
},
{ type: 'input', prop: 'province', placeholder: '省份' },
{ type: 'input', prop: 'city', placeholder: '城市' },
{ type: 'input', prop: 'industry', placeholder: '所在行业' },
{ type: 'input', prop: 'workplace', placeholder: '工作单位' }
],
columns: [
{ label: '姓名', prop: 'username', align: 'center' },
{
label: '性别',
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 '未知'
}
}
},
{ label: '班级', prop: 'class.name', align: 'center' },
{ label: '省份', prop: 'province', align: 'center' },
{ label: '城市', prop: 'city', align: 'center' },
{ label: '所在行业', prop: 'industry', align: 'center' },
{ label: '工作单位', prop: 'workplace', align: 'center' },
{ label: '操作', slots: 'table-operate', width: 230, align: 'center' }
]
}
})
const handleFresh = () => {
appList.value.refetch()
}
</script>
<template>
<AppCard>
<AppList v-bind="listOptions" ref="appList">
<template #filter-class="{ params }">
<el-select @change="handleFresh" clearable v-model="params.class_id" placeholder="班级" ref="el">
<el-option v-for="item in classListItem.list" :key="item.id" :label="item.name" :value="item.class_id" />
</el-select>
</template>
<template #table-operate="{ row }">
<el-space>
<router-link :to="`/alumni/view?id=${row.id}`">
......
......@@ -12,6 +12,7 @@ const getAlumniDetail = () => {
const params: any = { id: route.query.id }
getAlumniView(params).then((res: any) => {
detailList.value = res.data.detail
console.log(detailList)
project.value = allPrefixList.filter((item: any) => item.prefix === detailList.value.project_prefix)
})
}
......@@ -19,9 +20,9 @@ const sex = computed(() => {
if (detailList.value.sex === '0') {
return '女士'
} else if (detailList.value.sex === '1') {
return '女士'
return '先生'
} else if (detailList.value.sex === '2') {
return '女士'
return '未知'
}
})
</script>
......@@ -44,7 +45,9 @@ const sex = computed(() => {
<el-descriptions-item label="省份:">{{ detailList?.province }}</el-descriptions-item>
<el-descriptions-item label="城市:">{{ detailList?.city }}</el-descriptions-item>
<el-descriptions-item label="项目:">{{ project.length ? project[0].name : '' }}</el-descriptions-item>
<el-descriptions-item label="班级:">{{ detailList?.name }}</el-descriptions-item>
<el-descriptions-item label="班级:">
<span v-for="(item, index) in detailList.class" :key="index">{{ item.name }}</span>
</el-descriptions-item>
<el-descriptions-item label="工作单位:">{{ detailList?.workplace }}</el-descriptions-item>
<el-descriptions-item label="行业类别:">{{ detailList?.industry }}</el-descriptions-item>
<el-descriptions-item label="工作部门:">{{ detailList?.department }}</el-descriptions-item>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论