index.jsx 2.11 KB
Newer Older
krysent's avatar
krysent committed
1 2 3 4 5 6 7 8 9
import React, { useEffect, useMemo, useRef, useState } from "react";
import { Dropdown, Menu, Button, message } from "antd";
import AutoTable from "@/components/AutoTable";
import { doFetch } from "@/utils/doFetch";
import DrawInitForm from "@/components/DrawInitForm";
import getPrem from "@/utils/getPrem"; //权限判断fn
import { useReactToPrint } from "react-to-print";
import { useModel } from "umi";

krysent's avatar
krysent committed
10
function Errormange(props) {
krysent's avatar
krysent committed
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 36 37 38 39 40 41 42 43 44 45 46
  const { initialState, setInitialState } = useModel("@@initialState");
  const [activeTabKey, onTabChange] = useState("1");
  const [selectKeys, setSelectKeys] = useState([]);

  let [drawprops, setdrawprops] = useState({
      title: "",
      visible: false,
      onClose: () => {
        setdrawprops((s) => ({
          ...s,
          visible: false,
          fields: {},
        }));
      },
      fields: {},
      width: 1200,
    }),
    actionRef = useRef(),
    ChildRef = null,
    printRef = useRef(),
    mutiPrintRef = useRef();

  //操作完成后刷新
  function reload() {
    actionRef.current.reload();
    ChildRef?.onRefresh();
    message.success("操作成功");
    setdrawprops((s) => ({
      ...s,
      visible: false,
      fields: {},
    }));
  }


  const columns = useMemo(() => {
krysent's avatar
krysent committed
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
    return [
      {
        title: "设备编号",
        dataIndex: "requestEquipment",
        key: "requestEquipment",
      },
      {
        title: "错误代码",
        dataIndex: "requestErrorCode",
        search: false,
        key: "requestErrorCode",
      },
      {
        title: "错误说明",
        dataIndex: "requestErrorMsg",
        search: false,
        key: "requestErrorMsg",
      },
      {
        title: "请求时间",
        dataIndex: "apiSendTime",
        key: "apiSendTime",
        search: false,
      },
      
    ];
krysent's avatar
krysent committed
73 74 75 76 77
  }, [activeTabKey]);

  const tableprops = {
    ...props,
    columns,
krysent's avatar
krysent committed
78
    path: "/ngic-workmanship/alarmReport/queryList",
krysent's avatar
krysent committed
79 80 81 82 83 84 85 86 87 88 89 90 91
  };

  return (
    <div>
      <AutoTable
        {...tableprops}
        actionRef={actionRef}
        onRef={(node) => (ChildRef = node)}
      ></AutoTable>
    </div>
  );
}

krysent's avatar
krysent committed
92
export default Errormange;