施工大屏首页

This commit is contained in:
cwchen 2024-04-01 09:12:20 +08:00
parent 09e2b506f0
commit aa8f886ac5
9 changed files with 233 additions and 102 deletions

View File

@ -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,

View File

@ -38,6 +38,11 @@ body {
justify-content: space-between;
}
#img-carousel img {
width: 900px;
height: 360px;
}
#pro-desc {
width: 100%;
height: calc(100% - 380px);

View File

@ -37,6 +37,6 @@ layui.use(function () {
}
}, function (xhr, status, error) {
error(xhr, status, error)
}, "application/json");
}, "application/json",aqEnnable);
});
});

View File

@ -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);
}

156
js/pages/index/indexAjax.js Normal file
View File

@ -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 += '<div><img src="' + item.base64Url + '"></div>'
})
} else {
html += '<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-1.jpg"></div>'
}
$('#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);
}
}

View File

@ -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: {

View File

@ -12,8 +12,9 @@
<script src="../../plugin/scroll/jquery.nicescroll.min.js"></script>
<script src="../../js/publics/echarts.js"></script>
<script src="../../plugin/layui-v2.9.7/layui/layui.js"></script>
<script src="../../js/publics/aes.js"></script>
<script src="../../js/publics/aescbc.js"></script>
<script src="../../js/publics/sm3.js"></script>
<script src="../../api/commonRequest.js"></script>
<title>首页</title>
</head>
@ -23,61 +24,43 @@
<!-- 项目简介 -->
<div id="pro-introduct" class="layout">
<div class="layui-carousel" id="ID-carousel-demo-image">
<div carousel-item>
<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-1.jpg"></div>
<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-2.jpg"></div>
<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-3.jpg"></div>
<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-4.jpg"></div>
<div><img src="https://unpkg.com/outeres/demo/carousel/720x360-5.jpg"></div>
<div id="img-carousel" carousel-item>
</div>
</div>
<div id="pro-desc">
<p>
变电工程建设项目是为了满足电力系统的需求,并提供可靠稳定的电力供应而进行的工程项目。它涉及到变电站的建设、改造或扩建。
首先,在变电工程建设项目中,选址是一个重要的环节。通过科学的评估和分析,选择适合建设变电站的地点。选址需要考虑到地理条件、周边环境、输电线路的布局等因素,以确保变电站的正常运行,并最大限度地降低对周围环境和居民的影响。
其次,变电工程建设项目还需要进行详细的设计。设计阶段包括确定变电站的容量、类型和配置各种设备的布局。通过合理的设计,确保变电站能够满足电力系统的要求,提高输电效率和能源利用率。
然后,施工阶段是将设计方案付诸实践的阶段。施工过程中,需要进行基础设施建设、设备安装、线路连接等工作。施工单位需要按照相关的标准和规范进行操作,保证工程质量,并严格落实安全管理措施,确保施工过程的安全性。
变电工程建设项目是为了满足电力系统的需求,并提供可靠稳定的电力供应而进行的工程项目。它涉及到变电站的建设、改造或扩建。
首先,在变电工程建设项目中,选址是一个重要的环节。通过科学的评估和分析,选择适合建设变电站的地点。选址需要考虑到地理条件、周边环境、输电线路的布局等因素,以确保变电站的正常运行,并最大限度地降低对周围环境和居民的影响。
其次,变电工程建设项目还需要进行详细的设计。设计阶段包括确定变电站的容量、类型和配置各种设备的布局。通过合理的设计,确保变电站能够满足电力系统的要求,提高输电效率和能源利用率。
然后,施工阶段是将设计方案付诸实践的阶段。施工过程中,需要进行基础设施建设、设备安装、线路连接等工作。施工单位需要按照相关的标准和规范进行操作,保证工程质量,并严格落实安全管理措施,确保施工过程的安全性。
变电工程建设项目是为了满足电力系统的需求,并提供可靠稳定的电力供应而进行的工程项目。它涉及到变电站的建设、改造或扩建。
首先,在变电工程建设项目中,选址是一个重要的环节。通过科学的评估和分析,选择适合建设变电站的地点。选址需要考虑到地理条件、周边环境、输电线路的布局等因素,以确保变电站的正常运行,并最大限度地降低对周围环境和居民的影响。
其次,变电工程建设项目还需要进行详细的设计。设计阶段包括确定变电站的容量、类型和配置各种设备的布局。通过合理的设计,确保变电站能够满足电力系统的要求,提高输电效率和能源利用率。
然后,施工阶段是将设计方案付诸实践的阶段。施工过程中,需要进行基础设施建设、设备安装、线路连接等工作。施工单位需要按照相关的标准和规范进行操作,保证工程质量,并严格落实安全管理措施,确保施工过程的安全性。
</p>
<p></p>
</div>
</div>
</div>
<div id="right-box" class="layout">
<div id="real-time-monitor" class="layout">
<div class="layout monitor-data">
<p><span>45</span><span></span></p>
<p><span id="wd">0</span><span></span></p>
<p>温度</p>
<div class="monitor-icon"></div>
</div>
<div class="layout monitor-data">
<p><span>45</span><span>%</span></p>
<p><span id="sd">0</span><span>%</span></p>
<p>湿度</p>
<div class="monitor-icon"></div>
</div>
<div class="layout monitor-data">
<p><span>45</span><span>分贝</span></p>
<p><span id="zs">0</span><span>分贝</span></p>
<p>噪声</p>
<div class="monitor-icon"></div>
</div>
<div class="layout monitor-data">
<p><span>45</span><span>kwh</span></p>
<p><span id="gz">0</span><span>kwh</span></p>
<p>光照</p>
<div class="monitor-icon"></div>
</div>
<div class="layout monitor-data">
<p><span>45</span><span>μg/m³</span></p>
<p><span id="pm2">0</span><span>μg/m³</span></p>
<p>PM2.5</p>
<div class="monitor-icon"></div>
</div>
<div class="layout monitor-data">
<p><span>45</span><span>μg/m³</span></p>
<p><span id="pm10">0</span><span>μg/m³</span></p>
<p>PM10</p>
<div class="monitor-icon"></div>
</div>
@ -85,12 +68,12 @@
<div id="pro-risk"></div>
<div id="pro-progress" class="layout">
<div id="pro-start" class="layout">
<p>2024-03-15</p>
<p id="planStartTime"></p>
<p>开始日期</p>
</div>
<div id="pro-progress-echarts"></div>
<div id="pro-end" class="layout">
<p>2024-03-20</p>
<p id="planEndTime"></p>
<p>计划结束</p>
</div>
</div>
@ -98,6 +81,8 @@
</div>
</div>
</body>
<script src="../../js/pages/index/indexAjax.js" type="text/javascript"></script>
<script src="../../js/pages/index/indexEcharts.js" type="text/javascript"></script>
<script src="../../js/pages/index/index.js" type="text/javascript"></script>
</html>

View File

@ -9,7 +9,6 @@
<link rel="stylesheet" href="css/login.css">
<script src="js/publics/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="plugin/layui-v2.9.7/layui/layui.js"></script>
<script src="js/publics/public.js" type="text/javascript"></script>
<script src="api/commonRequest.js" type="text/javascript"></script>
<script src="js/publics/aescbc.js"></script>
<title>登录</title>

View File

@ -9,7 +9,6 @@
<link rel="stylesheet" href="css/login.css">
<script src="js/publics/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="plugin/layui-v2.9.7/layui/layui.js"></script>
<script src="js/publics/public.js" type="text/javascript"></script>
<script src="api/commonRequest.js" type="text/javascript"></script>
<script src="js/publics/aescbc.js"></script>
<title>登录</title>