update 设备异常分析

This commit is contained in:
g7hoo 2022-09-22 10:03:23 +08:00
parent 7ed4a512bc
commit 1ad64efe59
2 changed files with 57 additions and 64 deletions

View File

@ -8,8 +8,8 @@ import merge from 'lodash/merge'
const http = axios.create({
// baseURL: window.SITE_CONFIG['apiURL'],
// baseURL: '/api',
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
baseURL: '/api',
// baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
timeout: 1000 * 180,
withCredentials: true
})

View File

@ -21,7 +21,8 @@
</el-form>
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" />
<el-pagination
<!-- <el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
@ -29,18 +30,17 @@
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
/> -->
</div>
</template>
<script>
import i18n from '@/i18n'
import BaseTable from '@/components/base-table'
import TableOperateComponent from '@/components/base-table/components/operationComponent'
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
import TableTextComponent from '@/components/base-table/components/detailComponent'
import { calcMaxHeight } from '@/utils'
import { timeFilter } from '@/utils/filters'
import { calcMaxHeight } from '@/utils'
import moment from 'moment'
const tableConfigs = [
@ -48,6 +48,7 @@ const tableConfigs = [
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: '时间', filter: timeFilter },
{ prop: 'pdlName', name: '产线名称' },
{ prop: 'wsName', name: '工序' },
{ prop: 'eqName', name: '设备' },
@ -56,15 +57,15 @@ const tableConfigs = [
{ prop: 'workTime', name: '工作时长 (h)' },
{ prop: 'downTime', name: '故障时长 (h)' },
{ prop: 'downCount', name: '故障次数' },
{
prop: 'operations',
name: i18n.t('handle'),
fixed: 'right',
width: 180,
subcomponent: TableOperateComponent,
// options: ['edit', 'delete']
options: ['view-trend'] //
}
// {
// prop: 'operations',
// name: i18n.t('handle'),
// fixed: 'right',
// width: 120,
// subcomponent: TableTextComponent,
// buttonContent: '', //
// emitFullData: true
// }
]
export default {
@ -77,10 +78,9 @@ export default {
calcMaxHeight,
tableConfigs,
timeType: 'range',
rawTime: null, // [] or datetime
rawTime: new Date(),
dataForm: {
type: 1,
ftId: null,
productlines: [],
startTime: null,
entTime: null
@ -97,29 +97,29 @@ export default {
},
created() {
this.getFactoryList()
// this.getProductLineList()
// this.getFactoryList()
this.getProductLineList()
},
watch: {},
methods: {
//
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
}
})
},
// 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
// }
// })
// },
// 线
getProductLineList() {
this.$http({
@ -138,46 +138,39 @@ export default {
})
},
//
getTimeRange() {
let startTime
let endTime
if (this.rawTime instanceof Array) {
startTime = this.rawTime[0] ? moment(this.rawTime[0]).format('YYYY-MM-DDTHH:mm:ss') : '' // axios使
endTime = this.rawTime[1] ? moment(this.rawTime[1]).format('YYYY-MM-DDTHH:mm:ss') : ''
} else {
if (this.rawTime) {
startTime = moment(this.rawTime).format('YYYY-MM-DDTHH:mm:ss')
endTime = moment(startTime)
.add(1, 'd')
.format('YYYY-MM-DDTHH:mm:ss')
} else {
startTime = ''
endTime = ''
}
}
return { startTime, endTime }
},
//
getDataList() {
const { startTime, endTime } = this.getTimeRange()
// 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')
: ''
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/eqAnalysis/oee'),
url: this.$http.adornUrl('/monitoring/eqAnalysis/mtbrAndMtbr'),
method: 'post',
data: {
startTime,
endTime,
ftId: this.dataForm.ftId,
productlines: this.dataForm.productlines,
limit: this.pageIndex,
page: this.pageSize,
type: 1
}
}).then(({ data: res }) => {
console.log('oee data:', res)
if (res.code === 500) {
this.dataList.splice(0)
this.$message.error(res.msg)
} else {
this.dataList = res.data
}
})
},
//