import { Layout, Image, Col, Row } from 'antd'; import 'antd/dist/reset.css'; import './App.css'; import axios from 'axios'; import { Component } from 'react'; import { withRouter } from 'react-router-dom'; import TweenOne from 'rc-tween-one'; import PathPlugin from 'rc-tween-one/lib/plugin/PathMotionPlugin'; const { Header, Footer, Content } = Layout; TweenOne.plugins.push(PathPlugin); const headerStyle = { textAlign: 'center', color: '#fff', height: "5vh", paddingInline: 50, backgroundColor: 'rgb(49, 70, 89)', }; const contentStyle = { textAlign: 'center', minHeight: "90vh", backgroundColor: 'black', }; const footerStyle = { textAlign: 'center', color: '#fff', backgroundColor: 'rgb(49, 70, 89)', fontSize: '2vw' }; const empStyle = { lineHeight: '5vh', color: 'black', marginTop: "2px", fontFamily: "Yahei", textAlign: 'center', fontSize: '2vw' } const item = { employee_no: "M00001", name: "測試人員一", mfg_no: "電梯ID", fire: { colname: "火災", icon: "#", desc: "動作後取消呼梯指令,返基站開門停機" }, screen: { colname: "光幕", icon: "#", desc: "光束被遮斷時,重新開門" }, special_use: { colname: "專用", icon: "#", desc: "VIP模式,隻響應轎內指令" }, open_lengthen: { colname: "開延長", icon: "#", desc: "延長電梯的開門保持時間" }, fully_loaded: { colname: "滿載行駛", icon: "#", desc: "滿載時沿途層站不停靠" }, returning: { colname: "再平層", icon: "#", desc: "載重變化時,自動識別並重新拉平層" }, customer: "客戶名稱", spec: "規格", type: "機種", running: "運轉方式", panel_battery: 'PANEL 動力電源', panel_no: "PANEL編碼", motor: "馬達規格", door: "門機型號", hoisting_machine: "曳引機", electrocircuit: "電路型號", opb: "OPD", ind: "IND" }; class Board extends Component { constructor(props) { super(props); //四個看闆資料 this.state = { win1: item, win2: item, win3: item, win4: item, moment: null, paused: false, reverse: false, seq: 1, start: 0, //從數據庫第0條開始讀 total_record: 0 }; } componentDidMount() { const id = this.props.match; this.setState({ seq: id.params.seq }); this.interval(); } interval = () => { setInterval(() => this.fetchKabanData(), 20000); }; //每次取四條記錄, fetchKabanData = async () => { const { seq, start } = this.state; let data = await axios.get(`https://www.masada.com.tw/kanban_api/index.php?kind=cc&seq=${seq}&start=${start}`) .then(function (response) { return { start: response.data[0], win1: response.data[1], win2: response.data[2], win3: response.data[3], win4: response.data[4], paused: false, reverse: false, moment: 0, } }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed }); this.setState(data, () => { this.setState({ moment: null, }); }); } render() { let { win1, win2, paused, reverse, moment } = { ...this.state }; let items = [win1, win2]; return (