RepoRelatedTable.tsx 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import React, { useEffect, useRef, useState } from "react";
  2. import type { ProColumns, ActionType, ProFormInstance } from '@ant-design/pro-components';
  3. import type {FormInstance} from 'antd'
  4. import {Upload} from 'antd'
  5. import { SDPage,SDFormText,SDModalForm,SDTable,SDFormItem,SDButton,SDForm,SDSubmitButton,EditType, SDAreaTtile, SDLayout, SDOperate, baseFun, } from "@sundata/ui-frame";
  6. import {getDataList,selectDetailData,exportExcelModel, SysListModel,} from '@/services/rwa/dataquality/RepoRelatedTable';
  7. import { ProductProps } from "@/sundataImport";
  8. import { useModel } from '@umijs/max';
  9. type widowRush = {
  10. onCancel: () => void;
  11. onChangeVisible(visible: boolean, type: string): unknown;
  12. onChangeVisdible:(visible:boolean,type ?: 'none' | 'raload' )=>void;
  13. }& ProductProps;
  14. // 回购关联信息表
  15. const RepoRelatedTable : React.FC<widowRush> = (prop:widowRush) => {
  16. /** 编辑方式,查看、修改、新增按钮时设置,详细信息表单中使用 */
  17. const [editType, setEditType] = useState<EditType>(prop.editType || 'display');
  18. /** 是否显示详细信息窗口 */
  19. const [detailVisible, setDetailVisible] = useState<boolean>(false);
  20. const [currentRow, setCurrentRow] = useState<SysListModel>();
  21. /** 表格引用对象,刷新表格使用 */
  22. const actionRef = useRef<ActionType>();
  23. const formRef = useRef<FormInstance<any>>();
  24. const { fetchDict } = useModel('dict');
  25. // 页面数据
  26. var formDataList = new Array<SysListModel>;
  27. /**上传文件 */
  28. const [fileData, setFileData] = useState<File>();
  29. // 导入窗口显示
  30. const [importVisible, setImportVisible] = useState<boolean>(false);
  31. useEffect(() => {
  32. }, []);
  33. const selectData = async (formdata : SysListModel) => {
  34. const data = await selectDetailData(formdata);
  35. formRef.current?.setFieldsValue(data);
  36. }
  37. //关闭窗口刷新父页面
  38. const closeAndRefresh = ()=>{
  39. actionRef.current?.reloadAndRest?.();
  40. }
  41. // 页面展示元素
  42. const columns: ProColumns<SysListModel>[] = [
  43. {
  44. title: '计算实例号',
  45. dataIndex: 'calcindex',
  46. search: false,
  47. hideInTable: true,
  48. width:150,
  49. ellipsis:true
  50. },
  51. {
  52. title: '起始数据日期',
  53. dataIndex: 'startDate',
  54. search: false,
  55. hideInTable: true,
  56. width:150,
  57. ellipsis:true
  58. },
  59. {
  60. title: '截止数据日期',
  61. dataIndex: 'endDate',
  62. search: false,
  63. hideInTable: true,
  64. width:150,
  65. ellipsis:true
  66. },
  67. {
  68. title: '年月',
  69. dataIndex: 'yearMonth',
  70. search: false,
  71. hideInTable: true,
  72. width:150,
  73. ellipsis:true
  74. },
  75. {
  76. title: '数据日期',
  77. dataIndex: 'dataDate',
  78. hideInTable: false,
  79. order:-1,
  80. valueType:'date',
  81. width:150,
  82. ellipsis:true
  83. },
  84. {
  85. title: '缓释品编号',
  86. dataIndex: 'mitigationProdNo',
  87. hideInTable: false,
  88. order:-2,
  89. width:150,
  90. ellipsis:true
  91. },
  92. {
  93. title: '缓释品名称',
  94. dataIndex: 'mitigationProdName',
  95. hideInTable: false,
  96. order:-3,
  97. width:150,
  98. ellipsis:true
  99. },
  100. {
  101. title: '质押券证券代码',
  102. dataIndex: 'pledgeBondsSecurityCode',
  103. hideInTable: false,
  104. order:-4,
  105. width:150,
  106. ellipsis:true
  107. },
  108. {
  109. title: '证券名称',
  110. dataIndex: 'securityName',
  111. hideInTable: false,
  112. order:-5,
  113. width:150,
  114. ellipsis:true
  115. },
  116. {
  117. title: '证券种类代码',
  118. dataIndex: 'securityClass',
  119. search: false,
  120. hideInTable: false,
  121. width:150,
  122. ellipsis:true
  123. },
  124. {
  125. title: '证券种类',
  126. dataIndex: 'securityClass',
  127. search: false,
  128. hideInTable: false,
  129. width:150,
  130. ellipsis:true,
  131. valueType: 'treeSelect',
  132. request: () => fetchDict(''),
  133. fieldProps: {
  134. treeDefaultExpandAll: true,
  135. },
  136. },
  137. {
  138. title: '一般专项标签代码',
  139. dataIndex: 'generalSpecialLabel',
  140. search: false,
  141. hideInTable: false,
  142. width:150,
  143. ellipsis:true
  144. },
  145. {
  146. title: '一般专项标签',
  147. dataIndex: 'generalSpecialLabel',
  148. search: false,
  149. hideInTable: false,
  150. width:150,
  151. ellipsis:true,
  152. valueType: 'treeSelect',
  153. request: () => fetchDict('DEBT_TYPE'),
  154. fieldProps: {
  155. treeDefaultExpandAll: true,
  156. },
  157. },
  158. {
  159. title: '押品价值币种代码',
  160. dataIndex: 'collateralValueCcyCode',
  161. search: false,
  162. hideInTable: false,
  163. width:150,
  164. ellipsis:true
  165. },
  166. {
  167. title: '币种',
  168. dataIndex: 'collateralValueCcyCode',
  169. search: false,
  170. hideInTable: false,
  171. width:150,
  172. ellipsis:true,
  173. valueType: 'treeSelect',
  174. request: () => fetchDict(''),
  175. fieldProps: {
  176. treeDefaultExpandAll: true,
  177. },
  178. },
  179. {
  180. title: '质押券票面金额',
  181. dataIndex: 'pledgeBondsBillValueAmt',
  182. search: false,
  183. hideInTable: false,
  184. width:150,
  185. ellipsis:true
  186. },
  187. {
  188. title: '缓释起始日',
  189. dataIndex: 'mitigantOrginDate',
  190. search: false,
  191. hideInTable: false,
  192. width:150,
  193. ellipsis:true
  194. },
  195. {
  196. title: '缓释到期日',
  197. dataIndex: 'mitigantExpiryDate',
  198. search: false,
  199. hideInTable: false,
  200. width:150,
  201. ellipsis:true
  202. },
  203. {
  204. title: '债项编号',
  205. dataIndex: 'debtitemNo',
  206. hideInTable: false,
  207. order:-6,
  208. width:150,
  209. ellipsis:true
  210. },
  211. {
  212. title: '发行(承兑)人名称',
  213. dataIndex: 'issuerName',
  214. search: false,
  215. hideInTable: false,
  216. width:150,
  217. ellipsis:true
  218. },
  219. ];
  220. return (
  221. <SDPage>
  222. <SDTable
  223. title="查询表格"
  224. rowKey="customerName"
  225. request={async (formdata:SysListModel) =>{
  226. const formDatas = await getDataList(formdata);
  227. // 解构数组(导出用)
  228. formDataList=[...formDatas];
  229. return {data: formDatas}
  230. } }
  231. columns={columns}
  232. toolBarRender={(_, { selectedRows }) => [
  233. <SDButton
  234. key="export"
  235. successMessage=''
  236. onClick={() => {
  237. baseFun.confirm('确认导出数据?',async() => { exportExcelModel(formDataList,"RepoRelatedTable")});;
  238. //baseFun.info('处理完成');
  239. }}
  240. >
  241. 全部导出
  242. </SDButton>,
  243. ]}
  244. actionRef={actionRef}
  245. formRef={formRef}
  246. initLoad={false}
  247. setDetailVisible={() => {setDetailVisible(true)}}
  248. setEditType={setEditType}
  249. setCurrentRow={setCurrentRow}
  250. />
  251. </SDPage>
  252. );
  253. }
  254. export default RepoRelatedTable;