| | |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-04-18 18:35:55 |
| | | * @LastEditTime: 2024-06-05 11:37:17 |
| | | * @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 |
| | | --> |
| | |
| | | <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">461</div> |
| | | <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.test}}</el-form-item> |
| | | <el-form-item label="工位编号">{{stationForm.code}}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="机器品牌">{{stationForm.test}}</el-form-item> |
| | | <el-form-item label="机器品牌">{{stationForm.machineBrand}}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="机器编号">{{stationForm.test}}</el-form-item> |
| | | <el-form-item label="机器编号">{{stationForm.machineCode}}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="机器名称">{{stationForm.test}}</el-form-item> |
| | | <el-form-item label="机器名称">{{stationForm.machineName}}</el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | |
| | | </div> |
| | | <div class="collect-info-panel"> |
| | | <div class="fact-analysis-realtim"> |
| | | <div class="fact-analysis-card"> |
| | | <div class="card-name" style="background-color: rgb(127, 192, 192);">设备状态</div> |
| | | <div class="card-value" style="background-color: rgba(127, 192, 192, 0.14);"></div> |
| | | <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;"> |
| | | <img src="./quesheng.bd026700.png" style="height: auto; width: 100%;"> |
| | | </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': 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> |
| | | <el-tabs type="border-card" class="demo-tabs"> |
| | | <el-tab-pane label="工位数据"> |
| | | <div style="text-align: right;margin-bottom: 14px;"> |
| | | <el-date-picker v-model="wcsDate" type="date" @change="wcschangedate" value-format="YYYY-MM-DD" size="small" /> |
| | | </div> |
| | | <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> |
| | | <div class="bottom-panel content-panel"> |
| | | <div class="panel-title">班次状态记录</div> |
| | | <div class="panel-content bottom-panel-chart"> |
| | | <div class="status"> |
| | | <div class="feed-button" @click="table_edit">状态反馈</div> |
| | | <div class="status-wrap align-left"> |
| | | <div class="collect-status">采集状态</div> |
| | | <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" /> |
| | | <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> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="padding: 8px;"> |
| | | <div id="wcs-log" style="width: 100%;height:200px;"></div> |
| | | <el-table ref="multipleTableRef1" :data="recordData" border style="width: 100%;"> |
| | | <el-table-column prop="shiftIndexName" label="班次"></el-table-column> |
| | | <el-table-column prop="5" label="调试"></el-table-column> |
| | | <el-table-column prop="4" label="离线"></el-table-column> |
| | | <el-table-column prop="3" label="待机"></el-table-column> |
| | | <el-table-column prop="1" label="报警"></el-table-column> |
| | | <el-table-column prop="2" label="运行"></el-table-column> |
| | | <el-table-column prop="oee" label="稼动率%"> |
| | | <template #default="scope"> |
| | | <span>{{(Number(scope.row.oee) * 100).toFixed(2)}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="perdata" label="报警率%"> |
| | | <template #default="scope"> |
| | | <span>{{(Number(scope.row.fault) * 100).toFixed(2)}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="机器履历"> |
| | | <div class="alarm-title">报警信息履历</div> |
| | | <el-table ref="multipleTableRef" :data="alarmtableData" border style="width: 100%" class="multipleTableRef"> |
| | | <el-table-column prop="alarmCode" label="报警代码"></el-table-column> |
| | | <el-table-column prop="alarmMsg" label="报警信息"></el-table-column> |
| | | <el-table-column prop="alarmTime" label="报警时间"></el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | style="margin-top: 12px;" |
| | | @size-change="alarmSizeChange" |
| | | @current-change="alarmCurrentChange" |
| | | :current-page="currentPage4" |
| | | :page-sizes="[15, 50, 100]" |
| | | :page-size="15" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="alarmtotal"> |
| | | </el-pagination> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | </div> |
| | | <save-dialog v-if="dialog.save" ref="saveDialog" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog> |
| | | <save-dialog v-if="dialog.save" ref="saveDialog" @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog> |
| | | </template> |
| | | <script> |
| | | import saveDialog from './add-station-status' |
| | | import moment from 'moment' |
| | | import * as echarts from 'echarts'; |
| | | import saveDialog from './add-station-status' |
| | | export default { |
| | | name: "state-feedback", |
| | | data(){ |
| | | return { |
| | | achievements: [], |
| | | collectionstatus: [], |
| | | checked1: "", |
| | | alarmtotal: 0, |
| | | alarmtableData: [], |
| | | wcsDate: "", |
| | | wcsOptionL: { |
| | | title: { |
| | | text: '用时分布情况', |
| | | left: 'left', |
| | | textStyle: { |
| | | fontSize:14 |
| | | } |
| | | }, |
| | | grid: { |
| | | top: 0, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item', |
| | | //formatter: '{a} <br/>{b} : {c} ({d}%)' |
| | | formatter: '{a} {c}分钟' |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | bottom: 'bottom', |
| | | data: ['调试', '离线', '待机', '报告', '报警', '运行'] |
| | | }, |
| | | series: [ |
| | | { |
| | | top: -30, |
| | | name: '用时:', |
| | | type: 'pie', |
| | | radius: '55%', |
| | | center: ['40%', '50%'], |
| | | data: [], |
| | | itemStyle: { |
| | | borderRadius: 10, |
| | | borderColor: '#fff', |
| | | borderWidth: 2 |
| | | }, |
| | | emphasis: { |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowOffsetX: 0, |
| | | shadowColor: 'rgba(0, 0, 0, 0.5)' |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | wcsOptionR:{ |
| | | title: { |
| | | text: '设备效率', |
| | | left: 'left', |
| | | textStyle: { |
| | | fontSize:14 |
| | | } |
| | | }, |
| | | xAxis: { |
| | | max: '100' |
| | | }, |
| | | yAxis: { |
| | | type: 'category', |
| | | data: ['运行率', '报警率', '稼动率'] |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item', |
| | | //formatter: '{a} <br/>{b} : {c} ({d}%)' |
| | | formatter: '{b} {c}%' |
| | | }, |
| | | series: [ |
| | | { |
| | | top: -30, |
| | | name: 'wcsR', |
| | | type: 'bar', |
| | | center: ['40%', '50%'], |
| | | data: [], |
| | | itemStyle: { |
| | | borderRadius: 8, |
| | | borderColor: '#fff', |
| | | borderWidth: 1 |
| | | }, |
| | | label: { |
| | | show: true, |
| | | position: 'right', |
| | | formatter: '{c}%', |
| | | valueAnimation: true |
| | | }, |
| | | emphasis: { |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowOffsetX: 0, |
| | | shadowColor: 'rgba(0, 0, 0, 0.5)' |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | legend: { |
| | | show: true, // 强制显示图例 |
| | | orient: 'vertical', // 图例列表的布局朝向,可选值为:'horizontal' 或 'vertical' |
| | | left: 'left', // 图例组件离容器左侧的距离 |
| | | top: 'top', // 图例组件离容器上侧的距离 |
| | | data: ['运行率', '报警率', '稼动率'] // 与series中的name对应,用于显示图例名称 |
| | | } |
| | | }, |
| | | wcsOptionLog:{ |
| | | grid: { |
| | | top: '0%' |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | data: [], |
| | | }, |
| | | yAxis: { |
| | | type: 'category', |
| | | data: ['1', '2'] |
| | | }, |
| | | series: [] |
| | | }, |
| | | dmpList: [], |
| | | stationForm: { |
| | | test: "" |
| | | code: "", |
| | | machineBrand: "", |
| | | machineCode: "", |
| | | machineName: "" |
| | | }, |
| | | dialog: { |
| | | save: false |
| | |
| | | }, |
| | | parentId: "0", |
| | | tableData: [], |
| | | searchSelection: [] |
| | | searchSelection: [], |
| | | wcsBeginOption: {}, |
| | | alarmsearchData: { |
| | | current: "1", |
| | | size: "15" |
| | | }, |
| | | records: [], |
| | | recordData: [], // 班次状态记录table |
| | | allwcs: [] |
| | | } |
| | | }, |
| | | created(){ |
| | | |
| | | }, |
| | | mounted(){ |
| | | this.getTreeList(); |
| | | this.newDate(); //获取当前日期 |
| | | this.getTreeList(this.$route.query.code); |
| | | }, |
| | | components: { |
| | | saveDialog |
| | | }, |
| | | methods: { |
| | | addfeedbackSuccess() { |
| | | this.getlist(); |
| | | table_edit(){ |
| | | this.dialog.save = true |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open('edit').setData(this.lastLevelId); |
| | | }) |
| | | }, |
| | | feedBackStatusChange(val) { |
| | | this.getlist(); |
| | | alarmSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.alarmsearchData.current = "1"; |
| | | this.alarmsearchData.size = val; |
| | | this.alarmsearchBtn(); |
| | | }, |
| | | alarmCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.alarmsearchData.current = val; |
| | | 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=> { |
| | | if(res.code == 200) { |
| | | this.alarmtableData = res.data.records; |
| | | this.alarmtotal = res.data.total; |
| | | } |
| | | }) |
| | | }, |
| | | wcschangedate(date) { |
| | | this.wcsDate = date; |
| | | this.getwscLvalue(); //左侧图表 |
| | | this.getwcsR(); |
| | | this.getrecord(); //班次状态记录table |
| | | this.getlogcart(); //班次状态记录chart |
| | | }, |
| | | getrecord() { //班次状态记录table |
| | | var obj = { |
| | | date: this.wcsDate, |
| | | humanFeedback: true, |
| | | workstationId: this.lastLevelId |
| | | } |
| | | this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-table`,obj).then(res=> { |
| | | if(res.code == 200) { |
| | | var defaultValues = { |
| | | oee: 0, |
| | | fault: 0, |
| | | '1': "00:00:00", |
| | | '2': "00:00:00", |
| | | '3': "00:00:00", |
| | | '4': "00:00:00", |
| | | '5': "00:00:00" |
| | | }; |
| | | res.data.forEach(item => { |
| | | Object.keys(defaultValues).forEach(key => { |
| | | if (!item[key]) { |
| | | item[key] = defaultValues[key]; |
| | | } |
| | | }); |
| | | }); |
| | | this.recordData = res.data; |
| | | } |
| | | }) |
| | | }, |
| | | renderItem(params, api) { |
| | | var categoryIndex = api.value(0); |
| | | var start = api.coord([api.value(1), categoryIndex]); |
| | | var end = api.coord([api.value(2), categoryIndex]); |
| | | var height = api.size([0, 1])[1] * 0.6; |
| | | var rectShape = echarts.graphic.clipRectByRect( |
| | | { |
| | | x: start[0], |
| | | y: start[1] - height / 2, |
| | | width: end[0] - start[0], |
| | | height: height |
| | | }, |
| | | { |
| | | x: params.coordSys.x, |
| | | y: params.coordSys.y, |
| | | width: params.coordSys.width, |
| | | height: params.coordSys.height |
| | | } |
| | | ); |
| | | return ( |
| | | rectShape && { |
| | | type: 'rect', |
| | | transition: ['shape'], |
| | | shape: rectShape, |
| | | style: api.style() |
| | | } |
| | | ); |
| | | }, |
| | | getColor(name) { |
| | | var color = ''; |
| | | this.achievements.forEach(item=> { |
| | | if(item.code == name) { |
| | | color = item.color; |
| | | } |
| | | }) |
| | | return color; |
| | | }, |
| | | getStatus(name) { |
| | | var stauts = {}; |
| | | this.allwcs.forEach(item=> { |
| | | if(item.code == name) { |
| | | stauts.name= item.name; |
| | | stauts.type= item.type; |
| | | } |
| | | }) |
| | | return stauts; |
| | | }, |
| | | getlogcart() { //班次状态记录chart |
| | | var obj = { |
| | | date: this.wcsDate, |
| | | //date : "2024-05-15", |
| | | humanFeedback: true, |
| | | workstationId: this.lastLevelId |
| | | } |
| | | this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-chart`,obj).then(res=> { |
| | | if(res.code == 200) { |
| | | 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); |
| | | //计算开始时间,显示时间 |
| | | if(item.statusRecordList == null) item.statusRecordList = []; |
| | | item.statusRecordList.forEach(item1=> { |
| | | var initstart = item1.startTime.split(" ")[0]; //根据日期计算差值 |
| | | var startTime = moment(item1.startTime).diff(moment(initstart + " 00:00:00"), 'minutes'); |
| | | var endTime = moment(item1.endTime).diff(moment(initstart + " 00:00:00"), 'minutes'); |
| | | var diff = moment(item1.endTime).diff(moment(item1.startTime), 'minutes') //开始了多久 |
| | | var color = this.getColor(item1.wcs); |
| | | item1.value = [index,startTime,endTime,diff]; |
| | | item1.itemStyle = {"normal": {"color": color}}; |
| | | item1.statusName = this.getStatus(item1.wcs).name; |
| | | item1.statusType = this.getStatus(item1.wcs).type; |
| | | }) |
| | | newData.push(...item.statusRecordList); |
| | | }) |
| | | //渲染图表 |
| | | this.setCharts(yAxisData,newData); |
| | | |
| | | 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) |
| | | return; |
| | | //计算时间 |
| | | 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); |
| | | } |
| | | }) |
| | | }, |
| | | setCharts(yAxisData,data) { |
| | | var option = { |
| | | tooltip: { |
| | | formatter: function (params) { |
| | | if(params.data.statusType == 4) { |
| | | var dom = `<span class="tipdesc">工位:</span>${params.data.name}</br> |
| | | <span class="tipdesc">状态:</span>${params.data.wcsDesc}</br> |
| | | <span class="tipdesc">描述:</span>${params.data.feedbackDesc}</br> |
| | | <span class="tipdesc">状态时间:</span>${params.data.startTime} ~ ${params.data.endTime}</br> |
| | | <span class="tipdesc">反馈时间:</span>${params.data.feedbackTime}</br> |
| | | <span class="tipdesc">反馈人:</span>${params.data.feedUser}</br>` |
| | | }else { |
| | | var dom = `<span class="tipstatus">${params.data.statusName}</span></br> |
| | | <span class="tipdesc">时段:</span><span>${params.data.startTime.split(" ")[1]} ~ ${params.data.endTime.split(" ")[1]}</span></br>` |
| | | } |
| | | return dom; |
| | | } |
| | | }, |
| | | grid: { |
| | | top: 10, |
| | | left: 70, |
| | | bottom: 120 |
| | | }, |
| | | xAxis: { |
| | | min: 0, |
| | | max: 1440, // 单位分钟 |
| | | interval: 1440/6, //每隔多少分钟显示一个刻度 |
| | | axisLabel: { |
| | | formatter: (value)=> { |
| | | if(value == 0) { |
| | | return "00:00:00"; |
| | | }else if(value == 240) { |
| | | return "04:00:00"; |
| | | }else if(value == 480) { |
| | | return "08:00:00"; |
| | | }else if(value == 720) { |
| | | return "12:00:00"; |
| | | }else if(value == 960) { |
| | | return "16:00:00"; |
| | | }else if(value == 1200) { |
| | | return "18:00:00"; |
| | | }else if(value == 1440) { |
| | | return "00:00:00"; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | yAxis: { |
| | | type: 'category', |
| | | axisLabel: { |
| | | formatter: function (value) { |
| | | return value; |
| | | }, |
| | | rich: { |
| | | a: { |
| | | color: '#409eff', |
| | | cursor: 'pointer', |
| | | fontSize: '12px' |
| | | } |
| | | } |
| | | }, |
| | | data: yAxisData |
| | | }, |
| | | series: [ |
| | | { |
| | | type: 'custom', |
| | | renderItem: this.renderItem, |
| | | itemStyle: { |
| | | opacity: 0.8 |
| | | }, |
| | | encode: { |
| | | x: [1, 2], |
| | | y: 0 |
| | | }, |
| | | data: data |
| | | } |
| | | ] |
| | | }; |
| | | var myChart = echarts.init(document.getElementById('wcs-log')); |
| | | myChart.setOption(option); |
| | | }, |
| | | getwscLvalue() { |
| | | var obj = { |
| | | date: this.wcsDate, |
| | | humanFeedback: true, |
| | | workstationId: this.lastLevelId |
| | | } |
| | | this.$HTTP.post(`/api/blade-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)); |
| | | if(res.data.length == 0) { |
| | | wcsOption.forEach(item=> { |
| | | item.value = 0; |
| | | }) |
| | | }else { |
| | | wcsOption.forEach(item=> { |
| | | res.data.forEach(item2=> { |
| | | if(item.code == item2.name) { |
| | | item.value = item2.value; |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | this.wcsOptionL.series[0].data = wcsOption; |
| | | myChart.setOption(this.wcsOptionL); |
| | | } |
| | | }) |
| | | }, |
| | | getwcsLcolor() { |
| | | this.$HTTP.get(`/api/blade-cps/global_wcs/list?code=&name=`).then(res=> { |
| | | if(res.code == 200) { |
| | | res.data.forEach(item=> { |
| | | item.itemStyle = {color: item.color}; |
| | | }) |
| | | this.wcsBeginOption = res.data; |
| | | this.getwscLvalue(); |
| | | } |
| | | }) |
| | | }, |
| | | getwcsR() { |
| | | var obj = { |
| | | date: this.wcsDate, |
| | | humanFeedback: true, |
| | | workstationId: this.lastLevelId |
| | | } |
| | | this.$HTTP.post(`/api/blade-mdc/status-record/equipment-efficiency`,obj).then(res=> { |
| | | if(res.code == 200) { |
| | | var myChart = echarts.init(document.getElementById('wcs-right')); |
| | | res.data.forEach(item=> { |
| | | item.value = (Number(item.value)*100).toFixed(2); |
| | | if(item.name == "运行率") item.itemStyle = {color: '#73d13d'}; |
| | | if(item.name == "报警率") item.itemStyle = {color: '#ff4d4f'}; |
| | | if(item.name == "稼动率") item.itemStyle = {color: '#40a9ff'}; |
| | | }) |
| | | this.wcsOptionR.series[0].data = res.data; |
| | | myChart.setOption(this.wcsOptionR); |
| | | } |
| | | }) |
| | | }, |
| | | 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 |
| | | this.wcsDate = year + '-' + month + '-' + day; |
| | | }, |
| | | addfeedbackSuccess() { |
| | | |
| | | }, |
| | | handleNodeClick(data) { |
| | | if(data.code) { |
| | | this.lastLevelId = data.id; |
| | | var obj = { |
| | | workstationId: this.lastLevelId, |
| | | } |
| | | if(this.searchData.feedBackStatus.length != 0) { |
| | | obj.feedBackStatus = this.searchData.feedBackStatus; |
| | | } |
| | | if(this.searchData.endDate) { |
| | | obj.endDate = this.searchData.endDate; |
| | | } |
| | | if(this.searchData.startDate) { |
| | | obj.startDate = this.searchData.startDate; |
| | | } |
| | | this.$HTTP.post("/api/blade-cps/workstation-wcs-feedback/page?current=1&size=15",obj).then(res=> { |
| | | this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${this.lastLevelId}`).then(res=> { |
| | | if(res.code == 200) { |
| | | this.searchDataList = res.data.records; |
| | | this.stationForm = res.data; |
| | | this.getdmp(this.lastLevelId,this.stationForm.machineId); |
| | | //this.newDate(); //获取当前日期 |
| | | this.getwcsR(); |
| | | this.getwscLvalue(); //左侧图表 |
| | | this.alarmsearchBtn(); //机器履历 |
| | | this.getrecord(); //班次状态记录table |
| | | this.getlogcart(); //班次状态记录chart |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | getdmp(lastLevelId,machineId) { |
| | | console.log(lastLevelId,machineId) |
| | | this.$HTTP.get(`/api/blade-cps/workstation/get-dmp-variables?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> { |
| | | if(res.code == 200) { |
| | | this.dmpList = []; |
| | | var that = this; |
| | | //发送websocket |
| | | var obj = { |
| | | type: "realTimeData", |
| | | workstationIdList: [lastLevelId] |
| | | } |
| | | 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) { |
| | | if(res.data.length == 0) return; //没值不用循环 |
| | | res.data.forEach(item=> { //第一步把v放到code里 |
| | | var eventData = JSON.parse(event.data); |
| | | if(item.name == "DeviceStatus") { //机器状态 |
| | | item.code = eventData.data[item.name].v; |
| | | that.allwcs.forEach(item1=> { |
| | | if(item.code == item1.code) { |
| | | item.codeName = item1.name; //第二步把v的code和运行对应 |
| | | if(item.code == "2") { |
| | | item.color = "#73D13D"; |
| | | }else { |
| | | item.color = "#75C0C0"; |
| | | } |
| | | } |
| | | }) |
| | | }else { |
| | | if(item.name == 'Alarm') { //报警 |
| | | var v = JSON.parse(eventData.data[item.name].v); |
| | | item.description = v.code; |
| | | item.codeName = v.msg; |
| | | item.color = "#370C0D"; |
| | | }else { |
| | | item.codeName = eventData.data[item.name].v; |
| | | item.color = "#75C0C0"; |
| | | } |
| | | } |
| | | }); |
| | | that.dmpList = res.data; |
| | | }; |
| | | } |
| | | }) |
| | | }, |
| | | getLastLevelIds(tree) { |
| | | if (tree.length === 0) return ""; // 如果没有根节点,返回空 |
| | |
| | | }) |
| | | return tree; |
| | | }, |
| | | getTreeList(flag) { |
| | | getTreeList(id) { |
| | | var obj = { |
| | | groupCategory: 1, |
| | | groupType: "group_workstation" |
| | |
| | | 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(); //班次状态记录采集状态 |
| | | this.getrecord(); //班次状态记录table |
| | | this.getlogcart(); //班次状态记录chart |
| | | }) |
| | | |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | getachievements() { //班次状态记录采集状态 |
| | | this.$HTTP.get(`/api/blade-cps/global_wcs/wcs-achievements`).then(res=> { |
| | | if(res.code == 200) { |
| | | var achievements = [];//采集状态 |
| | | var collectionstatus = []; //人工反馈状态 |
| | | res.data.forEach(item=> { |
| | | if(item.type == 1) { |
| | | achievements.push(item); |
| | | } |
| | | if(item.type == 4) { |
| | | collectionstatus.push(item); |
| | | } |
| | | }) |
| | | 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) { |
| | | console.log(res.data,234) |
| | | this.stationForm = res.data; |
| | | this.getdmp(this.lastLevelId,this.stationForm.machineId); |
| | | } |
| | | }) |
| | | } |
| | |
| | | .content-machine-box { |
| | | display: flex; |
| | | align-items: center; |
| | | flex-direction: row; |
| | | flex-wrap: nowrap; |
| | | align-content: center; |
| | | justify-content: flex-start; |
| | | background-color: rgba(59, 142, 142, .06); |
| | | border-radius: 2px; |
| | | } |
| | | .content-machine-img { |
| | | margin: 14px; |
| | |
| | | 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; |
| | | } |
| | | .wcs-main > div { |
| | | padding: 6px; |
| | | box-shadow: 2px 3px 10px rgba(0,0,0,.16); |
| | | } |
| | | .wcs-main > div:nth-child(1) { |
| | | width: 50%; |
| | | margin-right: 4px; |
| | | } |
| | | .wcs-main > div:nth-child(2) { |
| | | flex:1; |
| | | } |
| | | .alarm-title { |
| | | padding-bottom: 8px; |
| | | font-size: 14px; |
| | | } |
| | | .wimi-empty { |
| | | height: 100%; |
| | | width: 100%; |
| | | display: flex; |
| | | border-radius: 2px; |
| | | flex-direction: column; |
| | | flex-wrap: nowrap; |
| | | align-content: center; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | .empty-description { |
| | | margin-bottom: 20px; |
| | | font-size: 14px; |
| | | color: #5e6d82; |
| | | margin-top: -16px; |
| | | line-height: 28px; |
| | | } |
| | | .bottom-panel { |
| | | margin-top: 8px; |
| | | min-height: 300px; |
| | | } |
| | | .content-panel { |
| | | height: 100%; |
| | | box-shadow: 2px 3px 10px rgba(0,0,0,.16); |
| | | } |
| | | .panel-title { |
| | | font-size: 16px; |
| | | box-sizing: border-box; |
| | | padding: 12px 24px; |
| | | width: 100%; |
| | | position: relative; |
| | | color: #333; |
| | | font-weight: 700; |
| | | } |
| | | .bottom-panel-chart { |
| | | display: flex; |
| | | flex-direction: column; |
| | | flex-wrap: nowrap; |
| | | align-content: flex-start; |
| | | align-items: flex-start; |
| | | padding: 8px; |
| | | padding-top: 0; |
| | | box-sizing: border-box; |
| | | } |
| | | .panel-content { |
| | | width: 100%; |
| | | height: calc(100% - 45px); |
| | | } |
| | | .panel-content-gant, .panel-content-table { |
| | | width: 100%; |
| | | } |
| | | .gant { |
| | | box-sizing: border-box; |
| | | padding: 8px; |
| | | } |
| | | .status { |
| | | display: flex; |
| | | align-items: start; |
| | | flex-direction: column; |
| | | justify-content: start; |
| | | margin: 8px 0; |
| | | position: relative; |
| | | width: 100%; |
| | | font-size: 16px; |
| | | cursor: pointer; |
| | | } |
| | | .feed-button { |
| | | position: absolute; |
| | | right: 10px; |
| | | top: -2px; |
| | | color: #409eff; |
| | | cursor: pointer; |
| | | } |
| | | .status-wrap.align-left, .status-wrap:first-child { |
| | | padding-left: 24px; |
| | | margin-bottom: 8px; |
| | | } |
| | | .status-wrap { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: start; |
| | | } |
| | | .collect-status { |
| | | color: #409eff; |
| | | margin-right: 16px; |
| | | font-size: 14px; |
| | | } |
| | | .status-box { |
| | | margin: 0 8px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | .status-color { |
| | | width: 40px; |
| | | height: 15px; |
| | | border-radius: 2px; |
| | | margin-right: 8px; |
| | | } |
| | | .status-wrap { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: start; |
| | | } |
| | | .status-wrap .status-con { |
| | | display: flex; |
| | | flex: 1; |
| | | flex-wrap: wrap; |
| | | } |
| | | .status-wrap /deep/ .el-checkbox.el-checkbox--large { |
| | | color: #409eff; |
| | | } |
| | | #record /deep/ .tipstatus { |
| | | width: 100%; |
| | | display: inline-block; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | </style> |