fix: 解决下拉列表问题
This commit is contained in:
@@ -12,7 +12,22 @@
|
|||||||
|
|
||||||
<section class="filter-bar case-review-filter">
|
<section class="filter-bar case-review-filter">
|
||||||
<el-input v-model="filters.search" :prefix-icon="Search" clearable placeholder="搜索病例" @keyup.enter="handleSearch" />
|
<el-input v-model="filters.search" :prefix-icon="Search" clearable placeholder="搜索病例" @keyup.enter="handleSearch" />
|
||||||
<el-input v-model="filters.department" clearable placeholder="科室ID" @keyup.enter="handleSearch" />
|
<el-select
|
||||||
|
v-model="filters.department"
|
||||||
|
:loading="loadingDepartments"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="科室名称"
|
||||||
|
@change="handleSearch"
|
||||||
|
@visible-change="handleDepartmentVisibleChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in departmentOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="String(item.id)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
<el-button :icon="Search" type="primary" @click="handleSearch">查询</el-button>
|
<el-button :icon="Search" type="primary" @click="handleSearch">查询</el-button>
|
||||||
<el-button :icon="Refresh" @click="resetFilters">重置</el-button>
|
<el-button :icon="Refresh" @click="resetFilters">重置</el-button>
|
||||||
</section>
|
</section>
|
||||||
@@ -269,6 +284,7 @@ import {
|
|||||||
type CaseListItem,
|
type CaseListItem,
|
||||||
type CasePublishStatus
|
type CasePublishStatus
|
||||||
} from '@/api/cases'
|
} from '@/api/cases'
|
||||||
|
import { fetchMyDepartments, type DepartmentOption } from '@/api/users'
|
||||||
import { useAppStore } from '@/stores/app'
|
import { useAppStore } from '@/stores/app'
|
||||||
|
|
||||||
type ReviewCaseType = 'traditional' | 'teaching'
|
type ReviewCaseType = 'traditional' | 'teaching'
|
||||||
@@ -316,8 +332,10 @@ const appStore = useAppStore()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const publishing = ref(false)
|
const publishing = ref(false)
|
||||||
const detailLoading = ref(false)
|
const detailLoading = ref(false)
|
||||||
|
const loadingDepartments = ref(false)
|
||||||
const detailDrawerVisible = ref(false)
|
const detailDrawerVisible = ref(false)
|
||||||
const cases = ref<CaseListItem[]>([])
|
const cases = ref<CaseListItem[]>([])
|
||||||
|
const departmentOptions = ref<DepartmentOption[]>([])
|
||||||
const detailCase = ref<CaseListItem | null>(null)
|
const detailCase = ref<CaseListItem | null>(null)
|
||||||
const caseDetail = ref<unknown>(null)
|
const caseDetail = ref<unknown>(null)
|
||||||
const detailForm = reactive<ReviewCaseDetailForm>({
|
const detailForm = reactive<ReviewCaseDetailForm>({
|
||||||
@@ -396,6 +414,27 @@ function resetFilters() {
|
|||||||
loadReviewCases()
|
loadReviewCases()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadDepartmentOptions() {
|
||||||
|
if (!appStore.token || loadingDepartments.value || departmentOptions.value.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
loadingDepartments.value = true
|
||||||
|
departmentOptions.value = await fetchMyDepartments(appStore.token)
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error(error instanceof Error ? error.message : '获取科室列表失败')
|
||||||
|
} finally {
|
||||||
|
loadingDepartments.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDepartmentVisibleChange(visible: boolean) {
|
||||||
|
if (visible) {
|
||||||
|
loadDepartmentOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function openDetailDrawer(row: CaseListItem) {
|
async function openDetailDrawer(row: CaseListItem) {
|
||||||
if (!appStore.token) {
|
if (!appStore.token) {
|
||||||
ElMessage.warning('缺少登录信息,请重新登录')
|
ElMessage.warning('缺少登录信息,请重新登录')
|
||||||
@@ -871,7 +910,10 @@ function formatDateTime(value: string) {
|
|||||||
return value.replace('T', ' ').slice(0, 19)
|
return value.replace('T', ' ').slice(0, 19)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(loadReviewCases)
|
onMounted(() => {
|
||||||
|
loadReviewCases()
|
||||||
|
loadDepartmentOptions()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
+33
-2
@@ -22,9 +22,40 @@
|
|||||||
<el-option label="正常" :value="1" />
|
<el-option label="正常" :value="1" />
|
||||||
<el-option label="已发布" :value="2" />
|
<el-option label="已发布" :value="2" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input v-if="canManageInstitution" v-model="filters.institution" clearable placeholder="机构ID" @keyup.enter="loadCases" />
|
<el-select
|
||||||
|
v-if="canManageInstitution"
|
||||||
|
v-model="filters.institution"
|
||||||
|
:loading="loadingInstitutions"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="机构名称"
|
||||||
|
@change="handleSearch"
|
||||||
|
@visible-change="handleInstitutionVisibleChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in institutionOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="institutionOptionLabel(item)"
|
||||||
|
:value="String(item.id)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-input v-model="filters.department" clearable placeholder="科室ID" @keyup.enter="loadCases" />
|
<el-select
|
||||||
|
v-model="filters.department"
|
||||||
|
:loading="loadingDepartments"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
placeholder="科室名称"
|
||||||
|
@change="handleSearch"
|
||||||
|
@visible-change="handleDepartmentVisibleChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in departmentOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="String(item.id)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
<el-input v-model="filters.status" clearable placeholder="状态" @keyup.enter="loadCases" />
|
<el-input v-model="filters.status" clearable placeholder="状态" @keyup.enter="loadCases" />
|
||||||
<el-select v-model="filters.osce_enabled" clearable placeholder="OSCE">
|
<el-select v-model="filters.osce_enabled" clearable placeholder="OSCE">
|
||||||
<el-option label="开启" value="true" />
|
<el-option label="开启" value="true" />
|
||||||
|
|||||||
@@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
<section class="filter-bar relation-filter">
|
<section class="filter-bar relation-filter">
|
||||||
<el-input v-model="filters.search" :prefix-icon="Search" clearable placeholder="搜索师生姓名/手机号" @keyup.enter="loadRelations" />
|
<el-input v-model="filters.search" :prefix-icon="Search" clearable placeholder="搜索师生姓名/手机号" @keyup.enter="loadRelations" />
|
||||||
<el-input v-model="filters.teacher" clearable placeholder="带教医生手机号" @keyup.enter="loadRelations" />
|
|
||||||
<el-input v-model="filters.student" clearable placeholder="学生手机号" @keyup.enter="loadRelations" />
|
|
||||||
<el-select v-model="filters.status" clearable placeholder="状态">
|
<el-select v-model="filters.status" clearable placeholder="状态">
|
||||||
<el-option label="进行中" value="1" />
|
<el-option label="进行中" value="1" />
|
||||||
<el-option label="已结束" value="0" />
|
<el-option label="已结束" value="0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user