<!--
@name: 辅助拣选监控
@author: 李恒
@time: 2022-03-10 20:52:29
-->
<template>
  <p-card title='人机辅助界面'>
    <a-empty v-if='pickPanelList.length === 0' />
    <div class='pick-container'>
      <div class='pick-item' v-for='item in pickPanelList'>
        <pickPanel :platformInfo='item' />
      </div>
    </div>
  </p-card>
</template>

<script>
import pollingMixin from './js/pollingMixin'
import pickPanel from './components/pickPanel'
import { itemContainerPick } from './api'

export default {
  mixins: [pollingMixin],
  components: { pickPanel },
  data() {
    return {
      searchForm: {
        stationNo: 'S01',
        positionNo: ''
      },
      pickPanelList: []
    }
  },
  mounted() {
    this.startPolling()
  },
  methods: {
    // 轮询执行
    getData() {
      console.log('轮询执行:getData')
      this.itemContainerPick()
    },
    itemContainerPick() {
      const params = {
        ...this.searchForm
      }
      itemContainerPick(params).then(res => {
        console.log(res)
        if (res.success) {
          this.pickPanelList = res.data
        } else {
          this.$message.error(res.message)
        }
      })
    }
  }
}
</script>

<style scoped lang='less'>
.pick-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  place-items: center;
  grid-gap: 5px;

  .pick-item {
    width: 680px;
    float: left;
  }
}
</style>