From 610976464e74720b6ed24e1df9202aadf64f774d Mon Sep 17 00:00:00 2001 From: nouffer Date: Mon, 19 Jul 2021 11:29:05 +0530 Subject: [PATCH] update for graph --- src/views/BoxDisplacemen/index.js | 36 ++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/views/BoxDisplacemen/index.js b/src/views/BoxDisplacemen/index.js index 2354b98..4f4b017 100644 --- a/src/views/BoxDisplacemen/index.js +++ b/src/views/BoxDisplacemen/index.js @@ -24,7 +24,7 @@ import { CInputRadio, CLabel, CSelect, - CSwitch + CSwitch, } from '@coreui/react' import CIcon from '@coreui/icons-react' import Downloader from '../downloader'; @@ -45,6 +45,7 @@ function Index() { const [sdate, setSdate] = useState(cdate); const [report, setReport] = useState(''); const [selectedcons, setSelectedCons] = useState(''); + const [graph, setGraph] = useState(false); useEffect(() => { async function fetchData() { @@ -66,15 +67,26 @@ function Index() { setSelectedCons(e.target.value); } + function setingGraph(e){ + setGraph(e.target.checked); + } + function doGetReport(){ if(report == "" || selectedcons == ""){ alert("建設とレポートの両方を選択してください"); return; } - var url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate; - console.log(selectedcons); - console.log(sdate); - console.log(report); + var url = ""; + if(graph){ + url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate+"&graph=true"; + } + else{ + url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate; + } + console.log(url); + //console.log(selectedcons); + //console.log(sdate); + //console.log(report); downloadReport(url); } @@ -150,6 +162,20 @@ function Index() { + {report == 'generateMachineControl' ? + + + Show Graph + + : + ("")} +