import React, { useEffect, useReducer, useRef } from "react"; import { Button, Drawer, Steps, Form, Popconfirm, Switch, Tabs, Tooltip, Row, Col, message, Card, } from "antd"; import AutoTable from "@/components/AutoTable"; import getPrem from "@/utils/getPrem"; //权限判断fn import InitForm from "@/components/InitForm"; import { useRequest, useModel } from "umi"; import { useInterval } from "ahooks"; import moment from "moment"; import Coltext from "@/components/Coltext"; const topleft = { collectionSitName: "采集站点", workingProcedureName: "工序名称", }, middleright = { jobOrderNo: "派工单编号", scheduledProductionNum: "排产数量", materieCode: "物料编号", qualifiedNum: "合格数量", productionOrderNo: "生产订单编号", noQualifiedNum: "不合格数量", f1: "当前SN号/批次号", f2: "上线数量", current: "当前工序", status: "当前状态", }; const initState = { topleftData: {}, time: moment().format("YYYY-MM-DD HH:mm:ss"), snorbatch: "", middlerightData: {}, timepage: moment().format("YYYY-MM-DD HH:mm:ss"), }; function reducer(state, action) { let { type } = action, newState = {}; switch (type) { case "changeTopleft": newState = { ...state, topleftData: { ...action.topleftData }, }; break; case "changeTopright": newState = { ...state, topRightData: { ...action.topRightData }, }; break; case "changeTime": newState = { ...state, time: action.time, }; break; case "close": newState = { topleftData: {}, user: "", time: moment().format("YYYY-MM-DD HH:mm:ss"), snorbatch: "", middlerightData: {}, }; break; } return newState; } const Gatherprocess = (props) => { const { initialState: { currentUser }, setInitialState, } = useModel("@@initialState"); const [state, dispatch] = useReducer(reducer, initState), { topleftData, time, snorbatch, middlerightData, timepage } = state; useInterval(() => { dispatch({ type: "changeTime", time: moment().add(1, "seconds").format("YYYY-MM-DD HH:mm:ss"), }); }, 1000); return (
{Object.keys(topleft).map((item) => { return ( ); })}
当前时间:{time}
当前采集人:{currentUser.userName}
); }; export default Gatherprocess;