From 2060805561eccdb666b43c88d649cf4fb410cd6a Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Fri, 6 Sep 2024 15:01:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E3=80=81=E5=BC=B9=E7=AA=97=20=E4=BF=A1=E6=81=AF=20=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomPages/BI/BI054HomeDetail.js | 119 ++- .../CustomPages/BI/BI055HomeDetail.js | 880 +++++------------- src/routes/Home.js | 586 +++++++++--- 3 files changed, 767 insertions(+), 818 deletions(-) diff --git a/src/components/CustomPages/BI/BI054HomeDetail.js b/src/components/CustomPages/BI/BI054HomeDetail.js index 76f25ad..6792614 100644 --- a/src/components/CustomPages/BI/BI054HomeDetail.js +++ b/src/components/CustomPages/BI/BI054HomeDetail.js @@ -55,15 +55,15 @@ class BI054HomeDetail extends React.Component { // this.timerID = setInterval(() => this.getBaseInfoData(1, this.state.tableKey, 5), 120000); } componentDidMount() { - // this.loadData() + this.loadData() this.hiddenDangerTotal(); - this.loadReal(); + // this.loadReal(); } componentWillUnmount() { // this.timerID && clearTimeout(this.timerID); } - renderSpeedColumn = ()=>{ - return { className: 'redTableCell'} + renderSpeedColumn = () => { + return { className: 'redTableCell' } } loadReal = () => { let result = { @@ -119,7 +119,7 @@ class BI054HomeDetail extends React.Component { }, Percent: 0, RowCount: 1, - listCount: [0, 349, 0, 0], + listCount: [0, 349, 0, 0], listName: [ "巡回检查", "例行检查", @@ -138,7 +138,7 @@ class BI054HomeDetail extends React.Component { }, Percent: 0, RowCount: 1, - listCount: [0, 349, 0, 0], + listCount: [0, 349, 0, 0], listName: [ "巡回检查", "例行检查", @@ -178,7 +178,7 @@ class BI054HomeDetail extends React.Component { }, Percent: 0, RowCount: 1, - listCount:[0, 0, 0, 0], + listCount: [0, 0, 0, 0], listName: [ "巡回检查", "例行检查", @@ -291,7 +291,7 @@ class BI054HomeDetail extends React.Component { "综合检查", ], }, - + ], ListSafeCheckYearMonth: [], }; @@ -574,42 +574,33 @@ class BI054HomeDetail extends React.Component { }; hiddenDangerTotal = () => { - + + if (this.state.data.ListSafeCheckYearMonth && this.state.data.ListSafeCheckYearMonth.length > 0) { + let data = this.state.data.ListSafeCheckYearMonth; let xData = []; - let data3 = [ - [17, 20, 16, 20, 16, 16, 20, 16, 16, 20, 16, 12], - [317, 330, 316, 330, 292, 286, 299, 286, 295, 299, 223, 201], - [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - ]; - for (let i = 0; i < 12; i++) { - xData.unshift(getSixMonth(-i, "-", "")); + let data1 = []; + let data2 = []; + let data3 = []; + let seriesName = []; + data.map((item) => { + if (item.MONTH > 9) { + xData.push(item.YEAR + '-' + item.MONTH); + } else { + xData.push(item.YEAR + '-0' + item.MONTH); + } + seriesName = item.listSOURCENAME; + data1.push(item.listListCount); + }); + for (var i = 0; i < data[0].listListCount.length; i++) { + for (var j = 0; j < data.length; j++) { + data2.push(data1[j][i]); + } } - let seriesName = [ - "巡回检查", - "例行检查", - "专业检查", - "综合检查", - ]; - // data.map((item) => { - // if (item.MONTH>9){ - // xData.push(item.YEAR+'-'+ item.MONTH); - // }else{ - // xData.push(item.YEAR+'-0'+ item.MONTH); - // } - // seriesName = item.listSOURCENAME; - // data1.push(item.listListCount); - // }); - // for (var i = 0; i < data[0].listListCount.length; i++) { - // for (var j = 0; j < data.length; j++) { - // data2.push(data1[j][i]); - // } - // } + for (var i = 0; i < data2.length; i += data.length) { + data3.push(data2.slice(i, i + data.length)); + } - // for (var i = 0; i < data2.length; i += data.length) { - // data3.push(data2.slice(i, i + data.length)); - // } let series = []; for (let i = 0; i < data3.length; i++) { series.push({ @@ -621,6 +612,52 @@ class BI054HomeDetail extends React.Component { }); } + // let xData = []; + // let data3 = [ + // [17, 20, 16, 20, 16, 16, 20, 16, 16, 20, 16, 12], + // [317, 330, 316, 330, 292, 286, 299, 286, 295, 299, 223, 201], + // [0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0], + // [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + // ]; + // for (let i = 0; i < 12; i++) { + // xData.unshift(getSixMonth(-i, "-", "")); + // } + // let seriesName = [ + // "巡回检查", + // "例行检查", + // "专业检查", + // "综合检查", + // ]; + // // data.map((item) => { + // // if (item.MONTH>9){ + // // xData.push(item.YEAR+'-'+ item.MONTH); + // // }else{ + // // xData.push(item.YEAR+'-0'+ item.MONTH); + // // } + // // seriesName = item.listSOURCENAME; + // // data1.push(item.listListCount); + // // }); + + // // for (var i = 0; i < data[0].listListCount.length; i++) { + // // for (var j = 0; j < data.length; j++) { + // // data2.push(data1[j][i]); + // // } + // // } + + // // for (var i = 0; i < data2.length; i += data.length) { + // // data3.push(data2.slice(i, i + data.length)); + // // } + // let series = []; + // for (let i = 0; i < data3.length; i++) { + // series.push({ + // name: seriesName[i], + // type: "bar", + // stack: "总量", + // data: data3[i], + // barWidth: "40%", + // }); + // } + //图标2 let dangerTotals = document.getElementById("dangerTotal2"); @@ -694,7 +731,7 @@ class BI054HomeDetail extends React.Component { series: series, }); } - + } }; render() { diff --git a/src/components/CustomPages/BI/BI055HomeDetail.js b/src/components/CustomPages/BI/BI055HomeDetail.js index ef8b996..7ee9595 100644 --- a/src/components/CustomPages/BI/BI055HomeDetail.js +++ b/src/components/CustomPages/BI/BI055HomeDetail.js @@ -1,20 +1,10 @@ -import React from "react"; -import { connect } from "dva"; -import { - initFilter, - extendRule, - extendInclude, - getIsPC, - openNotificationMobile, - getSixMonth, -} from "../../../utils/common"; -import { - ChartBarShow_Vertical, - LineShow, -} from "../../../utils/commonEcharsShow"; -import { Table, Row, Progress, Col } from "antd"; -import echarts from "echarts"; -import styles from "../HI/StepForm.css"; +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 { Table, Row, Progress, Col } from 'antd'; +import echarts from 'echarts'; +import styles from '../HI/StepForm.css'; const formItemLayout = { labelCol: { span: 6 }, @@ -37,377 +27,25 @@ class BI055HomeDetail extends React.Component { componenthidMount() { if (!getIsPC()) { - openNotificationMobile("bottomRight", notification); - this.state.displayStr = "none"; + openNotificationMobile('bottomRight', notification) + this.state.displayStr = 'none'; this.state.displayNum = 24; } else { - this.state.displayStr = ""; + this.state.displayStr = ''; this.state.displayNum = 16; } - this.loadReal(); + this.loadData() //定时器功能,暂时不开启 // this.timerID = setInterval(() => this.getBaseInfoData(1, this.state.tableKey, 5), 120000); - } + }; componentDidMount() { - this.loadReal(); + this.loadData(); } - loadReal = () => { - let data = { - IsSuccessful: true, - Data: { - ListC: [], - ListSafeCheckYearMonth: [ - { - DepartmentName: "穿孔班组", - NUM: 1, - Parent: { - DepartmentName: "穿爆车间", - RowCount: 2, - listCount: [0, 0, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "爆破班组", - NUM: 2, - Parent: { - DepartmentName: "穿爆车间", - RowCount: 2, - listCount: [0, 0, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "生产班", - NUM: 3, - Parent: { - DepartmentName: "生产技术科", - RowCount: 1, - listCount: [6, 4, 0, 10000], - }, - RowCount: 1, - listCount: [4, 1, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "综合班组", - NUM: 4, - Parent: { - DepartmentName: "综合组", - RowCount: 1, - listCount: [3, 4, 0, 10000], - }, - RowCount: 1, - listCount: [3, 4, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "采制样班", - NUM: 5, - Parent: { - DepartmentName: "试验化验室", - RowCount: 2, - listCount: [0, 0, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "化验班", - NUM: 6, - Parent: { - DepartmentName: "试验化验室", - RowCount: 2, - listCount: [0, 0, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "维修班组", - NUM: 7, - Parent: { - DepartmentName: "金宇宁化分公司", - RowCount: 4, - listCount: [6, 7, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "金宇现场", - NUM: 8, - Parent: { - DepartmentName: "金宇宁化分公司", - RowCount: 4, - listCount: [6, 7, 0, 10000], - }, - RowCount: 1, - listCount: [2, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "运输二班", - NUM: 9, - Parent: { - DepartmentName: "金宇宁化分公司", - RowCount: 4, - listCount: [6, 7, 0, 10000], - }, - RowCount: 1, - listCount: [1, 1, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "运输一班", - NUM: 10, - Parent: { - DepartmentName: "金宇宁化分公司", - RowCount: 4, - listCount: [6, 7, 0, 10000], - }, - RowCount: 1, - listCount: [1, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - { - DepartmentName: "民爆储存库班组", - NUM: 11, - Parent: { - DepartmentName: "安环科", - RowCount: 1, - listCount: [2, 1, 0, 10000], - }, - RowCount: 1, - listCount: [0, 0, 0, 10000], - listName: [ - "按时整改隐患", - "超期整改隐患", - "未整改隐患", - "隐患整改率", - ], - }, - ], - }, - }; - var countTypeTitle = []; - var countTypeDataIndex = []; - var columnsTb = []; - if ( - data.Data.ListSafeCheckYearMonth != null && - data.Data.ListSafeCheckYearMonth.length > 0 - ) { - countTypeTitle = data.Data.ListSafeCheckYearMonth[0].listName; - } - - if (countTypeTitle.length < 1) { - countTypeTitle.push("按时整改隐患"); - countTypeTitle.push("超期整改隐患"); - countTypeTitle.push("未整改隐患"); - countTypeTitle.push("隐患整改率"); - } - - var typeName = ["车间名称", "班组名称"]; - var RowCount = 0; - for (let i = 0; i < 2; i++) { - for (let j = 0; j < countTypeTitle.length; j++) { - countTypeDataIndex.push(j); - if (i == 0) { - if (j == 0) { - //头部 - columnsTb.push({ - title: typeName[i], - dataIndex: "NUM", - onCell: () => this.renderSpeedColumn(), - key: i * 10 + j, - render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; - } - const obj = { - children: record.Parent.DepartmentName, - props: { - rowSpan: RowCount, - }, - }; - return obj; - }, - }); - } - - //非头部 - if (countTypeTitle[j].indexOf("率") > -1) { - columnsTb.push({ - title: countTypeTitle[j], - dataIndex: "NUM", - key: i * 10 + j, - render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; - } - const obj = { - children: ( - - ), - props: { - rowSpan: RowCount, - }, - }; - return obj; - }, - }); - } else { - columnsTb.push({ - title: countTypeTitle[j], - dataIndex: "NUM", - key: i * 10 + j, - render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; - } - const obj = { - children: record.Parent.listCount[j], - props: { - rowSpan: RowCount, - }, - }; - return obj; - }, - }); - } - } else { - //班组 - if (j == 0) { - columnsTb.push({ - title: typeName[i], - onCell: () => this.renderSpeedColumn(), - key: i * 10 + j, - render: (value, record, index) => { - const obj = { - children: record.DepartmentName, - }; - return obj; - }, - }); - } - - if (countTypeTitle[j].indexOf("率") > -1) { - columnsTb.push({ - title: countTypeTitle[j], - key: i * 10 + j, - render: (text, record) => ( - - ), - }); - } else { - columnsTb.push({ - title: countTypeTitle[j], - key: i * 10 + j, - render: (value, record, index) => { - const obj = { - children: record.listCount[j], - }; - return obj; - }, - }); - } - } - } - } - - this.setState({ - countTypeTitle: countTypeTitle, - columnsTb: columnsTb, - ListC: data.Data.ListC, - ListSafeCheckYearMonth: data.Data.ListSafeCheckYearMonth, - }); - this.safeChekDanger(); - }; renderSpeedColumn = () => { - return { className: "redTableCell" }; - }; + return { className: 'redTableCell' } + } loadData = () => { this.state.showLoading = true; // var mineType = '' @@ -417,144 +55,119 @@ class BI055HomeDetail extends React.Component { // } else { // mineType = this.props.formParam.mineType; // } - let json = initFilter(this.props.login.OrgId); + // let json = initFilter(this.props.login.OrgId, (this.props.data.mineType == null ? this.props.formParam.mineType : this.props.data.mineType)); this.props.dispatch({ type: "app/getDataByPost", url: "BI/BIHome/GetHomeDetailMonthRisk", payload: json, onlyData: false, onComplete: (data) => { - if ( - data && - data.IsSuccessful && - data.Data && - (data.Data.ListC || data.Data.ListSafeCheckYearMonth) - ) { - var countTypeTitle = []; - var countTypeDataIndex = []; - var columnsTb = []; - if ( - data.Data.ListSafeCheckYearMonth != null && - data.Data.ListSafeCheckYearMonth.length > 0 - ) { - countTypeTitle = data.Data.ListSafeCheckYearMonth[0].listName; + if (data && data.IsSuccessful && data.Data && (data.Data.ListC || data.Data.ListSafeCheckYearMonth)) { + var countTypeTitle = [] + var countTypeDataIndex = [] + var columnsTb = [] + if (data.Data.ListSafeCheckYearMonth != null && data.Data.ListSafeCheckYearMonth.length > 0) { + countTypeTitle = data.Data.ListSafeCheckYearMonth[0].listName } if (countTypeTitle.length < 1) { - countTypeTitle.push("按时整改隐患"); - countTypeTitle.push("超期整改隐患"); - countTypeTitle.push("未整改隐患"); - countTypeTitle.push("隐患整改率"); + countTypeTitle.push('按时整改隐患') + countTypeTitle.push('超期整改隐患') + countTypeTitle.push('未整改隐患') + countTypeTitle.push('隐患整改率') } - var typeName = ["车间名称", "班组名称"]; - var RowCount = 0; + var typeName = ['车间名称', '班组名称'] + var RowCount = 0 for (let i = 0; i < 2; i++) { for (let j = 0; j < countTypeTitle.length; j++) { - countTypeDataIndex.push(j); + countTypeDataIndex.push(j) if (i == 0) { if (j == 0) { //头部 columnsTb.push({ title: typeName[i], - onCell: () => this.renderSpeedColumn(), dataIndex: "NUM", - key: i * 10 + j, + key: (i * 10 + j), + onCell: () => this.renderSpeedColumn(), render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; + RowCount = record.Parent.RowCount + if (index > 0 && this.state.ListSafeCheckYearMonth[index - 1].Parent.DepartmentName == record.Parent.DepartmentName) { + RowCount = 0 } const obj = { children: record.Parent.DepartmentName, props: { - rowSpan: RowCount, + 'rowSpan': RowCount }, }; return obj; - }, - }); + } + }) } //非头部 - if (countTypeTitle[j].indexOf("率") > -1) { + if (countTypeTitle[j].indexOf('率') > -1) { columnsTb.push({ title: countTypeTitle[j], dataIndex: "NUM", - key: i * 10 + j, + key: (i * 10 + j), render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; + RowCount = record.Parent.RowCount + if (index > 0 && this.state.ListSafeCheckYearMonth[index - 1].Parent.DepartmentName == record.Parent.DepartmentName) { + RowCount = 0 } const obj = { - children: ( - - ), + children: , props: { - rowSpan: RowCount, + 'rowSpan': RowCount, }, }; return obj; - }, - }); + } + }) } else { columnsTb.push({ title: countTypeTitle[j], dataIndex: "NUM", - key: i * 10 + j, + key: (i * 10 + j), render: (value, record, index) => { - RowCount = record.Parent.RowCount; - if ( - index > 0 && - this.state.ListSafeCheckYearMonth[index - 1].Parent - .DepartmentName == record.Parent.DepartmentName - ) { - RowCount = 0; + RowCount = record.Parent.RowCount + if (index > 0 && this.state.ListSafeCheckYearMonth[index - 1].Parent.DepartmentName == record.Parent.DepartmentName) { + RowCount = 0 } const obj = { children: record.Parent.listCount[j], props: { - rowSpan: RowCount, + 'rowSpan': RowCount }, }; return obj; - }, - }); + } + }) } + } else { //班组 if (j == 0) { columnsTb.push({ title: typeName[i], + key: (i * 10 + j), onCell: () => this.renderSpeedColumn(), - key: i * 10 + j, render: (value, record, index) => { const obj = { children: record.DepartmentName, }; return obj; - }, - }); + } + }) } - if (countTypeTitle[j].indexOf("率") > -1) { + if (countTypeTitle[j].indexOf('率') > -1) { columnsTb.push({ title: countTypeTitle[j], - key: i * 10 + j, + key: (i * 10 + j), render: (text, record) => ( ), - }); + }) + } else { columnsTb.push({ title: countTypeTitle[j], - key: i * 10 + j, + key: (i * 10 + j), render: (value, record, index) => { const obj = { children: record.listCount[j], }; return obj; - }, - }); + } + }) } + } } } + this.setState({ countTypeTitle: countTypeTitle, columnsTb: columnsTb, @@ -586,7 +202,8 @@ class BI055HomeDetail extends React.Component { ListSafeCheckYearMonth: data.Data.ListSafeCheckYearMonth, }); - this.safeChekDanger(); + this.safeChekDanger() + } }, }); @@ -603,223 +220,184 @@ class BI055HomeDetail extends React.Component { // 安全检查和隐患整改 safeChekDanger = () => { let xData = []; - for (let i = 0; i < 12; i++) { - xData.unshift(getSixMonth(-i, "-", "")); - } - let ydata = [ - ["3", "2", "2", "3", "2", "0", "2", "5", "6", "8", "0", "5"], - ["5", "4", "0", "1", "0", "0", "1", "7", "1", "0", "0", "2"], - ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"], - [ - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - "100.00", - ], - ]; - let sourceName = - ["按时整改隐患", "超期整改隐患", "未整改隐患", "隐患整改率"]; - - // if (this.state.ListC) { - // this.state.ListC.map((item) => { - // let name = item.NAME.split(","); - // xData.push(name); - // sourceName.push(item.SOURCENAME); - // let valu = item.Val.split(","); - // ydata.push(valu); - // }); - let safeInspections = document.getElementById("safeInspection2"); - if (safeInspections) { - let myChart = echarts.init(safeInspections); - myChart.setOption( - { - color: ["#72b85b", "#f6841a", "#cc0404", "#4285F4"], - tooltip: { - trigger: "axis", - axisPointer: { - // 坐标轴指示器,坐标轴触发有效 - type: "shadow", // 默认为直线,可选为:'line' | 'shadow' - }, - transitionDuration: 0, - formatter: function (params) { - return ( - params[0].name + - "
" + - params[0].marker + - params[0].seriesName + - " : " + - params[0].value + - "
" + - params[1].marker + - params[1].seriesName + - " : " + - params[1].value + - "
" + - params[2].marker + - params[2].seriesName + - " : " + - params[2].value + - "
" + - params[3].marker + - params[3].seriesName + - " : " + - params[3].value + - "%" - ); - }, - }, - grid: { - left: "5%", - right: "5%", - bottom: "15%", - top: "5%", - containLabel: true, - z: 22, - }, - xAxis: { - type: "category", - data: xData, - axisLine: { - lineStyle: { - color: "#0c3b71", + let ydata = []; + let sourceName = []; + if (this.state.ListC) { + this.state.ListC.map((item) => { + let name = item.NAME.split(","); + xData.push(name); + sourceName.push(item.SOURCENAME); + let valu = item.Val.split(","); + ydata.push(valu); + }); + let safeInspections = document.getElementById("safeInspection2"); + if (safeInspections) { + let myChart = echarts.init(safeInspections); + myChart.setOption( + { + color: ["#72b85b", "#f6841a", "#cc0404", "#4285F4"], + tooltip: { + trigger: "axis", + axisPointer: { + // 坐标轴指示器,坐标轴触发有效 + type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + }, + transitionDuration: 0, + formatter: function (params) { + return ( + params[0].name + + "
" + + params[0].marker + + params[0].seriesName + + " : " + + params[0].value + + "
" + + params[1].marker + + params[1].seriesName + + " : " + + params[1].value + + "
" + + params[2].marker + + params[2].seriesName + + " : " + + params[2].value + + "
" + + params[3].marker + + params[3].seriesName + + " : " + + params[3].value + + "%" + ); }, }, - axisLabel: { - show: true, - color: "rgb(170,170,170)", - interval: 0, - textStyle: { - lineHeight: 14, - }, + grid: { + left: "10%", + // right: "10%", + bottom: "15%", + top: "5%", + containLabel: true, + z: 22, }, - }, - legend: { - data: sourceName, - left: "center", - align: "left", - bottom: "2%", - textStyle: { - color: "#000", - }, - itemWidth: 10, - itemHeight: 10, - // itemGap: 35, - }, - yAxis: [ - { - type: "value", - position: "left", - splitLine: { - show: true, - lineStyle: { - color: ["#f2f2f2"], - // opacity:0.2 - // zlevel: -1, - }, - }, + xAxis: { + type: "category", + data: xData[0], axisLine: { lineStyle: { color: "#0c3b71", }, }, axisLabel: { + show: true, color: "rgb(170,170,170)", - formatter: "{value} ", - }, - }, - { - type: "value", - position: "right", - splitLine: { - show: false, - lineStyle: { - color: ["#f2f2f2"], + interval: 0, + textStyle: { + lineHeight: 14, }, }, - axisLine: { - lineStyle: { - color: "#f2f2f2", + }, + legend: { + data: sourceName, + left: "center", + align: "left", + bottom: "2%", + textStyle: { + color: "#000", + }, + itemWidth: 10, + itemHeight: 10, + // itemGap: 35, + }, + yAxis: [ + { + type: "value", + position: "left", + splitLine: { + show: true, + lineStyle: { + color: ["#f2f2f2"], + // opacity:0.2 + // zlevel: -1, + }, + }, + axisLine: { + lineStyle: { + color: "#0c3b71", + }, + }, + axisLabel: { + color: "rgb(170,170,170)", + formatter: "{value} ", }, }, - axisLabel: { - color: "rgb(170,170,170)", - formatter: "{value} %", + { + type: "value", + position: "right", + splitLine: { + show: false, + lineStyle: { + color: ["#f2f2f2"], + }, + }, + axisLine: { + lineStyle: { + color: "#f2f2f2", + }, + }, + axisLabel: { + color: "rgb(170,170,170)", + formatter: "{value} %", + }, }, - }, - ], - series: [ - { - name: sourceName[0], - type: "bar", - data: ydata[0], - barWidth: "20%", - barGap: "10%", - stack: null, - }, - { - name: sourceName[1], - type: "bar", - data: ydata[1], - barWidth: "20%", - barGap: "10%", - stack: null, - }, - { - name: sourceName[2], - type: "bar", - data: ydata[2], - barWidth: "20%", - barGap: "10%", - stack: null, - // zlevel: 99, - }, - { - name: sourceName[3], - type: "line", - data: ydata[3], - yAxisIndex: 1, - // zlevel:100, - }, - ], - }, - true - ); + ], + series: [ + { + name: sourceName[0], + type: "bar", + data: ydata[0], + barWidth: "20%", + barGap: "10%", + stack: null, + }, + { + name: sourceName[1], + type: "bar", + data: ydata[1], + barWidth: "20%", + barGap: "10%", + stack: null, + }, + { + name: sourceName[2], + type: "bar", + data: ydata[2], + barWidth: "20%", + barGap: "10%", + stack: null, + // zlevel: 99, + }, + { + name: sourceName[3], + type: "line", + data: ydata[3], + yAxisIndex: 1, + // zlevel:100, + }, + ], + } + , true + ); + } } - // } }; render() { return ( -
+
-
+
@@ -827,16 +405,8 @@ class BI055HomeDetail extends React.Component { -
- +
+
@@ -846,4 +416,4 @@ class BI055HomeDetail extends React.Component { ); } } -export default connect(({ login, app }) => ({ login, app }))(BI055HomeDetail); +export default connect(({ login, app }) => ({ login, app }))(BI055HomeDetail) diff --git a/src/routes/Home.js b/src/routes/Home.js index 9cfbd92..cc17f57 100644 --- a/src/routes/Home.js +++ b/src/routes/Home.js @@ -87,8 +87,8 @@ const WorkBench = (props) => { item.NOTICE_STATUS == 0 ? "未读" : item.NOTICE_STATUS == 3 - ? "已读" - : "已办"; + ? "已读" + : "已办"; const type = props.index == 1 || props.index == 2 ? prepare : warning; return ( @@ -112,10 +112,10 @@ const WorkBench = (props) => { type == "超期" ? "home-work-type-red" : type == "未办" || type == "未读" - ? "home-work-type-yellow" - : type == "已办" - ? "home-work-type-green" - : "home-work-type-black" + ? "home-work-type-yellow" + : type == "已办" + ? "home-work-type-green" + : "home-work-type-black" } style={{ marginLeft: "20px", @@ -243,7 +243,7 @@ class Home extends React.Component { value: 43, }, ], - riskLevelData:[] + riskLevelData: [] }; this.resizeRef = React.createRef(); } @@ -273,12 +273,12 @@ class Home extends React.Component { lmdisplay: 17, }, () => { - this.willDo() + this.willDo() } ); } } - willDo = ()=>{ + willDo = () => { this.getBaseData(1, "1", 5); this.getBaseData(1, "1"); this.timeJudg(); @@ -286,13 +286,13 @@ class Home extends React.Component { // this.homeRound(); this.completeRate(); this.timelyRate(); - this.safeCheck(); - this.dangerChange(); + this.safeCheck();// 安全检查次数统计 月度隐患整改情况 + // this.dangerChange();// 原 月度隐患整改情况 this.getUser(); //定时器功能,暂时不开启 this.timerID = setInterval( - () =>{this.getBaseData(1, this.state.tableKey, 5),this.getBaseData(1, this.state.overDataKey)} , - 120000 + () => { this.getBaseData(1, this.state.tableKey, 5), this.getBaseData(1, this.state.overDataKey) }, + 120000 ); this.showModalSign(); } @@ -775,108 +775,450 @@ class Home extends React.Component { }, }); }; - safeCheck = () => { - let series = []; - let seriesName = ["巡回检查", "例行检查", "专业检查", "综合检查"]; - let data3 = [ - [17, 20, 16, 20, 16, 16, 20, 16, 16, 20, 16, 4], - [43, 41, 43, 32, 47, 33, 57, 38, 46, 42, 49, 39], - [23, 21, 43, 12, 15, 13, 15, 16, 17, 14, 19, 24], - [17, 20, 23, 42, 12, 17, 13, 15, 12, 17, 19, 34], - ]; - let xData = []; - for (let i = 0; i < 12; i++) { - xData.unshift(getSixMonth(-i, "年", "月")); - } - for (let i = 0; i < data3.length; i++) { - series.push({ - name: seriesName[i], - type: "bar", - stack: "总量", - data: data3[i], - barWidth: "20%", - // itemStyle:{ - // borderWidth:2, - // borderColor:'#fff', - // barBorderRadius:5, - // } - }); - } - let safeChecks = document.getElementById("safeCheck"); - if (safeChecks) { - let myChart = echarts.init(safeChecks); - myChart.setOption({ - color: ["#4285F4", "#72b85b", "#c92a2a", "#ffa94d"], - tooltip: { - trigger: "axis", - axisPointer: { - // 坐标轴指示器,坐标轴触发有效 - type: "shadow", // 默认为直线,可选为:'line' | 'shadow' - }, - transitionDuration: 0, - }, - grid: { - left: "5%", - right: "5%", - bottom: "15%", - top: "10%", - containLabel: true, - z: 22, - }, - xAxis: { - type: "category", - data: xData, - axisLine: { - lineStyle: { - color: "#0c3b71", - }, - }, - axisLabel: { - show: true, - color: "rgb(170,170,170)", - interval: 0, - textStyle: { - lineHeight: 14, - }, - formatter: function (param) { - return param.split("年")[1]; - }, - }, - }, - legend: { - data: ["巡回检查", "例行检查", "专业检查", "综合检查"], - left: "center", - align: "left", - bottom: "2%", - textStyle: { - color: "#000", - }, - itemWidth: 10, - itemHeight: 10, - // itemGap: 15, - }, - yAxis: { - type: "value", - splitLine: { - show: true, - lineStyle: { - color: ["#f2f2f2"], - }, - }, - axisLine: { - lineStyle: { - color: "#0c3b71", - }, - }, - axisLabel: { - color: "rgb(170,170,170)", - formatter: "{value} ", - }, - }, - series: series, - }); - } + safeCheck = () => { + const userInfo = storage("lacal").getItem("webUserInfo").val; + let json = initFilter(this.props.login.OrgId, this.state.mineType, "NUM"); + this.props.dispatch({ + type: "app/getDataByPost", + url: "BI/BIHome/GetHomeInfo", + payload: json, + onlyData: false, + onComplete: (data) => { + if (data && data.IsSuccessful) { + //安全检查次数统计 + if (data.Data.ListSafeCheckYearMonth && data.Data.ListSafeCheckYearMonth.length > 0) { + + // this.hiddenTop = data.Data.length; + // this.setState({ + // dangerList: data.Data, + // }); + // //图标2 + var listD1 = data.Data.ListSafeCheckYearMonth + let series = []; + let seriesName = listD1[0].listSOURCENAME;// ["巡回检查", "例行检查", "专业检查", "综合检查"]; + var CheckTypeCount = seriesName.length + + // let data3 = [ + // [17, 20, 16, 20, 16, 16, 20, 16, 16, 20, 16, 4], + // [43, 41, 43, 32, 47, 33, 57, 38, 46, 42, 49, 39], + // [23, 21, 43, 12, 15, 13, 15, 16, 17, 14, 19, 24], + // [17, 20, 23, 42, 12, 17, 13, 15, 12, 17, 19, 34] + // ]; + + + let xData = []; + for (let i = 0; i < listD1.length; i++) { + xData.push(listD1[i].YEAR + "年" + listD1[i].MONTH + "月"); + } + let data3 = [] + // data3 组合 + for (let i = 0; i < CheckTypeCount; i++) { + let dataT = [] + for (let j = 0; j < xData.length; j++) { + dataT.push(listD1[j].listListCount[i]) + } + data3.push(dataT) + } + + + // for (let i = 0; i < 12; i++) { + // xData.unshift(getSixMonth(-i, "年", "月")); + // } + for (let i = 0; i < data3.length; i++) { + series.push({ + name: seriesName[i], + type: "bar", + stack: "总量", + data: data3[i], + barWidth: "20%", + // itemStyle:{ + // borderWidth:2, + // borderColor:'#fff', + // barBorderRadius:5, + // } + }); + } + let safeChecks = document.getElementById("safeCheck"); + if (safeChecks) { + let myChart = echarts.init(safeChecks); + myChart.setOption({ + color: ["#4285F4", "#72b85b", "#c92a2a", "#ffa94d", "#428576", "#72b876", "#c92a76", "#ffa976", "#4286F6", "#72b656", "#c92626", "#ffa646"], + + tooltip: { + trigger: "axis", + axisPointer: { + // 坐标轴指示器,坐标轴触发有效 + type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + }, + transitionDuration: 0, + }, + grid: { + left: "5%", + right: "5%", + bottom: "15%", + top: "10%", + containLabel: true, + z: 22, + }, + xAxis: { + type: "category", + data: xData, + axisLine: { + lineStyle: { + color: "#0c3b71", + }, + }, + axisLabel: { + show: true, + color: "rgb(170,170,170)", + interval: 0, + textStyle: { + lineHeight: 14, + }, + formatter: function (param) { + return param.split("年")[1]; + }, + }, + }, + legend: { + data: seriesName,// ["巡回检查", "例行检查", "专业检查", "综合检查"], + left: "center", + align: "left", + bottom: "2%", + textStyle: { + color: "#000", + }, + itemWidth: 10, + itemHeight: 10, + // itemGap: 15, + }, + yAxis: { + type: "value", + splitLine: { + show: true, + lineStyle: { + color: ["#f2f2f2"], + }, + }, + axisLine: { + lineStyle: { + color: "#0c3b71", + }, + }, + axisLabel: { + color: "rgb(170,170,170)", + formatter: "{value} ", + }, + }, + series: series, + }); + } + } + //月度隐患整改情况 + if (data.Data.ListC && data.Data.ListC.length > 0) { + let sourceName = [] + let ydata = [] + // let sourceName = [ + // "按时整改隐患", + // "超期整改隐患", + // "未整改隐患", + // "隐患整改率", + // ]; + // let ydata = [ + // ["2", "5", "6", "8", "10", "9"], + // ["1", "7", "1", "2", "5", "4"], + // ["0", "1", "0", "3", "0", "1"], + // ["100.00", "92.31", "100.00", "76.92", "100.00", "92.86"], + // ]; + + var ListC = data.Data.ListC; + // SOURCENAME + let xData = ListC[0].NAME.split(','); + for (let i = 0; i < ListC.length; i++) { + sourceName.push(ListC[i].SOURCENAME) + let ydataT = [] + for (let j = 0; j < xData.length; j++) { + ydataT.push(ListC[i].Val.split(',')[j]) + } + ydata.push(ydataT) + } + // let date = new Date(); + // let year = date.getFullYear(); + // let month = date.getMonth() + 1; + // let xData = []; + // for (let i = 0; i < 6; i++) { + // xData.unshift(getSixMonth(-i, "-", "")); + // } + let dangerChanges = document.getElementById("dangerChange"); + if (dangerChanges) { + let myChart = echarts.init(dangerChanges); + myChart.setOption({ + color: ["#72b85b", "#f6841a", "#cc0404", "#4285F4"], + tooltip: { + trigger: "axis", + axisPointer: { + // 坐标轴指示器,坐标轴触发有效 + type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + }, + transitionDuration: 0, + formatter: function (params) { + return ( + params[0].name + + "
" + + params[0].marker + + params[0].seriesName + + " : " + + params[0].value + + "
" + + params[1].marker + + params[1].seriesName + + " : " + + params[1].value + + "
" + + params[2].marker + + params[2].seriesName + + " : " + + params[2].value + + "
" + + params[3].marker + + params[3].seriesName + + " : " + + params[3].value + + "%" + ); + }, + }, + grid: { + left: "5%", + right: "5%", + bottom: "15%", + top: "10%", + containLabel: true, + z: 22, + }, + xAxis: { + type: "category", + data: xData, + axisLine: { + lineStyle: { + color: "#0c3b71", + }, + }, + axisLabel: { + show: true, + color: "rgb(170,170,170)", + interval: 0, + textStyle: { + lineHeight: 14, + }, + }, + }, + legend: { + data: sourceName, + left: "center", + align: "left", + bottom: "2%", + textStyle: { + color: "#000", + }, + itemWidth: 10, + itemHeight: 10, + // itemGap: 35, + }, + yAxis: [ + { + type: "value", + position: "left", + splitLine: { + show: true, + lineStyle: { + color: ["#f2f2f2"], + // opacity:0.2 + // zlevel: -1, + }, + }, + axisLine: { + lineStyle: { + color: "#0c3b71", + }, + }, + axisLabel: { + color: "rgb(170,170,170)", + formatter: "{value} ", + }, + }, + { + type: "value", + position: "right", + splitLine: { + show: false, + lineStyle: { + color: ["#f2f2f2"], + }, + }, + axisLine: { + lineStyle: { + color: "#f2f2f2", + }, + }, + axisLabel: { + color: "rgb(170,170,170)", + formatter: "{value} %", + }, + }, + ], + series: [ + { + name: sourceName[0], + type: "bar", + data: ydata[0], + barWidth: "10%", + barGap: "10%", + stack: null, + }, + { + name: sourceName[1], + type: "bar", + data: ydata[1], + barWidth: "10%", + barGap: "10%", + stack: null, + }, + { + name: sourceName[2], + type: "bar", + data: ydata[2], + barWidth: "10%", + barGap: "10%", + stack: null, + // zlevel: 99, + }, + { + name: sourceName[3], + type: "line", + smooth: false, + data: ydata[3], + yAxisIndex: 1, + itemStyle: { + normal: { + lineStyle: { + type: "dotted", + }, + }, + }, + // zlevel:100, + }, + ], + }); + } + } + } + }, + }); + + + // let series = []; + // let seriesName = ["巡回检查", "例行检查", "专业检查", "综合检查"]; + // let data3 = [ + // [17, 20, 16, 20, 16, 16, 20, 16, 16, 20, 16, 4], + // [43, 41, 43, 32, 47, 33, 57, 38, 46, 42, 49, 39], + // [23, 21, 43, 12, 15, 13, 15, 16, 17, 14, 19, 24], + // [17, 20, 23, 42, 12, 17, 13, 15, 12, 17, 19, 34], + // ]; + // let xData = []; + // for (let i = 0; i < 12; i++) { + // xData.unshift(getSixMonth(-i, "年", "月")); + // } + // for (let i = 0; i < data3.length; i++) { + // series.push({ + // name: seriesName[i], + // type: "bar", + // stack: "总量", + // data: data3[i], + // barWidth: "20%", + // // itemStyle:{ + // // borderWidth:2, + // // borderColor:'#fff', + // // barBorderRadius:5, + // // } + // }); + // } + // let safeChecks = document.getElementById("safeCheck"); + // if (safeChecks) { + // let myChart = echarts.init(safeChecks); + // myChart.setOption({ + // color: ["#4285F4", "#72b85b", "#c92a2a", "#ffa94d"], + + // tooltip: { + // trigger: "axis", + // axisPointer: { + // // 坐标轴指示器,坐标轴触发有效 + // type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + // }, + // transitionDuration: 0, + // }, + // grid: { + // left: "5%", + // right: "5%", + // bottom: "15%", + // top: "10%", + // containLabel: true, + // z: 22, + // }, + // xAxis: { + // type: "category", + // data: xData, + // axisLine: { + // lineStyle: { + // color: "#0c3b71", + // }, + // }, + // axisLabel: { + // show: true, + // color: "rgb(170,170,170)", + // interval: 0, + // textStyle: { + // lineHeight: 14, + // }, + // formatter: function (param) { + // return param.split("年")[1]; + // }, + // }, + // }, + // legend: { + // data: ["巡回检查", "例行检查", "专业检查", "综合检查"], + // left: "center", + // align: "left", + // bottom: "2%", + // textStyle: { + // color: "#000", + // }, + // itemWidth: 10, + // itemHeight: 10, + // // itemGap: 15, + // }, + // yAxis: { + // type: "value", + // splitLine: { + // show: true, + // lineStyle: { + // color: ["#f2f2f2"], + // }, + // }, + // axisLine: { + // lineStyle: { + // color: "#0c3b71", + // }, + // }, + // axisLabel: { + // color: "rgb(170,170,170)", + // formatter: "{value} ", + // }, + // }, + // series: series, + // }); + // } }; dangerChange = () => { let sourceName = [ @@ -1258,7 +1600,7 @@ class Home extends React.Component { if (data.Data && data.Data.length > 0) { this.setState({ riskLevelData: data.Data, - },()=>{ + }, () => { this.riskLevel() }); } @@ -1314,7 +1656,7 @@ class Home extends React.Component { orient: "vartical", // x: "right", // top: "18%", - y:'center', + y: 'center', right: "15%", // bottom: "20%", data: showData, @@ -1411,7 +1753,7 @@ class Home extends React.Component { visible: false, }); }; - ExpandCancel = () => {}; + ExpandCancel = () => { }; showDetailModal = (formCode) => { var titleTemp = ""; @@ -1490,7 +1832,7 @@ class Home extends React.Component { { querySearch, }, - () => {} + () => { } ); }; // 开始时间 @@ -1514,7 +1856,7 @@ class Home extends React.Component { { querySearch, }, - () => {} + () => { } ); }; // 结束时间 @@ -1572,7 +1914,7 @@ class Home extends React.Component { footer={null} className="antd-modal-fullscreen" closeModal={this.closeModal} - // forceRender={true} + // forceRender={true} > @@ -1598,7 +1940,7 @@ class Home extends React.Component { >
- +
- +