update for graph
This commit is contained in:
@ -24,7 +24,7 @@ import {
|
|||||||
CInputRadio,
|
CInputRadio,
|
||||||
CLabel,
|
CLabel,
|
||||||
CSelect,
|
CSelect,
|
||||||
CSwitch
|
CSwitch,
|
||||||
} from '@coreui/react'
|
} from '@coreui/react'
|
||||||
import CIcon from '@coreui/icons-react'
|
import CIcon from '@coreui/icons-react'
|
||||||
import Downloader from '../downloader';
|
import Downloader from '../downloader';
|
||||||
@ -45,6 +45,7 @@ function Index() {
|
|||||||
const [sdate, setSdate] = useState(cdate);
|
const [sdate, setSdate] = useState(cdate);
|
||||||
const [report, setReport] = useState('');
|
const [report, setReport] = useState('');
|
||||||
const [selectedcons, setSelectedCons] = useState('');
|
const [selectedcons, setSelectedCons] = useState('');
|
||||||
|
const [graph, setGraph] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
@ -66,15 +67,26 @@ function Index() {
|
|||||||
setSelectedCons(e.target.value);
|
setSelectedCons(e.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setingGraph(e){
|
||||||
|
setGraph(e.target.checked);
|
||||||
|
}
|
||||||
|
|
||||||
function doGetReport(){
|
function doGetReport(){
|
||||||
if(report == "" || selectedcons == ""){
|
if(report == "" || selectedcons == ""){
|
||||||
alert("建設とレポートの両方を選択してください");
|
alert("建設とレポートの両方を選択してください");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate;
|
var url = "";
|
||||||
console.log(selectedcons);
|
if(graph){
|
||||||
console.log(sdate);
|
url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate+"&graph=true";
|
||||||
console.log(report);
|
}
|
||||||
|
else{
|
||||||
|
url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate;
|
||||||
|
}
|
||||||
|
console.log(url);
|
||||||
|
//console.log(selectedcons);
|
||||||
|
//console.log(sdate);
|
||||||
|
//console.log(report);
|
||||||
downloadReport(url);
|
downloadReport(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +162,20 @@ function Index() {
|
|||||||
</CFormGroup>
|
</CFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
{report == 'generateMachineControl' ?
|
||||||
|
<CFormGroup variant="checkbox" className="checkbox">
|
||||||
|
<CInputCheckbox
|
||||||
|
id="checkbox1"
|
||||||
|
name="checkbox1"
|
||||||
|
checked = {graph}
|
||||||
|
value='graph'
|
||||||
|
onChange={setingGraph}
|
||||||
|
/>
|
||||||
|
<CLabel variant="checkbox" className="form-check-label" htmlFor="checkbox1">Show Graph</CLabel>
|
||||||
|
</CFormGroup>
|
||||||
|
:
|
||||||
|
("")}
|
||||||
|
|
||||||
</CForm>
|
</CForm>
|
||||||
</CCardBody>
|
</CCardBody>
|
||||||
<CCardFooter>
|
<CCardFooter>
|
||||||
|
|||||||
Reference in New Issue
Block a user