dev
This commit is contained in:
parent
a092e74a90
commit
c2b791e784
|
|
@ -28,7 +28,11 @@
|
||||||
<el-table-column prop="name" label="科室类型" show-overflow-tooltip/>
|
<el-table-column prop="name" label="科室类型" show-overflow-tooltip/>
|
||||||
<el-table-column prop="bedCnt" label="病床数量" width="80" show-overflow-tooltip/>
|
<el-table-column prop="bedCnt" label="病床数量" width="80" show-overflow-tooltip/>
|
||||||
<el-table-column prop="beginDate" label="开始日期" width="100" show-overflow-tooltip/>
|
<el-table-column prop="beginDate" label="开始日期" width="100" show-overflow-tooltip/>
|
||||||
<el-table-column prop="caty" label="类别" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="caty" label="类别" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
{{ getDeptDisplayName(scope.row.caty) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="code" label="编码" width="180" show-overflow-tooltip/>
|
<el-table-column prop="code" label="编码" width="180" show-overflow-tooltip/>
|
||||||
<el-table-column prop="creationDate" label="创建日期" width="120" show-overflow-tooltip/>
|
<el-table-column prop="creationDate" label="创建日期" width="120" show-overflow-tooltip/>
|
||||||
<el-table-column prop="delFlag" label="删除标志" show-overflow-tooltip/>
|
<el-table-column prop="delFlag" label="删除标志" show-overflow-tooltip/>
|
||||||
|
|
@ -66,6 +70,7 @@ import Mask from '@/components/common/Mask.vue'
|
||||||
import SectionEdit from "@/components/settings/SectionEdit.vue";
|
import SectionEdit from "@/components/settings/SectionEdit.vue";
|
||||||
import {post} from "@/utils/request.ts";
|
import {post} from "@/utils/request.ts";
|
||||||
import deptsObj from '@/assets/config/directory/depts.json'
|
import deptsObj from '@/assets/config/directory/depts.json'
|
||||||
|
|
||||||
import {formatDate} from '@/utils/dateUtils.ts'
|
import {formatDate} from '@/utils/dateUtils.ts'
|
||||||
import depts from "@/assets/config/directory/depts.json";
|
import depts from "@/assets/config/directory/depts.json";
|
||||||
import {Plus} from "@element-plus/icons-vue";
|
import {Plus} from "@element-plus/icons-vue";
|
||||||
|
|
@ -92,13 +97,12 @@ interface Dept {
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
id.value = ''
|
id.value = ''
|
||||||
post('organization/section/list', {page: page.value, size: pageSize.value, ...search.value}).then((res: any) => {
|
post('organization/section/list', {
|
||||||
|
page: page.value,
|
||||||
|
size: pageSize.value, ...search.value
|
||||||
|
}).then((res: any) => {
|
||||||
tableData.value = res.list
|
tableData.value = res.list
|
||||||
tableData.value.forEach((item: any) => {
|
total.value = res.total_count
|
||||||
let dept: Dept = deptsObj
|
|
||||||
item.caty = dept[item.caty]
|
|
||||||
console.log(item.caty)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const changePage = (val: any) => {
|
const changePage = (val: any) => {
|
||||||
|
|
@ -126,6 +130,41 @@ const resetSearch = () => {
|
||||||
search.value = {}
|
search.value = {}
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
|
// 修改 depts 的类型定义,允许字符串索引
|
||||||
|
interface DeptMap {
|
||||||
|
[key: string]: string | { name: string; children?: { [key: string]: string } };
|
||||||
|
}
|
||||||
|
const getDeptDisplayName = (code: string): string => {
|
||||||
|
if (!code) return '未知科室'
|
||||||
|
|
||||||
|
const dept = (depts as DeptMap)[code]
|
||||||
|
|
||||||
|
// 如果是一级科室,并且是字符串类型
|
||||||
|
if (typeof dept === 'string') {
|
||||||
|
return dept
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是一级科室,并且是对象类型(包含 name)
|
||||||
|
if (typeof dept === 'object' && dept !== null && 'name' in dept) {
|
||||||
|
return dept.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是二级科室,尝试查找父级下的 value
|
||||||
|
for (const key in depts) {
|
||||||
|
const parentDept = depts[key]
|
||||||
|
if (
|
||||||
|
typeof parentDept === 'object' &&
|
||||||
|
parentDept !== null &&
|
||||||
|
'children' in parentDept &&
|
||||||
|
code in (parentDept.children || {})
|
||||||
|
) {
|
||||||
|
return parentDept.children?.[code] || '未知科室'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '未知科室'
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "@/assets/scss/base.scss";
|
@use "@/assets/scss/base.scss";
|
||||||
|
|
@ -158,6 +197,7 @@ const resetSearch = () => {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-input__wrapper) {
|
:deep(.el-input__wrapper) {
|
||||||
height: 42px;
|
height: 42px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue