update realtimedata
This commit is contained in:
		@@ -8,21 +8,20 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div>
 | 
					  <div>
 | 
				
			||||||
    <div class="app-container">
 | 
					    <div class="app-container">
 | 
				
			||||||
      <small-title :size="'md'">{{ $t('module.factory.realtime.equipment.name') }}</small-title>
 | 
					      <!-- <small-title :size="'md'">{{ $t('module.factory.realtime.equipment.name') }}</small-title> -->
 | 
				
			||||||
 | 
					      <small-title :size="'md'">设备生产实时数据</small-title>
 | 
				
			||||||
      <base-table
 | 
					      <base-table
 | 
				
			||||||
        v-if="tableReady"
 | 
					        v-if="loadTable"
 | 
				
			||||||
        :table-config="tableProps"
 | 
					        :table-head-configs="tableProps"
 | 
				
			||||||
        :table-data="tableData.length ? tableData : []"
 | 
					        :data="tableData.length ? tableData : []"
 | 
				
			||||||
        :span-method="spanMethod"
 | 
					        :span-method="spanMethod"
 | 
				
			||||||
        :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'
 | 
					// import fetchList from '@/api/factory-manage/realtimeData'
 | 
				
			||||||
@@ -35,7 +34,7 @@ export default {
 | 
				
			|||||||
  components: { BaseTable, SmallTitle },
 | 
					  components: { BaseTable, SmallTitle },
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      tableReady: false,
 | 
					      loadTable: false,
 | 
				
			||||||
      tableProps: [{ label: 'default', prop: 'default' }],
 | 
					      tableProps: [{ label: 'default', prop: 'default' }],
 | 
				
			||||||
      stepOneArray: [],
 | 
					      stepOneArray: [],
 | 
				
			||||||
      tableData: [],
 | 
					      tableData: [],
 | 
				
			||||||
@@ -48,9 +47,6 @@ export default {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  created() {
 | 
					  created() {
 | 
				
			||||||
    // this.clearData()
 | 
					 | 
				
			||||||
    // this.testData = testData
 | 
					 | 
				
			||||||
    // this.handleData()
 | 
					 | 
				
			||||||
    this.clearData()
 | 
					    this.clearData()
 | 
				
			||||||
    fetchList('equipment').then(res => {
 | 
					    fetchList('equipment').then(res => {
 | 
				
			||||||
      this.testData = res
 | 
					      this.testData = res
 | 
				
			||||||
@@ -59,7 +55,7 @@ export default {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.intervalId = setInterval(() => {
 | 
					    this.intervalId = setInterval(() => {
 | 
				
			||||||
      this.$message({
 | 
					      this.$message({
 | 
				
			||||||
        message: this.$t('module.factory.realtime.equipment.refresh'),
 | 
					        // message: this.$t('module.factory.realtime.equipment.refresh'),
 | 
				
			||||||
        type: 'warning',
 | 
					        type: 'warning',
 | 
				
			||||||
        duration: 1500,
 | 
					        duration: 1500,
 | 
				
			||||||
        onClose: () => {
 | 
					        onClose: () => {
 | 
				
			||||||
@@ -83,15 +79,20 @@ export default {
 | 
				
			|||||||
      this.dynamicPropSet = false
 | 
					      this.dynamicPropSet = false
 | 
				
			||||||
      this.rowNum = 0
 | 
					      this.rowNum = 0
 | 
				
			||||||
      this.testData = null
 | 
					      this.testData = null
 | 
				
			||||||
      this.tableReady = false
 | 
					      this.loadTable = false
 | 
				
			||||||
      this.equipmentCount = {}
 | 
					      this.equipmentCount = {}
 | 
				
			||||||
      this.setStaticTableProps()
 | 
					      this.setStaticTableProps()
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    handleData() {
 | 
					    handleData() {
 | 
				
			||||||
      this.expandDataStepOne()
 | 
					      this.expandDataStepOne()
 | 
				
			||||||
      this.expandDataStepTwo()
 | 
					      this.expandDataStepTwo()
 | 
				
			||||||
      // console.log('span data: ', this.equipmentCount)
 | 
					      // console.log('span data: ', this.equipmentCount)
 | 
				
			||||||
      this.tableReady = true
 | 
					      this.loadTable = true
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fetchList() {
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    expandDataStepOne() {
 | 
					    expandDataStepOne() {
 | 
				
			||||||
@@ -148,13 +149,13 @@ export default {
 | 
				
			|||||||
                this.tableProps.push({
 | 
					                this.tableProps.push({
 | 
				
			||||||
                  label: moment(obj.recordTime).format('YYYY-MM-DD HH:mm:ss'),
 | 
					                  label: moment(obj.recordTime).format('YYYY-MM-DD HH:mm:ss'),
 | 
				
			||||||
                  children: [
 | 
					                  children: [
 | 
				
			||||||
                    { prop: obj.recordTime + '-inputNum', label: i18n.t('module.factory.realtime.equipment.input') },
 | 
					                    // { prop: obj.recordTime + '-inputNum', label: i18n.t('module.factory.realtime.equipment.input') },
 | 
				
			||||||
                    { prop: obj.recordTime + '-outputNum', label: i18n.t('module.factory.realtime.equipment.output') },
 | 
					                    // { prop: obj.recordTime + '-outputNum', label: i18n.t('module.factory.realtime.equipment.output') },
 | 
				
			||||||
                    { prop: obj.recordTime + '-scrapNum', label: i18n.t('module.factory.realtime.equipment.scrapNum') },
 | 
					                    // { prop: obj.recordTime + '-scrapNum', label: i18n.t('module.factory.realtime.equipment.scrapNum') },
 | 
				
			||||||
                    {
 | 
					                    // {
 | 
				
			||||||
                      prop: obj.recordTime + '-scrapRate',
 | 
					                    //   prop: obj.recordTime + '-scrapRate',
 | 
				
			||||||
                      label: i18n.t('module.factory.realtime.equipment.scrapRate')
 | 
					                    //   label: i18n.t('module.factory.realtime.equipment.scrapRate')
 | 
				
			||||||
                    }
 | 
					                    // }
 | 
				
			||||||
                  ]
 | 
					                  ]
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
@@ -199,11 +200,11 @@ export default {
 | 
				
			|||||||
    setStaticTableProps() {
 | 
					    setStaticTableProps() {
 | 
				
			||||||
      // Step1: 设置静态的 table props
 | 
					      // Step1: 设置静态的 table props
 | 
				
			||||||
      const staticTableProps = [
 | 
					      const staticTableProps = [
 | 
				
			||||||
        { prop: 'lineName', label: i18n.t('module.factory.realtime.equipment.pl'), fixed: true },
 | 
					        // { prop: 'lineName', label: i18n.t('module.factory.realtime.equipment.pl'), fixed: true },
 | 
				
			||||||
        { prop: 'orderName', label: i18n.t('module.factory.realtime.equipment.currOrder'), fixed: true },
 | 
					        // { prop: 'orderName', label: i18n.t('module.factory.realtime.equipment.currOrder'), fixed: true },
 | 
				
			||||||
        { prop: 'productSize', label: i18n.t('module.factory.realtime.equipment.pSpecs'), fixed: true },
 | 
					        // { prop: 'productSize', label: i18n.t('module.factory.realtime.equipment.pSpecs'), fixed: true },
 | 
				
			||||||
        { prop: 'equName', label: i18n.t('module.factory.realtime.equipment.eqName'), fixed: true },
 | 
					        // { prop: 'equName', label: i18n.t('module.factory.realtime.equipment.eqName'), fixed: true },
 | 
				
			||||||
        { prop: 'totalProduction', label: i18n.t('module.factory.realtime.equipment.produceTotal'), fixed: true }
 | 
					        // { prop: 'totalProduction', label: i18n.t('module.factory.realtime.equipment.produceTotal'), fixed: true }
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
      this.tableProps = staticTableProps
 | 
					      this.tableProps = staticTableProps
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user