<template>
  <div class="inventoryCheckingOverall-wrap">
    <a-page-header :ghost="false" @back="handleBack" class="inventoryCheckingOverall-back">
      <!-- 自定义的二级文字标题 -->
      <template slot="subTitle">
        <a id="inventoryChecking-overall-submit" href="javascript:;" @click="handleBack">返回列表</a>
      </template>
    </a-page-header>
    <a-card size="small" :bordered="false" class="inventoryCheckingOverall-cont">
      <!-- 操作按钮 -->
      <div class="table-operator">
        <a-checkbox-group @change="onChange" v-model="queryParam.keyword" :disabled="disabled" id="inventoryCheckingOverall-type">
          <a-checkbox value="A">不含废品仓</a-checkbox>
          <a-checkbox value="B">有库存</a-checkbox>
        </a-checkbox-group>
      </div>
      <!-- 列表 -->
      <s-table
        class="sTable"
        ref="table"
        size="default"
        :rowKey="(record) => record.id"
        :columns="columns"
        :data="loadData"
        :showPagination="false"
        bordered>
      </s-table>
    </a-card>
    <a-affix :offset-bottom="0">
      <div style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
        <a-button type="primary" id="inventoryChecking-overall-submit" size="large" class="button-primary" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
      </div>
    </a-affix>
  </div>
</template>

<script>
import { warehouseAllList, warehouseDel } from '@/api/warehouse'
import { STable, VSelect } from '@/components'
export default {
  components: { STable, VSelect },
  data () {
    return {
      queryParam: { //  查询条件
        keyword: [] //
      },
      disabled: false, //  查询、重置按钮是否可操作
      columns: [
        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
        { title: '产品编码', dataIndex: 'createDate', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品名称', dataIndex: 'nsso', width: 70, align: 'center', customRender: function (text) { return text || '--' } },
        { title: '单位', dataIndex: 'no3', width: 70, align: 'center', customRender: function (text) { return text || '--' } },
        { title: '库存数量', dataIndex: 'n4o', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
      ],
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        this.disabled = true
        // return warehouseAllList( this.queryParam ).then(res => {
        //   const data = res.data
        //   this.disabled = false
        //   return data
        // })
        const _this = this
        return new Promise(function (resolve, reject) {
          const data = {
            pageNo: 1,
            pageSize: 10,
            list: [
              { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
            ],
            count: 10
          }
          for (var i = 0; i < data.list.length; i++) {
            data.list[i].no = i + 1
          }
          _this.disabled = false
          resolve(data)
        })
      }

    }
  },
  methods: {
    //  提交
    handleSubmit () {

    },
    //  返回
    handleBack () {
      this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
    },
    //
    onChange () {}
  }
}
</script>

<style lang="less">
  .inventoryCheckingOverall-wrap{
    padding: 10px 0 30px;
    .table-operator{
      margin-bottom: 25px;
    }
    .inventoryCheckingOverall-cont, .inventoryCheckingOverall-back{
      margin-bottom: 15px;
    }
  }
</style>
