diff --git a/api/commonRequest.js b/api/commonRequest.js index 58c13f5..3d4348c 100644 --- a/api/commonRequest.js +++ b/api/commonRequest.js @@ -1,21 +1,22 @@ -let aqEnnable = false // 参数加密开关 +let aqEnnable = true // 参数加密开关 const commonUrl = "http://10.40.92.33:18080/zhgd/"; /* 登录相关 */ const login_url = commonUrl + "auth/login"; // 登录url const login_out = commonUrl + "auth/logout"; // 登出url const page_jump = commonUrl + "auth/pageJump"; // 登出url -const login_sg_page = "http://10.40.92.33:8101/sg_login.html" // 施工大屏登录页面 -const login_sc_page = "http://10.40.92.33:8100/sc_login.html" // 省侧大屏登录页面 -const login_sg_index = "http://10.40.92.33:8101/pages/home/navigation.html" // 施工大屏首页 -const login_sc_index = "http://10.40.92.33:8100/pages/web/index.html" // 省侧大屏首页 +const login_sg_page = "http://10.40.92.33:8100/sg_login.html" // 施工大屏登录页面 +const login_sc_page = "http://10.40.92.33:8101/sc_login.html" // 省侧大屏登录页面 +const login_sg_index = "http://10.40.92.33:8100/pages/home/navigation.html" // 施工大屏首页 +const login_sc_index = "http://10.40.92.33:8101/pages/web/index.html" // 省侧大屏首页 /* POST 请求 */ -function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType) { +function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType,isAes) { $.ajax({ url: url, type: type, headers: { - "authorization": sessionStorage.getItem("zhgd_token") + "authorization": sessionStorage.getItem("zhgd_token"), + "decrypt": isAes ? '' : 'decrypt' }, data: data, async: async, @@ -40,14 +41,14 @@ function ajaxRequest2(url, type, token, successFn, errorFn) { } /* GET请求 */ -function ajaxRequestGet(url, type, data, async, beforeFn, successFn, errorFn) { +function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) { $.ajax({ url: url, type: type, headers: { - "authorization": sessionStorage.getItem("zhgd_token") + "authorization": sessionStorage.getItem("zhgd_token"), + "decrypt": isAes ? '' : 'decrypt' }, - data: data, async: async, beforeSend: beforeFn, success: successFn, diff --git a/css/index/index.css b/css/index/index.css index 205f63c..a465baa 100644 --- a/css/index/index.css +++ b/css/index/index.css @@ -38,6 +38,11 @@ body { justify-content: space-between; } +#img-carousel img { + width: 900px; + height: 360px; +} + #pro-desc { width: 100%; height: calc(100% - 380px); diff --git a/js/login/login.js b/js/login/login.js index 292f11d..574f2bd 100644 --- a/js/login/login.js +++ b/js/login/login.js @@ -37,6 +37,6 @@ layui.use(function () { } }, function (xhr, status, error) { error(xhr, status, error) - }, "application/json"); + }, "application/json",aqEnnable); }); }); \ No newline at end of file diff --git a/js/pages/index/index.js b/js/pages/index/index.js index f951ca2..14a98ad 100644 --- a/js/pages/index/index.js +++ b/js/pages/index/index.js @@ -3,27 +3,23 @@ layui.use(['layer', 'element', 'carousel'], function () { element = layui.element; layer = layui.layer; carousel = layui.carousel; - // 渲染 - 图片轮播 - carousel.render({ - elem: '#ID-carousel-demo-image', - width: '720px', - height: '360px', - interval: 3000 - }); - $("#pro-desc").niceScroll({cursorborder:"",cursorcolor:"#c0c4cc",boxzoom:true}); - $("body").niceScroll({cursorborder:"",cursorcolor:"#c0c4cc",boxzoom:true}); - loadEcharts(); - console.log("选中的标段编码:"+parent.$('#bidPro').val()) + $("#pro-desc").niceScroll({ cursorborder: "", cursorcolor: "#c0c4cc", boxzoom: true }); + $("body").niceScroll({ cursorborder: "", cursorcolor: "#c0c4cc", boxzoom: true }); + loadData(); }); -/* 加载首页Echarts */ -function loadEcharts(){ - initEchartsOne(); - initEchartsTwo(); - initEchartsThree(); +/* 加载首页数据 */ +function loadData() { + const bidCode = parent.$('#bidPro').val(); + const paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId; + let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData); + loadProBrief(montageParam); + loadRealMonitor(montageParam); + loadProRisk(montageParam); + loadProCost(montageParam); + loadProProgress(montageParam); } - diff --git a/js/pages/index/indexAjax.js b/js/pages/index/indexAjax.js new file mode 100644 index 0000000..42e0a53 --- /dev/null +++ b/js/pages/index/indexAjax.js @@ -0,0 +1,156 @@ + +/* 工程简介 */ +function loadProBrief(montageParam) { + const url = commonUrl + 'screen/largeScreen/xcIndex/getProDetails?params=' + montageParam; + ajaxRequestGet(url, "GET", true, function () { + }, function (result) { + if (result.code === 200) { + setData(result.data.data); + } else if (result.code === 500) { + console.error('工程简介:' + result.msg); + setData(null); + } else if (result.code === 401) { + loginout(1); + } + }, function (xhr, status, error) { + error(xhr, status, error) + setData(null); + }, aqEnnable); + + // 项目简介赋值 + function setData(data) { + let proBrief = '暂无简介', html = ''; + let proImgList = []; + if (data) { + proBrief = data.proBrief ? data.proBrief : '暂无简介' + proImgList = data.fileData; + } + if (proImgList && proImgList.length > 0) { + $.each(proImgList, function (index, item) { + html += '
' + }) + } else { + html += '
' + } + $('#img-carousel').empty().append(html); + $('#pro-desc p').html(proBrief); + // 渲染 - 图片轮播 + carousel.render({ + elem: '#ID-carousel-demo-image', + width: '900px', + height: '360px', + interval: 3000 + }); + } +} + +/* 实时监测 */ +function loadRealMonitor(montageParam) { + const url = commonUrl + 'screen/largeScreen/xcIndex/getProJcData?params=' + montageParam; + ajaxRequestGet(url, "GET", true, function () { + }, function (result) { + if (result.code === 200) { + setData(result.data); + } else if (result.code === 500) { + console.error('实时监测' + result.msg); + setData(null); + } else if (result.code === 401) { + loginout(1); + } + }, function (xhr, status, error) { + error(xhr, status, error) + setData(null); + }, aqEnnable); + + /* 实时检测赋值 */ + function setData(data) { + if (data && data.length > 0) { + $.each(data, function (index, item) { + if (item.modelName === '温度') { + $('#wd').html(item.val ? item.val : 0); + } else if (item.modelName === '湿度') { + $('#sd').html(item.val ? item.val : 0); + } else if (item.modelName === '噪声') { + $('#zs').html(item.val ? item.val : 0); + } else if (item.modelName === '光照') { + $('#gz').html(item.val ? item.val : 0); + } else if (item.modelName === 'pm2') { + $('#pm2').html(item.val ? item.val : 0); + } else if (item.modelName === 'pm10') { + $('#pm10').html(item.val ? item.val : 0); + } + }) + } + } +} + +/* 项目风险 */ +function loadProRisk(montageParam) { + const url = commonUrl + 'screen/largeScreen/xcIndex/getProRisk?params=' + montageParam; + ajaxRequestGet(url, "GET", true, function () { + }, function (result) { + if (result.code === 200) { + setData(result.data); + } else if (result.code === 500) { + console.error('项目风险' + result.msg); + } else if (result.code === 401) { + loginout(1); + } + }, function (xhr, status, error) { + error(xhr, status, error) + }, aqEnnable); + + /* 项目风险赋值 */ + function setData(data) { + initEchartsOne(data.day, data.week, data.warn); + } +} + +/* 项目进度 */ +function loadProProgress(montageParam) { + const url = commonUrl + 'screen/largeScreen/xcIndex/getProcess?params=' + montageParam; + ajaxRequestGet(url, "GET", true, function () { + }, function (result) { + if (result.code === 200) { + setData(result.data); + } else if (result.code === 500) { + console.error('项目进度:' + result.msg); + } else if (result.code === 401) { + loginout(1); + } + }, function (xhr, status, error) { + error(xhr, status, error) + }, aqEnnable); + + /* 项目进度赋值 */ + function setData(data) { + if (data) { + $('#planStartTime').html(data.planStartTime); + $('#planEndTime').html(data.planEndTime); + initEchartsTwo(data.value2, data.value); + } + } +} + +/* 项目成本 */ +function loadProCost(montageParam) { + const url = commonUrl + 'screen/largeScreen/xcIndex/getProMoney?params=' + montageParam; + ajaxRequestGet(url, "GET", true, function () { + }, function (result) { + console.log(result); + if (result.code === 200) { + setData(result.data); + } else if (result.code === 500) { + console.error('项目成本:' + result.msg); + } else if (result.code === 401) { + loginout(1); + } + }, function (xhr, status, error) { + error(xhr, status, error) + }, aqEnnable); + function setData(data) { + let nameList = ['黄家村', '曹家村', '吕家村', '大草坝村', '庙坡村', '廉家庄村', '莲花池村', '小西关村', '杜家漕村', '栗子园村', '翟家寺村']; + let valueList = ['2', '3', '1', '1', '2', '2', '2', '6', '5', '3', '2']; + initEchartsThree(nameList,valueList); + } +} \ No newline at end of file diff --git a/js/pages/index/indexEcharts.js b/js/pages/index/indexEcharts.js index 2fff9f4..849737e 100644 --- a/js/pages/index/indexEcharts.js +++ b/js/pages/index/indexEcharts.js @@ -3,11 +3,11 @@ let myChart2 = echarts.init(document.getElementById('pro-progress-echarts')); let myChart3 = echarts.init(document.getElementById('pro-cost')); /* 项目风险 */ -function initEchartsOne() { +function initEchartsOne(day, week, warn) { let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; - let xLabel = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']; - let dataValue = [20, 30, 40, 35, 34, 15, 56, 15, 12, 25, 34, 42]; - let dataValue1 = [40, 35, 34, 15, 56, 15, 12, 25, 34, 42, 20, 30,]; + let xLabel = day; + let dataValue = week; + let dataValue1 = warn; const tooltip = { show: true, trigger: 'axis', @@ -243,16 +243,22 @@ function initEchartsOne() { } /* 计划进度 */ -function initEchartsTwo() { +function initEchartsTwo(value2, value) { let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; let kg = 0.3 // 计划进度、实际进度 - let total = 20; - let total_add = 30; + let total = value2; + let total_add = value; // 进度条占比 - let ljdata = total; - let newdata = total_add - total > 0 ? total_add - total : 0;; - let max = 100; + let ljdata = total_add > total ? total : total_add; + let newdata = total_add > total ? (total_add - total).toFixed(2) : (total - total_add).toFixed(2); + let str = total_add < total ? '实际进度' + '' + `${total_add}` + '%' : '计划进度' + '' + `${total}` + '%'; + let str2 = total_add > total ? '实际进度' + '' + `${total_add}` + '%' : '计划进度' + '' + `${total}` + '%'; + if (total === total_add) { + str2 = '实际进度' + '' + `${total_add}` + '%'; + str = '计划进度' + '' + `${total}` + '%'; + } + let max = 101; var option = { backgroundColor: 'transparent', yAxis: { @@ -275,8 +281,8 @@ function initEchartsTwo() { }, grid: { top: '20', - right: '10', - left: '20', + right: '50', + left: '50', bottom: '0', //图表尺寸大小 }, animationDuration: 2000, @@ -330,25 +336,16 @@ function initEchartsTwo() { color: 'transparent', }, label: { - // normal: { - // show: true, - // position: 'insideBottomRight', - // formatter: (params) => { - // return total - // }, - // distance: 0, - // offset: [-20, -5], - // color: '#fff', - // fontSize: 12, - // }, normal: { show: true, position: 'insideBottomRight', - formatter: '计划进度' + ' ' + `${total}` + '%', + formatter: str, + // formatter: '计划进度' + ' ' + `${total}` + '%', + // formatter: total_add < total ? '实际进度' + ' ' + `${total_add}` + '%' : '计划进度' + ' ' + `${total}` + '%', distance: 0, - offset: [50, 35], + offset: parseInt(total) === 100 ? [30, 35] :[60, 35], color: fontColor, - fontSize: fontSize, + fontSize: 12, padding: [12, 12, 12, 12], }, }, @@ -382,11 +379,13 @@ function initEchartsTwo() { normal: { show: true, position: 'insideBottomRight', - formatter: '实际进度' + ' ' + `${total_add}` + '%', + // formatter: total_add > total ? '实际进度' + ' ' + `${total_add}` + '%' : '计划进度' + ' ' + `${total}` + '%', + formatter: str2, distance: 0, - offset: [50, -21], + offset:parseInt(total_add) === 100 ? [30, -21] :[60, -21], + // offset: [50, -21], color: fontColor, - fontSize: fontSize, + fontSize: 12, padding: [12, 12, 12, 12], }, }, @@ -417,17 +416,6 @@ function initEchartsTwo() { color: 'transparent', }, label: { - // normal: { - // show: true, - // position: 'insideBottomRight', - // formatter: (params) => { - // return total_add - // }, - // distance: 0, - // offset: [-20, -5], - // color: '#fff', - // fontSize: 12, - // }, }, itemStyle: { normal: { @@ -446,7 +434,9 @@ function initEchartsTwo() { } /* 项目成本 */ -function initEchartsThree() { +function initEchartsThree(nameListData,valueListData) { + let nameList = nameListData; + let valueList = valueListData; let fontSize = '14', fontFamily = 'Alibaba PuHuiTi R', fontColor = '#fff'; const tooltip = { show: true, @@ -472,7 +462,7 @@ function initEchartsThree() { }, xAxis: { type: 'category', - data: ['黄家村', '曹家村', '吕家村', '大草坝村', '庙坡村', '廉家庄村', '莲花池村', '小西关村', '杜家漕村', '栗子园村', '翟家寺村'], + data: nameList, axisLine: { show: true, @@ -523,7 +513,7 @@ function initEchartsThree() { }, series: [{ barWidth: 14, - data: ['2', '3', '1', '1', '2', '2', '2', '6', '5', '3', '2'], + data: valueList, type: 'bar', itemStyle: { normal: { diff --git a/pages/index/index.html b/pages/index/index.html index d9b5614..a11ebf1 100644 --- a/pages/index/index.html +++ b/pages/index/index.html @@ -12,8 +12,9 @@ - + + 首页 @@ -23,61 +24,43 @@
-

45

+

0

温度

-

45%

+

0%

湿度

-

45分贝

+

0分贝

噪声

-

45kwh

+

0kwh

光照

-

45μg/m³

+

0μg/m³

PM2.5

-

45μg/m³

+

0μg/m³

PM10

@@ -85,12 +68,12 @@
-

2024-03-15

+

开始日期

-

2024-03-20

+

计划结束

@@ -98,6 +81,8 @@
+ + \ No newline at end of file diff --git a/sc_login.html b/sc_login.html index ce16b55..d42b3c8 100644 --- a/sc_login.html +++ b/sc_login.html @@ -9,7 +9,6 @@ - 登录 diff --git a/sg_login.html b/sg_login.html index aafc1d4..9a4dccf 100644 --- a/sg_login.html +++ b/sg_login.html @@ -9,7 +9,6 @@ - 登录