|
@@ -1,24 +1,28 @@
|
|
|
import React, { useEffect, useRef, useState } from 'react';
|
|
|
import { Button, Form, FormInstance, Input, Space, Tooltip } from 'antd';
|
|
|
-import { EditType, SDForm, SDFormDict, SDFormText, SDModal, SDModalForm, SDOperate, SDPage, SDSubmitButton, SDTable, baseFun } from '@sundata/ui-frame';
|
|
|
-import { SovereignModel, deleteSovereign, getSovereign, inserteSovere, selectSovereign } from '@/services/rwa/sovereign';
|
|
|
+import { EditType, SDForm, SDFormDict, SDFormText, SDModal, SDModalForm, SDOperate, SDPage, SDSubmitButton, SDTable, baseFun, SDButton } from '@sundata/ui-frame';
|
|
|
+import { SovereignModel, deleteSovereign, getSovereign, inserteSovere, selectSovereign, exportExcelModel, selectSovereignCode } from '@/services/rwa/sovereign';
|
|
|
import { ActionType, ProColumns } from '@ant-design/pro-table';
|
|
|
-import { WomanOutlined } from '@ant-design/icons';
|
|
|
+import { ExportOutlined, WomanOutlined } from '@ant-design/icons';
|
|
|
import { deletedata } from '@/services/idataMng/impandauditp';
|
|
|
+import { useModel } from '@umijs/max';
|
|
|
+import { ProFormInstance } from '@ant-design/pro-components';
|
|
|
|
|
|
type aaa = {
|
|
|
- custName ?:String;
|
|
|
+ custName ?:any;
|
|
|
onCancel: () => void;
|
|
|
onChangeVisible(visible: boolean, type: string): unknown;
|
|
|
onChangeVisdible:(visible:boolean,type ?: 'none' | 'raload' )=>void;
|
|
|
+ formRef: React.MutableRefObject<ProFormInstance<any> | undefined>;
|
|
|
}
|
|
|
|
|
|
|
|
|
const sovereignts: React.FC<aaa>= (prop : aaa) => {
|
|
|
-
|
|
|
+ const ref = prop.formRef;
|
|
|
const [editType, setEditType] = useState<EditType>('update');
|
|
|
const formRef = useRef<FormInstance<any>>();
|
|
|
- /** 当前行对象,查看详情、修改时,作为详细信息表单的查询条件 */
|
|
|
+ const formRef1 = useRef<FormInstance<any>>();
|
|
|
+ /** 当前行对象,查看详情、修改时,作为详细信息表单的查询条件 */
|
|
|
const [currentRow, setCurrentRow] = useState<SovereignModel>();
|
|
|
const [dataSource, setDataSource] = useState<any>() ;
|
|
|
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
|
@@ -28,15 +32,21 @@ const sovereignts: React.FC<aaa>= (prop : aaa) => {
|
|
|
const tableActionRef = useRef<ActionType>();
|
|
|
|
|
|
const SovereignModel = ( custName: string) => deleteSovereign(custName);
|
|
|
+ const { fetchDict } = useModel('dict');
|
|
|
|
|
|
-
|
|
|
- /** 表格引用对象,刷新表格使用 */
|
|
|
+ /** 表格引用对象,刷新表格使用 */
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
useEffect(() => {//初始化调用dealinitxmldomain
|
|
|
dealinit();
|
|
|
}, []);
|
|
|
+
|
|
|
+ var formDataList = new Array<SovereignModel>;
|
|
|
+
|
|
|
|
|
|
const dealinit=async()=>{
|
|
|
+ console.log(1);
|
|
|
+ // const sd = await getSovereign(formData,"");
|
|
|
+ // return {data :sd};
|
|
|
// if ( false){
|
|
|
// const sd = await selectdata(prop);
|
|
|
// formRef.current?.setFieldsValue(sd);
|
|
@@ -48,15 +58,22 @@ const sovereignts: React.FC<aaa>= (prop : aaa) => {
|
|
|
// }
|
|
|
// console.log(sd);
|
|
|
|
|
|
- // formRef.current?.setFieldsValue(sd.data);
|
|
|
// //return getSovereign();
|
|
|
|
|
|
}
|
|
|
const selectdata = async (record:any)=>{
|
|
|
- const sd =await selectSovereign(record.custName);
|
|
|
- console.log(sd);
|
|
|
+ const sd =await selectSovereign(record.custName);
|
|
|
formRef.current?.setFieldsValue(sd);
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const selectdata1=async()=>{
|
|
|
+ const sd = await selectSovereign;
|
|
|
+
|
|
|
+ // console.log( sd);
|
|
|
+ //formRef.current?.setFieldValue('crmFirstLevel','保证');
|
|
|
+ }
|
|
|
|
|
|
const closeAndRefresh = ()=>{
|
|
|
setVisible(false);
|
|
@@ -90,76 +107,101 @@ const sovereignts: React.FC<aaa>= (prop : aaa) => {
|
|
|
}
|
|
|
|
|
|
const columns: ProColumns<SovereignModel>[] = [
|
|
|
- {
|
|
|
- title: '计算实例号',
|
|
|
- dataIndex: 'calcindex', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '起始数据日期',
|
|
|
- dataIndex: 'sdate', // 查询结果中的隐藏列
|
|
|
- valueType: 'date',
|
|
|
- // search: false, //注调查询条件显示
|
|
|
- // hideInTable: true //注调字段列显示
|
|
|
- },
|
|
|
- {
|
|
|
- title: '截止数据日期',
|
|
|
- dataIndex: 'edate', // 查询结果中的隐藏列
|
|
|
- valueType: 'date',
|
|
|
- // search: false,
|
|
|
- // hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '年月',
|
|
|
- dataIndex: 'term', // 查询结果中的隐藏列
|
|
|
- valueType:"dateMonth",
|
|
|
- // search: false,
|
|
|
- hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '数据日期',
|
|
|
- dataIndex: 'dataDate', // 查询结果中的隐藏列
|
|
|
- valueType: 'date',
|
|
|
- search: false,
|
|
|
- // hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '保证人交易对手名称',
|
|
|
- dataIndex: 'custName', // 查询结果中的隐藏列
|
|
|
- // search: true,
|
|
|
- // hideInTable: false
|
|
|
- },
|
|
|
- {
|
|
|
- title: '主权评级(如有)',
|
|
|
- dataIndex: 'sovereignRating', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- //hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '缓释一级分类',
|
|
|
- dataIndex: 'crmFirstLevel', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- // hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '合格信用风险缓释工具类型',
|
|
|
- dataIndex: 'qualfiedCreditToolTypeName', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- // hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '基础缓释权重',
|
|
|
- dataIndex: 'baseWeight', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- //hideInTable: true
|
|
|
- },
|
|
|
- {
|
|
|
- title: '豁免后缓释权重',
|
|
|
- dataIndex: 'exemptionWeight', // 查询结果中的隐藏列
|
|
|
- search: false,
|
|
|
- // hideInTable: true
|
|
|
- },
|
|
|
+ {
|
|
|
+ title: '计算实例号',
|
|
|
+ dataIndex: 'calcindex', // 查询结果中的隐藏列
|
|
|
+ // search: false,
|
|
|
+ ellipsis: true,
|
|
|
+ hideInTable: true
|
|
|
+ ,width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '起始数据日期',
|
|
|
+ dataIndex: 'sdate', // 查询结果中的隐藏列
|
|
|
+ valueType: 'date',
|
|
|
+ // search: false, //注调查询条件显示
|
|
|
+ hideInTable: true ,//注调字段列显示
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '截止数据日期',
|
|
|
+ dataIndex: 'edate', // 查询结果中的隐藏列
|
|
|
+ valueType: 'date',
|
|
|
+ // search: false,
|
|
|
+ hideInTable: true,
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '年月',
|
|
|
+ dataIndex: 'term', // 查询结果中的隐藏列
|
|
|
+ valueType:"dateMonth",
|
|
|
+ // search: false,
|
|
|
+ hideInTable: true
|
|
|
+ ,width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数据日期',
|
|
|
+ dataIndex: 'dataDate', // 查询结果中的隐藏列
|
|
|
+ valueType: 'date',
|
|
|
+ // search: false,
|
|
|
+ hideInTable: true,
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '国家名称',
|
|
|
+ dataIndex: 'custName', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ // hideInTable: false
|
|
|
+ width:150 ,
|
|
|
+ // valueType: 'treeSelect',
|
|
|
+ // fieldProps: {
|
|
|
+ // treeDefaultExpandAll: true,
|
|
|
+ // treeCheckable: true,
|
|
|
+ // },
|
|
|
+ // request: () => fetchDict('region'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '国家代码',
|
|
|
+ dataIndex: 'sovereignCode', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ // hideInTable: true,
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '主权评级(如有)',
|
|
|
+ dataIndex: 'sovereignRating', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ //hideInTable: true
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '缓释一级分类',
|
|
|
+ dataIndex: 'crmFirstLevel', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ // hideInTable: true
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '合格信用风险缓释工具类型',
|
|
|
+ dataIndex: 'qualfiedCreditToolTypeName', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ // hideInTable: true
|
|
|
+ width:180
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '基础缓释权重',
|
|
|
+ dataIndex: 'baseWeight', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ //hideInTable: true
|
|
|
+ width:150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '豁免后缓释权重',
|
|
|
+ dataIndex: 'exemptionWeight', // 查询结果中的隐藏列
|
|
|
+ search: false,
|
|
|
+ // hideInTable: true
|
|
|
+ width:150
|
|
|
+ },
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'operate',
|
|
@@ -207,96 +249,106 @@ const sovereignts: React.FC<aaa>= (prop : aaa) => {
|
|
|
</SDOperate>,
|
|
|
],
|
|
|
},
|
|
|
-
|
|
|
- // {
|
|
|
- // title: '操作',
|
|
|
- // key: 'option',
|
|
|
- // valueType: 'option',
|
|
|
- // render: (_, record, index, action) => {
|
|
|
- // const btns: React.ReactNode[] = [];
|
|
|
- // const bts = record.roleStr?.split(',');
|
|
|
- // let btnIndex = 0;
|
|
|
- // bts?.forEach((bt: string) => {
|
|
|
- // const btn = (
|
|
|
- // <SDOperate
|
|
|
- // successMessage=''
|
|
|
- // key={'btn' + btnIndex++}
|
|
|
- // onClick={() => {
|
|
|
- // setCurrentRow(record);
|
|
|
- // if (bt === '查看') {
|
|
|
- // setEditType('display');
|
|
|
- // setVisible(true);
|
|
|
- // } else if (bt === '修改') {
|
|
|
- // setEditType('update');
|
|
|
- // setVisible(true);
|
|
|
- // }
|
|
|
- // }}
|
|
|
- // defaultIcon
|
|
|
- // >
|
|
|
- // {bt}
|
|
|
- // </SDOperate>
|
|
|
- // );
|
|
|
- // btns.push(btn);
|
|
|
- // })
|
|
|
-
|
|
|
- // return btns;
|
|
|
+ ]
|
|
|
+
|
|
|
+ // const sd1 = async(formData:SovereignModel)=>{
|
|
|
+ // console.log(2)
|
|
|
+ // if(formData.custName ===undefined){
|
|
|
+ // const sd = await getSovereign(formData,"");
|
|
|
+ // formDataList=[...sd];
|
|
|
+ // return {data :sd };
|
|
|
+ // } else{
|
|
|
+ // var value ="";
|
|
|
+ // formData.custName.forEach(function(item){ value += item +","}); // 循环下拉树数组变成字符串
|
|
|
+ // value= value.substring(0,value.length-1) // 去除最后一位,
|
|
|
+ // let {custName,...Model1}=formData // 重新解构对象 去除custName字段
|
|
|
+ // const sd = await getSovereign(Model1,value);
|
|
|
+ // return {data :sd };
|
|
|
// }
|
|
|
+
|
|
|
// }
|
|
|
|
|
|
+ const sd1 = async(formData:SovereignModel)=>{
|
|
|
+ const sd = await getSovereign(formData);
|
|
|
+ formDataList =[...sd];
|
|
|
+ return {data :sd };
|
|
|
+ }
|
|
|
|
|
|
- ]
|
|
|
|
|
|
return (
|
|
|
<SDPage >
|
|
|
<SDTable
|
|
|
title="查询表格"
|
|
|
rowKey="custName"
|
|
|
- request={async(formData : SovereignModel)=>{
|
|
|
- const sd = await getSovereign(formData);
|
|
|
- return {data :sd };
|
|
|
- }}
|
|
|
+ request={sd1}
|
|
|
columns={columns}
|
|
|
// singleSelect={false}
|
|
|
- operations={["create"]}
|
|
|
+ // operations={["create"]}
|
|
|
//displayColumn="custName"
|
|
|
actionRef={actionRef}
|
|
|
formRef={formRef}
|
|
|
//handleRemove={deletedata}
|
|
|
- setCurrentRow={setCurrentRow}
|
|
|
- setEditType={setEditType}
|
|
|
- setDetailVisible={setVisible}
|
|
|
+ //setCurrentRow={setCurrentRow}
|
|
|
+ // setEditType={setEditType}
|
|
|
+ // setDetailVisible={setVisible}
|
|
|
+ toolBarRender={(_, { selectedRows }) => [
|
|
|
+ <SDButton
|
|
|
+ key="export"
|
|
|
+ successMessage='导出成功'
|
|
|
+ onClick={() => {
|
|
|
+
|
|
|
+ // if (selectedRows === undefined || selectedRows.length < 1) {
|
|
|
+ // baseFun.warning('请先选择要倒出的模板');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ exportExcelModel(formDataList);
|
|
|
+ //baseFun.info('处理完成');
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 全部导出
|
|
|
+ </SDButton>,
|
|
|
+ <SDButton
|
|
|
+ key="create"
|
|
|
+ onClick={() => {
|
|
|
+ setVisible(true);
|
|
|
+ setEditType('create');
|
|
|
+ formRef.current?.setFieldValue('crmFirstLevel','保证');
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </SDButton>
|
|
|
+ ]}
|
|
|
>
|
|
|
</SDTable>
|
|
|
|
|
|
{ visible &&(
|
|
|
-
|
|
|
-
|
|
|
<SDModalForm
|
|
|
visible={visible}
|
|
|
//rowKey="custName"
|
|
|
editType={editType}
|
|
|
- request={selectdata}
|
|
|
+ // request={selectdata1}
|
|
|
//params={setDataSource}
|
|
|
onVisibleChange={() => { setVisible(false) }}
|
|
|
footer={[<SDSubmitButton editType={editType} formRef={formRef} doSubmit={inst} >保存</SDSubmitButton>]}
|
|
|
formRef={formRef}
|
|
|
+ onValuesChange={async (changedValues,Values) => {
|
|
|
+ if(changedValues.custName!=undefined){
|
|
|
+ const sd = await selectSovereignCode(changedValues.custName);
|
|
|
+ console.log(sd);
|
|
|
+ formRef.current?.setFieldValue('sovereignCode',sd)}
|
|
|
+ // const jiaoyan=formRef.current?.getFieldsValue();
|
|
|
+ }}
|
|
|
>
|
|
|
|
|
|
-<SDFormText name="custName" label="保证人交易对手名称" readonlyCond='update' />
|
|
|
- <SDFormText name="sovereignRating" label="主权评级(如有)" />
|
|
|
- <SDFormText name="crmFirstLevel" label="缓释一级分类" />
|
|
|
+<SDFormDict name="custName" label="国家名称" readonlyCond='update' dictKey='@sovereignCode' />
|
|
|
+<SDFormText name="sovereignCode" label="国家代码" readonlyCond='both' />
|
|
|
+ <SDFormDict name="sovereignRating" label="主权评级(标普)" dictKey="sovereignRating" />
|
|
|
+ <SDFormText name="crmFirstLevel" label="缓释分类" />
|
|
|
<SDFormText name="qualfiedCreditToolTypeName" label="合格信用风险缓释工具类型" />
|
|
|
- <SDFormText name="baseWeight" label="基础缓释权重" />
|
|
|
- <SDFormText name="exemptionWeight" label="豁免后缓释权重" />
|
|
|
+ <SDFormText name="baseWeight" label="缓释风险权重%" />
|
|
|
</SDModalForm>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
</SDPage>
|
|
@@ -304,3 +356,4 @@ return (
|
|
|
|
|
|
};export default sovereignts;
|
|
|
|
|
|
+
|