From 21d92eca9d1c74826f2c7c66b3b535cb1f4c9e5f Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Sat, 18 Oct 2025 16:58:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/commonRequest.js | 129 +- .../dataAnalysisOctober/overallEfficiency.js | 319 ++-- .../dataAnalysisOctober/projectManagement.js | 1431 ++++++++++------- .../overallEfficiency.html | 327 ++-- .../projectManagement.html | 72 +- 5 files changed, 1382 insertions(+), 896 deletions(-) diff --git a/api/commonRequest.js b/api/commonRequest.js index 990ee74..da5845b 100644 --- a/api/commonRequest.js +++ b/api/commonRequest.js @@ -1,4 +1,4 @@ -let aqEnnable = false // 参数加密开关 +let aqEnnable = false; // 参数加密开关 //后端路径 // 前端地址-生产 @@ -6,22 +6,18 @@ let aqEnnable = false // 参数加密开关 // const commonUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/"; // const imgUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/file/files/"; - - // const URL_IP="http://192.168.0.7:17789/gdwebs/zhgd-web" // const commonUrl = "http://192.168.0.7:17789/zhgd/"; // const imgUrl = "http://192.168.0.7:17789/zhgd/file/files/"; -const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web" -const commonUrl = "http://192.168.0.14:1999/zhgd/"; +const URL_IP = "http://192.168.0.14:1999/gdwebs/zhgd-web"; +const commonUrl = "http://192.168.0.60:28080/zhgd/"; const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/"; - // const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web" //前端 //请求路径 - // const commonUrl = "http://10.145.34.32:80/zhgd/"; // const imgUrl = "http://10.145.34.32:80/zhgd/file/files/"; @@ -29,18 +25,18 @@ const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/"; // // const imgUrl = "http://192.168.0.38:13030/zhgd/file/files/"; - const login_url = commonUrl + "auth/login"; // 登录url const sgcc_url = commonUrl + "auth/sgccLogin"; // 登录url const login_out = commonUrl + "auth/logout"; // 登出url const page_jump = commonUrl + "auth/pageJump"; // 登出url // const back_url="http://192.168.0.38:9527/zhgd-ht/#/ywgllogin?token="; -const back_url="http://192.168.0.14:1999/gdwebs/zhgd-ht/#/login?token="; +const back_url = "http://192.168.0.14:1999/gdwebs/zhgd-ht/#/login?token="; //大屏地址 -const screen_url="http://192.168.0.14:1999/gdwebs/zhgd-web/pages/web/index.html"; +const screen_url = + "http://192.168.0.14:1999/gdwebs/zhgd-web/pages/web/index.html"; //重定向地址 -let SGCC_LOGIN_URL="http://192.168.0.14:1999/gdwebs/zhgd-web/sg_login.html"; +let SGCC_LOGIN_URL = "http://192.168.0.14:1999/gdwebs/zhgd-web/sg_login.html"; // //后台登录地址 // const back_url="http://sgwpdm.ah.sgcc.com.cn/gdwebs/zhgd-ht/#/ywgllogin?token="; @@ -49,36 +45,31 @@ let SGCC_LOGIN_URL="http://192.168.0.14:1999/gdwebs/zhgd-web/sg_login.html"; // //重定向地址 // let SGCC_LOGIN_URL="http://sgwpdm.ah.sgcc.com.cn/"; - - -let sm4=new SM4Util(); -const login_sg_page = URL_IP+"/sg_login.html" // 施工大屏登录页面 +let sm4 = new SM4Util(); +const login_sg_page = URL_IP + "/sg_login.html"; // 施工大屏登录页面 const login_sc_page = SGCC_LOGIN_URL; // 省侧大屏登录页面 -const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页 +const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页 /** * 公钥 * @type {string} */ -const public_key="04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64"; - - - - +const public_key = + "04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64"; // 修改响应数据的函数 function modifyResponseData(responseData) { // 在这里对响应数据进行修改 - if(responseData.decrypt){ - responseData=sm4.decryptDefault_CBC(responseData.data); - }else{ - // responseData=responseData; + if (responseData.decrypt) { + responseData = sm4.decryptDefault_CBC(responseData.data); + } else { + // responseData=responseData; } - if(typeof(responseData)=='object'){ + if (typeof responseData == "object") { return responseData; } - if(typeof(responseData)=='string'){ - responseData=removePadding(responseData) + if (typeof responseData == "string") { + responseData = removePadding(responseData); var responseData = JSON.parse(responseData); var modifiedData = responseData; return modifiedData; @@ -86,7 +77,6 @@ function modifyResponseData(responseData) { return responseData; } - function removePadding(decrypted) { const lastByte = decrypted.charCodeAt(decrypted.length - 1); if (lastByte <= 16) { @@ -100,30 +90,38 @@ function removePadding(decrypted) { return decrypted; } - - /* POST 请求 */ -function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType, isAes) { +function ajaxRequest( + url, + type, + data, + async, + beforeFn, + successFn, + errorFn, + contentType, + isAes +) { $.ajax({ url: url, type: type, headers: { - "authorization": sessionStorage.getItem("zhgd_token"), - "decrypt": isAes ? '' : 'decrypt' + authorization: sessionStorage.getItem("zhgd_token"), + decrypt: isAes ? "" : "decrypt", }, data: data, async: async, beforeSend: beforeFn, - contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8", - success: function (event, xhr, settings, data){ - event=modifyResponseData(event); + contentType: + contentType || "application/x-www-form-urlencoded; charset=utf-8", + success: function (event, xhr, settings, data) { + event = modifyResponseData(event); successFn(event, xhr, settings, data); }, - error:function (event, xhr, settings, error) { - errorFn(event, xhr, settings, error) - } + error: function (event, xhr, settings, error) { + errorFn(event, xhr, settings, error); + }, }); - } /* 施工大屏跳转 ajax请求封装 */ @@ -132,16 +130,16 @@ function ajaxRequest2(url, type, token, successFn, errorFn) { url: url, type: type, headers: { - "authorization": token, - "decrypt": 'decrypt' + authorization: token, + decrypt: "decrypt", }, - success: function (event, xhr, settings, data){ - event=modifyResponseData(event); + success: function (event, xhr, settings, data) { + event = modifyResponseData(event); successFn(event, xhr, settings, data); }, - error:function (event, xhr, settings, error) { - errorFn(event, xhr, settings, error) - } + error: function (event, xhr, settings, error) { + errorFn(event, xhr, settings, error); + }, }); } @@ -151,38 +149,45 @@ function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) { url: url, type: type, headers: { - "authorization": sessionStorage.getItem("zhgd_token"), - "decrypt": isAes ? '' : 'decrypt' + authorization: sessionStorage.getItem("zhgd_token"), + decrypt: isAes ? "" : "decrypt", }, async: async, beforeSend: beforeFn, - success: function (event, xhr, settings, data){ - event=modifyResponseData(event); + success: function (event, xhr, settings, data) { + event = modifyResponseData(event); successFn(event, xhr, settings, data); }, - error:function (event, xhr, settings, error) { - errorFn(event, xhr, settings, error) - } + error: function (event, xhr, settings, error) { + errorFn(event, xhr, settings, error); + }, }); } - /* GET请求 */ -function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, isAes) { +function ajaxRequestGetExport( + url, + type, + async, + beforeFn, + successFn, + errorFn, + isAes +) { $.ajax({ url: url, type: type, headers: { - "encryption":"encryption", - "authorization": sessionStorage.getItem("zhgd_token"), - "decrypt": isAes ? '' : 'decrypt' + encryption: "encryption", + authorization: sessionStorage.getItem("zhgd_token"), + decrypt: isAes ? "" : "decrypt", }, xhrFields: { - responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob + responseType: "blob", // 告诉 xhr 我们期望返回的数据类型是 blob }, async: async, beforeSend: beforeFn, success: successFn, - error:errorFn + error: errorFn, }); } diff --git a/js/pages/dataAnalysisOctober/overallEfficiency.js b/js/pages/dataAnalysisOctober/overallEfficiency.js index c4c79c0..7de6762 100644 --- a/js/pages/dataAnalysisOctober/overallEfficiency.js +++ b/js/pages/dataAnalysisOctober/overallEfficiency.js @@ -1,5 +1,7 @@ let table, layer, form; -let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; +let fontSize = "14", + fontFamily = "Alibaba PuHuiTi R", + fontColor = "#fff"; layui.use(["layer", "table", "form"], function () { layer = layui.layer; @@ -11,18 +13,105 @@ layui.use(["layer", "table", "form"], function () { getSafetyAlert(); }); -function getEnvironmental() { - let yList = [32, 58, 64, 164, 99]; - let xData = ['学前', '小学', '初中', '高中', 'qq']; - initEnvironmental(yList, xData) +initData(); + +function initData() { + const url = commonUrl + "screen/proSafety/selectOverallEfficiencyData"; + + let encryptStr = encryptCBC( + JSON.stringify({ + startTime: "2025-10-10", + endTime: "2025-10-17", + }) + ); + + ajaxRequest( + url, + "get", + { + startTime: "2025-10-10", + endTime: "2025-10-17", + }, + true, + function () {}, + function (result) { + console.log(result, "数据"); + + const data = result.data; + let weather = ""; + let safetyAlert = ""; + for (const key in data) { + switch (key) { + case "计划施工天数": + $("#planWorkDay").text(data[key] + "天"); + break; + case "有效施工天数": + $("#effectiveWorkDay").text(data[key] + "天"); + break; + case "总验收项": + $("#totalItems").text(data[key] + "个"); + break; + case "已验收项": + $("#acceptedItems").text(data[key] + "个"); + break; + case "验收率": + $("#acceptanceItemsRate").text(data[key] + "%"); + break; + case "主设备试验调试一次通过率": + $("#firstRate").text(data[key] + "%"); + break; + + case "当前进度": + $("#currentProgress").text(data[key]); + break; + case "计划进度": + $("#planProgress").text(data[key]); + break; + case "进度偏差": + $("#delayProgress").text(data[key]); + break; + + case "计划成本": + $("#planCost").text(data[key] + "万元"); + break; + case "实际成本": + $("#actualCost").text(data[key] + "万元"); + break; + case "缩减成本": + $("#reduceCost").text(data[key] + "万元"); + break; + case "天气": + weather = data[key]; + initEnvironmental(weather); + break; + case "安全预警": + safetyAlert = data[key]; + initSafetyAlert(safetyAlert); + break; + } + } + }, + function (xhr) { + // error(xhr); + } + ); } -function initEnvironmental(yList, xData) { +function getEnvironmental() { + let yList = [32, 58, 64, 164, 99]; + let xData = ["学前", "小学", "初中", "高中", "qq"]; + initEnvironmental(yList, xData); +} + +function initEnvironmental(data) { + const xData = data.map((item) => item.weather); + const yList = data.map((item) => item.day); + let barWidth = 60; - let colors = [] + let colors = []; for (let i = 0; i < xData.length; i++) { colors.push({ - type: 'linear', + type: "linear", x: 0, x2: 1, y: 0, @@ -30,55 +119,60 @@ function initEnvironmental(yList, xData) { colorStops: [ { offset: 0, - color: '#1CFFF4' // 最左边 - }, { + color: "#1CFFF4", // 最左边 + }, + { offset: 0.5, - color: '#1CFFF4' // 左边的右边 颜色 - }, { + color: "#1CFFF4", // 左边的右边 颜色 + }, + { offset: 0.5, - color: '#1CFFF4' // 右边的左边 颜色 - }, { + color: "#1CFFF4", // 右边的左边 颜色 + }, + { offset: 1, - color: '#1CFFF4' - }] - }) + color: "#1CFFF4", + }, + ], + }); } const myChart = echarts.init(document.getElementById("environmental")); const option = { //提示框 tooltip: { - trigger: 'axis', + trigger: "axis", formatter: "{b} : {c}", - axisPointer: { // 坐标轴指示器,坐标轴触发有效 - type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' - } + axisPointer: { + // 坐标轴指示器,坐标轴触发有效 + type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + }, }, /**区域位置*/ grid: { - left: '8%', - right: '3%', - top: '30%', - bottom: '30%', + left: "8%", + right: "3%", + top: "30%", + bottom: "30%", }, //X轴 xAxis: { data: xData, - type: 'category', + type: "category", axisLine: { show: false, lineStyle: { - color: 'rgba(255,255,255,1)', - shadowColor: 'rgba(255,255,255,1)', - shadowOffsetX: '20', + color: "rgba(255,255,255,1)", + shadowColor: "rgba(255,255,255,1)", + shadowOffsetX: "20", }, - symbol: ['none', 'arrow'], - symbolOffset: [0, 25] + symbol: ["none", "arrow"], + symbolOffset: [0, 25], }, splitLine: { show: false, }, axisTick: { - show: false + show: false, }, axisLabel: { margin: 30, @@ -94,72 +188,72 @@ function initEnvironmental(yList, xData) { splitLine: { show: true, lineStyle: { - type: 'dashed', - color: '#075858' + type: "dashed", + color: "#075858", }, }, axisLabel: { - color: '#FFFFFF', + color: "#FFFFFF", margin: 8, - fontSize: 15 - } + fontSize: 15, + }, }, series: [ { - type: 'bar', + type: "bar", barWidth: barWidth, itemStyle: { normal: { color: function (params) { return colors[params.dataIndex % 7]; - } - } + }, + }, }, label: { show: false, position: [barWidth / 2, -(barWidth + 20)], - color: '#ffffff', + color: "#ffffff", fontSize: 14, - fontStyle: 'bold', - align: 'center', + fontStyle: "bold", + align: "center", }, - data: yList + data: yList, }, { z: 2, - type: 'pictorialBar', + type: "pictorialBar", data: yList, - symbol: 'diamond', - symbolOffset: [0, '50%'], + symbol: "diamond", + symbolOffset: [0, "50%"], symbolSize: [barWidth, barWidth * 0.5], itemStyle: { normal: { color: function (params) { return colors[params.dataIndex % 7]; }, - } + }, }, }, { z: 3, - type: 'pictorialBar', - symbolPosition: 'end', + type: "pictorialBar", + symbolPosition: "end", data: yList, - symbol: 'diamond', - symbolOffset: [0, '-50%'], + symbol: "diamond", + symbolOffset: [0, "-50%"], symbolSize: [barWidth, barWidth * 0.5], itemStyle: { normal: { borderWidth: 0, color: function (params) { - return colors[params.dataIndex % 7].colorStops[0].color; + return colors[params.dataIndex % 7].colorStops[0] + .color; }, - - } + }, }, }, ], - } + }; myChart.setOption(option); window.addEventListener("resize", function () { myChart.resize(); @@ -168,16 +262,18 @@ function initEnvironmental(yList, xData) { function getSafetyAlert() { let yList = [32, 58, 64, 164, 99]; - let xData = ['学前', '小学', '初中', '高中', 'qq']; - initSafetyAlert(yList, xData) + let xData = ["学前", "小学", "初中", "高中", "qq"]; + initSafetyAlert(yList, xData); } -function initSafetyAlert(yList, xData) { +function initSafetyAlert(data) { + const xData = data.map((item) => item.name); + const yList = data.map((item) => item.num); let barWidth = 60; - let colors = [] + let colors = []; for (let i = 0; i < xData.length; i++) { colors.push({ - type: 'linear', + type: "linear", x: 0, x2: 1, y: 0, @@ -185,55 +281,60 @@ function initSafetyAlert(yList, xData) { colorStops: [ { offset: 0, - color: '#1CFFF4' // 最左边 - }, { + color: "#1CFFF4", // 最左边 + }, + { offset: 0.5, - color: '#1CFFF4' // 左边的右边 颜色 - }, { + color: "#1CFFF4", // 左边的右边 颜色 + }, + { offset: 0.5, - color: '#1CFFF4' // 右边的左边 颜色 - }, { + color: "#1CFFF4", // 右边的左边 颜色 + }, + { offset: 1, - color: '#1CFFF4' - }] - }) + color: "#1CFFF4", + }, + ], + }); } const myChart = echarts.init(document.getElementById("safetyAlert")); const option = { //提示框 tooltip: { - trigger: 'axis', + trigger: "axis", formatter: "{b} : {c}", - axisPointer: { // 坐标轴指示器,坐标轴触发有效 - type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' - } + axisPointer: { + // 坐标轴指示器,坐标轴触发有效 + type: "shadow", // 默认为直线,可选为:'line' | 'shadow' + }, }, /**区域位置*/ grid: { - left: '8%', - right: '3%', - top: '30%', - bottom: '30%', + left: "8%", + right: "3%", + top: "30%", + bottom: "30%", }, //X轴 xAxis: { data: xData, - type: 'category', + type: "category", axisLine: { show: false, lineStyle: { - color: 'rgba(255,255,255,1)', - shadowColor: 'rgba(255,255,255,1)', - shadowOffsetX: '20', + color: "rgba(255,255,255,1)", + shadowColor: "rgba(255,255,255,1)", + shadowOffsetX: "20", }, - symbol: ['none', 'arrow'], - symbolOffset: [0, 25] + symbol: ["none", "arrow"], + symbolOffset: [0, 25], }, splitLine: { show: false, }, axisTick: { - show: false + show: false, }, axisLabel: { margin: 30, @@ -249,72 +350,72 @@ function initSafetyAlert(yList, xData) { splitLine: { show: true, lineStyle: { - type: 'dashed', - color: '#075858' + type: "dashed", + color: "#075858", }, }, axisLabel: { - color: '#FFFFFF', + color: "#FFFFFF", margin: 8, - fontSize: 15 - } + fontSize: 15, + }, }, series: [ { - type: 'bar', + type: "bar", barWidth: barWidth, itemStyle: { normal: { color: function (params) { return colors[params.dataIndex % 7]; - } - } + }, + }, }, label: { show: false, position: [barWidth / 2, -(barWidth + 20)], - color: '#ffffff', + color: "#ffffff", fontSize: 14, - fontStyle: 'bold', - align: 'center', + fontStyle: "bold", + align: "center", }, - data: yList + data: yList, }, { z: 2, - type: 'pictorialBar', + type: "pictorialBar", data: yList, - symbol: 'diamond', - symbolOffset: [0, '50%'], + symbol: "diamond", + symbolOffset: [0, "50%"], symbolSize: [barWidth, barWidth * 0.5], itemStyle: { normal: { color: function (params) { return colors[params.dataIndex % 7]; }, - } + }, }, }, { z: 3, - type: 'pictorialBar', - symbolPosition: 'end', + type: "pictorialBar", + symbolPosition: "end", data: yList, - symbol: 'diamond', - symbolOffset: [0, '-50%'], + symbol: "diamond", + symbolOffset: [0, "-50%"], symbolSize: [barWidth, barWidth * 0.5], itemStyle: { normal: { borderWidth: 0, color: function (params) { - return colors[params.dataIndex % 7].colorStops[0].color; + return colors[params.dataIndex % 7].colorStops[0] + .color; }, - - } + }, }, }, ], - } + }; myChart.setOption(option); window.addEventListener("resize", function () { myChart.resize(); diff --git a/js/pages/dataAnalysisOctober/projectManagement.js b/js/pages/dataAnalysisOctober/projectManagement.js index be38143..f0d0e3d 100644 --- a/js/pages/dataAnalysisOctober/projectManagement.js +++ b/js/pages/dataAnalysisOctober/projectManagement.js @@ -1,95 +1,202 @@ let table, layer, form; -let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; +let fontSize = "14", + fontFamily = "Alibaba PuHuiTi R", + fontColor = "#fff"; layui.use(["layer", "table", "form"], function () { layer = layui.layer; table = layui.table; form = layui.form; - getProjectProgress(); + // getProjectProgress(); - getProjectCost(); + // getProjectCost(); - getPprojectRisk(); + // getProjectRisk(); //土建专业 - getCivilEngineering(); + // getCivilEngineering(); //电气专业 - getElectrical(); + // getElectrical(); //项目成本 - getItemCost(); + // getItemCost(); //总风险数量 - getTotalRisk(); + // getTotalRisk(); }); function getProjectProgress() { - initProjectProgress() + initProjectProgress(); } -function initProjectProgress() { +// 获取数据 + +function initData() { + // const url = commonUrl + "screen/proSafety/selectOverallEfficiencyData"; + const url = commonUrl + "screen/projectData/selectProjectData"; + let encryptStr = encryptCBC( + JSON.stringify({ + startTime: "2025-10-10", + endTime: "2025-10-17", + }) + ); + + ajaxRequest( + url, + "get", + { + startTime: "2025-10-10", + endTime: "2025-10-17", + }, + true, + function () {}, + function (result) { + console.log(result, "数据"); + + const data = result.data; + + let projectProgress = ""; + let projectCost = ""; + let projectRisk = []; + let projectDetail = {}; + let electrical = []; + let civilEngineering = []; + let projectCostList = []; + let todayRisk = ""; + + for (const key in data) { + switch (key) { + case "当前工程进度": + projectProgress = data[key]; + break; + case "当前成本投入": + projectCost = data[key]; + break; + case "今日风险": + todayRisk = data[key]; + break; + case "项目风险": + projectRisk = data[key]; + break; + case "项目情况详情": + projectDetail = data[key]; + break; + case "项目成本": + projectCostList = data[key]; + break; + case "已销号风险": + $("#accountTerminatedRisk").text(data[key]); + break; + case "剩余风险": + $("#remainingRisk").text(data[key]); + break; + case "剩余二级及以上风险": + $("#remainingSecondaryRisk").text(data[key]); + break; + } + } + + for (const key in projectDetail) { + switch (key) { + case "变电电气专业": + electrical = projectDetail[key]; + break; + case "变电土建专业": + civilEngineering = projectDetail[key]; + break; + } + } + + initProjectProgress(projectProgress); + initProjectCost(projectCost); + initProjectRisk(todayRisk); + + initCivilEngineering(civilEngineering); + initElectrical(electrical); + initItemCost(projectCostList); + initTotalRisk(projectRisk); + }, + function (xhr) { + // error(xhr); + } + ); +} + +initData(); + +function initProjectProgress(projectProgress) { + const a = projectProgress.split("%")[0] * 1; + const b = 100 - a; const myChart = echarts.init(document.getElementById("projectProgress")); const option = { title: { - text: '当前工程进度', - left: '48%', - top: '30%', + text: "当前工程进度", + left: "48%", + top: "30%", textStyle: { - color: '#fff', + color: "#fff", fontSize: 15, - fontWeight: 'normal', - } + fontWeight: "normal", + }, }, graphic: { - type: 'text', - left: '50%', - top: '50%', + type: "text", + left: "50%", + top: "50%", style: { - text: '70%', - textAlign: 'center', - fill: '#79FFFF', + text: projectProgress, + textAlign: "center", + fill: "#79FFFF", fontSize: 24, - } + }, }, series: [ { - type: 'pie', - radius: ['25%', '50%'], - center: ['30%', '50%'], + type: "pie", + radius: ["25%", "50%"], + center: ["30%", "50%"], startAngle: 90, hoverAnimation: false, label: { - show: false + show: false, }, labelLine: { - show: false + show: false, }, data: [ { - value: 70, + value: a, itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "#3BE6E6" - }, - { - offset: 1, - color: "#FFFFFF" - } - ], false), - } + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "#3BE6E6", + }, + { + offset: 1, + color: "#FFFFFF", + }, + ], + false + ), + }, }, { - value: 30, + value: b, itemStyle: { - color: 'rgba(8, 220, 224, 0.1)' - } - } - ] - } - ] + color: "rgba(8, 220, 224, 0.1)", + }, + }, + ], + }, + ], }; myChart.setOption(option); window.addEventListener("resize", function () { @@ -101,67 +208,76 @@ function getProjectCost() { initProjectCost(); } -function initProjectCost() { +function initProjectCost(projectCost) { + const b = 100 - projectCost; const myChart = echarts.init(document.getElementById("projectCost")); const option = { title: { - text: '当前成本投入', - left: '48%', - top: '30%', + text: "当前成本投入", + left: "48%", + top: "30%", textStyle: { - color: '#fff', + color: "#fff", fontSize: 15, - fontWeight: 'normal', - } + fontWeight: "normal", + }, }, graphic: { - type: 'text', - left: '50%', - top: '50%', + type: "text", + left: "50%", + top: "50%", style: { - text: '70%', - textAlign: 'center', - fill: '#79FFFF', + text: projectCost + "%", + textAlign: "center", + fill: "#79FFFF", fontSize: 24, - } + }, }, series: [ { - type: 'pie', - radius: ['25%', '50%'], - center: ['30%', '50%'], + type: "pie", + radius: ["25%", "50%"], + center: ["30%", "50%"], startAngle: 90, hoverAnimation: false, label: { - show: false + show: false, }, labelLine: { - show: false + show: false, }, data: [ { - value: 70, + value: projectCost, itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "#3BE6E6" - }, - { - offset: 1, - color: "#FFFFFF" - } - ], false), - } + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "#3BE6E6", + }, + { + offset: 1, + color: "#FFFFFF", + }, + ], + false + ), + }, }, { - value: 30, + value: b, itemStyle: { - color: 'rgba(8, 220, 224, 0.1)' - } - } - ] - } - ] + color: "rgba(8, 220, 224, 0.1)", + }, + }, + ], + }, + ], }; myChart.setOption(option); window.addEventListener("resize", function () { @@ -169,16 +285,44 @@ function initProjectCost() { }); } -function getPprojectRisk() { +function getProjectRisk() { initProjectRisk(); } -function initProjectRisk() { +// 随机生成一个颜色 +function getRandomColor() { + return "#" + Math.floor(Math.random() * 16777215).toString(16); +} + +function initProjectRisk(projectRisk) { + $(".big-number").text( + projectRisk.filter((item) => item.riskLevel == 0)[0].num + ); + const level = { + 1: "一级风险", + 2: "二级风险", + 3: "三级风险", + 4: "四级风险", + 5: "五级风险", + }; + const data_1 = projectRisk + .filter((item) => item.riskLevel != 0) + .map((item) => { + return { + value: item.num, + name: level[item.riskLevel], + itemStyle: { + color: getRandomColor(), + }, + }; + }); + + console.log(data_1, "data_1"); const myChart = echarts.init(document.getElementById("projectRisk")); const option = { tooltip: { trigger: "item", - formatter: "{b}: {c}kWh ({d}%)", + formatter: "{b}: {c}个 ({d}%)", backgroundColor: "rgba(0, 0, 0, 0.8)", borderColor: "#08DCE0", borderWidth: 1, @@ -210,10 +354,10 @@ function initProjectRisk() { }, }, formatter: (name) => { - const data = option.series[0].data - const item = data.find((d) => d.name === name) - const percent = item ? item.value : 0 - return `{name|${name}} {value|${percent}%}` + const data = option.series[0].data; + const item = data.find((d) => d.name === name); + const percent = item ? item.value : 0; + return `{name|${name}} {value|${percent}}`; }, }, series: [ @@ -221,7 +365,7 @@ function initProjectRisk() { name: "用电统计", type: "pie", roseType: "radius", - radius: [0, '70%'], + radius: [0, "70%"], center: ["25%", "45%"], avoidLabelOverlap: false, itemStyle: { @@ -247,36 +391,37 @@ function initProjectRisk() { labelLine: { show: false, }, - data: [ - { - value: 60, - name: "二级风险", - itemStyle: { - color: '#75F7EC', - }, - }, - { - value: 60, - name: "三级风险", - itemStyle: { - color: '#75F791', - }, - }, - { - value: 26, - name: "四级风险", - itemStyle: { - color: '#00C3F2', - }, - }, - { - value: 14, - name: "五级风险", - itemStyle: { - color: '#EB846A', - }, - }, - ], + data: data_1, + // data: [ + // // { + // // value: 60, + // // name: "二级风险", + // // itemStyle: { + // // color: "#75F7EC", + // // }, + // // }, + // // { + // // value: 60, + // // name: "三级风险", + // // itemStyle: { + // // color: "#75F791", + // // }, + // // }, + // // { + // // value: 26, + // // name: "四级风险", + // // itemStyle: { + // // color: "#00C3F2", + // // }, + // // }, + // // { + // // value: 14, + // // name: "五级风险", + // // itemStyle: { + // // color: "#EB846A", + // // }, + // // }, + // ], }, ], }; @@ -287,63 +432,104 @@ function initProjectRisk() { } function getCivilEngineering() { - let xLabel = ['xxxx-xx-01', 'xxxx-xx-02', 'xxxx-xx-03', 'xxxx-xx-04', 'xxxx-xx-05', 'xxxx-xx-06','xxxx-xx-07', 'xxxx-xx-08', 'xxxx-xx-09', 'xxxx-xx-10', 'xxxx-xx-11', 'xxxx-xx-12',] - let expenditureData = ["12", "15", "4", "8", "13", "6","10", "11", "5", "12","10", "15"] - let incomeData = ["4", "5", "5", "5", "5", "4","3", "5", "3","16", "5", "18"] - initCivilEngineering( xLabel,expenditureData,incomeData); + let xLabel = [ + "xxxx-xx-01", + "xxxx-xx-02", + "xxxx-xx-03", + "xxxx-xx-04", + "xxxx-xx-05", + "xxxx-xx-06", + "xxxx-xx-07", + "xxxx-xx-08", + "xxxx-xx-09", + "xxxx-xx-10", + "xxxx-xx-11", + "xxxx-xx-12", + ]; + let expenditureData = [ + "12", + "15", + "4", + "8", + "13", + "6", + "10", + "11", + "5", + "12", + "10", + "15", + ]; + let incomeData = [ + "4", + "5", + "5", + "5", + "5", + "4", + "3", + "5", + "3", + "16", + "5", + "18", + ]; + initCivilEngineering(xLabel, expenditureData, incomeData); } -function initCivilEngineering( xLabel,expenditureData,incomeData) { - +function initCivilEngineering(date) { + const xLabel = date.map((item) => item.date); + const expenditureData = date.map((item) => item.plannedCount); + const incomeData = date.map((item) => item.actualCount); const leftChart = echarts.init(document.getElementById("civilEngineering")); - const option = { + const option = { title: { - text: '土建专业', + text: "土建专业", textStyle: { - color: '#ffffff', + color: "#ffffff", fontSize: fontSize, - fontFamily: fontFamily + fontFamily: fontFamily, }, left: 5, - top: 5 + top: 5, }, tooltip: { - show:true, - trigger: 'axis', + show: true, + trigger: "axis", axisPointer: { - type: 'shadow', + type: "shadow", }, - borderColor: 'rgba(255,255,255,.3)', - backgroundColor: 'rgba(19,51,55,.6)', + borderColor: "rgba(255,255,255,.3)", + backgroundColor: "rgba(19,51,55,.6)", textStyle: { - color: 'white', //设置文字颜色 + color: "white", //设置文字颜色 }, borderWidth: 1, padding: 10, }, legend: { - show:true, - top:'5%', - right:'4%', - textStyle:{ - color:'#ffffff' - } + show: true, + top: "5%", + right: "4%", + textStyle: { + color: "#ffffff", + }, }, grid: { - top: '25%', - left: '6%', - right: '4%', - bottom: '20%' + top: "25%", + left: "6%", + right: "4%", + bottom: "20%", }, xAxis: [ { - type: 'category', + type: "category", boundaryGap: true, axisLine: { //坐标轴轴线相关设置。数学上的x轴 show: true, lineStyle: { - color: '#5A6E71', + color: "#5A6E71", }, }, axisLabel: { @@ -351,13 +537,13 @@ function initCivilEngineering( xLabel,expenditureData,incomeData) { textStyle: { color: fontColor, fontSize: fontSize, - fontFamily: fontFamily + fontFamily: fontFamily, }, }, splitLine: { show: false, lineStyle: { - color: '#233653', + color: "#233653", }, }, axisTick: { @@ -366,110 +552,130 @@ function initCivilEngineering( xLabel,expenditureData,incomeData) { data: xLabel, }, ], - yAxis: [{ - min: 0, - splitNumber: 10, - splitLine: { - show: true, + yAxis: [ + { + min: 0, + splitNumber: 10, + splitLine: { + show: true, + lineStyle: { + color: "rgba(255,255,255,0.6)", + type: "dashed", + }, + }, + axisLine: { + show: false, + }, + axisLabel: { + show: true, + textStyle: { + color: "rgba(255,255,255,0.8)", + padding: 16, + }, + formatter: function (value) { + if (value === 0) { + return value; + } + return value; + }, + }, + axisTick: { + show: false, + }, + }, + ], + series: [ + { + name: "计划", + type: "line", + symbol: "circle", + showAllSymbol: true, + symbolSize: 0, + smooth: true, lineStyle: { - color: 'rgba(255,255,255,0.6)', - type: 'dashed', + normal: { + width: 2, + color: "#00FEFC", + }, }, - }, - axisLine: { - show: false, - }, - axisLabel: { - show: true, - textStyle: { - color: 'rgba(255,255,255,0.8)', - padding: 16 - }, - formatter: function(value) { - if (value === 0) { - return value - } - return value - } - }, - axisTick: { - show: false, - }, - }], - series: [{ - name: '计划', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, + itemStyle: { color: "#00FEFC", - } - }, - itemStyle: { - color: "#00FEFC", - borderWidth: 2 - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(18,86,100,0.6)" + borderWidth: 2, + }, + tooltip: { + show: true, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "rgba(18,86,100,0.6)", + }, + { + offset: 1, + color: "rgba(16,72,81, 0.7)", + }, + ], + false + ), + shadowColor: "rgba(15,55,63, 0.8)", + shadowBlur: 20, }, - { - offset: 1, - color: "rgba(16,72,81, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,63, 0.8)', - shadowBlur: 20 - } + }, + data: expenditureData, }, - data: expenditureData - }, { - name: '实现', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, + { + name: "实现", + type: "line", + symbol: "circle", + showAllSymbol: true, + symbolSize: 0, + smooth: true, + lineStyle: { + normal: { + width: 2, + color: "rgba(25,196,134, 1)", + }, + }, + itemStyle: { color: "rgba(25,196,134, 1)", - } - }, - itemStyle: { - color: "rgba(25,196,134, 1)", - borderWidth: 2 - - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(17,95,82, 0.6)" + borderWidth: 2, + }, + tooltip: { + show: true, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "rgba(17,95,82, 0.6)", + }, + { + offset: 1, + color: "rgba(16,72,67, 0.7)", + }, + ], + false + ), + shadowColor: "rgba(15,55,54, 0.8)", + shadowBlur: 20, }, - { - offset: 1, - color: "rgba(16,72,67, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,54, 0.8)', - shadowBlur: 20 - } + }, + data: incomeData, }, - data: incomeData - }] + ], }; leftChart.setOption(option); @@ -480,62 +686,104 @@ function initCivilEngineering( xLabel,expenditureData,incomeData) { } function getElectrical() { - let xLabel = ['xxxx-xx-01', 'xxxx-xx-02', 'xxxx-xx-03', 'xxxx-xx-04', 'xxxx-xx-05', 'xxxx-xx-06','xxxx-xx-07', 'xxxx-xx-08', 'xxxx-xx-09', 'xxxx-xx-10', 'xxxx-xx-11', 'xxxx-xx-12',] - let expenditureData = ["12", "15", "4", "8", "13", "6","10", "11", "5", "12","10", "15"] - let incomeData = ["4", "5", "5", "5", "5", "4","3", "5", "3","16", "5", "18"] - initElectrical( xLabel,expenditureData,incomeData); + let xLabel = [ + "xxxx-xx-01", + "xxxx-xx-02", + "xxxx-xx-03", + "xxxx-xx-04", + "xxxx-xx-05", + "xxxx-xx-06", + "xxxx-xx-07", + "xxxx-xx-08", + "xxxx-xx-09", + "xxxx-xx-10", + "xxxx-xx-11", + "xxxx-xx-12", + ]; + let expenditureData = [ + "12", + "15", + "4", + "8", + "13", + "6", + "10", + "11", + "5", + "12", + "10", + "15", + ]; + let incomeData = [ + "4", + "5", + "5", + "5", + "5", + "4", + "3", + "5", + "3", + "16", + "5", + "18", + ]; + initElectrical(xLabel, expenditureData, incomeData); } -function initElectrical( xLabel,expenditureData,incomeData) { +function initElectrical(data) { + const xLabel = data.map((item) => item.date); + const expenditureData = data.map((item) => item.plannedCount); + const incomeData = data.map((item) => item.actualCount); const leftChart = echarts.init(document.getElementById("electrical")); - const option = { + const option = { title: { - text: '电气专业', + text: "电气专业", textStyle: { - color: '#ffffff', + color: "#ffffff", fontSize: fontSize, - fontFamily: fontFamily + fontFamily: fontFamily, }, left: 5, - top: 5 + top: 5, }, tooltip: { - show:true, - trigger: 'axis', + show: true, + trigger: "axis", axisPointer: { - type: 'shadow', + type: "shadow", }, - borderColor: 'rgba(255,255,255,.3)', - backgroundColor: 'rgba(19,51,55,.6)', + borderColor: "rgba(255,255,255,.3)", + backgroundColor: "rgba(19,51,55,.6)", textStyle: { - color: 'white', //设置文字颜色 + color: "white", //设置文字颜色 }, borderWidth: 1, padding: 10, }, legend: { - show:true, - top:'5%', - right:'4%', - textStyle:{ - color:'#ffffff' - } + show: true, + top: "5%", + right: "4%", + textStyle: { + color: "#ffffff", + }, }, grid: { - top: '25%', - left: '6%', - right: '4%', - bottom: '20%' + top: "25%", + left: "6%", + right: "4%", + bottom: "20%", }, xAxis: [ { - type: 'category', + type: "category", boundaryGap: true, axisLine: { //坐标轴轴线相关设置。数学上的x轴 show: true, lineStyle: { - color: '#5A6E71', + color: "#5A6E71", }, }, axisLabel: { @@ -543,13 +791,13 @@ function initElectrical( xLabel,expenditureData,incomeData) { textStyle: { color: fontColor, fontSize: fontSize, - fontFamily: fontFamily + fontFamily: fontFamily, }, }, splitLine: { show: false, lineStyle: { - color: '#233653', + color: "#233653", }, }, axisTick: { @@ -558,110 +806,130 @@ function initElectrical( xLabel,expenditureData,incomeData) { data: xLabel, }, ], - yAxis: [{ - min: 0, - splitNumber: 10, - splitLine: { - show: true, + yAxis: [ + { + min: 0, + splitNumber: 10, + splitLine: { + show: true, + lineStyle: { + color: "rgba(255,255,255,0.6)", + type: "dashed", + }, + }, + axisLine: { + show: false, + }, + axisLabel: { + show: true, + textStyle: { + color: "rgba(255,255,255,0.8)", + padding: 16, + }, + formatter: function (value) { + if (value === 0) { + return value; + } + return value; + }, + }, + axisTick: { + show: false, + }, + }, + ], + series: [ + { + name: "计划", + type: "line", + symbol: "circle", + showAllSymbol: true, + symbolSize: 0, + smooth: true, lineStyle: { - color: 'rgba(255,255,255,0.6)', - type: 'dashed', + normal: { + width: 2, + color: "#00FEFC", + }, }, - }, - axisLine: { - show: false, - }, - axisLabel: { - show: true, - textStyle: { - color: 'rgba(255,255,255,0.8)', - padding: 16 - }, - formatter: function(value) { - if (value === 0) { - return value - } - return value - } - }, - axisTick: { - show: false, - }, - }], - series: [{ - name: '计划', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, + itemStyle: { color: "#00FEFC", - } - }, - itemStyle: { - color: "#00FEFC", - borderWidth: 2 - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(18,86,100,0.6)" + borderWidth: 2, + }, + tooltip: { + show: true, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "rgba(18,86,100,0.6)", + }, + { + offset: 1, + color: "rgba(16,72,81, 0.7)", + }, + ], + false + ), + shadowColor: "rgba(15,55,63, 0.8)", + shadowBlur: 20, }, - { - offset: 1, - color: "rgba(16,72,81, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,63, 0.8)', - shadowBlur: 20 - } + }, + data: expenditureData, }, - data: expenditureData - }, { - name: '实现', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, + { + name: "实现", + type: "line", + symbol: "circle", + showAllSymbol: true, + symbolSize: 0, + smooth: true, + lineStyle: { + normal: { + width: 2, + color: "rgba(25,196,134, 1)", + }, + }, + itemStyle: { color: "rgba(25,196,134, 1)", - } - }, - itemStyle: { - color: "rgba(25,196,134, 1)", - borderWidth: 2 - - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(17,95,82, 0.6)" + borderWidth: 2, + }, + tooltip: { + show: true, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "rgba(17,95,82, 0.6)", + }, + { + offset: 1, + color: "rgba(16,72,67, 0.7)", + }, + ], + false + ), + shadowColor: "rgba(15,55,54, 0.8)", + shadowBlur: 20, }, - { - offset: 1, - color: "rgba(16,72,67, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,54, 0.8)', - shadowBlur: 20 - } + }, + data: incomeData, }, - data: incomeData - }] + ], }; leftChart.setOption(option); @@ -671,53 +939,96 @@ function initElectrical( xLabel,expenditureData,incomeData) { }); } -function getItemCost(){ - let xLabel = ['xxxx-xx-01', 'xxxx-xx-02', 'xxxx-xx-03', 'xxxx-xx-04', 'xxxx-xx-05', 'xxxx-xx-06','xxxx-xx-07', 'xxxx-xx-08', 'xxxx-xx-09', 'xxxx-xx-10', 'xxxx-xx-11', 'xxxx-xx-12',] - let expenditureData = ["12", "15", "4", "8", "13", "6","10", "11", "5", "12","10", "15"] - let incomeData = ["4", "5", "5", "5", "5", "4","3", "5", "3","16", "5", "18"] - initItemCost(xLabel,expenditureData,incomeData) +function getItemCost() { + let xLabel = [ + "xxxx-xx-01", + "xxxx-xx-02", + "xxxx-xx-03", + "xxxx-xx-04", + "xxxx-xx-05", + "xxxx-xx-06", + "xxxx-xx-07", + "xxxx-xx-08", + "xxxx-xx-09", + "xxxx-xx-10", + "xxxx-xx-11", + "xxxx-xx-12", + ]; + let expenditureData = [ + "12", + "15", + "4", + "8", + "13", + "6", + "10", + "11", + "5", + "12", + "10", + "15", + ]; + let incomeData = [ + "4", + "5", + "5", + "5", + "5", + "4", + "3", + "5", + "3", + "16", + "5", + "18", + ]; + initItemCost(xLabel, expenditureData, incomeData); } -function initItemCost(xLabel,expenditureData,incomeData){ +function initItemCost(data) { + console.log(data, "data---**---"); + const xLabel = data.map((item) => item.dateTime); + const expenditureData = data.map((item) => item.dataMoney); + // const incomeData = data.map((item) => item.actualCount); const leftChart = echarts.init(document.getElementById("itemCost")); - const option = { + const option = { tooltip: { - show:true, - trigger: 'axis', + show: true, + trigger: "axis", axisPointer: { - type: 'shadow', + type: "shadow", }, - borderColor: 'rgba(255,255,255,.3)', - backgroundColor: 'rgba(19,51,55,.6)', + borderColor: "rgba(255,255,255,.3)", + backgroundColor: "rgba(19,51,55,.6)", textStyle: { - color: 'white', //设置文字颜色 + color: "white", //设置文字颜色 }, borderWidth: 1, padding: 10, }, legend: { - show:true, - top:'15%', - right:'4%', - textStyle:{ - color:'#ffffff' - } + show: true, + top: "15%", + right: "4%", + textStyle: { + color: "#ffffff", + }, }, grid: { - top: '30%', - left: '5%', - right: '4%', - bottom: '20%' + top: "30%", + left: "5%", + right: "4%", + bottom: "20%", }, xAxis: [ { - type: 'category', + type: "category", boundaryGap: true, axisLine: { //坐标轴轴线相关设置。数学上的x轴 show: true, lineStyle: { - color: '#5A6E71', + color: "#5A6E71", }, }, axisLabel: { @@ -725,13 +1036,13 @@ function initItemCost(xLabel,expenditureData,incomeData){ textStyle: { color: fontColor, fontSize: fontSize, - fontFamily: fontFamily + fontFamily: fontFamily, }, }, splitLine: { show: false, lineStyle: { - color: '#233653', + color: "#233653", }, }, axisTick: { @@ -740,110 +1051,130 @@ function initItemCost(xLabel,expenditureData,incomeData){ data: xLabel, }, ], - yAxis: [{ - min: 0, - splitNumber: 10, - splitLine: { - show: true, + yAxis: [ + { + min: 0, + splitNumber: 10, + splitLine: { + show: true, + lineStyle: { + color: "rgba(255,255,255,0.6)", + type: "dashed", + }, + }, + axisLine: { + show: false, + }, + axisLabel: { + show: true, + textStyle: { + color: "rgba(255,255,255,0.8)", + padding: 16, + }, + formatter: function (value) { + if (value === 0) { + return value; + } + return value; + }, + }, + axisTick: { + show: false, + }, + }, + ], + series: [ + { + name: "项目成本", + type: "line", + symbol: "circle", + showAllSymbol: true, + symbolSize: 0, + smooth: true, lineStyle: { - color: 'rgba(255,255,255,0.6)', - type: 'dashed', + normal: { + width: 2, + color: "#00FEFC", + }, }, - }, - axisLine: { - show: false, - }, - axisLabel: { - show: true, - textStyle: { - color: 'rgba(255,255,255,0.8)', - padding: 16 - }, - formatter: function(value) { - if (value === 0) { - return value - } - return value - } - }, - axisTick: { - show: false, - }, - }], - series: [{ - name: '计划', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, + itemStyle: { color: "#00FEFC", - } - }, - itemStyle: { - color: "#00FEFC", - borderWidth: 2 - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(18,86,100,0.6)" + borderWidth: 2, + }, + tooltip: { + show: true, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient( + 0, + 0, + 0, + 1, + [ + { + offset: 0, + color: "rgba(18,86,100,0.6)", + }, + { + offset: 1, + color: "rgba(16,72,81, 0.7)", + }, + ], + false + ), + shadowColor: "rgba(15,55,63, 0.8)", + shadowBlur: 20, }, - { - offset: 1, - color: "rgba(16,72,81, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,63, 0.8)', - shadowBlur: 20 - } + }, + data: expenditureData, }, - data: expenditureData - }, { - name: '实现', - type: 'line', - symbol: 'circle', - showAllSymbol: true, - symbolSize: 0, - smooth: true, - lineStyle: { - normal: { - width: 2, - color: "rgba(25,196,134, 1)", - } - }, - itemStyle: { - color: "rgba(25,196,134, 1)", - borderWidth: 2 - - }, - tooltip: { - show: true - }, - areaStyle: { - normal: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: "rgba(17,95,82, 0.6)" - }, - { - offset: 1, - color: "rgba(16,72,67, 0.7)" - } - ], false), - shadowColor: 'rgba(15,55,54, 0.8)', - shadowBlur: 20 - } - }, - data: incomeData - }] + // { + // name: "实现", + // type: "line", + // symbol: "circle", + // showAllSymbol: true, + // symbolSize: 0, + // smooth: true, + // lineStyle: { + // normal: { + // width: 2, + // color: "rgba(25,196,134, 1)", + // }, + // }, + // itemStyle: { + // color: "rgba(25,196,134, 1)", + // borderWidth: 2, + // }, + // tooltip: { + // show: true, + // }, + // areaStyle: { + // normal: { + // color: new echarts.graphic.LinearGradient( + // 0, + // 0, + // 0, + // 1, + // [ + // { + // offset: 0, + // color: "rgba(17,95,82, 0.6)", + // }, + // { + // offset: 1, + // color: "rgba(16,72,67, 0.7)", + // }, + // ], + // false + // ), + // shadowColor: "rgba(15,55,54, 0.8)", + // shadowBlur: 20, + // }, + // }, + // data: incomeData, + // }, + ], }; leftChart.setOption(option); @@ -853,16 +1184,37 @@ function initItemCost(xLabel,expenditureData,incomeData){ }); } -function getTotalRisk(){ - initTotalRisk() +function getTotalRisk() { + initTotalRisk(); } -function initTotalRisk(){ +function initTotalRisk(projectRisk) { + $(".big-number").text( + projectRisk.filter((item) => item.riskLevel == 0)[0].num + ); + const level = { + 1: "一级风险", + 2: "二级风险", + 3: "三级风险", + 4: "四级风险", + 5: "五级风险", + }; + const data_1 = projectRisk + .filter((item) => item.riskLevel != 0) + .map((item) => { + return { + value: item.num, + name: level[item.riskLevel], + itemStyle: { + color: getRandomColor(), + }, + }; + }); const myChart = echarts.init(document.getElementById("totalRisk")); const option = { tooltip: { trigger: "item", - formatter: "{b}: {c}kWh ({d}%)", + formatter: "{b}: {c}个 ({d}%)", backgroundColor: "rgba(0, 0, 0, 0.8)", borderColor: "#08DCE0", borderWidth: 1, @@ -895,10 +1247,10 @@ function initTotalRisk(){ }, }, formatter: (name) => { - const data = option.series[0].data - const item = data.find((d) => d.name === name) - const percent = item ? item.value : 0 - return `{name|${name}} {value|${percent}%}` + const data = option.series[0].data; + const item = data.find((d) => d.name === name); + const percent = item ? item.value : 0; + return `{name|${name}} {value|${percent}}`; }, }, series: [ @@ -906,7 +1258,7 @@ function initTotalRisk(){ name: "用电统计", type: "pie", roseType: "radius", - radius: [0, '70%'], + radius: [0, "70%"], center: ["15%", "45%"], avoidLabelOverlap: false, itemStyle: { @@ -932,36 +1284,37 @@ function initTotalRisk(){ labelLine: { show: false, }, - data: [ - { - value: 60, - name: "二级风险", - itemStyle: { - color: '#75F7EC', - }, - }, - { - value: 60, - name: "三级风险", - itemStyle: { - color: '#75F791', - }, - }, - { - value: 26, - name: "四级风险", - itemStyle: { - color: '#00C3F2', - }, - }, - { - value: 14, - name: "五级风险", - itemStyle: { - color: '#EB846A', - }, - }, - ], + data: data_1, + // data: [ + // { + // value: 60, + // name: "二级风险", + // itemStyle: { + // color: "#75F7EC", + // }, + // }, + // { + // value: 60, + // name: "三级风险", + // itemStyle: { + // color: "#75F791", + // }, + // }, + // { + // value: 26, + // name: "四级风险", + // itemStyle: { + // color: "#00C3F2", + // }, + // }, + // { + // value: 14, + // name: "五级风险", + // itemStyle: { + // color: "#EB846A", + // }, + // }, + // ], }, ], }; diff --git a/pages/dataAnalysisOctober/overallEfficiency.html b/pages/dataAnalysisOctober/overallEfficiency.html index 29d4208..6199319 100644 --- a/pages/dataAnalysisOctober/overallEfficiency.html +++ b/pages/dataAnalysisOctober/overallEfficiency.html @@ -1,5 +1,6 @@ +
@@ -8,7 +9,7 @@ - + @@ -63,7 +64,7 @@ .progress { height: 100%; - width: 35%; + width: 50%; background: url("../../img/dataAnalysisOctober/progress.png") no-repeat 0 0 / 100% 100%; background-position: center center !important; display: flex; @@ -72,7 +73,7 @@ .cost { height: 100%; - width: 35%; + width: 50%; margin-left: 1%; background: url("../../img/dataAnalysisOctober/cost.png") no-repeat 0 0 / 100% 100%; background-position: center center !important; @@ -135,7 +136,7 @@ border-radius: 2px 2px 2px 2px; } - .total-rate{ + .total-rate { width: 55px; height: 60px; flex-shrink: 0; @@ -143,7 +144,7 @@ background-position: center center !important; } - .accepted-items-rate{ + .accepted-items-rate { width: 55px; height: 60px; flex-shrink: 0; @@ -151,7 +152,7 @@ background-position: center center !important; } - .acceptance-items-rate{ + .acceptance-items-rate { width: 55px; height: 60px; flex-shrink: 0; @@ -159,7 +160,7 @@ background-position: center center !important; } - .first-rate{ + .first-rate { width: 55px; height: 60px; flex-shrink: 0; @@ -167,7 +168,7 @@ background-position: center center !important; } - #safetyAlert{ + #safetyAlert { height: 100%; width: 100%; } @@ -181,183 +182,201 @@ } + -