index.jsx 4.7 KB
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
import React, { useEffect, useRef, useState } from 'react';
import { Button, Drawer } from 'antd';
import { connect, useModel } from "umi";
import AutoTable from '@/components/AutoTable';
import getPrem from '@/utils/getPrem';//权限判断fn
import Details from "@/components/Details";

let SendList = (props) => {
    const { global, dispatch } = props;
    const actionRef = useRef(),
        [details, cdetails] = useState({
            totalTitle: "推送记录详情",
            visible: false,
            dataSource: {},
            totalCard: []
        });



    let columns = [
        {
            "title": "推送时间",
            "dataIndex": "sendTime",
            "key": "sendTimeList",
            "valueType": "dateRange"
        },
        {
            "title": "接收用户",
            "dataIndex": "userName",
            "key": "userName"
        },
        {
            "title": "推送方式",
            "dataIndex": "sendMethodName",
            "key": "sendMethodName",
左玲玲's avatar
左玲玲 committed
36
            search: false
wuhao's avatar
wuhao committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
        },
        {
            "title": "推送内容",
            "dataIndex": "msgContent",
            "key": "msgContent"
        },
        {
            "title": "状态",
            "dataIndex": "sendResultName",
            "key": "sendResult",
            "valueType": "select",
            options: [
                {
                    "label": "成功",
                    "value": 1
                },
                {
                    "label": "失败",
                    "value": 2
                }
            ]
        },
        {
            title: '操作',
            valueType: 'option',
            width: 120,
            render: (text, row, _, action) => extraAction(text, row, _, action)
        },
    ]



    function extraAction(text, record, _, action) {
        return (
            <div>
                {
                    getPrem(true, null, "查看详情", () => {
                        cdetails(details => {
                            return {
                                ...details,
                                visible: true,
                                dataSource: record,
                                totalCard: [
                                    { //每一个模块信息
                                        cardTitle: '记录详情',
                                        itemData: [
                                            {
                                                "title": "推送时间",
                                                "key": "sendTime"
                                            },
                                            {
                                                "title": "接收用户",
                                                "key": "userName"
                                            },
                                            {
                                                "title": "推送方式",
                                                "key": "sendMethodName"
                                            },
                                            {
                                                "title": "消息标题",
                                                "key": "msgTitle",
                                                col: { span: 24 }
                                            },
                                            {
                                                "title": "消息内容",
                                                "key": "msgContent",
                                                col: { span: 24 }
                                            }
                                        ]
                                    }
                                ]
                            }
                        })
                    })
                }

            </div>
        );
    }
    // let extrarender = ([<Button  type="primary" onClick={() => {

    // }}>导出</Button>])


    return (
        <div>
            <AutoTable
                pagetitle={props.route.name} //页面标题
                // pageextra={extrarender} //页面操作 新增or批量删除
                columns={columns}
                actionRef={actionRef}
                path="/ngic-base-business/paMsgSendRecord/queryList"
            ></AutoTable>
左玲玲's avatar
左玲玲 committed
130
            <Details
wuhao's avatar
wuhao committed
131 132 133 134 135 136
                title={details.totalTitle}
                closable={true}
                visible={details.visible}
                onClose={() => { cdetails({ ...details, visible: false }) }}
                width="100%"
                className="drawerDetails"
左玲玲's avatar
左玲玲 committed
137
                {...details}
wuhao's avatar
wuhao committed
138
            >
左玲玲's avatar
左玲玲 committed
139
            </Details>
wuhao's avatar
wuhao committed
140 141 142 143 144
        </div>
    )
}

export default SendList