123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- import { history, Link } from 'umi';
- import { useRef, useState, useEffect } from 'react';
- import { Button, Popconfirm, message, Tooltip } from 'antd';
- import { PlusOutlined, QuestionCircleOutlined, DownOutlined } from '@ant-design/icons';
- import { PageHeaderWrapper } from '@ant-design/pro-layout';
- import ProTable from '@ant-design/pro-table';
-
- export default (props) => {
- const dataSource = [
- {
- id: 9,
- key: '1',
- name: '胡彦斌',
- age: 32,
- address: '西湖区湖底公园1号',
- },
- {
- id: 10,
- key: '2',
- name: '胡彦祖',
- age: 42,
- address: '西湖区湖底公园1号',
- },
- ];
-
- const actions = () => [
- <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>
- 新增商户
- </Button>,
- ];
- const columns = [
- {
- title: '消息ID',
-
- key: 'id',
- dataIndex: 'id',
- search: false,
-
- render: (t, record) => (
- <Link key={1} to={`./edit?id=${record.shopId}`}>
- {record.shopName}
- </Link>
- ),
- },
-
- {
- title: '消息标题',
- key: 'title',
- dataIndex: 'title',
- render: (t, record) => (
- <Link key={1} to={`./package?shopId=${record.shopId}`}>
- {record?.packageNum}
- </Link>
- ),
- },
-
- {
- title: '推送对象',
- key: 'pushPerson',
- search: false,
- dataIndex: 'pushPerson',
- render: (t, record) => (record.pushPerson === 1 ? '农机手' : '农户'),
- },
-
- {
- title: '推送方式',
- key: 'status',
- dataIndex: 'status',
- // render: (t, record) => record.status === 1 ? '发布' : '未发布',
- formItemProps: { label: '推送方式' },
- valueType: 'select',
- valueEnum: {
- 0: { text: '通知栏推送' },
- 1: { text: 'APP内消息中心推送' },
- 2: { text: '短信推送' },
- },
- },
-
- {
- title: (
- <>
- 创建时间
- <Tooltip placement="top">
- <QuestionCircleOutlined style={{ marginLeft: 4 }} />
- </Tooltip>
- </>
- ),
- width: 140,
- key: 'createdAt',
- dataIndex: 'createdAt',
- valueType: 'date',
- // render: (t) => formatterTime(t),
- sorter: (a, b) => a.createdAt - b.createdAt,
- },
-
- {
- title: '操作',
- valueType: 'option',
- width: '300px',
- render: (_, record) => [
- <Link key={2} to={`./MessageEdit`}>
- 查看
- </Link>,
- <Popconfirm
- key={3}
- title="您是否确认删除 ?"
- onConfirm={() => handleDelete(record.noticeId)}
- okText="确定"
- cancelText="取消"
- >
- <a href="#">删除</a>
- </Popconfirm>,
- ],
- },
- ];
-
- return (
- <PageHeaderWrapper>
- <ProTable
- dataSource={dataSource}
- columns={columns}
- // request={getList}
- rowKey="id"
- options={false}
- toolBarRender={actions}
- scroll={{ x: 1000 }}
- />
- </PageHeaderWrapper>
- );
- };
|