update 质量实时

This commit is contained in:
g7hoo 2022-08-23 15:07:17 +08:00
parent 2e40570969
commit 626e543fa5

View File

@ -9,33 +9,26 @@
<div>
<div class="app-container">
<small-title :size="'md'">质量检查实时数据</small-title>
<base-table
v-if="tableReady"
:table-config="tableProps"
:table-data="tableData.length ? tableData : []"
:is-loading="listLoading"
:index-config="{ align: 'left', fixed: 'left' }"
/>
<base-table v-if="loadTable" :table-head-configs="tableProps" :data="tableData.length ? tableData : []" />
</div>
</div>
</template>
<script>
// import BaseTable from '@/components/BaseTable/index-compound'
import BaseTable from '@/components/base-table'
import SmallTitle from '@/components/small-title'
import moment from 'moment'
// import fetchList from '@/api/factory-manage/realtimeData'
export default {
name: 'RealtimeDataOfTeam',
components: { BaseTable, SmallTitle },
data() {
return {
tableReady: false,
loadTable: false,
// dynamicPropSet: false,
tableProps: [{ label: 'default', prop: 'default' }],
tableData: [],
testData,
testData: null,
listLoading: false,
intervalId: null
}
@ -44,22 +37,18 @@ export default {
mounted() {
this.clearData()
// fetchList('quality').then(res => {
// this.testData = res
// this.handleData()
// })
// this.intervalId = setInterval(() => {
// this.clearData()
// fetchList('quality').then(res => {
// this.testData = res
// this.handleData()
// })
// }, 1000 * 60 * 5)
this.$nextTick(() => {
this.fetchList().then(({ data: res }) => {
this.testData = res
this.handleData()
})
this.intervalId = setInterval(() => {
this.clearData()
this.fetchList().then(res => {
this.testData = res
this.handleData()
})
}, 1000 * 60 * 5)
},
beforeDestroy() {
@ -67,9 +56,17 @@ export default {
},
methods: {
fetchList() {
//
return this.$http({
url: this.$http.adornUrl('/monitoring/productionMonitoring/qualityInspectionRealTimeData'),
method: 'post'
})
},
clearData() {
this.tableReady = false
// this.testData = null
this.loadTable = false
this.testData = null
this.tableData.splice(0)
this.tableProps.splice(0)
},
@ -80,7 +77,7 @@ export default {
// console.log('props ===> ', this.tableProps)
this.initData()
// console.log('datas ===> ', this.tableData)
this.tableReady = true
this.loadTable = true
},
handleRow(data) {