index.jsx 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { history, Link } from 'umi';
  2. import { useRef, useState, useEffect } from 'react';
  3. import { Button, Popconfirm, message, Tooltip } from 'antd';
  4. import { PlusOutlined, QuestionCircleOutlined, DownOutlined } from '@ant-design/icons';
  5. import { PageHeaderWrapper } from '@ant-design/pro-layout';
  6. import ProTable from '@ant-design/pro-table';
  7. export default (props) => {
  8. const dataSource = [
  9. {
  10. id: 2121329,
  11. title: '这是是一个标题标题',
  12. name: '胡彦斌',
  13. pushPerson: '农机手',
  14. status: 'APP内消息中心推送',
  15. },
  16. ];
  17. const gotoDetail = (id) => {
  18. history.push(`./MessageEdit`)
  19. }
  20. const actions = () => [
  21. <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
  22. 新增商户
  23. </Button>,
  24. ];
  25. const columns = [
  26. {
  27. title: '消息ID',
  28. key: 'id',
  29. dataIndex: 'id',
  30. search: false,
  31. render: (t, record) => (
  32. <Link key={1} to={`./edit?id=${record.shopId}`}>
  33. {record.shopName}
  34. </Link>
  35. ),
  36. },
  37. {
  38. title: '消息标题',
  39. key: 'title',
  40. dataIndex: 'title',
  41. render: (t, record) => (
  42. <Link key={1} to={`./package?shopId=${record.shopId}`}>
  43. {record?.packageNum}
  44. </Link>
  45. ),
  46. },
  47. {
  48. title: '推送对象',
  49. key: 'pushPerson',
  50. search: false,
  51. dataIndex: 'pushPerson',
  52. render: (t, record) => (record.pushPerson === 1 ? '农机手' : '农户'),
  53. },
  54. {
  55. title: '推送方式',
  56. key: 'status',
  57. dataIndex: 'status',
  58. // render: (t, record) => record.status === 1 ? '发布' : '未发布',
  59. formItemProps: { label: '推送方式' },
  60. valueType: 'select',
  61. valueEnum: {
  62. 0: { text: '通知栏推送' },
  63. 1: { text: 'APP内消息中心推送' },
  64. 2: { text: '短信推送' },
  65. },
  66. },
  67. {
  68. title: (
  69. <>
  70. 创建时间
  71. <Tooltip placement="top">
  72. <QuestionCircleOutlined style={{ marginLeft: 4 }} />
  73. </Tooltip>
  74. </>
  75. ),
  76. width: 140,
  77. key: 'createdAt',
  78. dataIndex: 'createdAt',
  79. valueType: 'date',
  80. // render: (t) => formatterTime(t),
  81. sorter: (a, b) => a.createdAt - b.createdAt,
  82. },
  83. {
  84. title: '操作',
  85. valueType: 'option',
  86. width: '300px',
  87. render: (_, record) => [
  88. <Link key={2} to={`./MessageEdit`}>
  89. 查看
  90. </Link>,
  91. <Popconfirm
  92. key={3}
  93. title="您是否确认删除 ?"
  94. onConfirm={() => handleDelete(record.noticeId)}
  95. okText="确定"
  96. cancelText="取消"
  97. >
  98. <a href="#">删除</a>
  99. </Popconfirm>,
  100. ],
  101. },
  102. ];
  103. return (
  104. <PageHeaderWrapper>
  105. <ProTable
  106. dataSource={dataSource}
  107. columns={columns}
  108. // request={getList}
  109. rowKey="id"
  110. options={false}
  111. toolBarRender={actions}
  112. scroll={{ x: 1000 }}
  113. />
  114. </PageHeaderWrapper>
  115. );
  116. };