Przeglądaj źródła

信息采集保存后更新健康分析报告中的指标信息

cc12458 1 rok temu
rodzic
commit
e4e5b86a6b

+ 13 - 8
src/pages/index/patient/room@default.vue

@@ -19,12 +19,14 @@ import ReportSchemeCardWidget                 from '@/widgets/ReportSchemeCardWi
 import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons-vue';
 import { useElementSize }                     from '@vueuse/core';
 import { useRouteQuery }                      from '@vueuse/router';
-import { invalidateCache }                    from 'alova';
-import { useRequest, useWatcher }             from 'alova/client';
-import { h }                                  from 'vue';
-import { useRouter }                          from 'vue-router';
-import { RecycleScroller }                    from 'vue-virtual-scroller';
-import { VxeUI }                              from 'vxe-pc-ui';
+
+import { invalidateCache }                                    from 'alova';
+import { actionDelegationMiddleware, useRequest, useWatcher } from 'alova/client';
+
+import { h }               from 'vue';
+import { useRouter }       from 'vue-router';
+import { RecycleScroller } from 'vue-virtual-scroller';
+import { VxeUI }           from 'vxe-pc-ui';
 
 
 const patientId = useRouteQuery<string>('patientId');
@@ -77,7 +79,9 @@ const { data: indicator, loading: indicatorLoading } = useWatcher(
   [ reportId ],
   {
     initialData: [], immediate: true,
-    middleware: (_, next) => { if ( reportId.value ) next(); },
+    middleware: (_, next) => {
+      if ( reportId.value ) return actionDelegationMiddleware('updatePatientIndicator')(_, next);
+    },
   },
 );
 
@@ -116,7 +120,8 @@ function schemeRefreshHandle(id?: string) {
   invalidateCache(reportSchemeMethod(reportId.value!));
   schemeRefresh().then(() => nextTick()).then(() => {
     if ( id ) {
-      document.querySelector(`#scrollable_scheme_${ id }`)?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });
+      document.querySelector(`#scrollable_scheme_${ id }`)?.scrollIntoView(
+        { behavior: 'smooth', block: 'start', inline: 'nearest' });
     }
   });
 }

+ 5 - 4
src/widgets/ReportIndicatorWidget.vue

@@ -2,14 +2,11 @@
 import type { ReportIndicatorModel }          from '@/model';
 import { updateIndicatorByPatientIdMethod }   from '@/request/api/report.api';
 import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons-vue';
-import { useRequest }                         from 'alova/client';
+import { accessAction, useRequest }           from 'alova/client';
 import { Form, message as Message }           from 'ant-design-vue';
 import type { Rule }                          from 'ant-design-vue/es/form';
 
 
-
-
-
 const props = withDefaults(defineProps<{
   dataset: ReportIndicatorModel[];
   loading?: boolean;
@@ -66,6 +63,10 @@ const { loading: submitting, send: submit } = useRequest(
   },
 ).onSuccess(() => {
   Message.success(`指标信息保存成功`);
+  accessAction('updatePatientIndicator', delegatedActions => {
+    // 调用组件A中的send函数
+    delegatedActions.send();
+  });
   emits('destroy');
 });