TableHasNoCode.jsx 3.11 KB
Newer Older
DarkForst's avatar
DarkForst 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 36 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 130
import React, { useRef, useState, useEffect } from 'react';
import {
  Checkbox,
  Popover,
  Divider,
  Tabs,
  Badge,
  Popconfirm,
  DatePicker,
  Table,
  Card,
  Row,
  Col,
  Form,
  Input,
  Button,
  Select,
  Switch,
  TreeSelect,
  message,
  Modal,
} from 'antd';
import { DownloadOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons';
import { connect, history } from 'umi';

import { dispatchHandle } from '@/utils/publicHandle';
import useUpdateEffect from '@/useHooks/useUpdateEffect';
import useFormTable from '@/useHooks/useFormTable';
import TableEditHasNoCode from './TableEditHasNoCode';
import OperateFooterBar from '../components/OperateFooterBar';
import moment from 'moment';
import classNames from 'classnames';
import utilsStyles from '@/utils/utils.less';
const TableHasNoCode = (props) => {
  const [tableData, setTableData] = useState([]);
  const [form] = Form.useForm();
  const optColumns = [
    { title: '序号', dataIndex: 'id', disabled: true },
    // { title: '虚拟料号', dataIndex: 'a', editable: true },
    { title: '品名', dataIndex: 'materialName', editable: true },
    {
      title: '规格/型号',
      dataIndex: 'c',
      editable: true,
    },
    { title: '供应商', dataIndex: 'supplierName', editable: true },
    { title: '采购周期(天)', dataIndex: 'e', editable: true, width: 140 },
    { title: '单位', dataIndex: 'f', editable: true, width: 100 },
    { title: '单价(元)', dataIndex: 'materialPrice', editable: true, width: 120 },
    {
      title: '领取数量',
      dataIndex: 'totalNum',
      editable: true,
      width: 150,
    },
    { title: '领取金额', dataIndex: 'amount' },
    { title: '备注', dataIndex: 'remarks', editable: true, width:120 },
  ];

  const searchResetSubmit = () => {
    setSelectIds([]);
    setTotalCount(0);
    search.submit();
  };
  const getListItems = (payload = {}) => {
    //       payload.alarmClass = 1 ;//1:设备告警 2:能耗告警
    //    dispatchHandle(dispatch, 'alarmCenter/device_service_alarm_post', payload,(data,res)=>{
    //       setTotalCount(res.totalElements);
    //    });
  };

  // 查询表单
  const { tableProps, search } = useFormTable(getListItems, {
    form,
  });
  const handleClose = () => {};
  const handleSubmit = () => {};
  useEffect(() => {
    let tempTableData = [
      {
        id: 1,
        key: 1,
        a: '1',
        b: 'b',
        c: 'c',
        d: 'd',
        e: 'e',
        f: 'f',
        g: 'g',
        h: 1000,
        i: 2000,
        j: 4000,
        k: 1,
        l: '暂无备注',
      },
      {
        id: 2,
        key: 2,
        a: '2222',
        b: 'b22',
        c: 'c',
        d: 'd',
        e: 'e',
        f: 'f',
        g: 'g22',
        h: 1000,
        i: 2000,
        j: 4000,
        k: 1,
        l: '暂无备注',
      },
    ];
    setTableData([...tempTableData]);
  }, []);

  return (
    <>
      <TableEditHasNoCode
        optColumns={optColumns}
        tableData={tableData}
        setTableData={setTableData}
      />
    </>
  );
};

export default connect(({ ware,loading }) => ({
  ware,
  loading
}))(TableHasNoCode);