123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import React from 'react';
  2. import { history, Link } from 'umi';
  3. import { Button, Popconfirm, message, Tooltip } from 'antd';
  4. import { PlusOutlined } from '@ant-design/icons';
  5. import { getList } from '@/services/cooperative';
  6. import { PageHeaderWrapper } from '@ant-design/pro-layout';
  7. import moment from 'moment';
  8. import PageTable from '@/components/PageTable';
  9. const formatterTime = (val) => {
  10. return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '';
  11. };
  12. export default (props) => {
  13. const actions = () => [
  14. <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoEdit()}>
  15. 新增机构
  16. </Button>,
  17. ];
  18. const gotoEdit = (id) => {
  19. const queryStr = id ? `?id=${id}` : '';
  20. history.push(`./Cooperative/edit.jsx${queryStr}`);
  21. };
  22. const columns = [
  23. {
  24. title: '机构名',
  25. dataIndex: 'name',
  26. key: 'name',
  27. },
  28. {
  29. title: '联系人',
  30. dataIndex: 'contactPerson',
  31. key: 'contactPerson',
  32. },
  33. {
  34. title: '联系方式',
  35. dataIndex: 'phone',
  36. key: 'phone',
  37. },
  38. {
  39. title: '区域',
  40. dataIndex: 'regionId',
  41. key: 'regionId',
  42. },
  43. {
  44. title: '地址',
  45. dataIndex: 'address',
  46. key: 'address',
  47. search: false,
  48. },
  49. {
  50. title: '农机数',
  51. dataIndex: 'machineryNum',
  52. key: 'machineryNum',
  53. search: false,
  54. },
  55. {
  56. title: '员工数',
  57. dataIndex: 'employeesNum',
  58. key: 'employeesNum',
  59. search: false,
  60. },
  61. {
  62. title: '完成订单数',
  63. dataIndex: 'orderNum',
  64. key: 'orderNum',
  65. search: false,
  66. },
  67. {
  68. title: '评分',
  69. dataIndex: 'score',
  70. key: 'score',
  71. search: false,
  72. },
  73. {
  74. title: '操作',
  75. valueType: 'option',
  76. render: (_, record) => [
  77. <Link key={1} to={`./edit.jsx`}>
  78. 编辑
  79. </Link>,
  80. <Popconfirm
  81. key={2}
  82. title="您是否确认删除 ?"
  83. onConfirm={() => handleDelete(record.cooperativeId)}
  84. okText="确定"
  85. cancelText="取消"
  86. >
  87. <a href="#">删除</a>
  88. </Popconfirm>,
  89. ],
  90. },
  91. ];
  92. const handleDelete = () => {};
  93. return (
  94. <PageHeaderWrapper>
  95. <PageTable
  96. request={getList}
  97. // expfunc={exportPersonList}
  98. columns={columns}
  99. rowKey="cooperativeId"
  100. options={false}
  101. toolBarRender={actions}
  102. scroll={{ x: 1000 }}
  103. />
  104. </PageHeaderWrapper>
  105. );
  106. };