Преглед изворни кода

随访计划 搜索标签接口更换 selectTag -> selectAllTag

cc12458 пре 10 месеци
родитељ
комит
b7e7504529
4 измењених фајлова са 48 додато и 7 уклоњено
  1. 11 3
      src/components/Enabled.vue
  2. 1 0
      src/model/system.model.ts
  3. 11 3
      src/pages/index/follow/plan.vue
  4. 25 1
      src/request/api/follow.api.ts

+ 11 - 3
src/components/Enabled.vue

@@ -6,7 +6,7 @@ import {
   doctorMethod,
   doctorMethod,
   departmentsMethod,
   departmentsMethod,
   planEditMethod,
   planEditMethod,
-  tagsSearchMethod,
+  allTagsSearchMethod,
 } from '@/request/api/follow.api';
 } from '@/request/api/follow.api';
 import { useRequest } from 'alova/client';
 import { useRequest } from 'alova/client';
 import {
 import {
@@ -15,6 +15,7 @@ import {
   VxeUI,
   VxeUI,
   type VxeFormInstance,
   type VxeFormInstance,
 } from 'vxe-pc-ui';
 } from 'vxe-pc-ui';
+import { list2Groups } from '@/tools/data';
 
 
 type FollowModel = Partial<PlanModel>;
 type FollowModel = Partial<PlanModel>;
 
 
@@ -46,7 +47,7 @@ const { data: departmentsData, loading: depDataLoading } = useRequest(department
   initialData: { total: 0, data: [] },
   initialData: { total: 0, data: [] },
 });
 });
 // 获取患者标签
 // 获取患者标签
-const { data: tagData, loading: tagDataLoading } = useRequest(tagsSearchMethod, {
+const { data: tagData, loading: tagDataLoading } = useRequest(allTagsSearchMethod, {
   initialData: { total: 0, data: [] },
   initialData: { total: 0, data: [] },
 });
 });
 
 
@@ -169,8 +170,15 @@ const patientsForm = reactive<VxeFormProps<PlanModel['filter']>>({
         props: {
         props: {
           placeholder: '患者标签',
           placeholder: '患者标签',
           loading: tagDataLoading,
           loading: tagDataLoading,
-          options: computed(() => tagData.value.data),
+          optionGroups: computed(() =>
+            list2Groups(
+              tagData.value.data.filter((tag) => !tag.disabled),
+              'category',
+              (key) => ({ 1: '系统标签', 2: '个人标签' })[key]!
+            )
+          ),
           optionProps: { value: 'id', label: 'name' },
           optionProps: { value: 'id', label: 'name' },
+          optionGroupProps: { options: 'groups' },
           clearable: true,
           clearable: true,
           multiple: true,
           multiple: true,
           filterable: true,
           filterable: true,

+ 1 - 0
src/model/system.model.ts

@@ -52,6 +52,7 @@ export interface TagModel {
   parentId?: string;
   parentId?: string;
   parentName?: string;
   parentName?: string;
 
 
+  disabled?: boolean;
   editable?: boolean;
   editable?: boolean;
   deletable?: boolean;
   deletable?: boolean;
 }
 }

+ 11 - 3
src/pages/index/follow/plan.vue

@@ -9,7 +9,7 @@ import {
   planDeleteMethod,
   planDeleteMethod,
   planMethod,
   planMethod,
   planUpdateStatusMethod,
   planUpdateStatusMethod,
-  tagsSearchMethod,
+  allTagsSearchMethod,
 } from '@/request/api/follow.api';
 } from '@/request/api/follow.api';
 import { usePagination, useRequest } from 'alova/client';
 import { usePagination, useRequest } from 'alova/client';
 import { notification } from 'ant-design-vue';
 import { notification } from 'ant-design-vue';
@@ -22,12 +22,13 @@ import {
   type VxeGridProps,
   type VxeGridProps,
   VxeUI,
   VxeUI,
 } from 'vxe-pc-ui';
 } from 'vxe-pc-ui';
+import { list2Groups } from '@/tools/data';
 
 
 const { data: tags, loading: tagsLoading } = useRequest(planMethod, {
 const { data: tags, loading: tagsLoading } = useRequest(planMethod, {
   initialData: { total: 0, data: [] },
   initialData: { total: 0, data: [] },
 });
 });
 // 获取患者标签
 // 获取患者标签
-const { data: tagData, loading: tagDataLoading } = useRequest(tagsSearchMethod, {
+const { data: tagData, loading: tagDataLoading } = useRequest(allTagsSearchMethod, {
   initialData: { total: 0, data: [] },
   initialData: { total: 0, data: [] },
 });
 });
 
 
@@ -63,8 +64,15 @@ const searchFormProps = reactive<VxeFormProps<PlanQuery>>({
         props: {
         props: {
           placeholder: '患者标签',
           placeholder: '患者标签',
           loading: tagDataLoading,
           loading: tagDataLoading,
-          options: computed(() => tagData.value.data),
+          optionGroups: computed(() =>
+            list2Groups(
+              tagData.value.data.filter((tag) => !tag.disabled),
+              'category',
+              (key) => ({ 1: '系统标签', 2: '个人标签' })[key]!
+            )
+          ),
           optionProps: { value: 'id', label: 'name' },
           optionProps: { value: 'id', label: 'name' },
+          optionGroupProps: { options: 'groups' },
           clearable: true,
           clearable: true,
           multiple: true,
           multiple: true,
           filterable: true,
           filterable: true,

+ 25 - 1
src/request/api/follow.api.ts

@@ -49,7 +49,31 @@ export function tagsSearchMethod(query?: TagQuery) {
   return request.Post<List<TagModel>, TagModel[]>(`/fdhb-pc/tagManage/selectTag`, query ?? {}, {
   return request.Post<List<TagModel>, TagModel[]>(`/fdhb-pc/tagManage/selectTag`, query ?? {}, {
     hitSource: /tag$/,
     hitSource: /tag$/,
     transform(data) {
     transform(data) {
-      return { total: data.length, data };
+      return {
+        total: data.length,
+        data: data.map((item) => Object.assign(item, {
+          category: item.type,
+          disabled: item.status === '1',
+          color: { 1: 'pink', 2: 'blue' }[item.type],
+        })),
+      };
+    },
+  });
+}
+
+// 全部标签
+export function allTagsSearchMethod(query?: TagQuery) {
+  return request.Post<List<TagModel>, TagModel[]>(`/fdhb-pc/tagManage/selectAllTag`, query ?? {}, {
+    hitSource: /tag$/,
+    transform(data) {
+      return {
+        total: data.length,
+        data: data.map((item) => Object.assign(item, {
+          category: item.type,
+          disabled: item.status === '1',
+          color: { 1: 'pink', 2: 'blue' }[item.type],
+        })),
+      };
     },
     },
   });
   });
 }
 }