From 4f17438e8199eb44c98d6fcc888dc08ece3bab19 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期五, 08 十一月 2024 18:14:05 +0800
Subject: [PATCH] 1
---
src/views/mdc/station-live.vue | 156 +++++++++++++++++----------------------------------
1 files changed, 53 insertions(+), 103 deletions(-)
diff --git a/src/views/mdc/station-live.vue b/src/views/mdc/station-live.vue
index 51a59cf..9ece0d4 100644
--- a/src/views/mdc/station-live.vue
+++ b/src/views/mdc/station-live.vue
@@ -2,19 +2,19 @@
* @Author: lzhe lzhe@example.com
* @Date: 2024-03-26 10:28:33
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-07 00:49:07
+ * @LastEditTime: 2024-11-08 15:55:24
* @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
-->
<template>
<div class="aposcope-main">
<div class="aposcope-left">
- <div class="left-title">鏌ヨ鏉′欢</div>
- <el-tree :data="tableData" node-key="id" default-expand-all :expand-on-click-node="false" :props="defalutProps" @node-click="handleNodeClick" ref="treeRef" highlight-current />
+ <el-row style="margin: 8px;font-size: 14px;">宸ヤ綅</el-row>
+ <MYTree v-model="treeChecked" @loaded="query"></MYTree>
</div>
<div class="aposcope-right">
<div class="content-machine-box">
- <div class="content-machine-img"><img src="./station.png" alt=""></div>
+ <div class="content-machine-img"><img :src="stationForm.avatar" alt=""></div>
<div class="content-machine-detail">
<div class="content-machine-name">{{stationForm.machineName}}</div>
<el-form :model="stationForm" ref="dialogForm" label-width="80px" label-position="center" style="width: 100%;">
@@ -46,7 +46,7 @@
</div>
</div>
<div class="fact-analysis-card" v-for="item in dmpList" v-if="dmpList.length != 0">
- <div class="card-name" :style="{'background-color': item.color}">{{item.description}}</div>
+ <div class="card-name" :style="{'background-color': item.color}">{{item.dpLabel}}</div>
<div :class="{'card-value': true,'card-value-bg1':item.name != 'Alarm','card-value-bg2':item.name == 'Alarm'}">{{item.codeName}}</div>
</div>
</div>
@@ -121,16 +121,19 @@
</el-tabs>
</div>
</div>
- <save-dialog v-if="dialog.save" ref="saveDialog" @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog>
+ <save-dialog v-if="dialog.save" ref="saveDialog" @success="addfeedbackSuccess" :workstationId="treeChecked.toString()" @closed="dialog.save=false"></save-dialog>
</template>
<script>
+ import station from "./station.png";
import moment from 'moment'
import * as echarts from 'echarts';
- import saveDialog from './add-station-status'
+ import saveDialog from './add-station-status';
+ import MYTree from './MYTree.vue';
export default {
name: "state-feedback",
data(){
return {
+ treeChecked: [],
achievements: [],
collectionstatus: [],
humanFeedback: "",
@@ -260,7 +263,6 @@
dialog: {
save: false
},
- lastLevelId: "",
current: "1",
size: "15",
searchData: {
@@ -293,18 +295,22 @@
created(){
},
+ watch: {
+ treeChecked() {
+ this.query()
+ }
+ },
mounted(){
this.newDate(); //鑾峰彇褰撳墠鏃ユ湡
- this.getTreeList(this.$route.query.code);
},
components: {
- saveDialog
+ saveDialog,MYTree
},
methods: {
table_edit(){
this.dialog.save = true
this.$nextTick(() => {
- this.$refs.saveDialog.open('edit').setData(this.lastLevelId);
+ this.$refs.saveDialog.open('edit').setData(this.treeChecked.toString());
})
},
alarmSizeChange(val) {
@@ -319,7 +325,7 @@
this.alarmsearchBtn();
},
alarmsearchBtn() {
- this.$HTTP.get(`/api/blade-mdc/work-station-analysis/alarm/${this.lastLevelId}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
+ this.$HTTP.get(`/api/mdc/work-station-analysis/alarm/${this.treeChecked.toString()}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
if(res.code == 200) {
this.alarmtableData = res.data.records;
this.alarmtotal = res.data.total;
@@ -337,9 +343,9 @@
var obj = {
date: this.wcsDate,
humanFeedback: this.humanFeedback,
- workstationId: this.lastLevelId
+ workstationId: this.treeChecked.toString()
}
- this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
+ this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
if(res.code == 200) {
var defaultValues = {
oee: 0,
@@ -413,9 +419,9 @@
date: this.wcsDate,
//date : "2024-05-15",
humanFeedback: this.humanFeedback,
- workstationId: this.lastLevelId
+ workstationId: this.treeChecked.toString()
}
- this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
+ this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
if(res.code == 200) {
var yAxisData = [];
var newData = [];
@@ -561,9 +567,9 @@
var obj = {
date: this.wcsDate,
humanFeedback: this.humanFeedback,
- workstationId: this.lastLevelId
+ workstationId: this.treeChecked.toString()
}
- this.$HTTP.post(`/api/blade-mdc/status-record/time-distribution`,obj).then(res=> {
+ this.$HTTP.post(`/api/mdc/status-record/time-distribution`,obj).then(res=> {
if(res.code == 200) {
var myChart = echarts.init(document.getElementById('wcs-left'));
var wcsOption = JSON.parse(JSON.stringify(this.wcsBeginOption));
@@ -586,7 +592,7 @@
})
},
getwcsLcolor() {
- this.$HTTP.get(`/api/blade-cps/global_wcs/list?code=&name=`).then(res=> {
+ this.$HTTP.get(`/api/smis/global_wcs/list?code=&name=`).then(res=> {
if(res.code == 200) {
res.data.forEach(item=> {
item.itemStyle = {color: item.color};
@@ -600,9 +606,9 @@
var obj = {
date: this.wcsDate,
humanFeedback: this.humanFeedback,
- workstationId: this.lastLevelId
+ workstationId: this.treeChecked.toString()
}
- this.$HTTP.post(`/api/blade-mdc/status-record/equipment-efficiency`,obj).then(res=> {
+ this.$HTTP.post(`/api/mdc/status-record/equipment-efficiency`,obj).then(res=> {
if(res.code == 200) {
var myChart = echarts.init(document.getElementById('wcs-right'));
res.data.forEach(item=> {
@@ -626,32 +632,33 @@
addfeedbackSuccess() {
},
- handleNodeClick(data) {
- if(data.code) {
- this.lastLevelId = data.id;
- this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
- if(res.code == 200) {
- this.stationForm = res.data;
- this.getdmp(this.lastLevelId,this.stationForm.machineId);
- //this.newDate(); //鑾峰彇褰撳墠鏃ユ湡
- this.getwcsR();
- this.getwscLvalue(); //宸︿晶鍥捐〃
- this.alarmsearchBtn(); //鏈哄櫒灞ュ巻
- this.getrecord(); //鐝鐘舵�佽褰晅able
- this.getlogcart(); //鐝鐘舵�佽褰昪hart
+ query() {
+ if (!this.treeChecked.toString()) return;
+ this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.treeChecked.toString()}`).then(res=> {
+ if(res.code == 200) {
+ if(res.data.avatar == "") {
+ res.data.avatar = station;
}
- })
- }
+ this.stationForm = res.data;
+ this.getdmp(this.stationForm.machineId);
+ //this.newDate(); //鑾峰彇褰撳墠鏃ユ湡
+ this.getwcsR();
+ this.getwcsLcolor(); //宸︿晶鍥捐〃
+ this.alarmsearchBtn(); //鏈哄櫒灞ュ巻
+ this.getrecord(); //鐝鐘舵�佽褰晅able
+ this.getlogcart(); //鐝鐘舵�佽褰昪hart
+ }
+ })
},
- getdmp(lastLevelId,machineId) {
- this.$HTTP.get(`/api/blade-cps/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
+ getdmp(machineId) {
+ this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${this.treeChecked.toString()}`).then(res=> {
if(res.code == 200) {
this.dmpList = [];
var that = this;
//鍙戦�亀ebsocket
var obj = {
type: "realTimeData",
- workstationIdList: [lastLevelId]
+ workstationIdList: this.treeChecked
}
if(res.data.dpConfig == null || res.data.dpConfig.length == 0) return; //娌″�间笉鐢ㄥ惊鐜�
if(this.$TOOL.socket.websocket == null) { //娌℃湁寤虹珛鍏堝缓绔�
@@ -673,7 +680,6 @@
item.color = item1.color;
}
})
- item.description = item.dpLabel;
}else {
if(item.dpName == 'Alarm') { //鎶ヨ
if(eventData.data[item.dpName]) {
@@ -682,24 +688,25 @@
if(v.length == 0) {
JSONData.splice(index,1);
}else {
- item.description = v[0].code;
item.codeName = v[0].msg;
}
}else {
- item.description = v.code;
item.codeName = v.msg;
}
}
}else {
if(eventData.data[item.dpName]) {
- item.description = item.dpLabel;
item.codeName = eventData.data[item.dpName].v;
+ }else {
+ item.codeName = "";
}
}
that.allwcs.forEach((item1)=> {
if(item.code == item1.code) {
item.color = item1.color;
- }
+ }else {
+ item.color = "#7FC0C0";
+ }
})
}
});
@@ -707,26 +714,6 @@
};
}
})
- },
- getLastLevelIds(tree) {
- if (tree.length === 0) return ""; // 濡傛灉娌℃湁鏍硅妭鐐癸紝杩斿洖绌�
- const lastLevelIds = [];
- const lastLevelCodes = [];
- function traverseTree(node) {
- if(!node.code) {
- lastLevelCodes.push(node.id);
- }
- if (node.children.length > 0) {
- node.children.forEach(traverseTree); // 閫掑綊閬嶅巻瀛愯妭鐐�
- } else {
- if(node.code) {
- lastLevelIds.push(node.id); // 鏈塩ode鎵嶈
- }
- }
- }
- // 鍙亶鍘嗙涓�涓牴鑺傜偣
- traverseTree(tree[0]);
- return {lastLevelCodes,lastLevelId:lastLevelIds[0]}; // 杩斿洖lastLevelCodes锛氭病鏈塩ode鐨勬暟缁勩�俵astLevelId锛氭湁code鐨勭涓�涓猧d
},
buildTree(items) {
const idMap = {};
@@ -763,38 +750,8 @@
})
return tree;
},
- getTreeList(id) {
- var obj = {
- groupCategory: 1,
- groupType: "group_workstation"
- }
- this.$HTTP.post("/api/blade-cps/group/groupWorkstation/type",obj).then(res=> {
- if(res.code == 200) {
- if (res.code == 200) {
- var treeDisabled = this.addTreeDisable(res.data);
- this.tableData = this.buildTree(treeDisabled); //浠庢墎骞冲寲鍙樹负鏍戠姸缁撴瀯
- this.$nextTick(()=> {
- if(id) {
- this.lastLevelId = id; //鎸囧畾id
- }else {
- this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
- }
- this.$refs.treeRef.setCurrentKey(this.lastLevelId); //绗竴涓妭鐐圭殑绗竴涓瓙鑺傜偣鏈�鍚庝竴绾ч粯璁ら�変腑
- //浠ヤ笅鏄垵濮嬪寲鏁版嵁
- this.getlist(); //娓叉煋璇︽儏鍜�(鐘舵�乴ist)
- this.getwcsLcolor(); //宸︿晶鍥捐〃
- this.getwcsR(); //鍙充晶鍥炬爣
- this.getachievements(); //鐝鐘舵�佽褰曢噰闆嗙姸鎬�
- this.getrecord(); //鐝鐘舵�佽褰晅able
- this.getlogcart(); //鐝鐘舵�佽褰昪hart
- })
-
- }
- }
- })
- },
getachievements() { //鐝鐘舵�佽褰曢噰闆嗙姸鎬�
- this.$HTTP.get(`/api/blade-cps/global_wcs/wcs-achievements`).then(res=> {
+ this.$HTTP.get(`/api/smis/global_wcs/wcs-achievements`).then(res=> {
if(res.code == 200) {
var achievements = [];//閲囬泦鐘舵��
var collectionstatus = []; //浜哄伐鍙嶉鐘舵��
@@ -809,14 +766,6 @@
this.achievements = achievements;
this.collectionstatus = collectionstatus;
this.allwcs = res.data;
- }
- })
- },
- getlist() {
- this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
- if(res.code == 200) {
- this.stationForm = res.data;
- this.getdmp(this.lastLevelId,this.stationForm.machineId);
}
})
}
@@ -834,6 +783,7 @@
margin-right: 8px;
padding: 4px;
background-color: #fff;
+ padding-top: 20px;
}
.aposcope-right {
flex: 1;
--
Gitblit v1.9.3