pushHistoryDetail.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React, { useEffect, useState } from 'react';
  2. import { Descriptions, Modal } from 'antd';
  3. import moment from 'moment';
  4. import { queryPushHistoryDetail } from '@/services/pushMessage';
  5. interface userCheckPros {
  6. visible: boolean;
  7. record_id: string;
  8. onCallback: () => void;
  9. }
  10. interface detailType {
  11. title: string;
  12. phone: string;
  13. created_at: string;
  14. }
  15. /**
  16. * 推送历史详情
  17. * @param props
  18. * @constructor
  19. */
  20. const PushHistoryDetail: React.FC<userCheckPros> = (props) => {
  21. const { visible, onCallback, record_id } = props;
  22. const [dataDetail, setDataDetail] = useState<detailType>({
  23. title: '',
  24. phone: '',
  25. created_at: '',
  26. });
  27. useEffect(() => {
  28. queryPushHistoryDetail(record_id).then((res) => {
  29. if (res.code === 0) {
  30. setDataDetail(res.data);
  31. }
  32. });
  33. }, []);
  34. // 确定
  35. const onOk = () => {
  36. onCallback();
  37. };
  38. // 取消
  39. const onCancel = () => {
  40. onCallback();
  41. };
  42. return (
  43. <Modal title="查看" open={visible} onOk={onOk} onCancel={onCancel} width={1000}>
  44. <Descriptions title="历史记录" bordered column={2}>
  45. <Descriptions.Item label="推送标题">{dataDetail?.title}</Descriptions.Item>
  46. <Descriptions.Item label="推送类型">{dataDetail?.phone}</Descriptions.Item>
  47. <Descriptions.Item label="推送时间">
  48. {dataDetail?.created_at
  49. ? moment(dataDetail?.created_at).format('YYYY-MM-DD HH:ss:mm')
  50. : '暂无'}
  51. </Descriptions.Item>
  52. {/*<MyEditor data={dataDetail?.body ? dataDetail?.body : ''} readOnly={true} />*/}
  53. </Descriptions>
  54. </Modal>
  55. );
  56. };
  57. export default PushHistoryDetail;