2 Commits dcb6ced334 ... 9300bc5ed9

Author SHA1 Message Date
  JammeyJiang 9300bc5ed9 fix(指标管理): 添加divisionId字段并确保部门ID为字符串类型 1 month ago
  JammeyJiang 7932c42911 fix(指标管理): 将部门选择值从code改为id以匹配数据源 1 month ago

+ 2 - 1
src/pages/platform/setting/indicatorMana/DrawerForm/drawer.tsx

@@ -846,6 +846,7 @@ const DrawerForm = (props: IndicatorDrawerForm) => {
                       ? { indicatorTypeList: [], indicatorExternalList: [] }
                       : {
                           ...record,
+                          divisionId: record.divisionId ? `${record.divisionId}` : undefined,
                           indicatorMenuList: setFormInit('indicatorMenuList'),
                           // indicatorTypeList:record.indicatorTypeList?record.indicatorTypeList.map((t:string)=>t.split('/')).slice(1,record.indicatorTypeList.map((t:string)=>t.split('/')).length - 1):[],
                           indicatorTypeList: setFormInit('indicatorTypeList'),
@@ -868,7 +869,7 @@ const DrawerForm = (props: IndicatorDrawerForm) => {
                     request={async () => {
                       if (deptCache) return deptCache;
                       const data = await getHospDepartment();
-                      deptCache = data.map(t => ({ label: t.name, value: t.code }));
+                      deptCache = data.map(t => ({ label: t.name, value: `${t.id}` }));
                       return deptCache;
                     }}
                     placeholder="请选择"

+ 61 - 49
src/pages/platform/setting/indicatorMana/index.tsx

@@ -63,8 +63,12 @@ const IndicatorMana = () => {
   });
   const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
   const [currentSelectedLeft, set_currentSelectedLeft] = useState<any>(undefined);
-  const [actionType, set_actionType] = useState<'NORMAL' | 'DETAIL' | 'ANALYZE' | undefined>('NORMAL');
-  const [drawerActype, set_drawerActype] = useState<'ADD' | 'EDIT' | 'DATAMANA' | undefined>(undefined);
+  const [actionType, set_actionType] = useState<'NORMAL' | 'DETAIL' | 'ANALYZE' | undefined>(
+    'NORMAL'
+  );
+  const [drawerActype, set_drawerActype] = useState<'ADD' | 'EDIT' | 'DATAMANA' | undefined>(
+    undefined
+  );
   const [tableDataSource, set_tableDataSource] = useState<any[]>([]);
   const [currentYear, set_currentYear] = useState(defaultYear);
   const [currentEditRow, set_currentEditRow] = useState<any>(undefined);
@@ -124,7 +128,7 @@ const IndicatorMana = () => {
       if (parts.length < 2) return 0;
       const nodeQuery = parseQuery(parts[1]);
       let matched = 0;
-      Object.keys(nodeQuery).forEach((k) => {
+      Object.keys(nodeQuery).forEach(k => {
         if (currentQuery[k] !== undefined && currentQuery[k] === nodeQuery[k]) matched += 1;
       });
       return matched;
@@ -139,7 +143,8 @@ const IndicatorMana = () => {
       } else if (s === bestScore) {
         // 平分时,优先带有 function 的
         const hasFuncBest = Array.isArray(best?.function) && best.function.length > 0;
-        const hasFuncCurr = Array.isArray(candidates[i]?.function) && candidates[i].function.length > 0;
+        const hasFuncCurr =
+          Array.isArray(candidates[i]?.function) && candidates[i].function.length > 0;
         if (!hasFuncBest && hasFuncCurr) best = candidates[i];
       }
     }
@@ -149,7 +154,7 @@ const IndicatorMana = () => {
     if (selectedKeysStr) {
       try {
         const [selectedKey] = JSON.parse(selectedKeysStr) || [];
-        const byKey = candidates.find((n) => String(n.key) === String(selectedKey));
+        const byKey = candidates.find(n => String(n.key) === String(selectedKey));
         if (byKey) return byKey;
       } catch (e) {}
     }
@@ -162,7 +167,6 @@ const IndicatorMana = () => {
       ? ((node as any).function as any[]).map((i: any) => i?.code).filter(Boolean)
       : [];
     return codes.includes('report_manage');
-
   }, [initialState?.menuData, location.pathname, (location as any).search]);
 
   // 读取基础参数:userId、hospId(院区)
@@ -521,6 +525,7 @@ const IndicatorMana = () => {
           drillLevel: formData.drillLevel ? formData.drillLevel.join('/') : '',
           dataSum: formData.dataSum ? formData.dataSum.join('/') : '',
           chartType: formData.chartType ? formData.chartType.join('/') : '',
+          divisionId: `${formData.divisionId}`,
         });
         if (resp) {
           set_drawerVisible(false);
@@ -684,7 +689,7 @@ const IndicatorMana = () => {
             analysisReportCode: values.reportId,
             analysisReportParam: finalParamStr,
           }));
-          set_reportReloadKey((k) => k + 1);
+          set_reportReloadKey(k => k + 1);
           return true;
         }
       } else if (isDetailOnline) {
@@ -702,7 +707,7 @@ const IndicatorMana = () => {
             onlineReportCode: values.reportId,
             onlineReportParam: finalParamStr,
           }));
-          set_reportReloadKey((k) => k + 1);
+          set_reportReloadKey(k => k + 1);
           return true;
         }
       } else {
@@ -738,37 +743,36 @@ const IndicatorMana = () => {
         onFinish={handleReportSubmit}
         width={500}
         initialValues={
-          currentEditRow && (
-            actionType === 'ANALYZE'
-              ? {
-                  reportId: currentEditRow.analysisReportCode,
-                  remark: currentEditRow.analysisRemark,
-                  analysisReportParam: (() => {
-                    try {
-                      const txt = currentEditRow.analysisReportParam;
-                      if (!txt || String(txt).trim().length === 0) return '{}';
-                      const obj = JSON.parse(String(txt));
-                      return JSON.stringify(obj, null, 2);
-                    } catch (e) {
-                      return String(currentEditRow.analysisReportParam || '{}');
-                    }
-                  })(),
-                }
-              : {
-                  reportId: currentEditRow.onlineReportCode,
-                  remark: currentEditRow.onlineRemark,
-                  onlineReportParam: (() => {
-                    try {
-                      const txt = currentEditRow.onlineReportParam;
-                      if (!txt || String(txt).trim().length === 0) return '{}';
-                      const obj = JSON.parse(String(txt));
-                      return JSON.stringify(obj, null, 2);
-                    } catch (e) {
-                      return String(currentEditRow.onlineReportParam || '{}');
-                    }
-                  })(),
-                }
-          )
+          currentEditRow &&
+          (actionType === 'ANALYZE'
+            ? {
+                reportId: currentEditRow.analysisReportCode,
+                remark: currentEditRow.analysisRemark,
+                analysisReportParam: (() => {
+                  try {
+                    const txt = currentEditRow.analysisReportParam;
+                    if (!txt || String(txt).trim().length === 0) return '{}';
+                    const obj = JSON.parse(String(txt));
+                    return JSON.stringify(obj, null, 2);
+                  } catch (e) {
+                    return String(currentEditRow.analysisReportParam || '{}');
+                  }
+                })(),
+              }
+            : {
+                reportId: currentEditRow.onlineReportCode,
+                remark: currentEditRow.onlineRemark,
+                onlineReportParam: (() => {
+                  try {
+                    const txt = currentEditRow.onlineReportParam;
+                    if (!txt || String(txt).trim().length === 0) return '{}';
+                    const obj = JSON.parse(String(txt));
+                    return JSON.stringify(obj, null, 2);
+                  } catch (e) {
+                    return String(currentEditRow.onlineReportParam || '{}');
+                  }
+                })(),
+              })
         }
         formRef={reportForm}
         modalProps={{
@@ -850,18 +854,22 @@ const IndicatorMana = () => {
               <div className="currentBigTab1content_header">
                 <span>{currentEditRow?.onlineRemark}</span>
                 {canManageReport && (
-                  <div className='btn' onClick={openReportModal}>
-                    <IconFont type='iconpeizhi' /> 报告管理
+                  <div className="btn" onClick={openReportModal}>
+                    <IconFont type="iconpeizhi" /> 报告管理
                   </div>
                 )}
               </div>
-              {(currentEditRow && currentEditRow.onlineReportCode) && (
+              {currentEditRow && currentEditRow.onlineReportCode && (
                 <FrameComponent
-                  link={`/platform/setting/embeddedDashboard/${currentEditRow.onlineReportCode}?noTopbar=true&noMenu=true&reload=${reportReloadKey}&urlParams=${encodeURIComponent(
+                  link={`/platform/setting/embeddedDashboard/${
+                    currentEditRow.onlineReportCode
+                  }?noTopbar=true&noMenu=true&reload=${reportReloadKey}&urlParams=${encodeURIComponent(
                     (() => {
                       try {
                         const base = withBaseParams({});
-                        const raw = currentEditRow?.onlineReportParam ? JSON.parse(currentEditRow.onlineReportParam) : {};
+                        const raw = currentEditRow?.onlineReportParam
+                          ? JSON.parse(currentEditRow.onlineReportParam)
+                          : {};
                         return JSON.stringify({ ...base, ...raw });
                       } catch {
                         return JSON.stringify(withBaseParams({}));
@@ -957,8 +965,8 @@ const IndicatorMana = () => {
               </div>
               <span>{currentEditRow?.name}</span>
               {canManageReport && (
-                <div className='btn' onClick={openReportModal} style={{ marginLeft: 'auto' }}>
-                  <IconFont type='iconpeizhi' /> 报告管理
+                <div className="btn" onClick={openReportModal} style={{ marginLeft: 'auto' }}>
+                  <IconFont type="iconpeizhi" /> 报告管理
                 </div>
               )}
             </div>
@@ -968,13 +976,17 @@ const IndicatorMana = () => {
             </div>
           </div>
           <div className="currentBigTab1content">
-            {(currentEditRow && currentEditRow.analysisReportCode) && (
+            {currentEditRow && currentEditRow.analysisReportCode && (
               <FrameComponent
-                link={`/platform/setting/embeddedDashboard/${currentEditRow.analysisReportCode}?noTopbar=true&noMenu=true&reload=${reportReloadKey}&urlParams=${encodeURIComponent(
+                link={`/platform/setting/embeddedDashboard/${
+                  currentEditRow.analysisReportCode
+                }?noTopbar=true&noMenu=true&reload=${reportReloadKey}&urlParams=${encodeURIComponent(
                   (() => {
                     try {
                       const base = withBaseParams({});
-                      const raw = currentEditRow?.analysisReportParam ? JSON.parse(currentEditRow.analysisReportParam) : {};
+                      const raw = currentEditRow?.analysisReportParam
+                        ? JSON.parse(currentEditRow.analysisReportParam)
+                        : {};
                       return JSON.stringify({ ...base, ...raw });
                     } catch {
                       return JSON.stringify(withBaseParams({}));