This commit is contained in:
ChenQiuYu 2025-05-20 13:01:03 +08:00
parent c2b791e784
commit c76999b3d3
1 changed files with 22 additions and 22 deletions

View File

@ -12,8 +12,8 @@
<el-input v-model="search.resperName" placeholder="负责人姓名" style="width: 200px"></el-input>
</el-form-item>
<el-form-item>
<el-cascader :props="{ checkStrictly: true }" v-model="search.caty" :options="options"
placeholder="科室类别"/>
<!-- <el-cascader :props="{ checkStrictly: true }" v-model="search.caty" :options="options"-->
<!-- placeholder="科室类别"/>-->
</el-form-item>
</el-form>
</div>
@ -72,7 +72,6 @@ import {post} from "@/utils/request.ts";
import deptsObj from '@/assets/config/directory/depts.json'
import {formatDate} from '@/utils/dateUtils.ts'
import depts from "@/assets/config/directory/depts.json";
import {Plus} from "@element-plus/icons-vue";
const id = ref<any>("")
@ -112,32 +111,33 @@ const pageSize = ref(20);
const page = ref(1);
const total = ref(0);
const search = ref<any>({})
const options = Object.entries(depts).map(([key, value]) => {
if (typeof value === 'string') {
return {value: key, label: value};
} else {
return {
value: key,
label: value.name,
children: Object.entries(value.children).map(([childKey, childValue]) => ({
value: childKey,
label: childValue,
})),
};
}
});
const resetSearch = () => {
search.value = {}
init()
}
// depts
interface DeptMap {
[key: string]: string | { name: string; children?: { [key: string]: string } };
// script setup
interface DeptChildren {
[key: string]: string;
}
interface DeptItem {
name: string;
children?: DeptChildren;
}
type DeptsType = {
[key: string]: string | DeptItem;
};
// depts DeptsType
const depts: DeptsType = deptsObj;
// getDeptDisplayName
const getDeptDisplayName = (code: string): string => {
if (!code) return '未知科室'
const dept = (depts as DeptMap)[code]
const dept = depts[code]
//
if (typeof dept === 'string') {
@ -151,7 +151,7 @@ const getDeptDisplayName = (code: string): string => {
// value
for (const key in depts) {
const parentDept = depts[key]
const parentDept = depts[key] as DeptItem; //
if (
typeof parentDept === 'object' &&
parentDept !== null &&