page.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import './index.less';
  4. import Page from '@src/containers/Page';
  5. import Block from '@src/components/Block';
  6. // import ActionLayout from '@src/layouts/ActionLayout';
  7. import TableLayout from '@src/layouts/TableLayout';
  8. import { getMap } from '@src/services/Tools';
  9. import { System } from '../../../stores/system';
  10. import { ContractKey } from '../../../../Constant';
  11. const ContractKeyMap = getMap(ContractKey, 'value', 'label');
  12. export default class extends Page {
  13. constructor(props) {
  14. super(props);
  15. this.columns = [{
  16. title: '协议名称',
  17. dataIndex: 'title',
  18. }, {
  19. title: '应用场景',
  20. dataIndex: 'key',
  21. render: (text) => {
  22. return ContractKeyMap[text] || '';
  23. },
  24. }, {
  25. title: '操作',
  26. dataIndex: 'handler',
  27. render: (text, record) => {
  28. return <div className="table-button">
  29. {<Link to={`/setting/contract/detail/${record.key}`}>修改</Link>}
  30. </div>;
  31. },
  32. }];
  33. }
  34. initData() {
  35. System.allContract().then(result => {
  36. this.setState({ list: result });
  37. });
  38. }
  39. renderView() {
  40. return <Block flex>
  41. <TableLayout
  42. columns={this.tableSort(this.columns)}
  43. list={this.state.list}
  44. pagination={false}
  45. loading={this.props.core.loading}
  46. />
  47. </Block>;
  48. }
  49. }