<template>
  <div>
    <p-form-model v-show="toggleFormTag" ref='formTarget' :colon="false" :label-col='{ span: 8 }' :model='form'
                  :wrapper-col='{ span: 16 }' class='plg-grid-from' >
      <a-row>
        <a-col :span='6'>
          <p-form-model-item label='起始时间'>
            <p-date-picker v-model='form.startDate' allowClear placeholder='请选择起始时间'
                           style='width: 100%;' show-time valueFormat="YYYY-MM-DD HH:mm:ss" />
          </p-form-model-item>
        </a-col>
        <a-col :span='6'>
          <p-form-model-item label='结束时间'>
            <p-date-picker v-model='form.endDate' allowClear placeholder='请选择结束时间'
                           style='width: 100%;' show-time valueFormat="YYYY-MM-DD HH:mm:ss" />
          </p-form-model-item>
        </a-col>
        <a-col :span='6'>
          <p-form-model-item label='商品名称'>
            <p-input v-model='form.itemName' allowClear placeholder='请输入商品名称' />
          </p-form-model-item>
        </a-col>
        <!-- <a-col :span='6'>
          <p-form-model-item label='批号'>
            <p-input v-model='form.lotNo' allowClear placeholder='请输入批号' />
          </p-form-model-item>
        </a-col> -->
        <a-col :span='6'>
          <p-form-model-item label='出库单号'>
            <p-input v-model='form.billNo' allowClear placeholder='请输入出库单号' />
          </p-form-model-item>
        </a-col>
        <a-col :span='6'>
          <p-form-model-item label='波次号'>
            <p-input v-model='form.waveid' allowClear placeholder='请输入波次号' />
          </p-form-model-item>
        </a-col>
        <a-col :span='6'>
          <p-form-model-item label='商品编码'>
            <p-input v-model='form.itemCode' allowClear placeholder='请输入商品编码' />
          </p-form-model-item>
        </a-col>
      </a-row>
    </p-form-model>
    <p-table ref='dataSource' :data-source.sync='dataSource'
               :remote-url='listRemoteUrl'
               :remoteData='listParams'
               :scroll="{x:true}"
               :autoLoad="false"
               :selectedRowKeys.sync='selectedRowKeys'
               @select="onSelect"
               @selectAll="selectAll"
               bordered dragle row-key='lineid'>
      <p-table-column :width="180" data-index='createdate' title='订单时间' />
      <p-table-column :width="180" data-index='billno' title='出库单号' />
      <p-table-column :width="180" data-index='waveid' title='波次号' />
      <p-table-column :width="180" data-index='itemcode' title='商品编码' />
      <p-table-column :width="180" data-index='itemname' title='商品名称' />
      <p-table-column :width="120" data-index='upFlag' title='是否上传首营资料' />
      <p-table-column :width="80" data-index='count' title='打印次数' />
    </p-table>
  </div>
</template>

<script>
import { listRemoteUrl } from '../api'
export default {
  props: {
    toggleFormTag: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      form: {},
      dataSource:[],
      selectedRowKeys:[],
      selectedRow:[],
      listRemoteUrl,
      listParams: {
        num: "syzlbill",
      },
    }
  },
  mounted() {
    this.$set(this.form,'startDate',this.$moment().format('YYYY-MM-DD 00:00:00'))
    this.$set(this.form, 'endDate', this.$moment().format('YYYY-MM-DD 23:59:59'))
    this.listParams = {
      num: "syzlbill",
      params: {
        ...this.form
      }
    }
  },
  methods: {
    onSelect(p1,p2,p3) {
      this.selectedRow = p3
    },
    selectAll(p1, p2, p3) {
      this.selectedRow = p2
    },
  }
}
</script>

<style>

</style>