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({ const http = axios.create({
// baseURL: window.SITE_CONFIG['apiURL'], // baseURL: window.SITE_CONFIG['apiURL'],
// baseURL: '/api', baseURL: '/api',
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor', // baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
timeout: 1000 * 180, timeout: 1000 * 180,
withCredentials: true withCredentials: true
}) })

View File

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