|  |  |  | 
|---|
|  |  |  | const LocCharts = () => { | 
|---|
|  |  |  | const [trafficWay, setTrafficWay] = useState([ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: 'HG', | 
|---|
|  |  |  | name: '空闲', | 
|---|
|  |  |  | value: 20, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: 'RG', | 
|---|
|  |  |  | name: '在库', | 
|---|
|  |  |  | value: 10, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: 'MG', | 
|---|
|  |  |  | name: '入库', | 
|---|
|  |  |  | value: 20, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: 'FM', | 
|---|
|  |  |  | name: '出库', | 
|---|
|  |  |  | value: 10, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: 'PG', | 
|---|
|  |  |  | name: '禁用', | 
|---|
|  |  |  | value: 30, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | name: '其他', | 
|---|
|  |  |  | value: 30, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]); | 
|---|
|  |  |  | 
|---|
|  |  |  | useEffect(() => { | 
|---|
|  |  |  | const timer = setInterval(() => { | 
|---|
|  |  |  | getLocCharts().then(res => { | 
|---|
|  |  |  | // setApiData(res.reverse().map(item => { | 
|---|
|  |  |  | //   return ["AGV" + item.agvNo, "0000" + Number(item.qrcode), item.angle.toFixed(1) + "°", item.height] | 
|---|
|  |  |  | // })) | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | setTrafficWay(res.map(item => { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | name: item.name.substr(0, 2), | 
|---|
|  |  |  | value: item.count | 
|---|
|  |  |  | } | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, 3000); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | clearInterval(timer); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, []); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const data = []; | 
|---|
|  |  |  | const color = ['#00ffff', '#00cfff', '#006ced', '#ffe000', '#ffa800', '#ff5b00']; | 
|---|
|  |  |  | 
|---|
|  |  |  | itemWidth: 8, | 
|---|
|  |  |  | orient: 'horizontal', | 
|---|
|  |  |  | // x: 'left', | 
|---|
|  |  |  | data: ['HG', 'RG', 'MG', 'FM', 'PG'], | 
|---|
|  |  |  | data: ['空闲', '在库', '入库', '出库', '禁用', '其他'], | 
|---|
|  |  |  | left: 10, | 
|---|
|  |  |  | bottom: 20, | 
|---|
|  |  |  | align: 'left', | 
|---|