| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>MES可视化大屏</title>
- <link rel="stylesheet" href="${ctxStatic}/bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet" href="${ctxStatic}/screen/style.css">
- <style>
- .dashboard{
- position: absolute;
- top: 132px;
- left: 25px;
- right: 25px;
- bottom: 110px;
- z-index: 100;
- }
- .overview-row{
- display: flex;
- gap: 18px;
- height: 126px;
- margin-bottom: 18px;
- }
- .overview-card{
- position: relative;
- flex: 1;
- padding: 24px 28px;
- background: linear-gradient(135deg, rgba(17, 46, 109, 0.88), rgba(7, 22, 54, 0.78));
- border: 1px solid rgba(64, 173, 255, 0.35);
- box-shadow: inset 0 0 26px rgba(56, 160, 255, 0.12), 0 10px 24px rgba(0, 10, 35, 0.4);
- overflow: hidden;
- }
- .overview-card:before{
- content: "";
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 3px;
- background: linear-gradient(90deg, rgba(55, 180, 255, 0.1), rgba(55, 180, 255, 0.9), rgba(55, 180, 255, 0.1));
- }
- .overview-label{
- font-size: 18px;
- color: #79CFFF;
- letter-spacing: 2px;
- }
- .overview-value{
- margin-top: 16px;
- font-size: 46px;
- line-height: 1;
- font-weight: bold;
- color: #FFFFFF;
- font-family: FZChaoCuHei-M10S;
- }
- .overview-sub{
- margin-top: 14px;
- font-size: 16px;
- color: rgba(196, 231, 255, 0.72);
- }
- .dashboard-main{
- display: flex;
- gap: 18px;
- height: calc(100% - 144px);
- }
- .panel-box{
- background: linear-gradient(180deg, rgba(10, 28, 70, 0.92), rgba(5, 15, 38, 0.88));
- border: 1px solid rgba(64, 173, 255, 0.28);
- box-shadow: inset 0 0 32px rgba(60, 143, 255, 0.12), 0 12px 30px rgba(0, 0, 0, 0.22);
- }
- .table-panel{
- flex: 0 0 1210px;
- padding: 22px 22px 18px;
- }
- .side-panel{
- flex: 1;
- display: flex;
- flex-direction: column;
- gap: 18px;
- }
- .panel-title{
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 42px;
- line-height: 42px;
- margin-bottom: 16px;
- padding-left: 16px;
- padding-right: 16px;
- background: linear-gradient(90deg, rgba(24, 78, 166, 0.58), rgba(24, 78, 166, 0.08));
- color: #7ED4FF;
- font-size: 22px;
- font-weight: bold;
- }
- .panel-title span{
- font-size: 16px;
- font-weight: normal;
- color: rgba(182, 227, 255, 0.75);
- }
- .oprnobox-header{
- display: flex;
- align-items: center;
- height: 58px;
- padding: 0 12px;
- background: rgba(20, 55, 120, 0.85);
- font-size: 20px;
- color: #3DB3FF;
- font-weight: bold;
- text-align: center;
- border: 1px solid rgba(73, 163, 255, 0.2);
- }
- .oprnobox-header > div{
- flex-shrink: 0;
- }
- .oprno-num{
- width: 150px;
- }
- .oprno-title{
- width: 330px;
- }
- .oprno-shift{
- width: 170px;
- }
- .oprno-day{
- width: 170px;
- }
- .oprno-rate{
- flex: 1;
- min-width: 0;
- }
- #numbox{
- margin-top: 14px;
- }
- .oprnobox-list{
- display: flex;
- align-items: center;
- height: 68px;
- padding: 0 12px;
- margin-bottom: 12px;
- background: linear-gradient(90deg, rgba(14, 49, 108, 0.86), rgba(8, 25, 59, 0.78));
- border: 1px solid rgba(62, 163, 255, 0.18);
- box-shadow: inset 0 0 18px rgba(56, 160, 255, 0.08);
- font-size: 28px;
- text-align: center;
- font-family: FZChaoCuHei-M10S;
- font-weight: 400;
- color: #FFFFFF;
- }
- .oprnobox-list:nth-child(even){
- background: linear-gradient(90deg, rgba(11, 41, 92, 0.92), rgba(6, 22, 51, 0.82));
- }
- .oprnobox-list .oprno-num{
- font-size: 24px;
- color: #6CD6FF;
- }
- .oprnobox-list .oprno-title{
- padding: 0 12px;
- font-size: 24px;
- text-align: left;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .oprnobox-list .oprno-shift,
- .oprnobox-list .oprno-day{
- font-size: 28px;
- color: #FFFFFF;
- }
- .rate-box{
- display: flex;
- align-items: center;
- gap: 14px;
- padding-right: 8px;
- }
- .rate-track{
- position: relative;
- flex: 1;
- height: 14px;
- border-radius: 10px;
- background: rgba(255, 255, 255, 0.08);
- overflow: hidden;
- }
- .rate-bar{
- height: 100%;
- border-radius: 10px;
- background: linear-gradient(90deg, #1ED4FF, #2FF4A6);
- box-shadow: 0 0 12px rgba(47, 244, 166, 0.35);
- }
- .rate-text{
- width: 76px;
- font-size: 22px;
- color: #8AE4FF;
- }
- .chart-panel{
- flex: 1;
- padding: 18px 18px 10px;
- }
- .chart-box{
- height: calc(100% - 58px);
- }
- .empty-box{
- display: flex;
- align-items: center;
- justify-content: center;
- height: calc(100% - 58px);
- font-size: 28px;
- color: rgba(185, 223, 255, 0.6);
- letter-spacing: 4px;
- }
- .dangerbox{
- position: absolute;
- z-index: 100000;
- bottom: 25px;
- left: 25px;
- width: 1870px;
- height: 64px;
- line-height: 64px;
- padding: 0 20px;
- text-align: center;
- background: rgba(255, 0, 0, 0.15);
- border: 1px solid rgba(255, 74, 74, 0.6);
- box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.08);
- color: #FF8F8F;
- font-family: Microsoft YaHei;
- font-weight: 400;
- font-size: 28px;
- display: none;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- </style>
- </head>
- <body id="app">
- <div class="screenbg">
- <img class="bg1" src="${ctxStatic}/screen/imgs/bg.png" alt="">
- <img class="bg2" style="display: none;" src="${ctxStatic}/screen/imgs/bg2.png" alt="">
- </div>
- <div class="screenbox1">
- <div class="screenmain">
- <div class="screen-title">MES系统生产数据大屏</div>
- <div class="dashboard">
- <div class="overview-row">
- <div class="overview-card">
- <div class="overview-label">工位总数</div>
- <div class="overview-value" id="overviewCount">46</div>
- <div class="overview-sub" id="overviewPageCount">当前页 46 个工位</div>
- </div>
- <div class="overview-card">
- <div class="overview-label">当班总产值</div>
- <div class="overview-value" id="overviewShift">0</div>
- <div class="overview-sub">当前班次累计</div>
- </div>
- <div class="overview-card">
- <div class="overview-label">当日总产值</div>
- <div class="overview-value" id="overviewDay">0</div>
- <div class="overview-sub">08:00 至次日 08:00</div>
- </div>
- <div class="overview-card">
- <div class="overview-label">当班合格率</div>
- <div class="overview-value" id="overviewRate">0%</div>
- <div class="overview-sub" id="overviewPage">OK 0 / NG 0</div>
- </div>
- </div>
- <div class="dashboard-main">
- <div class="table-panel panel-box">
- <div class="panel-title">工位产值明细 </div>
- <div class="oprnobox-header">
- <div class="oprno-num">工位</div>
- <div class="oprno-title">工位名称</div>
- <div class="oprno-shift">当班产值</div>
- <div class="oprno-day">当日产值</div>
- <div class="oprno-rate">合格率</div>
- </div>
- <div id="numbox"></div>
- </div>
- <div class="side-panel">
- <div class="chart-panel panel-box">
- <div class="panel-title">当前页工位对比 <span>当班 / 当日</span></div>
- <div id="shiftDayChart" class="chart-box"></div>
- </div>
- <div class="chart-panel panel-box">
- <div class="panel-title">日产值 TOP 6 <span>全工位排名</span></div>
- <div id="topChart" class="chart-box"></div>
- </div>
- </div>
- </div>
- </div>
- <div class="dangerbox" id="dangerbox">
- </div>
- </div>
- </div>
- <script src="${ctxStatic}/jquery-1.11.3.min.js"></script>
- <script src="${ctxStatic}/leaflet/js/echarts.min.js"></script>
- <script>
- let lists = [];
- let overviewData = {};
- let topListData = [];
- let pageSize = 9;
- let pageIndex = 0;
- let shiftDayChart = null;
- let topChart = null;
- $(window).resize(function(){
- location.reload()
- });
- $(function () {
- changeZoom();
- initCharts();
- getData();
- getAlarmData();
- setInterval(function () {
- getData();
- },1000*60*2);
- setInterval(function () {
- formatData();
- getAlarmData();
- },1000*10);
- });
- function initCharts() {
- if (window.echarts) {
- shiftDayChart = echarts.init(document.getElementById('shiftDayChart'));
- topChart = echarts.init(document.getElementById('topChart'));
- }
- }
- function getData() {
- let url = "/js/a/mes/mesProduct/screenDashboardData";
- $.post(url,function (ret) {
- let data = ret.data || {};
- lists = $.isArray(data.list) ? data.list : [];
- overviewData = data.overview || {};
- topListData = $.isArray(data.topList) ? data.topList : [];
- pageIndex = 0;
- formatData();
- });
- }
- function getAlarmData() {
- let url = "/js/a/mes/mesProduct/alarmData";
- $.post(url,function (ret) {
- if(ret.result == "true"){
- let str = ret.data.createDate+" 【"+ret.data.oprno+"-"+ret.data.title+"】"+ret.data.remark+":"+ret.data.sn;
- $("#dangerbox").show().text(str);
- }else{
- $("#dangerbox").hide().text("");
- }
- });
- }
- function formatData(){
- let pageData = getPageData();
- renderOverview(pageData);
- renderTable(pageData.list);
- renderCharts(pageData.list);
- if (pageData.totalPages > 1) {
- pageIndex = (pageIndex + 1) % pageData.totalPages;
- }
- }
- function getPageData() {
- let totalPages = Math.ceil(lists.length / pageSize);
- if (totalPages < 1) {
- totalPages = 1;
- }
- if (pageIndex >= totalPages) {
- pageIndex = 0;
- }
- let start = pageIndex * pageSize;
- let end = start + pageSize;
- return {
- list: lists.slice(start, end),
- totalPages: totalPages,
- currentPage: lists.length ? pageIndex + 1 : 0
- };
- }
- function renderOverview(pageData) {
- let totalShift = normalizeNumber(overviewData.totalShift);
- let totalDay = normalizeNumber(overviewData.totalDay);
- let shiftOkCount = normalizeNumber(overviewData.shiftOkCount);
- let shiftNgCount = normalizeNumber(overviewData.shiftNgCount);
- let rate = normalizeDecimal(overviewData.qualityRate).toFixed(1);
- $("#overviewCount").text(normalizeNumber(46));
- $("#overviewPageCount").text("当前页 " + pageData.list.length + " 个工位");
- $("#overviewShift").text(totalShift);
- $("#overviewDay").text(totalDay);
- $("#overviewRate").text(rate + "%");
- $("#overviewPage").text("OK " + shiftOkCount + " / NG " + shiftNgCount);
- }
- function renderTable(dataList) {
- let str = '';
- if (!dataList.length) {
- str = '<div class="empty-box">暂无生产数据</div>';
- $("#numbox").html(str);
- return;
- }
- $.each(dataList, function (idx, item) {
- let shiftCount = normalizeNumber(item.shiftCount);
- let dayCount = normalizeNumber(item.dayCount);
- let rateValue = normalizeDecimal(item.qualityRate);
- let rateWidth = Math.max(6, Math.min(rateValue, 100));
- str += '<div class="oprnobox-list">';
- str += '<div class="oprno-num">' + escapeHtml(item.oprno) + '</div>';
- str += '<div class="oprno-title">' + escapeHtml(item.title) + '</div>';
- str += '<div class="oprno-shift">' + shiftCount + '</div>';
- str += '<div class="oprno-day">' + dayCount + '</div>';
- str += '<div class="oprno-rate">';
- str += '<div class="rate-box">';
- str += '<div class="rate-track"><div class="rate-bar" style="width:' + rateWidth + '%;"></div></div>';
- str += '<div class="rate-text">' + rateValue.toFixed(1) + '%</div>';
- str += '</div>';
- str += '</div>';
- str += '</div>';
- });
- $("#numbox").html(str);
- }
- function renderCharts(dataList) {
- renderShiftDayChart(dataList);
- renderTopChart();
- }
- function renderShiftDayChart(dataList) {
- if (!shiftDayChart) {
- return;
- }
- if (!dataList.length) {
- shiftDayChart.clear();
- return;
- }
- let categories = [];
- let shiftData = [];
- let dayData = [];
- $.each(dataList, function (idx, item) {
- categories.push(item.oprno || '');
- shiftData.push(normalizeNumber(item.shiftCount));
- dayData.push(normalizeNumber(item.dayCount));
- });
- shiftDayChart.setOption({
- backgroundColor: 'transparent',
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- top: 6,
- right: 10,
- textStyle: {
- color: '#BFE8FF'
- },
- data: ['当班产值', '当日产值']
- },
- grid: {
- top: 46,
- left: 44,
- right: 22,
- bottom: 42,
- borderWidth: 0
- },
- xAxis: [
- {
- type: 'category',
- data: categories,
- axisLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.35)'
- }
- },
- axisLabel: {
- textStyle: {
- color: '#CDEFFF',
- fontSize: 12
- }
- }
- }
- ],
- yAxis: [
- {
- type: 'value',
- axisLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.35)'
- }
- },
- splitLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.12)'
- }
- },
- axisLabel: {
- textStyle: {
- color: '#CDEFFF',
- fontSize: 12
- }
- }
- }
- ],
- series: [
- {
- name: '当班产值',
- type: 'bar',
- barMaxWidth: 18,
- itemStyle: {
- normal: {
- color: '#1FD6FF'
- }
- },
- data: shiftData
- },
- {
- name: '当日产值',
- type: 'bar',
- barMaxWidth: 18,
- itemStyle: {
- normal: {
- color: '#35E595'
- }
- },
- data: dayData
- }
- ]
- }, true);
- }
- function renderTopChart() {
- if (!topChart) {
- return;
- }
- if (!topListData.length) {
- topChart.clear();
- return;
- }
- let categories = [];
- let values = [];
- $.each(topListData, function (idx, item) {
- categories.push(item.oprno || '');
- values.push(normalizeNumber(item.dayCount));
- });
- topChart.setOption({
- backgroundColor: 'transparent',
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- grid: {
- top: 16,
- left: 90,
- right: 30,
- bottom: 18,
- borderWidth: 0
- },
- xAxis: [
- {
- type: 'value',
- splitLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.12)'
- }
- },
- axisLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.35)'
- }
- },
- axisLabel: {
- textStyle: {
- color: '#CDEFFF',
- fontSize: 12
- }
- }
- }
- ],
- yAxis: [
- {
- type: 'category',
- data: categories,
- axisLine: {
- lineStyle: {
- color: 'rgba(120, 187, 255, 0.35)'
- }
- },
- axisTick: {
- show: false
- },
- axisLabel: {
- textStyle: {
- color: '#CDEFFF',
- fontSize: 12
- }
- }
- }
- ],
- series: [
- {
- name: '当日产值',
- type: 'bar',
- barMaxWidth: 18,
- itemStyle: {
- normal: {
- color: '#3C86FF',
- label: {
- show: true,
- position: 'right',
- textStyle: {
- color: '#E4F7FF'
- }
- }
- }
- },
- data: values
- }
- ]
- }, true);
- }
- function normalizeNumber(value) {
- let num = parseInt(value, 10);
- return isNaN(num) ? 0 : num;
- }
- function normalizeDecimal(value) {
- let num = parseFloat(value);
- return isNaN(num) ? 0 : num;
- }
- function escapeHtml(value) {
- let text = value == null ? '' : String(value);
- return text
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
- }
- function changeZoom() {
- var wb = $(window).width() / 1920;
- var hb = $(window).height() / 1080;
- if (wb >= hb) {
- $('body').css({
- 'zoom': hb,
- });
- } else {
- $('body').css({
- 'zoom': wb,
- });
- }
- }
- </script>
- </body>
- </html>
|