2022-09-20 15:59:45 +08:00
|
|
|
<template>
|
2022-09-21 11:08:44 +08:00
|
|
|
<!-- 设备效率分析 -->
|
2022-09-20 15:59:45 +08:00
|
|
|
<div class="mod-config">
|
2022-09-28 11:23:39 +08:00
|
|
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)">
|
2022-09-21 11:08:44 +08:00
|
|
|
<!-- 月份 -->
|
2022-09-20 15:59:45 +08:00
|
|
|
<el-form-item>
|
2022-10-17 16:52:07 +08:00
|
|
|
<el-date-picker key="month-picker" v-model="rawTime" type="month" :placeholder="$t('prompt.month')" format="yyyy-MM" />
|
2022-09-20 15:59:45 +08:00
|
|
|
</el-form-item>
|
2022-09-21 11:08:44 +08:00
|
|
|
<!-- 产线 -->
|
|
|
|
<el-form-item>
|
2022-10-17 16:52:07 +08:00
|
|
|
<el-select v-model="dataForm.productlines" :placeholder="$t('pl.title')" multiple clearable>
|
2022-09-21 11:08:44 +08:00
|
|
|
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id" :label="productLine.name" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<!-- 按钮 -->
|
2022-09-20 15:59:45 +08:00
|
|
|
<el-form-item>
|
2022-09-28 11:23:39 +08:00
|
|
|
<el-button @click="currentChangeHandle(1)">{{ $t('search') }}</el-button>
|
2022-09-21 11:08:44 +08:00
|
|
|
<!-- <el-button v-if="$hasPermission('monitoring:equipmentEffiency:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> -->
|
2022-09-20 15:59:45 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
2022-09-22 10:03:23 +08:00
|
|
|
|
|
|
|
<!-- <el-pagination
|
2022-09-20 15:59:45 +08:00
|
|
|
@size-change="sizeChangeHandle"
|
|
|
|
@current-change="currentChangeHandle"
|
|
|
|
:current-page="pageIndex"
|
|
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
|
|
:page-size="pageSize"
|
|
|
|
:total="totalPage"
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
2022-09-22 10:03:23 +08:00
|
|
|
/> -->
|
2022-09-20 15:59:45 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import i18n from '@/i18n'
|
|
|
|
import BaseTable from '@/components/base-table'
|
2022-09-22 10:03:23 +08:00
|
|
|
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
2022-09-20 15:59:45 +08:00
|
|
|
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
|
|
|
import { timeFilter } from '@/utils/filters'
|
2022-09-22 10:03:23 +08:00
|
|
|
import { calcMaxHeight } from '@/utils'
|
2022-09-21 11:08:44 +08:00
|
|
|
import moment from 'moment'
|
2022-09-20 15:59:45 +08:00
|
|
|
|
|
|
|
const tableConfigs = [
|
|
|
|
{
|
|
|
|
type: 'index',
|
|
|
|
name: i18n.t('index')
|
|
|
|
},
|
2022-09-23 15:02:13 +08:00
|
|
|
// { prop: 'time', name: '时间', filter: timeFilter },
|
2022-10-17 16:52:07 +08:00
|
|
|
{ prop: 'pdName', name: i18n.t('pl.name') },
|
|
|
|
{ prop: 'wsName', name: i18n.t('ws.title') },
|
|
|
|
{ prop: 'eqName', name: i18n.t('eq.title') },
|
|
|
|
{ prop: 'mtbf', name: i18n.t('eq.mtbf'), width: 220 },
|
|
|
|
{ prop: 'mttr', name: i18n.t('eq.mttr'), width: 190 },
|
|
|
|
{ prop: 'workTime', name: i18n.t('eq.worktimeh') },
|
|
|
|
{ prop: 'downTime', name: i18n.t('eq.downtimeh') },
|
|
|
|
{ prop: 'downCount', name: i18n.t('eq.downcount') }
|
2022-09-22 10:03:23 +08:00
|
|
|
// {
|
|
|
|
// prop: 'operations',
|
|
|
|
// name: i18n.t('handle'),
|
|
|
|
// fixed: 'right',
|
|
|
|
// width: 120,
|
|
|
|
// subcomponent: TableTextComponent,
|
|
|
|
// buttonContent: '查看详情', // 会转到“设备报警”
|
|
|
|
// emitFullData: true
|
|
|
|
// }
|
2022-09-20 15:59:45 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2022-09-21 11:08:44 +08:00
|
|
|
/** hfxny part */
|
|
|
|
factoryList: [],
|
|
|
|
productLineList: [],
|
|
|
|
/** */
|
2022-09-20 15:59:45 +08:00
|
|
|
calcMaxHeight,
|
|
|
|
tableConfigs,
|
2022-09-21 11:08:44 +08:00
|
|
|
timeType: 'range',
|
2022-09-22 10:03:23 +08:00
|
|
|
rawTime: new Date(),
|
2022-09-20 15:59:45 +08:00
|
|
|
dataForm: {
|
2022-09-21 11:08:44 +08:00
|
|
|
type: 1,
|
|
|
|
productlines: [],
|
|
|
|
startTime: null,
|
|
|
|
entTime: null
|
2022-09-20 15:59:45 +08:00
|
|
|
},
|
|
|
|
dataList: [],
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
totalPage: 0,
|
2022-09-21 11:08:44 +08:00
|
|
|
dataListLoading: false
|
2022-09-20 15:59:45 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
BaseTable
|
|
|
|
},
|
2022-09-21 11:08:44 +08:00
|
|
|
|
2022-10-14 14:03:00 +08:00
|
|
|
activated() {
|
2022-09-22 10:03:23 +08:00
|
|
|
// this.getFactoryList()
|
|
|
|
this.getProductLineList()
|
2022-09-20 15:59:45 +08:00
|
|
|
},
|
2022-09-21 11:08:44 +08:00
|
|
|
watch: {},
|
2022-09-20 15:59:45 +08:00
|
|
|
methods: {
|
2022-09-21 11:08:44 +08:00
|
|
|
// 获取工厂列表
|
2022-09-22 10:03:23 +08:00
|
|
|
// getFactoryList() {
|
|
|
|
// this.$http({
|
|
|
|
// url: this.$http.adornUrl('/monitoring/factory/page'),
|
|
|
|
// method: 'get'
|
|
|
|
// }).then(({ data }) => {
|
|
|
|
// if (data && data.code === 0) {
|
|
|
|
// this.factoryList = data.data.list
|
|
|
|
// /** set default */
|
|
|
|
// if (this.factoryList.length) {
|
|
|
|
// this.dataForm.ftId = this.factoryList[0].id
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// this.factoryList = []
|
|
|
|
// this.dataForm.ftId = null
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// },
|
2022-09-21 11:08:44 +08:00
|
|
|
// 获取产线列表
|
|
|
|
getProductLineList() {
|
2022-09-20 15:59:45 +08:00
|
|
|
this.$http({
|
2022-10-14 14:03:00 +08:00
|
|
|
url: this.$http.adornUrl('/monitoring/productionLine/list'),
|
2022-09-21 11:08:44 +08:00
|
|
|
method: 'get'
|
2022-10-14 14:03:00 +08:00
|
|
|
}).then(({ data: res }) => {
|
|
|
|
if (res && res.code === 0) {
|
|
|
|
this.productLineList = res.data
|
2022-09-21 11:08:44 +08:00
|
|
|
/** set default */
|
|
|
|
if (this.productLineList.length) {
|
|
|
|
this.dataForm.productlines = [this.productLineList[0].id]
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.productLineList = []
|
2022-10-14 14:03:00 +08:00
|
|
|
this.dataForm.productlines = []
|
2022-09-21 11:08:44 +08:00
|
|
|
}
|
2022-09-20 15:59:45 +08:00
|
|
|
})
|
|
|
|
},
|
2022-09-21 11:08:44 +08:00
|
|
|
|
2022-09-20 15:59:45 +08:00
|
|
|
// 获取数据列表
|
|
|
|
getDataList() {
|
2022-09-22 10:03:23 +08:00
|
|
|
// this.dataList = Array(10).fill(1)
|
|
|
|
// return
|
|
|
|
let startTime = this.rawTime
|
|
|
|
? moment(this.rawTime)
|
|
|
|
.set({ date: 1, hour: 0, minute: 0, second: 0, millisecond: 0 })
|
|
|
|
.format('YYYY-MM-DDTHH:mm:ss')
|
|
|
|
: ''
|
|
|
|
let endTime = startTime
|
|
|
|
? moment(startTime)
|
|
|
|
.add(1, 'M')
|
|
|
|
.format('YYYY-MM-DDTHH:mm:ss')
|
|
|
|
: ''
|
2022-09-21 11:08:44 +08:00
|
|
|
|
2022-09-20 15:59:45 +08:00
|
|
|
this.dataListLoading = true
|
2022-09-22 10:03:23 +08:00
|
|
|
|
2022-09-20 15:59:45 +08:00
|
|
|
this.$http({
|
2022-09-22 10:03:23 +08:00
|
|
|
url: this.$http.adornUrl('/monitoring/eqAnalysis/mtbrAndMtbr'),
|
2022-09-21 11:08:44 +08:00
|
|
|
method: 'post',
|
|
|
|
data: {
|
|
|
|
startTime,
|
|
|
|
endTime,
|
|
|
|
productlines: this.dataForm.productlines,
|
|
|
|
type: 1
|
2022-09-20 15:59:45 +08:00
|
|
|
}
|
2022-09-21 11:08:44 +08:00
|
|
|
}).then(({ data: res }) => {
|
2022-09-22 10:03:23 +08:00
|
|
|
if (res.code === 500) {
|
|
|
|
this.dataList.splice(0)
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
} else {
|
|
|
|
this.dataList = res.data
|
|
|
|
}
|
2022-09-20 15:59:45 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
// 每页数
|
|
|
|
sizeChangeHandle(val) {
|
|
|
|
this.pageSize = val
|
|
|
|
this.pageIndex = 1
|
|
|
|
this.getDataList()
|
|
|
|
},
|
|
|
|
// 当前页
|
|
|
|
currentChangeHandle(val) {
|
|
|
|
this.pageIndex = val
|
|
|
|
this.getDataList()
|
|
|
|
},
|
|
|
|
// 多选
|
|
|
|
selectionChangeHandle(val) {
|
|
|
|
this.dataListSelections = val
|
|
|
|
},
|
|
|
|
handleOperations({ type, data: id }) {
|
|
|
|
switch (type) {
|
|
|
|
case 'view-detail':
|
|
|
|
return this.addOrUpdateHandle(id, true)
|
|
|
|
case 'edit':
|
|
|
|
return this.addOrUpdateHandle(id)
|
|
|
|
case 'delete':
|
|
|
|
return this.deleteHandle(id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|