Kaynağa Gözat

前端总长勾稽代码

zhang_qk 6 ay önce
ebeveyn
işleme
f41b795818

+ 27 - 16
Procedure/frontend/projectb/src/pages/rwa_data_check/diffconfig_list.tsx

@@ -17,7 +17,7 @@ type aaa = {
     onCancel:  () => void;
     onChangeVisible(visible: boolean, type: string): unknown;
     onChangeVisdible:(visible:boolean,type ?: 'none' | 'raload' )=>void;
-    formRef: React.MutableRefObject<ProFormInstance<any> | undefined>;
+   // formRef: React.MutableRefObject<ProFormInstance<any> | undefined>;
   }
 const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
     var formDataList = new Array<difftoleranceModel>;
@@ -58,18 +58,19 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
     const selectdata = async (record:any)=>{
         const sd =await rule_queryone(record.ruleNo);
         parentformRef.current?.setFieldsValue(sd.result1[0]);
-        if(editType==='update')
-         {setMockData(sd.result2);
-        } else {
-          setMockData([]);
-        }
+        // if(editType==='update')
+         setMockData(sd.result2);
+        // } else {
+        //   setMockData([]);
+        // }
          
     }
 
     
     const deldata = async (record:any)=>{
         baseFun.confirm("请确认是否继续操作",async()=>{
-            await diffconfig_deleteone(record.ruleNo);
+         const s =   await diffconfig_deleteone(record.ruleNo);
+            closeAndRefresh();
         })
     }
 
@@ -92,12 +93,14 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
       //  closeAndRefresh();
       //  }
       
-      await diffconfig_addone(formData);
+     const b= await diffconfig_addone(formData);
       var obg ={...mockData,ruleNo:formData.ruleNo}
       inst1(formData.ruleNo,obg);
+      closeAndRefresh();
       }
       const inst1 = async(ruleNo:any,obg:any)=>{
-        await diffconfig_addone1(ruleNo,mockData);
+      const a=  await diffconfig_addone1(ruleNo,mockData);
+        closeAndRefresh();
       }
     const columns: ProColumns<difftoleranceModel>[] = [
         { title : '计算实例号',
@@ -194,7 +197,7 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
              successMessage=""
              onClick={()=>{ 
               deldata(record);
-              closeAndRefresh();
+             
               } }
            >
             删除
@@ -269,6 +272,7 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
         <SDPage>
             <SDTable
       rowKey="custName"
+      
       request={async(formData : difftoleranceModel)=>{
         const sd = await rule_querylist(formData);
         formDataList =[...sd];
@@ -276,10 +280,13 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
         return {data :sd };
       }}
       columns={columns}
+      actionRef={actionRef}
+      
      //  singleSelect={false}
    //  operations={["create"]}
       //displayColumn="custName"
      formRef={formRef}
+     
      //handleRemove={deletedata}
       toolBarRender={(_, { selectedRows }) => [
         <SDButton
@@ -297,7 +304,7 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
       />
       {visible &&(
         
-      <SDModalForm title={''} visible={visible} editType={editType} onVisibleChange={() => { closeAndRefresh(); setVisible(false);  }
+      <SDModalForm title={''} visible={visible} editType={editType} onVisibleChange={() => {  setVisible(false);  }
     } 
     footer={[<SDSubmitButton  editType={editType}   formRef={parentformRef} successMessage="" doSubmit={inst} >保存</SDSubmitButton>,
     <SDButton     successMessage="" onClick={()=>closeAndRefresh()} >关闭</SDButton>
@@ -342,15 +349,19 @@ const diffconfig_list: React.FC<aaa>= (prop : aaa) => {
         rowKey="ruleId"
         search={false} 
         dataSource={mockData}
+        actionRef={actionRef}
         request={async(formData : resultListModel)=>{
-          const sd = await rule_list(formData);
+          if(editType!='update')
+          {const sd = await rule_list(formData);
               formDataList1=[...sd];
-              if(editType==='update')
-              {setMockData(sd);
+              setMockData(sd);
+              return {data:sd}
+             
              } else {
-               setMockData([]);
+              return setMockData([]);
              }
-            return {data:sd}}}
+           
+        }}
         columns={columns1}
         //singleSelect={false}
        actionRef={actionRef}

+ 345 - 0
Procedure/frontend/projectb/src/pages/rwa_data_check/rule_list.tsx

@@ -0,0 +1,345 @@
+import React, { useEffect, useRef, useState } from 'react';
+import { Button, Form, FormInstance, Input, Space, Tooltip, Upload } from 'antd';
+import { ActionType, ProColumns, ProFormInstance } from '@ant-design/pro-components';
+import { baseFun, EditType, SDButton, SDFormDict, SDFormSearch, SDFormText, SDModal, SDModalForm, SDOperate, SDPage, SDSubmitButton, SDTable, validateFun } from '@sundata/ui-frame';
+import {  rule_list, rule_addone, rule_listModel, rule_queryone, selectsubjectNature, updateResultList } from '@/services/rwa/rule_list';
+import { useModel } from '@umijs/max';
+import { WomanOutlined } from '@ant-design/icons';
+
+type aaa = {
+    glCode ?:any;
+    subjectNature ?:any;
+    onCancel:  () => void;
+    onChangeVisible(visible: boolean, type: string): unknown;
+    onChangeVisdible:(visible:boolean,type ?: 'none' | 'raload' )=>void;
+    formRef: React.MutableRefObject<ProFormInstance<any> | undefined>;
+  }
+const rulelist: React.FC<aaa>= (prop : aaa) => {
+    
+    var formDataList = new Array<rule_listModel>;
+    const [visible,setVisible] = useState<boolean>(false);//弹窗是否显示
+    const formRef = useRef<FormInstance<any>>();
+    const [editType, setEditType] = useState<EditType>('update');
+
+      /** 当前行对象,查看详情、修改时,作为详细信息表单的查询条件 */
+    const [currentRow, setCurrentRow] = useState<rule_listModel>();
+
+    const actionRef = useRef<ActionType>();
+    const { fetchDict } = useModel('dict');
+    const tableActionRef = useRef<ActionType>();
+
+    const [onoroff1,setOnoroff] =useState<Boolean>(false);
+
+    const closeAndRefresh = ()=>{
+        setVisible(false);
+        actionRef.current?.reloadAndRest?.();
+      }
+    
+
+    const selectdata = async (record:any)=>{
+        const sd =await rule_queryone(record.ruleId);
+         formRef.current?.setFieldsValue(sd);
+    }
+
+    const disdata = async (record:any)=>{
+        const sd =await rule_queryone(record.ruleId);
+        console.log(sd);
+        formRef.current?.setFieldsValue(sd);
+     }
+     const inst =  async(formData : rule_listModel) => {
+        setEditType('create')
+       const ResultList =await rule_addone(formData)  
+       if("规则编号已重复,请重新输入"===ResultList){
+        baseFun.warning(ResultList);
+       }else{
+        baseFun.info(ResultList);
+       closeAndRefresh();
+       }
+      
+      }
+      const state =async(record:any)=>{
+        baseFun.confirm("请确实是否继续操作" ,async()=>{
+         await updateResultList(record.ruleId) 
+         closeAndRefresh();
+       })
+     }
+     
+
+    const columns: ProColumns<rule_listModel>[] = [
+{ title : '计算实例号',
+dataIndex : 'calcindex',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '起始数据日期',
+dataIndex : 'sdate',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '截止数据日期',
+dataIndex : 'edate',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '年月',
+dataIndex : 'term',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '数据日期',
+dataIndex : 'dataDate',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '规则编号',
+dataIndex : 'ruleId',
+width : 150
+},
+
+{ title : '规则名称',
+dataIndex : 'ruleName',
+width : 150
+},
+
+{ title : '科目代码',
+dataIndex : 'glCode',
+width : 150
+},
+
+{ title : '科目名称',
+dataIndex : 'subjectDesc',
+width : 150
+},
+
+{ title : '科目性质',
+dataIndex : 'subjectNature',
+search:false,
+width : 150
+},
+
+{ title : '科目状态',
+dataIndex : 'subjectState',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '表内外标识',
+dataIndex : 'onoroff',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '记账方向',
+dataIndex : 'accountingDirection',
+search:false,
+width : 150
+},
+
+{ title : '计算方式',
+dataIndex : 'calcMethod',
+search:false,
+width : 150
+},
+
+{ title : '正差异风险暴露分类',
+dataIndex : 'positiveRiskType',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '负差异风险暴露分类',
+dataIndex : 'negativeRiskType',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '正差异表外项目分类',
+dataIndex : 'positiveOffProjectType',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '负差异表外项目分类',
+dataIndex : 'negativeOffProjectType',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '所属阶段',
+dataIndex : 'stageinId',
+search:false,
+hideInTable: true,
+width : 150
+},
+
+{ title : '总账取数规则',
+dataIndex : 'subjectSql',
+hideInTable: true,
+search:false,
+width : 150
+},
+
+{ title : '勾稽明细取数规则',
+dataIndex : 'productSql',
+search:false,
+hideInTable: true,
+width : 150
+},
+{ title : '状态',
+dataIndex : 'yesorno',
+search:false,
+width : 150
+},
+{
+    title: '操作',
+    dataIndex: 'operate',
+    valueType: 'option',
+    render: (_, record) => [
+
+      <SDOperate
+        key="roleCfg"
+        icon={<WomanOutlined />}
+        successMessage=""
+        
+        onClick={()=>{ 
+            selectdata(record);
+        setVisible(true);
+        setEditType('update')
+         } }
+      >
+        修改
+      </SDOperate>,
+
+     <SDOperate
+     key="roleCfg"
+     icon={<WomanOutlined />}
+     successMessage=""
+     onClick={()=>{ 
+      disdata(record);
+      closeAndRefresh();
+     setVisible(true);
+     setEditType('display')
+      } }
+   >
+     查看
+   </SDOperate>,
+   <span style={record?.yesorno==="作废" ? {display:'none'}: {}}>
+   <SDOperate
+   key="roleCfg"
+   icon={<WomanOutlined />}
+   successMessage=""
+   onClick={()=>{ 
+    state(record);
+    } }
+ >
+   作废
+ </SDOperate>,
+ </span>
+    ],
+  },
+ ]
+    return(
+        <SDPage>
+         <SDTable
+      title="查询表格"
+      rowKey="custName"
+      request={async(formData : rule_listModel)=>{
+        const sd = await rule_list(formData);
+        formDataList =[...sd];
+        return {data :sd };
+      }}
+      columns={columns}
+     //  singleSelect={false}
+   //  operations={["create"]}
+      //displayColumn="custName"
+     actionRef={actionRef}
+     formRef={formRef}
+     //handleRemove={deletedata}
+      setCurrentRow={setCurrentRow}
+      setEditType={setEditType}
+      setDetailVisible={setVisible} 
+      toolBarRender={(_, { selectedRows }) => [
+        <SDButton
+        key="create"
+        successMessage=''
+        onClick={() => {
+          setVisible(true);
+          setOnoroff(true);
+          setEditType('create');
+        }}
+        >
+          新增
+        </SDButton>
+      ]} 
+      />
+      { visible &&(
+      <SDModalForm  
+      visible={visible}
+      //rowKey="custName" 
+      editType={editType} 
+
+      //request={selectdata1}
+      //params={setDataSource}
+      onVisibleChange={() => { setVisible(false);
+      }}
+      initialValues={{glCode:prop.glCode,subjectNature:prop.subjectNature,editType:setEditType}}
+      footer={[<SDSubmitButton  editType={editType}   formRef={formRef} successMessage="" doSubmit={inst} >保存</SDSubmitButton>,
+    <SDButton     successMessage="" onClick={()=>closeAndRefresh()} >关闭</SDButton>
+  ]}
+      formRef={formRef}
+      onValuesChange={async (changedValues,Values) => {
+        if(Values.glCode!=undefined){    
+            const sd = await selectsubjectNature(Values.glCode);  
+            console.log(sd);
+          formRef.current?.setFieldValue('subjectDesc',sd)}
+          if(Values.subjectNature=="04"){
+            setOnoroff(false);
+          }else{
+            setOnoroff(true);
+          }
+
+        }
+      }
+       >
+<SDFormText name="ruleId"   label="规则编号"  max={20}/>
+<SDFormText name="ruleName"   label="规则名称"  max={60}  width={250}/>
+<SDFormDict  name="glCode"   label="科目代码" dictKey='org' />
+<SDFormText name="subjectDesc"   label="科目名称"   readonlyCond='both' />
+<SDFormDict name="subjectNature"   label="科目性质"  dictKey='SUBJECT_DESC' />
+<SDFormDict name="onoroff"   label="表内外标识"  required={onoroff1} dictKey='ONOROFF'/>
+<SDFormDict name="accountingDirection"   label="记账方向"   dictKey='ACCOUNTING_DIRECTION'  />
+<SDFormDict name="calcMethod"   label="计算方式"  dictKey='CALC_METHOD'/>
+<SDFormDict name="positiveRiskType"   label="正差异风险暴露分类"  />
+<SDFormDict name="negativeRiskType"   label="负差异风险暴露分类"  />
+<SDFormDict name="positiveOffProjectType"   label="正差异表外项目分类"  />
+<SDFormDict name="negativeOffProjectType"   label="负差异表外项目分类"  />
+<SDFormDict name="stageinId"   label="所属阶段"  />
+<SDFormText name="subjectSql"   label="总账取数规则" type='textarea' />
+<SDFormText name="productSql"   label="勾稽明细取数规则"  type='textarea' />
+<div style={{display:"none"}}>
+<SDFormText name="yesorno"   label="状态"  />
+</div>
+      </SDModalForm>
+     )
+     }  
+        </SDPage>
+    );
+
+} 
+export default rulelist;

+ 92 - 0
Procedure/frontend/projectb/src/services/rwa/rule_list.ts

@@ -0,0 +1,92 @@
+import { baseFun } from "@sundata/ui-frame"
+
+export type rule_listModel={
+    //计算实例号
+calcindex : String;
+//起始数据日期
+sdate : String;
+//截止数据日期
+edate : String;
+//年月
+term : String;
+//数据日期
+dataDate : String;
+//规则编号
+ruleId : String;
+//规则名称
+ruleName : String;
+//总账科目号
+glCode : String;
+//科目名称
+subjectDesc : String;
+//科目性质
+subjectNature : String;
+//科目状态
+subjectState : String;
+//表内外标识
+onoroff : String;
+//记账方向(A:实际,D:借方,C:贷方)
+accountingDirection : String;
+//计算方式
+calcMethod : String;
+//正差异风险暴露分类
+positiveRiskType : String;
+//负差异风险暴露分类
+negativeRiskType : String;
+//正差异表外项目分类
+positiveOffProjectType : String;
+//负差异表外项目分类
+negativeOffProjectType : String;
+//所属阶段
+stageinId : String;
+//总账取数规则
+subjectSql : String;
+//勾稽明细取数规则
+productSql : String;
+//状态
+yesorno : String;
+}
+
+//初始化
+export async function rule_list(body:any){
+    return baseFun.request<rule_listModel[]>('/api/product/rwa/resultList/RuleListAction/rule_list',{
+        data:body
+    })
+    ;
+}
+
+
+//修改,查询
+export async function rule_queryone(ruleId :String){
+    return baseFun.request<rule_listModel[]>('/api/product/rwa/resultList/RuleListAction/rule_queryone',{
+        params:{ruleId}
+    })
+    ;
+}
+
+//新增
+export async function rule_addone(body :rule_listModel){
+    return baseFun.request<any>('/api/product/rwa/resultList/RuleListAction/rule_addone',{
+        data:body
+    // dats:modelcode
+    });
+}
+
+//校验唯一性
+export async function selectsubjectNature(glCode :any){
+    return baseFun.request<any>('/api/product/rwa/resultList/RuleListAction/selectsubjectNature',{
+        params:{glCode}
+    // dats:modelcode
+    });
+
+}
+
+
+//作废状态
+export async function updateResultList(ruleId :String){
+    return baseFun.request<rule_listModel>('/api/product/rwa/resultList/RuleListAction/updateRuletList',{
+        params:{ruleId}
+    // dats:modelcode
+    })
+    ;
+}