50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
|
|
import React, { useEffect, useState, useMemo } from 'react';
|
||
|
|
import { Descriptions, Form, Button, Input, DatePicker } from 'antd';
|
||
|
|
import {CloseOutlined} from '@ant-design/icons';
|
||
|
|
import ReactEcharts from 'echarts-for-react';
|
||
|
|
import { httppost2 } from '../../../utils/request';
|
||
|
|
import apiurl from '../../../service/apiurl';
|
||
|
|
import moment from "moment"
|
||
|
|
import drpOption from './drpOption';
|
||
|
|
|
||
|
|
const Page = ({data}) => {
|
||
|
|
const [ tableData, setTableData ] = useState([])
|
||
|
|
const option = useMemo(() => drpOption(tableData), [tableData])
|
||
|
|
|
||
|
|
const getData = async(resCode)=>{
|
||
|
|
const { code, data} = await httppost2(apiurl.fxdd_xyt.fhxs.getSk,{resCode:resCode})
|
||
|
|
if(code!==200){
|
||
|
|
return
|
||
|
|
}
|
||
|
|
setTableData(
|
||
|
|
data.list
|
||
|
|
// [
|
||
|
|
// { name1:'name1',tm:'2021-01-01',ll:100,sl:120*0.2 },
|
||
|
|
// { name1:'name1',tm:'2021-01-02',ll:110,sl:110*0.2 },
|
||
|
|
// { name1:'name1',tm:'2021-01-03',ll:120,sl:100*0.2 },
|
||
|
|
// { name1:'name1',tm:'2021-01-04',ll:110,sl:130*0.2 },
|
||
|
|
// { name1:'name1',tm:'2021-01-05',ll:130,sl:110*0.2 },
|
||
|
|
// { name1:'name1',tm:'2021-01-06',ll:110,sl:110*0.2 },
|
||
|
|
// ]
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
useEffect(()=>{
|
||
|
|
if(data.resCode){
|
||
|
|
getData(data.resCode)
|
||
|
|
}
|
||
|
|
},[data])
|
||
|
|
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
{
|
||
|
|
tableData.length>0?
|
||
|
|
<ReactEcharts option={option} style={{width: "100%", height: '300px'}}/>
|
||
|
|
:<div style={{textAlign: "center", margin: "10%"}}><img src={`${process.env.PUBLIC_URL}/assets/noData.png`} alt=""/></div>
|
||
|
|
}
|
||
|
|
</>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
export default Page;
|