Răsfoiți Sursa

界面修改

JoeLazy 4 luni în urmă
părinte
comite
359889891e

+ 22 - 4
src/pages/internalEvaluation/configuration/InterfacePage.tsx

@@ -18,7 +18,7 @@ import {
   getDataList,
   insertInterfaceService,
   InterfaceModel,
-  selectDetailData,
+  selectDetailData, testCalc,
   updateInterfaceService
 } from "@/services/internalEvaluation/configuration/Interface";
 
@@ -27,7 +27,7 @@ import {WomanOutlined} from "@ant-design/icons";
 import {EditType} from "@sundata/ui-frame/lib/types";
 import {FormInstance} from "antd/lib/form";
 import {InterfaceParamModel} from "@/services/internalEvaluation/configuration/InterfaceParam";
-import {ActionType} from "@ant-design/pro-components";
+import {ActionType, EditableProTable} from "@ant-design/pro-components";
 import {Popconfirm} from "antd";
 
 
@@ -147,6 +147,17 @@ const InterfacePage: FC = () => {
             删除
           </SDOperate>
         </Popconfirm>,
+        <SDOperate
+          key="roleCfg"
+          icon={<WomanOutlined/>}
+          successMessage=""
+          onClick={() => {
+            console.log("测试...", record)
+            testCalc1(record);
+          }}
+        >
+          测试接口
+        </SDOperate>
 
       ],
     },
@@ -156,7 +167,7 @@ const InterfacePage: FC = () => {
   /**
    * 接口请求参数列表
    */
-  const paramColumns: ProColumns<InterfaceModel>[] = [
+  const paramColumns: ProColumns<InterfaceParamModel>[] = [
     {
       title: '参数对象名称',
       dataIndex: 'paramObjName',
@@ -258,7 +269,6 @@ const InterfacePage: FC = () => {
       hideInTable: false,
       valueType: 'textarea'
     },
-
   ];
 
   /**
@@ -286,6 +296,13 @@ const InterfacePage: FC = () => {
     setOperateInterfaceId(formDatas.id)
   }
 
+  const testCalc1 = async (record: InterfaceModel)=>{
+
+    console.log (await testCalc(record).then((res)=>{
+      console.log(res)
+    }))
+  }
+
 
   /**
    * 关闭弹窗操作
@@ -383,6 +400,7 @@ const InterfacePage: FC = () => {
           <SDAreaTtile title={"请求参数"}/>
 
           <SDEditableTable<InterfaceParamModel>
+            rowKey={"id"}
             columns={paramColumns}
             value={paramList}
             onChange={

+ 53 - 10
src/pages/internalEvaluation/configuration/RulePage.tsx

@@ -1,15 +1,15 @@
 import React, {FC, useRef, useState} from "react";
 import {
   baseFun,
-  EditType,
-  SDButton, SDFormDict,
+  EditType, SDAreaTtile,
+  SDButton, SDEditableTable, SDFormDict,
   SDFormText,
   SDLayout,
   SDModalForm,
   SDOperate,
   SDPage,
   SDTable,
-  SDTabs
+  SDTabs, validateFun
 } from "@sundata/ui-frame";
 import {
   deleteService, deleteServiceRules,
@@ -24,12 +24,53 @@ import {FormInstance} from "antd/lib/form";
 import {ActionType} from "@ant-design/pro-components";
 import {Popconfirm} from "antd";
 import {useModel} from "@@/exports";
+import {firstCharIsNotNumber} from "@/pages/internalEvaluation/utils/rwacheckutils";
 
 
 const RulePage: FC = () => {
 
   const {fetchDict} = useModel('dict');
 
+  const ruleIndexColumns: ProColumns<any>[] = [
+    {
+      title: '模板参数',
+      dataIndex: 'ruleLogicParam',
+      hideInTable: false,
+      formItemProps:{
+        wrapperCol:{ span: 16 },
+        rules: [
+          { required: true, message: '请输入模板参数' },
+          {
+            validator:validateFun.account
+          },
+          {
+            validator: (rule, value, callback)=> {
+              if (firstCharIsNotNumber(value)>0) {
+                callback('模板参数不能以数字开头');
+              } else {
+                callback();
+              }
+
+            }
+          }
+        ],
+      }
+    },
+    {
+      title: '指标',
+      dataIndex: 'indexNo',
+      hideInTable: false,
+      valueType:'select',
+      request:()=>fetchDict('@selectAllIndexToDict'),
+      formItemProps:{
+        style: {width: '100%'},
+        wrapperCol:{ span: 16 },
+        required: true,
+         rules: [{ required: true, message: '请选择指标信息' }],
+      }
+    }
+  ]
+
   // 规则表格列信息
   const ruleColumns: ProColumns<RuleModel>[] = [
     {
@@ -42,12 +83,6 @@ const RulePage: FC = () => {
       dataIndex: 'ruleName',
       hideInTable: false,
     },
-    {
-      title: '规则指标',
-      dataIndex: 'ruleIndex',
-      search: false,
-      hideInTable: false,
-    },
     {
       title: '规则阈值',
       dataIndex: 'ruleThreshold',
@@ -191,6 +226,7 @@ const RulePage: FC = () => {
 
   const openRuleModelForm = ()=>{
     setRuleDetailVisible(true)
+    setRuleIndexList([]);
   }
 
   const closeRuleModelForm = ()=>{
@@ -207,6 +243,7 @@ const RulePage: FC = () => {
 
 
   const saveOrUpdateInfo = async (re: RuleModel) => {
+    re.ruleIndexList = ruleIndexList;
     const isSuccess = ruleEditType === 'create' ? await insertService(re) : await updateService(re) as boolean;
     if (isSuccess) {
       closeRuleModelForm();
@@ -225,6 +262,7 @@ const RulePage: FC = () => {
   // 规则
   const selectRuleDetail = async (record: RuleModel) => {
     const res = await getDetailByIdService(record) as RuleModel ;
+    setRuleIndexList(res.ruleIndexList);
     ruleFormRef.current?.setFieldsValue(res)
   }
   // 规则集
@@ -248,6 +286,7 @@ const RulePage: FC = () => {
   const [ruleEditType, setRuleEditType] = useState<EditType>("display");
   const ruleFormRef = useRef<FormInstance<any>>();
   const ruleActionRef = useRef<ActionType>();
+  const [ruleIndexList, setRuleIndexList] = useState<any>([]);
   // 规则集
   const [rulesDetailVisible, setRulesDetailVisible] = useState(false);
   const [rulesEditType, setRulesEditType] = useState<EditType>("display");
@@ -290,14 +329,18 @@ const RulePage: FC = () => {
         formRef={ruleFormRef}
         editType={ruleEditType}
       >
+        <SDAreaTtile title={"基本信息"}/>
         <SDFormText label="规则编号" name="ruleNo" required={true}  width={'md'} readonlyCond={"update"}/>
         <SDFormText label="规则名称" name="ruleName"  width={'md'} required={true}/>
         <SDFormText label="规则模板" type={'textarea'} name="ruleTemplate" />
         <SDFormText label="模板说明" type={'textarea'} name="templateDesc" />
         <SDFormDict label="规则结果" name="ruleResult"  width={'md'} required={true} dictKey={'RULE_RESULT_TYPE'} />
-        <SDFormText label="规则指标" name="ruleIndex"  width={'md'}/>
+        {/*<SDFormDict label="规则指标" multiple={true} dictKey={'@selectAllIndexToDict'} name="indexNoList"  width={'md'}/>*/}
         <SDFormText label="规则阈值" name="ruleThreshold"  width={'md'}/>
         <SDFormText label="规则结论" type={'textarea'} name="ruleConclusionTemplate" />
+        <SDAreaTtile title={"指标清单"}/>
+        <SDEditableTable columns={ruleIndexColumns} value={ruleIndexList} onChange={(value)=>{
+          setRuleIndexList([...value])}}/>
       </SDModalForm>
     </>
   )

+ 22 - 19
src/pages/internalEvaluation/configuration/indexconfig.tsx

@@ -31,11 +31,11 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
     const { fetchDict } = useModel('dict');
 
     const [indexSourceList, setIndexSourceList] = useState<IndexSourceModel[]>();
- 
+
     useEffect(() => {
 
       }, []);
-    
+
     // 修改查询查询
     const selectData = async (formdata : IndexConfigModel) => {
       const data = await selectDetailData(formdata);
@@ -44,13 +44,13 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
      }
 
     // 删除
-    const delRows =async(record:any)=>{ 
+    const delRows =async(record:any)=>{
        baseFun.confirm('确认删除?',async() =>{
         await deleteRows(record);
         baseFun.info("删除成功");
         closeAndRefresh();
        });
-       
+
      }
 
     //关闭窗口刷新父页面
@@ -71,16 +71,16 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
     }
     setDetailVisible(false);
   }
-     
+
     // 数据项配置页面展示元素
     const columns: ProColumns<IndexConfigModel>[] = [
         {
-          title: '指标编号', 
+          title: '指标编号',
           dataIndex: 'indexNo',
           hideInTable: false,
         },
         {
-          title: '指标名称', 
+          title: '指标名称',
           dataIndex: 'indexName',
           search: false,
           hideInTable: false,
@@ -91,7 +91,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
           }
         },
         {
-          title: '指标逻辑', 
+          title: '指标逻辑',
           dataIndex: 'indexLogic',
           search: false,
           hideInTable: false,
@@ -106,7 +106,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
               icon={<WomanOutlined />}
               successMessage=""
               onClick={
-                ()=>{ 
+                ()=>{
                 selectData(record);
                 setDetailVisible(true);
                 setEditType('update')
@@ -122,7 +122,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
           >
             删除
           </SDOperate>,
-           
+
           ],
         },
 
@@ -131,21 +131,22 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
        // 数据项配置页面展示元素
        const indexSourceColumns: ProColumns<IndexSourceModel>[] = [
         {
-          title: '指标数据来源编号', 
+          title: '指标数据来源编号',
           dataIndex: 'indexSourceNo',
           search: false,
           hideInTable: true,
         },
         {
-          title: '指标编号', 
+          title: '指标编号',
           dataIndex: 'indexNo',
           search:false,
           hideInTable: true,
         },
         {
-          title: '其他指标编号', 
+          title: '其他指标编号',
           dataIndex: 'otherIndexNo',
           hideInTable: false,
+          valueType:'select',
           request:()=>fetchDict('@selectAllIndexToDict'),
           fieldProps: {
              treeDefaultExpandAll: true,
@@ -153,10 +154,11 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
            },
         },
         {
-          title: '数据集编号', 
+          title: '数据集编号',
           dataIndex: 'dataSetNo',
           search: false,
           hideInTable: false,
+          valueType:'select',
           request:()=>fetchDict('@selectDataSet'),
           fieldProps: {
              treeDefaultExpandAll: true,
@@ -164,11 +166,12 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
            },
         },
         {
-          title: '数据类型', 
+          title: '数据类型',
           dataIndex: 'dataSourceType',
           search: false,
           hideInTable: false,
           request:()=>fetchDict('org'),
+          valueType:'select',
           fieldProps: {
              treeDefaultExpandAll: true,
              treeCheckable:true,
@@ -198,7 +201,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
           ],
         },
       ];
-    
+
     return (
         <SDPage>
         <SDTable
@@ -230,7 +233,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
          />
 
         {detailVisible && (
-        <SDModalForm          
+        <SDModalForm
           title={'详细信息'}
           editType={editType}
           params={currentRow}
@@ -274,7 +277,7 @@ const indexconfig : React.FC<widowRush> = (prop:widowRush) => {
         </SDModalForm>
       )}
         </SDPage>
-        
+
     );
 }
-export default indexconfig;
+export default indexconfig;

+ 12 - 1
src/pages/internalEvaluation/utils/rwacheckutils.ts

@@ -10,6 +10,17 @@ export function countChineseChars(str:any) {
     }
   }
 
+
+// 判断第一个字符不为数字
+export function firstCharIsNotNumber(str:string) {
+  const chineseRegex = /^\d/; // 匹配任何中文字符
+  if (str == null || str.length == 0) {
+    return -1;
+  } else {
+    return str.match(chineseRegex)?.length || 0;
+  }
+}
+
 // 范围超出校验
 export function inputRangeCheck(value:any,formRange:any) {
     let rowStart = String(value).split('-')[0];
@@ -24,4 +35,4 @@ export function inputRangeCheck(value:any,formRange:any) {
     } else {
       return('上方输入框内行范围必输');
     }
-}
+}

+ 5 - 0
src/services/internalEvaluation/configuration/Interface.ts

@@ -124,3 +124,8 @@ export async function selectDetailData(body: any) {
   return baseFun.request<InterfaceModel>('/api/npapi/getById', {data: body});
 }
 
+/** 查询当前行详细数据 POST*/
+export async function testCalc(body: any) {
+  return baseFun.request<any>('/api/npapi/testCalc', {data: body});
+}
+

+ 8 - 0
src/services/internalEvaluation/configuration/Rule.ts

@@ -29,6 +29,14 @@ export type RuleModel = {
    * 规则指标
    */
   ruleIndex: string,
+
+  /**
+   * 规则指标
+   */
+  indexNoList: [],
+
+  ruleIndexList:[],
+
   /**
    * 规则阈值
    */