457 lines
9.4 KiB
Vue
457 lines
9.4 KiB
Vue
<template>
|
|
<div class="app-container allow-overflow">
|
|
<!-- 搜索工作栏 -->
|
|
<SearchBar
|
|
:formConfigs="searchBarFormConfig"
|
|
ref="search-bar"
|
|
@headBtnClick="handleSearchBarBtnClick" />
|
|
|
|
<el-row>
|
|
<el-col class="custom-tabs">
|
|
<el-tabs v-model="activeName" :stretch="true">
|
|
<el-tab-pane :label="'\u2002数据列表\u2002'" name="table">
|
|
<!-- 列表 -->
|
|
<base-table
|
|
class="base-table__margin"
|
|
:table-props="tableProps"
|
|
:page="1"
|
|
:limit="10"
|
|
:table-data="list"
|
|
:max-height="tableH"></base-table>
|
|
</el-tab-pane>
|
|
<el-tab-pane
|
|
:label="'\u3000可视化\u3000'"
|
|
name="graph"
|
|
style="overflow: inherit">
|
|
<div
|
|
v-if="activeName == 'graph'"
|
|
class="graph"
|
|
style="
|
|
overflow: inherit;
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: relative;
|
|
">
|
|
<div class="blue-title">各设备加工数量</div>
|
|
<div class="legend">
|
|
<div class="legend-item">
|
|
<span class="icon blue"></span>
|
|
<span class="text">工作时长</span>
|
|
</div>
|
|
<div class="legend-item">
|
|
<span class="icon green"></span>
|
|
<span class="text">停机时长</span>
|
|
</div>
|
|
<div class="legend-item">
|
|
<span class="icon purple"></span>
|
|
<span class="text">故障时长</span>
|
|
</div>
|
|
<div class="legend-item">
|
|
<span class="icon yellow"></span>
|
|
<span class="text">速度开动率</span>
|
|
</div>
|
|
</div>
|
|
<div class="graph-grid">
|
|
<div class="bg-grid grid-line">
|
|
<div
|
|
class="grid-item"
|
|
v-for="item in list.length"
|
|
:key="item"></div>
|
|
</div>
|
|
|
|
<div class="bg-grid grid-charts">
|
|
<pie-chart
|
|
v-for="item in list"
|
|
:key="item.id"
|
|
:value="item" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
|
import PieChart from './components/pieChart.vue';
|
|
import tableHeightMixin from '@/mixins/tableHeightMixin';
|
|
import { exportEfficiencyExcel } from '@/api/equipment/analysis/statistics.js';
|
|
|
|
export default {
|
|
name: 'EfficiencyAnalysis',
|
|
mixins: [basicPageMixin, tableHeightMixin],
|
|
components: { PieChart },
|
|
props: {},
|
|
data() {
|
|
return {
|
|
activeName: 'table',
|
|
tableProps: [
|
|
{
|
|
prop: 'factoryName',
|
|
label: '工厂',
|
|
minWidth: 120,
|
|
showOverflowtooltip: true,
|
|
},
|
|
{
|
|
prop: 'lineName',
|
|
label: '产线',
|
|
minWidth: 120,
|
|
showOverflowtooltip: true,
|
|
},
|
|
{
|
|
prop: 'sectionName',
|
|
label: '工段',
|
|
minWidth: 120,
|
|
showOverflowtooltip: true,
|
|
},
|
|
{
|
|
prop: 'equipmentName',
|
|
label: '设备',
|
|
minWidth: 120,
|
|
showOverflowtooltip: true,
|
|
},
|
|
{
|
|
label: '有效时间',
|
|
children: [
|
|
{
|
|
width: 128,
|
|
prop: 'workTime',
|
|
label: '工作时长[h]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'workRate',
|
|
label: '百分比[%]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: '关机时间',
|
|
children: [
|
|
{
|
|
width: 128,
|
|
prop: 'stopTime',
|
|
label: '停机时长[h]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'stopRate',
|
|
label: '百分比[%]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: '中断损失',
|
|
children: [
|
|
{
|
|
width: 128,
|
|
prop: 'downTime',
|
|
label: '故障时长[h]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'downRate',
|
|
label: '百分比[%]',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'timeEfficiency',
|
|
label: '时间开动率',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: '速度损失',
|
|
children: [
|
|
{
|
|
width: 128,
|
|
prop: 'realProcSpeed',
|
|
label: '实际加工速度',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'designProcSpeed',
|
|
label: '理论加工速度',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
{
|
|
width: 128,
|
|
prop: 'peEfficiency',
|
|
label: '速度开动率',
|
|
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
|
|
},
|
|
],
|
|
},
|
|
],
|
|
searchBarFormConfig: [
|
|
{
|
|
type: 'select',
|
|
label: '工单名称',
|
|
param: 'workOrderId',
|
|
selectOptions: [],
|
|
filterable: true,
|
|
clearable: false,
|
|
defaultSelect: '',
|
|
},
|
|
{
|
|
// parent: 'dateFilterType',
|
|
// 时间段选择
|
|
type: 'datePicker',
|
|
label: '时间段',
|
|
dateType: 'daterange',
|
|
format: 'yyyy-MM-dd',
|
|
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
defaultTime: ['00:00:00', '00:00:00'],
|
|
rangeSeparator: '-',
|
|
startPlaceholder: '开始时间',
|
|
endPlaceholder: '结束时间',
|
|
param: 'recordTime',
|
|
},
|
|
{
|
|
type: 'button',
|
|
btnName: '查询',
|
|
name: 'search',
|
|
color: 'primary',
|
|
},
|
|
{
|
|
type: 'separate',
|
|
},
|
|
{
|
|
type: 'button',
|
|
btnName: '导出',
|
|
name: 'export',
|
|
plain: true,
|
|
color: 'success',
|
|
},
|
|
],
|
|
// 查询参数
|
|
queryParams: {
|
|
workOrderId: null,
|
|
recordTime: [],
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
list: [],
|
|
};
|
|
},
|
|
created() {
|
|
this.getWorkOrder();
|
|
},
|
|
methods: {
|
|
/** 准备工厂数据 */
|
|
async getWorkOrder() {
|
|
const { code, data } = await this.$axios({
|
|
url: '/base/core-work-order/listbyfilter',
|
|
method: 'get',
|
|
});
|
|
if (code == 0) {
|
|
this.searchBarFormConfig[0].selectOptions = data.map((item) => {
|
|
return {
|
|
name: item.name,
|
|
id: item.id,
|
|
};
|
|
});
|
|
this.searchBarFormConfig[0].defaultSelect =
|
|
this.searchBarFormConfig[0].selectOptions[0].id;
|
|
this.queryParams.workOrderId =
|
|
this.searchBarFormConfig[0].selectOptions[0].id;
|
|
} else {
|
|
this.searchBarFormConfig[0].selectOptions = [];
|
|
this.searchBarFormConfig[0].defaultSelect = '';
|
|
this.queryParams.workOrderId = '';
|
|
}
|
|
this.getList();
|
|
},
|
|
/** 查询列表 */
|
|
async getList() {
|
|
this.loading = true;
|
|
const { code, data } = await this.$axios({
|
|
url: '/analysis/equipment-analysis/efficiency',
|
|
method: 'get',
|
|
params: this.queryParams,
|
|
});
|
|
if (code == 0) {
|
|
this.list = data;
|
|
}
|
|
},
|
|
exportExcel() {
|
|
this.loading = true;
|
|
exportEfficiencyExcel({ ...this.queryParams }).then((res) => {
|
|
this.$download.excel(res, '设备状态追溯.xls');
|
|
this.loading = false;
|
|
});
|
|
},
|
|
handleSearchBarBtnClick({ btnName, ...payload }) {
|
|
this.queryParams.workOrderId = payload.workOrderId || null;
|
|
this.queryParams.recordTime = payload.recordTime || undefined;
|
|
if (btnName == 'search') {
|
|
this.getList();
|
|
} else {
|
|
this.exportExcel();
|
|
console.log('导出');
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.visualization {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, minmax(240px, 1fr));
|
|
}
|
|
|
|
:deep(.custom-tabs) {
|
|
.el-tabs__header {
|
|
margin-bottom: 8px;
|
|
display: inline-block;
|
|
transform: translateY(-12px);
|
|
}
|
|
|
|
.el-tabs__content {
|
|
overflow: visible;
|
|
}
|
|
|
|
.el-tabs__item {
|
|
padding-left: 0 !important;
|
|
padding-right: 0 !important;
|
|
line-height: 36px !important;
|
|
height: 36px;
|
|
}
|
|
}
|
|
|
|
.blue-title {
|
|
position: relative;
|
|
padding: 4px 0;
|
|
padding-left: 12px;
|
|
font-size: 14px;
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: 0;
|
|
top: 6px;
|
|
height: 16px;
|
|
width: 4px;
|
|
border-radius: 1px;
|
|
background: #0b58ff;
|
|
}
|
|
}
|
|
|
|
.graph-grid {
|
|
margin-top: 8px;
|
|
padding: 12px;
|
|
position: relative;
|
|
border-radius: 12px;
|
|
border: 1px solid #ccc;
|
|
// background: #0003;
|
|
overflow: inherit;
|
|
}
|
|
.bg-grid {
|
|
display: grid;
|
|
place-content: center;
|
|
grid-template-columns: repeat(4, minmax(280px, 1fr));
|
|
grid-auto-columns: 280px;
|
|
grid-auto-rows: 290px;
|
|
overflow: inherit;
|
|
position: relative;
|
|
}
|
|
|
|
.grid-line::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: -1px;
|
|
left: -1px;
|
|
width: calc(100% + 2px);
|
|
height: calc(100% + 2px);
|
|
display: inline-block;
|
|
border: 8px solid #fff;
|
|
}
|
|
|
|
.grid-charts {
|
|
position: absolute;
|
|
width: calc(100% - 24px);
|
|
top: 12px;
|
|
left: 12px;
|
|
}
|
|
|
|
.grid-item {
|
|
border: 1px solid #ccc;
|
|
}
|
|
|
|
.grid-item:not(:first-child) {
|
|
border-left: 0;
|
|
border-top: 0;
|
|
}
|
|
|
|
.legend {
|
|
position: absolute;
|
|
top: 8px;
|
|
right: 12px;
|
|
display: flex;
|
|
}
|
|
|
|
.legend .legend-item {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-left: 12px;
|
|
}
|
|
|
|
.legend .legend-item .icon {
|
|
width: 10px;
|
|
height: 10px;
|
|
border-radius: 1px;
|
|
margin-right: 4px;
|
|
margin-top: 1px;
|
|
}
|
|
|
|
.legend .legend-item .text {
|
|
color: #8c8c8c;
|
|
}
|
|
|
|
.blue {
|
|
background-color: #3da8fd;
|
|
}
|
|
|
|
.green {
|
|
background-color: #8ef0ab;
|
|
}
|
|
|
|
.purple {
|
|
background-color: #6b5cfd;
|
|
}
|
|
|
|
.yellow {
|
|
background-color: #ffc72a;
|
|
}
|
|
|
|
@media screen and (max-width: 1390px) {
|
|
.bg-grid {
|
|
grid-template-columns: repeat(3, minmax(280px, 1fr));
|
|
}
|
|
}
|
|
|
|
@media screen and (max-width: 1190px) {
|
|
.bg-grid {
|
|
grid-template-columns: repeat(2, minmax(280px, 1fr));
|
|
}
|
|
}
|
|
|
|
@media screen and (max-width: 640px) {
|
|
.bg-grid {
|
|
grid-template-columns: repeat(1, minmax(280px, 1fr));
|
|
}
|
|
}
|
|
</style>
|