// material-ui import { Button, CardContent, Grid, TextField, Typography, Autocomplete, } from '@mui/material'; import MainCard from "components/MainCard"; import { useForm } from "react-hook-form"; import { useState } from "react"; import * as React from "react"; import * as UrlUtils from "utils/ApiPathConst"; import * as HttpUtils from "utils/HttpUtils"; import * as ComboData from "utils/ComboData"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const OrganizationSearchForm = ({ applySearch }) => { const [type, setType] = useState([]); const [creditorSelected, setCreditorSelected] = React.useState({ key: 0, labelCht: '全部', label: 'All', type: 'all' }); const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { let typeArray = []; for (let i = 0; i < type.length; i++) { typeArray.push(type[i].label); } const temp = { brNo: data.brNo, enCompanyName: data.enCompanyName, chCompanyName: data.chCompanyName, }; if(creditorSelected.type == 'true'){ temp["creditor"] = true; }else if(creditorSelected.type == 'false'){ temp["creditor"] = false; } applySearch(temp); }; function resetForm() { setType([]); reset(); } const doExport=()=>{ HttpUtils.fileDownload({ url: UrlUtils.GET_ORG_EXPORT }); } return (
{/*row 1*/} Search Form {/*row 2*/} { setCreditorSelected(newValue); }} getOptionLabel={(option) => option.label} renderInput={(params) => ( )} /> {/*last row*/}
); }; export default OrganizationSearchForm;