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