1
lzhe
2024-05-14 a7b6aa5c857c091bc53a9f02fed855d926ecb90a
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-04-19 18:26:26
 * @LastEditTime: 2024-04-23 17:08:42
 * @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
-->
@@ -116,6 +116,7 @@
   <save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog>
</template>
<script>
   import moment from 'moment'
   import * as echarts from 'echarts';
   import saveDialog from './add-station-status'
   export default {
@@ -233,7 +234,7 @@
               },
               xAxis: {
                  type: 'category',
                  data: ['00:00:00', '02:00:00', '04:00:00', '06:00:00', '08:00:00', '10:00:00', '12:00:00', '14:00:00', '18:00:00'],
                  data: [],
               },
               yAxis: {
                  type: 'category',
@@ -297,7 +298,7 @@
      },
      mounted(){
         this.newDate();  //获取当前日期
         this.getTreeList();
         this.getTreeList(this.$route.query.code);
      },
      components: {
         saveDialog
@@ -347,7 +348,6 @@
                     item.temdata = "00:00:00";
                     item.perdata = "0";
                  })
                  console.log(res.data,980)
                  this.recordData = res.data;
               }
            })
@@ -365,6 +365,24 @@
                     item.value = 0;
                  })
                  this.wcsOptionLog.series[0].data = res.data;
                  //计算时间
                  var startOfDay = moment().startOf('day'); //00:00:00
                  var now = moment();  //当前时间
                  var diffInMilliseconds = now.diff(startOfDay);  //时间差
                  var diffInHours = Math.floor(diffInMilliseconds / (1000 * 60 * 60));  //时间差转换成小时
                  //分割
                  var everTime = Math.ceil(diffInHours/8);
                  var arrData = [];
                  for(var i=0;i<=diffInHours;i+=everTime) {
                     if(i<=10) {
                        var num = '0' + i;
                     }else {
                        var num = i;
                     }
                     arrData.push(num + ':00:00');
                  }
                  //计算时间结束
                  this.wcsOptionLog.xAxis.data = [...arrData,moment().format("HH:mm:ss")];
                  myChart.setOption(this.wcsOptionLog);
               }
            })
@@ -425,7 +443,6 @@
                  })
                  this.wcsOptionR.series[0].data = res.data;   
                  myChart.setOption(this.wcsOptionR);
                  console.log(res.data)
               }
            })
         },
@@ -518,7 +535,7 @@
            })
            return tree;
         },
         getTreeList(flag) {
         getTreeList(id) {
            var obj = {
               groupCategory: 1,
               groupType: "group_workstation"
@@ -529,10 +546,14 @@
                     var treeDisabled = this.addTreeDisable(res.data);
                     this.tableData = this.buildTree(treeDisabled);  //从扁平化变为树状结构
                     this.$nextTick(()=> {
                        this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
                        if(id) {
                           this.lastLevelId = id;  //指定id
                        }else {
                           this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
                        }
                        this.$refs.treeRef.setCurrentKey(this.lastLevelId);  //第一个节点的第一个子节点最后一级默认选中
                        //以下是初始化数据
                        this.getlist();  //渲染反馈列表
                        this.getlist();  //渲染详情和(状态list)
                        this.getwcsLcolor();  //左侧图表
                        this.getwcsR();  //右侧图标
                        this.getachievements();  //班次状态记录采集状态
@@ -760,7 +781,7 @@
   position: absolute;
    right: 10px;
    top: -2px;
    color: #3b8e8e;
    color: #409eff;
    cursor: pointer;
}
.status-wrap.align-left, .status-wrap:first-child {
@@ -773,7 +794,7 @@
    justify-content: start;
}
.collect-status {
    color: #3b8e8e;
    color: #409eff;
    margin-right: 16px;
   font-size: 14px;
}
@@ -791,10 +812,7 @@
}
.status-wrap {
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: start;
}
.status-wrap .status-con {
@@ -803,6 +821,6 @@
    flex-wrap: wrap;
}
.status-wrap /deep/ .el-checkbox.el-checkbox--large {
    color: #3b8e8e;
    color: #409eff;
}
</style>