|
@@ -12,7 +12,7 @@
|
|
|
|
|
|
</el-form-item>
|
|
|
<el-form-item label="创建人科室">
|
|
|
- <el-input v-model="queryParams.createBy" placeholder="请选择" clearable />
|
|
|
+ <el-tree-select v-model="queryParams.createBy" :data="treeData" :props="treeProps" placeholder="请选择" check-strictly node-key="id" @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类型">
|
|
|
<el-select v-model="queryParams.templateTypeId" placeholder="请选择" clearable>
|
|
@@ -88,6 +88,7 @@
|
|
|
import { listResultTemplateType } from '@/api/parameter/basicPublicTemplate/consultantResultTemplateType';
|
|
|
import type { ResultTemplateTypeQuery } from '@/api/parameter/basicPublicTemplate/consultantResultTemplateType/types';
|
|
|
import ResultTemplateTypeDialog from '../consultantResultTemplateType/resultTemplateTypeDialog.vue';
|
|
|
+ import { listDept } from '@/api/system/dept'; // 部门列表
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const resultTemplateList = ref < ResultTemplateVO[] > ([]);
|
|
@@ -99,6 +100,7 @@
|
|
|
const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
|
import { useRouter } from 'vue-router';
|
|
|
+ const treeData = ref([]); // 定义 treeData
|
|
|
import { json } from 'stream/consumers';
|
|
|
const router = useRouter();
|
|
|
const queryFormRef = ref < ElFormInstance > ();
|
|
@@ -109,6 +111,11 @@
|
|
|
value: string | number;
|
|
|
label: string;
|
|
|
}
|
|
|
+ const treeProps = ref({
|
|
|
+ value: 'deptId', // 对应部门的 deptId
|
|
|
+ label: 'deptName', // 对应部门的 deptName
|
|
|
+ children: 'children' // 保持原有的父子结构
|
|
|
+ });
|
|
|
const templateTypeList = ref < ResultTemplateTypeOption[] > ([]);
|
|
|
|
|
|
const dialog = reactive < DialogOption > ({
|
|
@@ -175,12 +182,48 @@
|
|
|
loading.value = true;
|
|
|
const res = await listResultTemplate(queryParams.value);
|
|
|
resultTemplateList.value = res.rows;
|
|
|
- console.log(JSON.stringify(resultTemplateList.value));
|
|
|
-
|
|
|
+ // 获取部门数据
|
|
|
+ const deptMap = new Map();
|
|
|
+ treeData.value.forEach(dept => {
|
|
|
+ deptMap.set(dept.deptId, dept.deptName);
|
|
|
+ if (dept.children) {
|
|
|
+ dept.children.forEach(child => {
|
|
|
+ deptMap.set(child.deptId, child.deptName);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
total.value = res.total;
|
|
|
loading.value = false;
|
|
|
}
|
|
|
|
|
|
+ const getDeptList = async () => {
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ const res = await listDept({});
|
|
|
+ if (!res.data) {
|
|
|
+ console.warn("部门数据为空");
|
|
|
+ treeData.value = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理树形数据
|
|
|
+ const processedData = proxy ?.handleTree(res.data, 'deptId');
|
|
|
+ if (!processedData) {
|
|
|
+ console.warn("树形数据处理失败");
|
|
|
+ treeData.value = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ treeData.value = processedData;
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取部门列表失败:', error);
|
|
|
+ treeData.value = [];
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/** 获取会诊模板类型列表 */
|
|
|
const getTemplateTypeList = async () => {
|
|
|
try {
|
|
@@ -303,6 +346,7 @@
|
|
|
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
- getTemplateTypeList(); // 初始化时加载供应商数据
|
|
|
+ getDeptList(); // 初始化时加载部门数据
|
|
|
+ getTemplateTypeList();
|
|
|
});
|
|
|
</script>
|