import React from "react";
import { connect } from "dva";
import {
  initFilter,
  extendRule,
  extendInclude,
  getIsPC,
  openNotificationMobile,
} from "../../../utils/common";
import {
  ChartBarShow_Vertical,
  LineShow,
} from "../../../utils/commonEcharsShow";
import { notification, Button, Descriptions } from "antd";
import echarts from "echarts";
import styles from "../HI/StepForm1.css";

const formItemLayout = {
  labelCol: { span: 6 },
  wrapperCol: { span: 14 },
};

class BI051BSCompanyYear extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: {
        titleDate: "      ",
        countPlan: "      ",
        countFinishIntTime: "    ",
        countFinishOutTime: "    ",
        countNotFinish: "    ",
        count1: 0,
        count2: 0,
        count3: 0,
        count4: 0,
        parm7: "",
        parm8: "",

        count21: 0,
        count22: 0,
        count23: 0,
        parm27: "",

        year: new Date().getFullYear(),
        company: "公司级",
      },
      listSafeCheckYear: [],
      listCheckTypeYear: [],
    };
  }

  componenthidMount() {
    if (!getIsPC()) {
      openNotificationMobile("bottomRight", notification);
      this.state.displayStr = "none";
      this.state.displayNum = 24;
      //alert('手机');
    } else {
      this.state.displayStr = "";
      this.state.displayNum = 16;
      //alert('PC');
    }
    this.loadData();

    //定时器功能，暂时不开启
    // this.timerID = setInterval(() => this.getBaseInfoData(1, this.state.tableKey, 5), 120000);
  }
  componentDidMount() {
    this.loadData();
  }
  componentWillUnmount() {
    // this.timerID && clearTimeout(this.timerID);
  }

  //加载数据赋值
  loadData = () => {
    var orgId = this.props.login ? this.props.login.OrgId : "";
    let json = initFilter(orgId);
    // this.props.dispatch({
    //   type: "app/getDataByPost",
    //   payload: json,
    //   url: "BI/BISafeYear/BISafeYearShow",
    //   onComplete: (data) => {
    //     if (data) {
    //       console.log(data);
    var data = {
      NAME: "宁化行洛坑钨矿有限公司",
      listCheckTypeYear: [
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 5,
          ALLCOUNT: 34,
          INTTIMECOUNT: 20,
          OUTTIMECOUNT: 13,
          NOTFINISHCOUN: 1,
          FINISHPERCENT: 97.06,
          ID: "23bcb111-ee16-48c4-85b6-cce1740749f0",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-09-07 14:06:46",
          MODIFY_TIME: "2023-12-06 16:49:12",
          CREATER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 6,
          ALLCOUNT: 30,
          INTTIMECOUNT: 16,
          OUTTIMECOUNT: 13,
          NOTFINISHCOUN: 1,
          FINISHPERCENT: 96.67,
          ID: "1feee87b-4113-4da4-a887-3d8ab39a0b3c",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-09-07 14:06:46",
          MODIFY_TIME: "2023-12-06 16:49:12",
          CREATER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 7,
          ALLCOUNT: 27,
          INTTIMECOUNT: 17,
          OUTTIMECOUNT: 8,
          NOTFINISHCOUN: 2,
          FINISHPERCENT: 92.59,
          ID: "1ab92899-87d8-4fb7-b337-f3586200e2cb",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-09-07 14:06:46",
          MODIFY_TIME: "2023-12-06 16:49:12",
          CREATER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 8,
          ALLCOUNT: 7,
          INTTIMECOUNT: 6,
          OUTTIMECOUNT: 1,
          NOTFINISHCOUN: 0,
          FINISHPERCENT: 100,
          ID: "9e95e8e8-ea3e-4424-811e-7f3c6afe5b04",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-09-07 14:06:46",
          MODIFY_TIME: "2023-12-06 16:49:12",
          CREATER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 9,
          ALLCOUNT: 13,
          INTTIMECOUNT: 7,
          OUTTIMECOUNT: 5,
          NOTFINISHCOUN: 1,
          FINISHPERCENT: 92.31,
          ID: "23e4bc28-f5c4-4ae6-827d-a6bd93d65928",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-09-07 14:06:46",
          MODIFY_TIME: "2023-12-31 15:54:46",
          CREATER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 10,
          ALLCOUNT: 25,
          INTTIMECOUNT: 19,
          OUTTIMECOUNT: 3,
          NOTFINISHCOUN: 3,
          FINISHPERCENT: 88,
          ID: "96974083-0e36-4023-a8c8-4db3e403f0fb",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-10-01 20:19:57",
          MODIFY_TIME: "2023-12-31 15:54:46",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 11,
          ALLCOUNT: 51,
          INTTIMECOUNT: 35,
          OUTTIMECOUNT: 6,
          NOTFINISHCOUN: 10,
          FINISHPERCENT: 80.39,
          ID: "d2714b2d-88a6-431b-8850-82c324cb0f0e",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-11-01 20:19:58",
          MODIFY_TIME: "2024-01-31 15:54:48",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2023,
          MONTH: 12,
          ALLCOUNT: 17,
          INTTIMECOUNT: 12,
          OUTTIMECOUNT: 4,
          NOTFINISHCOUN: 1,
          FINISHPERCENT: 94.12,
          ID: "c16b2d38-5ae0-4b30-98be-7b8dc7724fba",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-12-01 20:19:59",
          MODIFY_TIME: "2024-02-29 15:54:50",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2024,
          MONTH: 1,
          ALLCOUNT: 69,
          INTTIMECOUNT: 54,
          OUTTIMECOUNT: 12,
          NOTFINISHCOUN: 3,
          FINISHPERCENT: 95.65,
          ID: "5abf40f1-8e05-4950-a6bf-1fac6b211b15",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-01-01 15:54:46",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2024,
          MONTH: 2,
          ALLCOUNT: 25,
          INTTIMECOUNT: 8,
          OUTTIMECOUNT: 9,
          NOTFINISHCOUN: 8,
          FINISHPERCENT: 68,
          ID: "77108913-f421-4473-b9f6-f6ada933d619",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-02-01 15:54:47",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: null,
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          DEPARTMENT_ID: null,
          YEAR: 2024,
          MONTH: 3,
          ALLCOUNT: 3,
          INTTIMECOUNT: 0,
          OUTTIMECOUNT: 0,
          NOTFINISHCOUN: 3,
          FINISHPERCENT: 0,
          ID: "d39408aa-01e8-404c-966f-6a41bd7df357",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-03-01 15:54:50",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: null,
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
      ],
      listSafeCheckYear: [
        {
          MineType: 0,
          YEAR: 2024,
          LEVEL: 3,
          NAME: "公司级",
          ROW_NO: 0,
          COUNTJANUARY: 5,
          COUNTFEBRUARY: 5,
          COUNTMARCH: 1,
          COUNTAPRIL: 0,
          COUNTMAY: 0,
          COUNTJUNE: 0,
          COUNTJULY: 0,
          COUNTAUGUST: 0,
          COUNTSEPTEMBER: 0,
          COUNTOCTOBER: 0,
          COUNTNOVEMBER: 0,
          COUNTDECEMBER: 0,
          COUNTTOTAL: 11,
          ID: "65c79afa-7a60-48c6-8c22-dcfe823bdbaa",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-01-01 15:54:46",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          YEAR: 2024,
          LEVEL: 0,
          NAME: "部门级",
          ROW_NO: 1,
          COUNTJANUARY: 12,
          COUNTFEBRUARY: 8,
          COUNTMARCH: 8,
          COUNTAPRIL: 0,
          COUNTMAY: 0,
          COUNTJUNE: 0,
          COUNTJULY: 0,
          COUNTAUGUST: 0,
          COUNTSEPTEMBER: 0,
          COUNTOCTOBER: 0,
          COUNTNOVEMBER: 0,
          COUNTDECEMBER: 0,
          COUNTTOTAL: 28,
          ID: "f33f6aca-2708-47ba-8db5-5a9342c1739b",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-01-01 15:54:46",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          YEAR: 2024,
          LEVEL: 1,
          NAME: "车间级",
          ROW_NO: 2,
          COUNTJANUARY: 104,
          COUNTFEBRUARY: 96,
          COUNTMARCH: 24,
          COUNTAPRIL: 0,
          COUNTMAY: 0,
          COUNTJUNE: 0,
          COUNTJULY: 0,
          COUNTAUGUST: 0,
          COUNTSEPTEMBER: 0,
          COUNTOCTOBER: 0,
          COUNTNOVEMBER: 0,
          COUNTDECEMBER: 0,
          COUNTTOTAL: 224,
          ID: "f127b5a9-def9-4125-a372-4f7157a965ee",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-01-01 15:54:46",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          YEAR: 2024,
          LEVEL: 2,
          NAME: "班组级",
          ROW_NO: 3,
          COUNTJANUARY: 873,
          COUNTFEBRUARY: 639,
          COUNTMARCH: 136,
          COUNTAPRIL: 0,
          COUNTMAY: 0,
          COUNTJUNE: 0,
          COUNTJULY: 0,
          COUNTAUGUST: 0,
          COUNTSEPTEMBER: 0,
          COUNTOCTOBER: 0,
          COUNTNOVEMBER: 0,
          COUNTDECEMBER: 0,
          COUNTTOTAL: 1648,
          ID: "82963320-962a-4123-af5c-59e4f3f1138d",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-01-01 15:54:46",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          MineType: 0,
          YEAR: 0,
          LEVEL: 0,
          NAME: "合计",
          ROW_NO: 4,
          COUNTJANUARY: 994,
          COUNTFEBRUARY: 748,
          COUNTMARCH: 169,
          COUNTAPRIL: 0,
          COUNTMAY: 0,
          COUNTJUNE: 0,
          COUNTJULY: 0,
          COUNTAUGUST: 0,
          COUNTSEPTEMBER: 0,
          COUNTOCTOBER: 0,
          COUNTNOVEMBER: 0,
          COUNTDECEMBER: 0,
          COUNTTOTAL: 1911,
          ID: "4c84b169-c16d-452d-bbd1-df391c412ed3",
          IS_DELETED: false,
          ORG_ID: null,
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2024-04-24 15:10:38",
          MODIFY_TIME: "2024-04-24 15:10:38",
          CREATER_ID: null,
          MODIFIER_ID: null,
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
      ],
      listSummary: [
        {
          CODE: "BI051_BSCOMPANYYEAR",
          PART: 3,
          NUM: 1,
          TimeType: 0,
          MineType: 0,
          Parameter1: "隐患数",
          Count1: 97,
          Parameter2: "超整改数",
          Count2: 22,
          Parameter3: "按期整改数",
          Count3: 62,
          Parameter4: "整改率",
          Count4: 0,
          Count5: 0,
          Count6: 0,
          Parameter7: "86.6%",
          Count7: 0,
          Count8: 0,
          Count9: 0,
          Count10: 0,
          ID: "494021ca-236c-4669-b4c5-c6d7006ae1c8",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-04-12 09:39:50",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
        {
          CODE: "BI051_BSCOMPANYYEAR",
          PART: 1,
          NUM: 1,
          TimeType: 0,
          MineType: 0,
          Parameter1: "计划检查数",
          Count1: 1911,
          Parameter2: "按时已办",
          Count2: 1811,
          Parameter3: "超时已办",
          Count3: 0,
          Parameter4: "未完成数",
          Count4: 100,
          Parameter5: "完成率",
          Count5: 0,
          Parameter6: "及时完成率",
          Count6: 0,
          Parameter7: "94.77%",
          Count7: 0,
          Parameter8: "94.77%",
          Count8: 0,
          Count9: 0,
          Count10: 0,
          ID: "c107f8c9-d66e-4981-abdd-f1fbb34b8e0a",
          IS_DELETED: false,
          ORG_ID: "a3dce14a-13d9-d879-d9ab-821d4a3f1f93",
          ENTITY_ORG_TPYE: 0,
          FORM_ID: null,
          FLOW_STATUS: 0,
          FLOW_SEND_STATUS: 0,
          FLOW_ID: null,
          CREATE_TIME: "2023-04-12 09:39:50",
          MODIFY_TIME: "2024-03-05 15:54:51",
          CREATER_ID: null,
          MODIFIER_ID: "8f26c255-fdfd-47ff-b83e-6309815958dd",
          TaskID: "00000000-0000-0000-0000-000000000000",
        },
      ],
    };
    console.log(
      data.listSafeCheckYear[data.listSafeCheckYear.length - 1].COUNTTOTAL,
      "11"
    );
    var count1 = 0;
    var count2 = 0;
    var count3 = 0;
    var count4 = 0;
    var parm7 = "";
    var parm8 = "";

    var count21 = 0;
    var count22 = 0;
    var count23 = 0;
    var parm27 = "";

    //数量赋值
    if (data.listSummary != null && data.listSummary.length == 2) {
      data.listSummary.forEach((item) => {
        if (item.PART == 1) {
          count1 = item.Count1;
          count2 = item.Count2;
          count3 = item.Count3;
          count4 = item.Count4;
          parm7 = item.Parameter7;
          parm8 = item.Parameter8;
        } else if (item.PART == 3) {
          count21 = item.Count1;
          count22 = item.Count2;
          count23 = item.Count3;
          parm27 = item.Parameter7;
        }
      });
    }
    var year = new Date().getFullYear();
    if (data.listSafeCheckYear != null && data.listSafeCheckYear.length > 0)
      year = data.listSafeCheckYear[0].YEAR;
    var companyName =
      data.NAME == undefined || data.NAME == null ? "公司级" : data.NAME;
    this.setState({
      data: {
        count1: count1,
        count2: count2,
        count3: count3,
        count4: count4,
        parm7: parm7,
        parm8: parm8,

        count21: count21,
        count22: count22,
        count23: count23,
        parm27: parm27,

        listSafeCheckYear: data.listSafeCheckYear,
        listCheckTypeYear: data.listCheckTypeYear,
        year: year,
        company: companyName,
      },
    });
    var divchekData = [];
    var divchekData1 = [];

    data.listSafeCheckYear.forEach((item) => {
      if (item.NAME != "合计") {
        divchekData.push({ name: item.NAME, value: item.COUNTTOTAL });
        divchekData1.push(item.NAME);
      }
    });
    //   COUNTTOTAL
    var colorList = [
      "#47A2FF ",
      "#53C8D1",
      "#59CB74",
      "#FBD444",
      "#7F6AAD",
      "#585247",
    ];
    console.log(divchekData1, "divchekData1");
    console.log(divchekData, "divchekData");
    let divcheks = document.getElementById("divchek");
    if (divcheks) {
      console.log('11111111',divcheks)
      let myChart = echarts.init(divcheks);

      myChart.setOption({
        title: {
          text: "年度检查数",
          // subtext:
          //   data.listSafeCheckYear[data.listSafeCheckYear.length - 1]
          //     .COUNTTOTAL,
          subtext: 1911,
          textStyle: {
            fontSize: 14,
            color: "#999",
            lineHeight: 20,
          },
          subtextStyle: {
            fontSize: 20,
            color: "#333",
          },
          textAlign: "center",
          left: "49%",
          top: "33%",
        },
        tooltip: {
          trigger: "item",
        },
        //   toolbox: {
        //     show: true,
        //   },
        legend: {
          // type: "scroll",
          bottom: "10%",
          // top: "center",
          itemGap: 30,
          selectedMode: false,
          icon: "pin",
          // data: divchekData1,
          data: ["公司级", "部门级", "车间级", "班组级"],
          textStyle: {
            color: "#77899c",
            rich: {
              uname: {
                width: 100,
              },
              unum: {
                color: "#4ed139",
                width: 40,
                align: "right",
              },
            },
          },
        },
        color: colorList,
        series: [
          {
            name: "姓名",
            type: "pie",
            minAngle: 10,
            radius: [50, 70],
            center: ["50%", "40%"],
            clockwise: true,
            avoidLabelOverlap: true,
            hoverOffset: 15,
            itemStyle: {
              borderWidth: 3,
              borderColor: "#fff",
              alignItems: "center",
            },
            label: {
              show: true,
              position: "outside",
              formatter: (params) => {
                return (
                  "{name|" + params.name + "}\n{value|" + params.value + "}"
                );
              },
              rich: {
                hr: {
                  backgroundColor: "t",
                  borderRadius: 3,
                  width: 3,
                  height: 3,
                  padding: [3, 3, 0, -12],
                },
                a: {
                  padding: [-30, 15, -20, 15],
                },
              },
            },
            labelLine: {
              normal: {
                length: 20,
                length2: 30,
                lineStyle: {
                  width: 1,
                },
              },
            },
            // data: divchekData,
            data: [
              {
                name: "公司级",
                value: 11,
              },
              {
                name: "部门级",
                value: 28,
              },
              {
                name: "车间级",
                value: 224,
              },
              {
                name: "班组级",
                value: 1648,
              },
            ],
          },
        ],
      });
    }

    //   ChartBarShow_Vertical(
    //     echarts,
    //     "divRisk",
    //     data.listCheckTypeYear,
    //     "安全检查隐患整改统计图（近12个月）"
    //   );
    var xAxisData = [];
    var yAxisData1 = [];
    var yAxisData2 = [];
    var yAxisData3 = [];

    data.listCheckTypeYear.forEach((item) => {
      xAxisData.push(item.YEAR + "-" + item.MONTH);
      yAxisData1.push(item.INTTIMECOUNT);
      yAxisData2.push(item.OUTTIMECOUNT);
      yAxisData3.push(item.NOTFINISHCOUN);
    });
    let divRisks = document.getElementById("divRisk");
    if (divRisks) {
      let myChart = echarts.init(divRisks);

      myChart.setOption({
        color: ["#67afee", "#e67f82", "#858FAC"],
        title: {
          text: "安全检查隐患整改统计图（近12个月）",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
        },
        grid: {
          left: "7%",
          // right: "10%",
          bottom: 0,
          top: "25%",
          containLabel: true,
          z: 22,
        },
        xAxis: {
          type: "category",
          data: xAxisData,
          axisLabel: {
            show: true,
            color: "rgb(170,170,170)",
            interval: 0,
            textStyle: {
              lineHeight: 14,
            },
          },
        },
        legend: {
          data: ["按期整改", "延期整改", "未完成"],
          left: "center",
          align: "left",
          top: "10%",
          textStyle: {
            color: "#000",
          },
          itemWidth: 10,
          itemHeight: 10,
          itemGap: 35,
        },
        yAxis: {
          type: "value",
          splitLine: {
            show: true,
            lineStyle: {
              color: ["#f2f2f2"],
            },
          },
          axisLabel: {
            color: "rgb(170,170,170)",
            formatter: "{value} ",
          },
        },
        series: [
          {
            name: "按期整改",
            type: "bar",
            stack: "总量",
            data: yAxisData1,
            barWidth: "18px",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            //   barMinHeight: 2,
          },
          {
            name: "延期整改",
            type: "bar",
            stack: "总量",
            data: yAxisData2,
            barWidth: "18px",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            //   barMinHeight: 2,
          },
          {
            name: "未完成",
            type: "bar",
            stack: "总量",
            data: yAxisData3,
            barWidth: "18px",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            //   barMinHeight: 2,
          },
        ],
      });
    }

    var dataXAxis = [];
    var dataSeries = [];
    if (
      data.listCheckTypeYear != null &&
      data.listCheckTypeYear != undefined &&
      data.listCheckTypeYear.length > 0
    ) {
      data.listCheckTypeYear.forEach((item) => {
        dataXAxis.push(item.YEAR + "-" + item.MONTH);
        dataSeries.push(item.FINISHPERCENT);
      });
    }
    let divRiskPercents = document.getElementById("divRiskPercent");
    if (divRiskPercents) {
      let myChart = echarts.init(divRiskPercents);
      myChart.setOption({
        title: {
          text: "安全检查隐患整改率（近12个月）",
          left: "center",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["隐患整改率"],
          left: "center",
          align: "left",
          top: "10%",
        },
        grid: {
          containLabel: true,
          left: "7%",
          // right: "10%",
          bottom: 0,
          top: "25%",
        },
        //   toolbox: {
        //     feature: {
        //       saveAsImage: {},
        //     },
        //   },
        xAxis: {
          type: "category",
          boundaryGap: false, //坐标轴两边留白
          data: dataXAxis,
          axisLabel: {
            //坐标轴刻度标签的相关设置。
            interval: 0, //设置为 1，表示『隔一个标签显示一个标签』
            //	margin:15,
            textStyle: {
              color: "#1B253A",
              fontStyle: "normal",
              fontFamily: "微软雅黑",
              fontSize: 12,
            },

            //rotate:50,
          },
          axisTick: {
            //坐标轴刻度相关设置。
            show: false,
          },
          axisLine: {
            //坐标轴轴线相关设置
            lineStyle: {
              color: "#E5E9ED",
              // opacity:0.2
            },
          },
          splitLine: {
            //坐标轴在 grid 区域中的分隔线。
            show: true,
            lineStyle: {
              color: "#E5E9ED",
              // 	opacity:0.1
            },
          },
        },
        yAxis: [
          {
            type: "value",
            splitNumber: 5,
            axisLabel: {
              textStyle: {
                color: "#a8aab0",
                fontStyle: "normal",
                fontFamily: "微软雅黑",
                fontSize: 12,
              },
            },
            axisLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: "#E5E9ED",
                // 	opacity:0.1
              },
            },
          },
        ],
        series: [
          {
            name: "隐患整改率",
            type: "line",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#3A84FF",
                lineStyle: {
                  color: "#3A84FF",
                  width: 1,
                },
                areaStyle: {
                  color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                    {
                      offset: 0,
                      color: "rgba(58,132,255,0)",
                    },
                    {
                      offset: 1,
                      color: "rgba(58,132,255,0.35)",
                    },
                  ]),
                },
              },
            },
            data: dataSeries,
          },
        ],
      });
    }

    //   LineShow(
    //     echarts,
    //     "divRiskPercent",
    //     "安全检查隐患整改率（近12个月）",
    //     dataXAxis,
    //     dataSeries
    //   );
    //     }
    //   },
    // });
  };

  // 搜索
  handleSearch = (item) => {
    this.getBaseInfoData(1, item, null);
  };

  closeModal = () => {
    this.setState({
      searchVisible: false,
      searchTodayVisible: false,
    });
  };

  // ChartBarShow_Vertical(echarts, divId, data, title) {
  //   var element = document.getElementById(divId)
  //   if (element != undefined && data != null && data.length > 0) {
  //     var myChart = echarts.init(element);
  //     var series = []
  //     var xAxisData = []
  //     var yAxisData1 = []
  //     var yAxisData2 = []
  //     var yAxisData3 = []

  //     data.forEach((item) => {
  //       xAxisData.push(item.YEAR + "-" + item.MONTH)
  //       yAxisData1.push(item.INTTIMECOUNT)
  //       yAxisData2.push(item.OUTTIMECOUNT)
  //       yAxisData3.push(item.NOTFINISHCOUN)
  //     })

  //     var option = {
  //       title: {
  //         text: title,
  //         left: 'center'
  //       },
  //       tooltip: {
  //         trigger: 'axis',
  //         axisPointer: {
  //           type: 'shadow'
  //         }
  //       },
  //       legend: {
  //         bottom: '0px'
  //       },
  //       grid: {
  //         left: '3%',
  //         right: '4%',
  //         bottom: '10%',
  //         containLabel: true
  //       },
  //       xAxis: {
  //         type: 'category',
  //         data: xAxisData
  //       },
  //       yAxis: {
  //         type: 'value'
  //       },
  //       series: [
  //         {
  //           name: '按期整改',
  //           type: 'bar',
  //           stack: 'total',
  //           label: {
  //             show: true
  //           },
  //           emphasis: {
  //             focus: 'series'
  //           },
  //           data: yAxisData1
  //         },
  //         {
  //           name: '延期整改',
  //           type: 'bar',
  //           stack: 'total',
  //           label: {
  //             show: true
  //           },
  //           emphasis: {
  //             focus: 'series'
  //           },
  //           data: yAxisData2
  //         },
  //         {
  //           name: '未完成',
  //           type: 'bar',
  //           stack: 'total',
  //           label: {
  //             show: true
  //           },
  //           emphasis: {
  //             focus: 'series'
  //           },
  //           data: yAxisData3
  //         }
  //       ]
  //     };
  //     // 使用刚指定的配置项和数据显示图表。
  //     myChart.setOption(option);
  //   }
  // }

  // LineShow(echarts, divId, title, dataXAxis, dataSeries) {

  //   var chartDom = document.getElementById(divId);
  //   if (chartDom != null && chartDom != undefined) {
  //     var myChart = echarts.init(chartDom);
  //     var option;
  //     option = {
  //       title: {
  //         text: title,
  //         left: 'center'
  //       },
  //       label: {
  //         show: true,
  //         position: 'top'
  //       },
  //       xAxis: {
  //         type: 'category',
  //         data: dataXAxis
  //       },
  //       yAxis: {
  //         type: 'value'
  //       },
  //       series: [
  //         {
  //           data: dataSeries,
  //           type: 'line'
  //         }
  //       ]
  //     };

  //     option && myChart.setOption(option);
  //   }
  // }

  render() {
    const { data } = this.state;
    return (
      <div
        style={{
          backgroundColor: "white",
          width: "1200px",
          top: "0",
          bottom: "0",
          left: "0",
          right: "0",
          margin: "auto",
          borderStyle: "solid",
          borderColor: "#ccc",
          borderWidth: "1px",
        }}
      >
        <div className={styles.routeHome}>
          <h1 className={styles.showPrintHead}>
            {" "}
            {data.company} {data.year}年度安全检查情况综合统计分析
          </h1>{" "}
          {/* {this.props?.login?.currActivatedMenu?.MENU_FORM_PARAMS == "30" ? "矿山部" : "选矿部"}  */}
          {/* <h3 style={{ textAlign: 'center' }}>({data.titleDate})</h3> */}
          <div
            style={{
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              //   marginBottom: "20px",
            }}
          >
            <div className={styles.menuPie}>
              <li>
                计划检查数
                <br />
                <div className={styles.dataStyle}>{data.count1}</div>
              </li>
              <li>
                按时已办
                <br />
                <div className={styles.dataStyle1}>{data.count2}</div>
              </li>
              <li>
                超时已办
                <br />
                <div className={styles.dataStyle2}>{data.count3}</div>
              </li>
              <li>
                未完成数
                <br />
                <div className={styles.dataStyle3}>{data.count4}</div>
                {/* <a href="#" style={{ color: "red" }}> */}
                {/* </a> */}
              </li>
              <li>
                完成率
                <br />
                <div className={styles.dataStyle4}>{data.parm7}</div>
                {/* <a href="#" style={{ color: "red" }}> */}
                {/* </a> */}
              </li>
              <li>
                及时完成率
                <br />
                <div className={styles.dataStyle5}>{data.parm8}</div>
              </li>
            </div>
          </div>
          {/* <hr /> */}
          {/* 表一 */}
          <div
            style={{
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              //   marginBottom: "20px",
              // margin:'0px 20px 20px 20px'
            }}
          >
            <div
              style={{
                display: "flex",
                alignItems: "center",
                justifyContent: "center",
                //   marginBottom: "20px",
                width: "1100px",
                flexDirection: "row",
                //   margin:'0px 20px 20px 20px'
              }}
            >
              <div
                style={{
                  display: "flex",
                  alignItems: "center",
                  justifyContent: "center",
                  // margin:'0px 15px',
                  width: "40%",
                  height: "100%",
                }}
              >
                {/* {data?.listSafeCheckYear ? (
                  <div
                    id="divchek"
                    style={{
                      width: "500px",
                      height: "425px",
                      //   float: "left",
                      //    marginTop: "20px",
                      display: "flex",
                      justifyContent: "center",
                    }}
                  ></div>
                ) : (
                  <ul className={styles.menuPie2}>
                    <li>公司级</li>
                    <li>部门级</li>
                    <li>车间级</li>
                    <li>班组级</li>
                  </ul>
                )} */}
                 <div
                    id="divchek"
                    style={{
                      width: "500px",
                      height: "425px",
                      //   float: "left",
                      //    marginTop: "20px",
                      display: "flex",
                      justifyContent: "center",
                    }}
                  ></div>
              </div>

              <div
                style={{
                  display: "flex",
                  alignItems: "center",
                  justifyContent: "center",
                  width: "60%",
                }}
              >
                <table className={styles.tableRow}>
                  <tbody>
                    <tr>
                      <th>序号</th>
                      <th>检查层级</th>
                      <th>1月</th>
                      <th>2月</th>
                      <th>3月</th>
                      <th>4月</th>
                      <th>5月</th>
                      <th>6月</th>
                      <th>7月</th>
                      <th>8月</th>
                      <th>9月</th>
                      <th>10月</th>
                      <th>11月</th>
                      <th>12月</th>
                      <th>合计</th>
                    </tr>
                    {data?.listSafeCheckYear ? (
                      data.listSafeCheckYear.map((item, i) => {
                        if (item.NAME == "合计") {
                          return (
                            <tr>
                              <td colSpan={2}>{item.NAME}</td>
                              <td>
                                {item.COUNTJANUARY == 0
                                  ? ""
                                  : item.COUNTJANUARY}
                              </td>
                              <td>
                                {item.COUNTFEBRUARY == 0
                                  ? ""
                                  : item.COUNTFEBRUARY}
                              </td>
                              <td>
                                {item.COUNTMARCH == 0 ? "" : item.COUNTMARCH}
                              </td>
                              <td>
                                {item.COUNTAPRIL == 0 ? "" : item.COUNTAPRIL}
                              </td>
                              <td>{item.COUNTMAY == 0 ? "" : item.COUNTMAY}</td>
                              <td>
                                {item.COUNTJUNE == 0 ? "" : item.COUNTJUNE}
                              </td>
                              <td>
                                {item.COUNTJULY == 0 ? "" : item.COUNTJULY}
                              </td>
                              <td>
                                {item.COUNTAUGUST == 0 ? "" : item.COUNTAUGUST}
                              </td>
                              <td>
                                {item.COUNTSEPTEMBER == 0
                                  ? ""
                                  : item.COUNTSEPTEMBER}
                              </td>
                              <td>
                                {item.COUNTOCTOBER == 0
                                  ? ""
                                  : item.COUNTOCTOBER}
                              </td>
                              <td>
                                {item.COUNTNOVEMBER == 0
                                  ? ""
                                  : item.COUNTNOVEMBER}
                              </td>
                              <td>
                                {item.COUNTDECEMBER == 0
                                  ? ""
                                  : item.COUNTDECEMBER}
                              </td>
                              <td>
                                {item.COUNTTOTAL == 0 ? "" : item.COUNTTOTAL}
                              </td>
                            </tr>
                          );
                        } else {
                          return (
                            <tr>
                              <td>{item.ROW_NO + 1}</td>
                              <td>{item.NAME}</td>
                              <td>{item.COUNTJANUARY}</td>
                              <td>{item.COUNTFEBRUARY}</td>
                              <td>{item.COUNTMARCH}</td>
                              <td>{item.COUNTAPRIL}</td>
                              <td>{item.COUNTMAY}</td>
                              <td>{item.COUNTJUNE}</td>
                              <td>{item.COUNTJULY}</td>
                              <td>{item.COUNTAUGUST}</td>
                              <td>{item.COUNTSEPTEMBER}</td>
                              <td>{item.COUNTOCTOBER}</td>
                              <td>{item.COUNTNOVEMBER}</td>
                              <td>{item.COUNTDECEMBER}</td>
                              <td>{item.COUNTTOTAL}</td>
                            </tr>
                          );
                        }
                      })
                    ) : (
                      <tr>
                        <td colSpan={15}>数据加载中...</td>
                      </tr>
                    )}
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          {/* 表一 */}
          <div>
            <div
              style={{
                width: "100%",
                // height: "90px",

                marginTop: "15px",
                display: "flex",
                flexDirection: "column",
                marginBottom: "40px",
                justifyContent: "center",
                alignItems: "center",
              }}
            >
              {" "}
              {/*  */}
              <div
                style={{
                  height: "2px",
                  width: "100%",
                  border: "1px dashed rgba(0, 0, 0, 0.65)",
                }}
              ></div>
              <div
                style={{
                  margin: "40px 20px 0px 20px",
                  display: "flex",
                  alignItems: "center",
                  justifyContent: "center",
                }}
              >
                <ul className={styles.menuPie}>
                  <li>
                    隐患数
                    <br />
                    <div className={styles.dataStyle}>{data.count21}</div>
                  </li>
                  <li>
                    延期整改数
                    <br />
                    <div className={styles.dataStyle}>{data.count22}</div>
                  </li>
                  <li>
                    按期整改数
                    <br />
                    <div className={styles.dataStyle}>{data.count23}</div>
                  </li>
                  <li>
                    整改率
                    <br />
                    <div className={styles.dataStyle}>{data.parm27}</div>
                  </li>
                </ul>
              </div>
              <div
                style={{
                  width: "1100px",
                  height: "500px",
                  //   float: "left",
                  marginTop: "20px",
                  display: "flex",
                  justifyContent: "center",
                  alignItems: "center",
                  border: "1px solid #E8E8E8",
                  marginBottom: "40px",
                }}
              >
                <div
                  id="divRisk"
                  style={{
                    width: "100%",
                    height: "400px",
                    //   float: "left",
                    marginTop: "20px",
                    display: "flex",
                    justifyContent: "center",
                  }}
                ></div>
              </div>
              <div
                style={{
                  width: "1100px",
                  height: "500px",
                  //   float: "left",
                  marginTop: "20px",
                  display: "flex",
                  justifyContent: "center",
                  alignItems: "center",
                  border: "1px solid #E8E8E8",
                  marginBottom: "40px",
                }}
              >
                <div
                  id="divRiskPercent"
                  style={{
                    width: "100%",
                    height: "400px",
                    //   float: "left",
                    marginTop: "20px",
                  }}
                ></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}
export default connect(({ login, app }) => ({ login, app }))(
  BI051BSCompanyYear
);
