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