From e28dcf85c227f3df8f72ec0e436a89233e9d8e0b Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期四, 18 四月 2024 23:57:44 +0800
Subject: [PATCH] Merge branch 'master' of http://www.beijingsoft.cn:9090/r/smart-web
---
src/views/mdc/station-live.vue | 456 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 439 insertions(+), 17 deletions(-)
diff --git a/src/views/mdc/station-live.vue b/src/views/mdc/station-live.vue
index 8cfa92b..62a82b8 100644
--- a/src/views/mdc/station-live.vue
+++ b/src/views/mdc/station-live.vue
@@ -1,24 +1,446 @@
<!--
- * @Date: 2024-04-09 22:11:21
- * @LastEditors: Sneed
- * @LastEditTime: 2024-04-13 22:15:47
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/station-live.vue
- 鐘舵�佸弽棣�
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-04-18 18:35:55
+ * @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>
- <el-main>
- <el-card shadow="never">
- 鏁堢巼鍒嗘瀽
- </el-card>
- </el-main>
+ <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 />
+ </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-detail">
+ <div class="content-machine-name">{{stationForm.machineName}}</div>
+ <el-form :model="stationForm" ref="dialogForm" label-width="80px" label-position="center" style="width: 100%;">
+ <el-row>
+ <el-col :span="8">
+ <el-form-item label="宸ヤ綅缂栧彿">{{stationForm.code}}</el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鏈哄櫒鍝佺墝">{{stationForm.machineBrand}}</el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鏈哄櫒缂栧彿">{{stationForm.machineCode}}</el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鏈哄櫒鍚嶇О">{{stationForm.machineName}}</el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ </div>
+ <div class="collect-info-panel">
+ <div class="fact-analysis-realtim">
+ <div class="fact-analysis-card" v-for="item in dmpList">
+ <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>
+ </div>
+ </div>
+ <el-tabs type="border-card" class="demo-tabs">
+ <el-tab-pane label="宸ヤ綅鏁版嵁">
+ <div class="wcs-main">
+ <div><div id="wcs-left" style="width: 100%;height:400px;"></div></div>
+ <div><div id="wcs-right" style="width: 100%;height:400px;"></div></div>
+ </div>
+ </el-tab-pane>
+ <el-tab-pane label="鏈哄櫒灞ュ巻">234</el-tab-pane>
+ </el-tabs>
+ </div>
+ </div>
+ <save-dialog v-if="dialog.save" ref="saveDialog" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog>
</template>
-
<script>
- export default {
-
- }
+ import * as echarts from 'echarts';
+ import saveDialog from './add-station-status'
+ export default {
+ name: "state-feedback",
+ data(){
+ return {
+ wcsOption: {
+ title: {
+ text: '鐢ㄦ椂鍒嗗竷鎯呭喌',
+ left: 'left',
+ textStyle: {
+ fontSize:14
+ }
+ },
+ grid: {
+ top: 0,
+ },
+ tooltip: {
+ trigger: 'item',
+ //formatter: '{a} <br/>{b} : {c} ({d}%)'
+ formatter: '{a} 0鍒嗛挓'
+ },
+ legend: {
+ orient: 'vertical',
+ bottom: 'bottom',
+ data: ['璋冭瘯', '绂荤嚎', '寰呮満', '鎶ュ憡', '鎶ヨ', '杩愯']
+ },
+ series: [
+ {
+ top: -30,
+ name: '鐢ㄦ椂:',
+ type: 'pie',
+ radius: '55%',
+ center: ['30%', '50%'],
+ data: [],
+ emphasis: {
+ itemStyle: {
+ shadowBlur: 10,
+ shadowOffsetX: 0,
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
+ }
+ }
+ }
+ ]
+ },
+ dmpList: [],
+ stationForm: {
+ code: "",
+ machineBrand: "",
+ machineCode: "",
+ machineName: ""
+ },
+ dialog: {
+ save: false
+ },
+ lastLevelId: "",
+ current: "1",
+ size: "15",
+ searchData: {
+ feedBackStatus: [],
+ date: [],
+ endDate: "",
+ startDate: ""
+ },
+ searchDataList: [], //鍙充晶鏁版嵁list
+ aList: [],
+ defalutProps: {
+ label: 'title',
+ children: 'children',
+ isLeaf: 'hasChildren',
+ disabled: 'disabled'
+ },
+ parentId: "0",
+ tableData: [],
+ searchSelection: []
+ }
+ },
+ created(){
+
+ },
+ mounted(){
+ this.getTreeList();
+ this.getwcsL(); //宸︿晶鍥捐〃
+ },
+ components: {
+ saveDialog
+ },
+ methods: {
+ getwcsL() {
+ this.$HTTP.get(`/api/blade-cps/global_wcs/list?code=&name=`).then(res=> {
+ if(res.code == 200) {
+ var myChart = echarts.init(document.getElementById('wcs-left'));
+ res.data.forEach(item=> {
+ item.value=20;
+ item.itemStyle = {color: item.color}
+ })
+ this.wcsOption.series[0].data = res.data;
+ myChart.setOption(this.wcsOption);
+ console.log(this.wcsOption,9991);
+ }
+ })
+ },
+ getwcsR() {
+ var obj = {
+ date: String(this.newDate()),
+ humanFeedback: true,
+ workstationId: this.lastLevelId
+ }
+ this.$HTTP.post(`/api/blade-mdc/status-record/equipment-efficiency`,obj).then(res=> {
+ if(res.code == 200) {
+ console.log(res.data,98988)
+ var myChart = echarts.init(document.getElementById('wcs-right'));
+ // res.data.forEach(item=> {
+ // item.value=20;
+ // item.itemStyle = {color: item.color}
+ // })
+ // this.wcsOption.series[0].data = res.data;
+ // myChart.setOption(this.wcsOption);
+ // console.log(this.wcsOption,9991);
+ var option = {
+ title: {
+ text: '璁惧鏁堢巼鎸囨爣', // 鍥捐〃鏍囬
+ left: 'left',
+ textStyle: {
+ fontSize:14
+ }
+ },
+ tooltip: {
+ trigger: 'item'
+ },
+ legend: {
+ orient: 'vertical',
+ bottom: 'bottom', // 鍥句緥缁勪欢绂诲鍣ㄥ乏渚х殑璺濈
+ data: ['鎶ヨ鐜�', '绋煎姩鐜�', '杩愯鐜�'] // 鍥句緥鏁版嵁
+ },
+ series: [
+ {
+ name: 'Access From',
+ type: 'pie',
+ radius: ['30%', '50%'],
+ avoidLabelOverlap: false,
+ label: {
+ show: false,
+ position: 'center'
+ },
+ emphasis: {
+ label: {
+ show: true,
+ fontSize: 40,
+ fontWeight: 'bold'
+ }
+ },
+ labelLine: {
+ show: false
+ },
+ data: [
+ {value: 0, name: '鎶ヨ鐜�'}, // 鎶ヨ鐜囨暟鎹�
+ {value: 0, name: '绋煎姩鐜�'}, // 绋煎姩鐜囨暟鎹�
+ {value: 0, name: '杩愯鐜�'}
+ ]
+ }
+ ]
+ };
+
+ // 浣跨敤鍒氭寚瀹氱殑閰嶇疆椤瑰拰鏁版嵁鏄剧ず鍥捐〃銆�
+ myChart.setOption(option);
+ }
+ })
+ },
+ newDate() {
+ var date = new Date();
+ var year = date.getFullYear();
+ var month = (1 + date.getMonth()).toString().padStart(2, '0'); // JavaScript涓湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ユ垜浠渶瑕佸姞1
+ var day = date.getDate().toString().padStart(2, '0'); // getDate()杩斿洖鐨勬槸褰撳墠鏈堢殑鏃ユ暟锛屼笉闇�瑕佸姞1
+ return year + '-' + month + '-' + day;
+ },
+ addfeedbackSuccess() {
+ this.getlist();
+ },
+ feedBackStatusChange(val) {
+ this.getlist();
+ },
+ 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);
+ }
+ })
+ }
+ },
+ getdmp(lastLevelId,machineId) {
+ this.$HTTP.get(`/api/blade-cps/workstation/get-dmp-variables?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
+ if(res.code == 200) {
+ this.dmpList = res.data;
+ }
+ })
+ },
+ 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 = {};
+ const tree = [];
+ // 绗竴姝ワ細鍒涘缓id鍒板璞$殑鏄犲皠
+ items.forEach(item => {
+ idMap[item.id] = { ...item, children: [] };
+ });
+ // 绗簩姝ワ細鏋勫缓鏍戝舰缁撴瀯
+ items.forEach(item => {
+ const currentNode = idMap[item.id];
+ // 濡傛灉parentId涓�0锛岃鏄庢槸鏍硅妭鐐�
+ if (item.parentId === 0) {
+ tree.push(currentNode);
+ } else {
+ // 鍚﹀垯锛屾煡鎵剧埗鑺傜偣锛屽苟灏嗗綋鍓嶈妭鐐规坊鍔犲埌鐖惰妭鐐圭殑children鏁扮粍涓�
+ const parentId = item.parentId;
+ if (idMap[parentId]) {
+ idMap[parentId].children.push(currentNode);
+ }
+ }
+ });
+ return tree;
+ },
+ addTreeDisable(treeData) {
+ var tree = [];
+ treeData.forEach(item=> {
+ if(item.code) {
+ item.disabled = false;
+ }else {
+ item.disabled = true;
+ }
+ tree.push(item);
+ })
+ return tree;
+ },
+ getTreeList(flag) {
+ 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(()=> {
+ this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
+ this.$refs.treeRef.setCurrentKey(this.lastLevelId); //绗竴涓妭鐐圭殑绗竴涓瓙鑺傜偣鏈�鍚庝竴绾ч粯璁ら�変腑
+ //浠ヤ笅鏄垵濮嬪寲鏁版嵁
+ this.getlist(); //娓叉煋鍙嶉鍒楄〃
+ this.getwcsR(); //鍙充晶鍥炬爣
+ })
+
+ }
+ }
+ })
+ },
+ 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);
+ }
+ })
+ }
+ }
+ }
</script>
-
-<style lang="scss" scoped>
-
+<style scoped>
+.aposcope-main {
+ display: flex;
+ min-height: 100%;
+ margin: 8px;
+}
+.aposcope-left {
+ width: 240px;
+ margin-right: 8px;
+ padding: 4px;
+ background-color: #fff;
+}
+.aposcope-right {
+ flex: 1;
+ padding: 8px;
+ background-color: #fff;
+}
+.left-title {
+ font-size: 16px;
+ text-align: center;
+ height: 38px;
+ line-height: 38px;
+ border-bottom: 1px solid #e2e2e2;
+ background-color: #409eff;
+ color: #fff;
+ border-radius: 2px 2px 0 0;
+}
+.content-machine-box {
+ display: flex;
+ align-items: center;
+}
+.content-machine-img {
+ margin: 14px;
+ padding: 2px;
+ border: 1px solid #e8e8e8;
+ width: 148px;
+ height: 145px;
+ justify-content: center;
+}
+.content-machine-img img {
+ width: 135px;
+ height: 135px;
+}
+.content-machine-detail {
+ display: flex;
+ width: calc(100% - 210px);
+ flex-direction: column;
+ align-items: flex-start;
+ align-content: flex-start;
+ flex-wrap: nowrap;
+}
+.content-machine-name {
+ margin-bottom: 12px;
+ font-size: 24px;
+ font-weight: 700;
+}
+.collect-info-panel {
+ background-color: rgba(59, 142, 142, .06);
+ padding: 8px;
+ padding-top: 0;
+}
+.fact-analysis-realtim {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: flex-start;
+ align-content: flex-start;
+ box-sizing: border-box;
+ background: #fff;
+}
+.fact-analysis-card {
+ border-radius: 2px;
+ box-sizing: border-box;
+ display: flex;
+ margin: 8px;
+}
+.fact-analysis-card .card-name {
+ width: 98px;
+ height: 68px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ color: #fff;
+}
+.fact-analysis-card .card-value {
+ min-width: 118px;
+ max-width: 396px;
+ align-items: center;
+ padding: 0 8px;
+ overflow: hidden;
+ word-break: break-all;
+}
+.wcs-main {
+ display: flex;
+}
+.wcs-main > div {
+ width: 50%;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3