|
@@ -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;
|