ActiveMenuComponent2.0.js 2.0 KB
Newer Older
1
import React, { useEffect, useState } from "react";
2 3 4 5 6 7 8
import CheckRecord2 from "@/webPublic/FormInsertDiy/AffairPage/IframeFor2.0"; // 2.0的 查询类 应用 直接iframe 嵌入
import Apply from "@/webPublic/FormInsertDiy/AffairPage/ApplyPage"; // 申请
import BatchAudit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit"; // 批量审批
import Audit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js"; // 审批
import Detail from "@/webPublic/FormInsertDiy/AffairPage/Detail"; //详情
import { getToken } from "@/utils/authority";
import config from "@/config/config";
钟是志's avatar
钟是志 committed
9

10 11 12 13 14
export default function ActiveMenuComponent2({
                                               routerConfig,
                                               ...otherProps
                                             }) {
  const { component = "", appId } = routerConfig;
15 16 17 18 19
  const [show, setShow] = useState(true);
  useEffect(() => {
    if(appId){
      setShow(false);
      setTimeout(() => {
20

21 22 23 24 25 26 27 28
        setShow(true);
      }, 1000);
    }
  }, [appId]);

  if(!show){
    return null;
  }
29 30 31

  switch (component) {
    case "CheckRecord": // 查询类应用
32
      console.log(appId);
33 34 35 36
      return <CheckRecord2 workId={appId} {...otherProps} />;
    case "Apply": // 申请类
      return <Apply
        iframeUrlDiy={config.gateWayPort + `/portal/#/showApplyIframe?id=${appId}&hasSingle=false&token=${getToken()}`}
钟是志's avatar
钟是志 committed
37
        // http://localhost:8022/portal/#/showApplyIframe?id=1557980082801213440&hasSingle=false&token=6c994ce4-e9a0-47ff-9223-21877d116265
38 39 40 41 42 43 44 45 46
        iframeHeight={200}
        workId={appId}
        {...otherProps}
      />;
    case "Audit": // 审批类
      return <Audit
        workId={appId}
        {...otherProps} />;
    case "BatchAudit": // 批量审批
钟是志's avatar
钟是志 committed
47
      return <BatchAudit
48 49 50 51 52 53 54 55 56 57 58 59 60
        workId={appId}
        {...otherProps} />;
    case "Detail": // 详情
      return <Detail
        from={routerConfig?.from}
        {...otherProps}
      />;
    default:
      console.log(component, "没有找到此组件");
      return <div>暂无此功能</div>;
  }

}