From 3e2690f4f8e42e826164431d7ecff4d7e6318fe6 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期日, 06 十月 2024 22:47:29 +0800
Subject: [PATCH] 1
---
src/views/mdc/station-live.vue | 114 ++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 93 insertions(+), 21 deletions(-)
diff --git a/src/views/mdc/station-live.vue b/src/views/mdc/station-live.vue
index 70027b6..1744fc6 100644
--- a/src/views/mdc/station-live.vue
+++ b/src/views/mdc/station-live.vue
@@ -2,7 +2,7 @@
* @Author: lzhe lzhe@example.com
* @Date: 2024-03-26 10:28:33
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-15 16:25:52
+ * @LastEditTime: 2024-10-06 22:46:49
* @FilePath: /smart-web/src/views/master/person/main/index.vue
* @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -38,16 +38,16 @@
<div class="collect-info-panel">
<div class="fact-analysis-realtim">
<div class="wimi-empty" style="background-color: rgb(255, 255, 255);" v-if="dmpList.length == 0">
- <div class="wimi-empty-img" style="width: 150px; height: 150px;">
+ <!-- <div class="wimi-empty-img" style="width: 150px; height: 150px;">
<img src="./quesheng.bd026700.png" style="height: auto; width: 100%;">
- </div>
+ </div> -->
<div class="empty-description">
<div>鏆傛棤鏁版嵁</div>
</div>
</div>
<div class="fact-analysis-card" v-for="item in dmpList" v-if="dmpList.length != 0">
- <div class="card-name" style="background-color: rgb(127, 192, 192);">{{item.description}}</div>
- <div class="card-value" style="background-color: rgba(127, 192, 192, 0.14);"></div>
+ <div class="card-name" :style="{'background-color': item.color}">{{item.description}}</div>
+ <div :class="{'card-value': true,'card-value-bg1':item.name != 'Alarm','card-value-bg2':item.name == 'Alarm'}">{{item.codeName}}</div>
</div>
</div>
</div>
@@ -70,7 +70,7 @@
<div class="status-box" v-for="item in achievements"><div class="status-color" :style="{'background-color': item.color}"></div>{{ item.name }}</div>
</div>
<div class="status-wrap">
- <el-checkbox v-model="checked1" label="浜哄伐鍙嶉鐘舵��" size="large" />
+ <el-checkbox v-model="humanFeedback" label="浜哄伐鍙嶉鐘舵��" size="large" />
<div class="status-con">
<div class="status-box" v-for="item in collectionstatus"><div class="status-color" :style="{'background-color': item.color}"></div>{{ item.name }}</div>
</div>
@@ -133,7 +133,7 @@
return {
achievements: [],
collectionstatus: [],
- checked1: "",
+ humanFeedback: "",
alarmtotal: 0,
alarmtableData: [],
wcsDate: "",
@@ -151,7 +151,7 @@
tooltip: {
trigger: 'item',
//formatter: '{a} <br/>{b} : {c} ({d}%)'
- formatter: '{a} 0鍒嗛挓'
+ formatter: '{a} {c}鍒嗛挓'
},
legend: {
orient: 'vertical',
@@ -336,7 +336,7 @@
getrecord() { //鐝鐘舵�佽褰晅able
var obj = {
date: this.wcsDate,
- humanFeedback: true,
+ humanFeedback: this.humanFeedback,
workstationId: this.lastLevelId
}
this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
@@ -410,9 +410,9 @@
},
getlogcart() { //鐝鐘舵�佽褰昪hart
var obj = {
- //date: this.wcsDate,
- date : "2024-05-15",
- humanFeedback: true,
+ date: this.wcsDate,
+ //date : "2024-05-15",
+ humanFeedback: this.humanFeedback,
workstationId: this.lastLevelId
}
this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
@@ -420,6 +420,16 @@
var yAxisData = [];
var newData = [];
this.records = res.data.reverse();
+ res.data.forEach(item=> {
+ if(item.statusRecordList == null) item.statusRecordList = [];
+ var filterRecordList = [];
+ item.statusRecordList.forEach(item1=> {
+ if(item1.endTime.startsWith(this.wcsDate)) { //鍙繑鍥炲綋鍓嶇粨鏉熸棩鏈熺殑
+ filterRecordList.push(item1)
+ }
+ })
+ item.statusRecordList = filterRecordList;
+ })
res.data.forEach((item,index)=> {
yAxisData.push(item.shiftIndex);
//璁$畻寮�濮嬫椂闂达紝鏄剧ず鏃堕棿
@@ -442,7 +452,7 @@
var nowTime = moment().format("HH:mm:ss"); //11:37:54
var spaceTime = moment(obj.date + " " + nowTime).diff(moment(obj.date + " 00:00:00"), 'hours'); //绂诲綋澶�00:00:00杩囦簡澶氬皯灏忔椂
- console.log(spaceTime,obj.date + " " + nowTime,234)
+ //console.log(spaceTime,obj.date + " " + nowTime,234)
return;
//璁$畻鏃堕棿
var startOfDay = moment().startOf('day'); //00:00:00
@@ -495,7 +505,6 @@
interval: 1440/6, //姣忛殧澶氬皯鍒嗛挓鏄剧ず涓�涓埢搴�
axisLabel: {
formatter: (value)=> {
- console.log(value,111)
if(value == 0) {
return "00:00:00";
}else if(value == 240) {
@@ -551,7 +560,7 @@
getwscLvalue() {
var obj = {
date: this.wcsDate,
- humanFeedback: true,
+ humanFeedback: this.humanFeedback,
workstationId: this.lastLevelId
}
this.$HTTP.post(`/api/blade-mdc/status-record/time-distribution`,obj).then(res=> {
@@ -560,7 +569,7 @@
var wcsOption = JSON.parse(JSON.stringify(this.wcsBeginOption));
if(res.data.length == 0) {
wcsOption.forEach(item=> {
- item.value = 20;
+ item.value = 0;
})
}else {
wcsOption.forEach(item=> {
@@ -590,7 +599,7 @@
getwcsR() {
var obj = {
date: this.wcsDate,
- humanFeedback: true,
+ humanFeedback: this.humanFeedback,
workstationId: this.lastLevelId
}
this.$HTTP.post(`/api/blade-mdc/status-record/equipment-efficiency`,obj).then(res=> {
@@ -624,7 +633,7 @@
if(res.code == 200) {
this.stationForm = res.data;
this.getdmp(this.lastLevelId,this.stationForm.machineId);
- this.newDate(); //鑾峰彇褰撳墠鏃ユ湡
+ //this.newDate(); //鑾峰彇褰撳墠鏃ユ湡
this.getwcsR();
this.getwscLvalue(); //宸︿晶鍥捐〃
this.alarmsearchBtn(); //鏈哄櫒灞ュ巻
@@ -635,10 +644,66 @@
}
},
getdmp(lastLevelId,machineId) {
- this.$HTTP.get(`/api/blade-cps/workstation/get-dmp-variables?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
+ this.$HTTP.get(`/api/blade-cps/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
if(res.code == 200) {
- this.dmpList = res.data;
- console.log(this.dmpList,111)
+ this.dmpList = [];
+ var that = this;
+ //鍙戦�亀ebsocket
+ var obj = {
+ type: "realTimeData",
+ workstationIdList: [lastLevelId]
+ }
+ if(res.data.dpConfig == null || res.data.dpConfig.length == 0) return; //娌″�间笉鐢ㄥ惊鐜�
+ if(this.$TOOL.socket.websocket == null) { //娌℃湁寤虹珛鍏堝缓绔�
+ this.$TOOL.socket.connectToWebSocket(this.$TOOL.cookie.get("TOKEN"));
+ }
+ this.$TOOL.socket.sendDataToWebSocket(obj); //鍙戦��
+ this.$TOOL.socket.websocket.onmessage = function(event) {
+ var JSONData = JSON.parse(res.data.dpConfig);
+ JSONData.forEach((item,index)=> { //绗竴姝ユ妸v鏀惧埌code閲�
+ var eventData = JSON.parse(event.data);
+ if(item.dpName == "DeviceStatus") { //鏈哄櫒鐘舵��
+ if(eventData.data[item.dpName]) {
+ item.code = eventData.data[item.dpName].v;
+ }
+ that.allwcs.forEach((item1)=> {
+ if(item.code == item1.code) {
+ item.codeName = item1.name; //绗簩姝ユ妸v鐨刢ode鍜岃繍琛屽搴�
+ if(item.code == "2") {
+ item.color = "#73D13D";
+ }else {
+ item.color = "#75C0C0";
+ }
+ }
+ })
+ }else {
+ if(item.dpName == 'Alarm') { //鎶ヨ
+ if(eventData.data[item.dpName]) {
+ var v = JSON.parse(eventData.data[item.dpName].v);
+ if(Array.isArray(v)) { //濡傛灉鏄暟缁勶紝涓嶈祴鍊�
+ if(v.length == 0) {
+ JSONData.splice(index,1);
+ }else {
+ item.description = v[0].code;
+ item.codeName = v[0].msg;
+ item.color = "#370C0D";
+ }
+ }else {
+ item.description = v.code;
+ item.codeName = v.msg;
+ item.color = "#370C0D";
+ }
+ }
+ }else {
+ if(eventData.data[item.dpName]) {
+ item.codeName = eventData.data[item.dpName].v;
+ }
+ item.color = "#75C0C0";
+ }
+ }
+ });
+ that.dmpList = JSONData;
+ };
}
})
},
@@ -854,6 +919,13 @@
padding: 0 8px;
overflow: hidden;
word-break: break-all;
+ line-height: 68px;
+}
+.card-value-bg1 {
+ background-color: rgba(115, 209, 61, 0.14);
+}
+.card-value-bg2 {
+ background-color: rgba(55, 12, 13, 0.14);
}
.wcs-main {
display: flex;
--
Gitblit v1.9.3