PurchaseSearch.tsx 1.99 KB
import React from 'react';
import {Button, Col, Form, Row} from "antd";
import {createSearchForm} from "@/utils/createForm";
import ExportFile from "@/components/Custom/ExportFile";
import {DownloadOutlined} from "@ant-design/icons";

export interface PurchaseSearchProps {
  form: any,
  allFormData: any[];
  valChange: (values: any) => void;
  selectedRowKeys?: number[];
  mergeConfirm?: (values: any) => void;
  checkConfirm?: (values?: number[]) => void;
  exportData: any;
  tabKey?: '981' | '980'
  tab?: '0' | '2' | '10' | '15' | '20' | '90'
}


const PurchaseList: React.FC<PurchaseSearchProps> = (props) => {
  const {
    form, allFormData, valChange, selectedRowKeys, mergeConfirm,
    checkConfirm, exportData, tabKey, tab
  } = props;

  return (
    <Form form={form} onValuesChange={valChange} style={{ borderBottom: '1px solid #f3f4f3' }}>
      <Row gutter={10} >
        {allFormData?.length > 0 && allFormData.map(item => (
          <Col {...item.layout} key={item.name} className="pos_aline">
            {createSearchForm(item)}
          </Col>
        ))}
        <Col style={{flex: 1, padding: 10}} className="pos_end">
          {tabKey ==='981' && (
            <>
              <Button
                disabled={selectedRowKeys?.length === 0 || tab === '10'}
                type="primary" onClick={mergeConfirm}
              >合并</Button>
              <Button
                style={{margin: '0 10px'}}
                disabled={selectedRowKeys?.length === 0 || tab === '2'}
                type="primary" danger onClick={() => checkConfirm?.(selectedRowKeys)}
              >撤销</Button>
            </>
          )}
           {/* <ExportFile */}
           {/*   name="设备类告警" */}
           {/*   url="/warehouse-service/purchase-material/export" */}
           {/*   data={exportData} */}
           {/* ><Button type="primary" icon={<DownloadOutlined />}>导出</Button> */}
           {/* </ExportFile> */}

        </Col>
      </Row>
    </Form>
  );
};

export default PurchaseList;