update 设备异常分析
This commit is contained in:
parent
7ed4a512bc
commit
1ad64efe59
@ -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
|
||||
})
|
||||
|
@ -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
|
||||
}
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
|
Loading…
Reference in New Issue
Block a user