<template>
  <a-row :gutter="24">
    <a-col :md="24">
      <a-card :bordered="false">
        <!-- 查询区域 -->
        <!-- <filter-form></filter-form> -->
        <div>
          <a-button type="primary" icon="plus" @click="addTask">新增盘点任务</a-button>
          <a-button>取消盘点</a-button>
          <a-button>批量删除</a-button>
          <a-button>导出任务</a-button>
        </div>
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :components="handleDrag(columns)"
          :pagination="ipagination"
          :scroll="scroll"
          :loading="loading"
          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
          @change="handleTableChange"
        >
          <span slot="action" slot-scope="text, record">
            <a @click="myHandleDetail(record, '采购入库', prefixNo)">查看</a>
            <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
            <a v-if="btnEnableList.indexOf(1) > -1" @click="myHandleEdit(record)">编辑</a>
            <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
            <a-popconfirm
              v-if="btnEnableList.indexOf(1) > -1"
              title="确定删除吗?"
              @confirm="() => myHandleDelete(record)"
            >
              <a>删除</a>
            </a-popconfirm>
          </span>
        </a-table>
      </a-card>
    </a-col>
    <stock-modal
      :stockVisible.sync="stockVisible"
      :form="form"
      :validatorRules="validatorRules"
      ref="stockF"
    ></stock-modal>
  </a-row>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import FilterForm from './components/FilterForm.vue'
import table from './utils/table'
import StockModal from './components/stockModal.vue'
import { getAction } from '@/api/manage'

export default {
  components: { FilterForm, StockModal },
  mixins: [JeecgListMixin],
  data() {
    return {
      description: '盘点任务列表',
      // 表头
      scroll: { x: 1500 },
      // 权限按钮集合
      btnEnableList: [1, 1, 1],
      queryParam: {
        taskStatus: '',
        number: '',
        depotId: '',
        createBy: '',
      },
      // stockTable: {
      //   loading: false,
      //   dataSource: [],
      //   columns: table.taskColumns,
      // },
      defColumns: table.taskColumns,
      dataSource: [],
      form: {
        number: '',
        taskType: '',
        taskName: '',
        depotId: '',
        creator: '',
        createBy: '',
        createTime: '',
        positionRange: '',
        materialExtendIdList: [],
      },
      validatorRules: {
        taskType: { rules: [{ required: true, message: '请选择盘点类型' }] },
        depotId: { rules: [{ required: true, message: '请选择盘点仓库' }] },
        taskName: { rules: [{ required: true, message: '请输入盘点任务名称' }] },
      },
      rules: {
        number: { rules: [{ required: true, message: '请输入盘点编号' }] },
      },
      organId: { rules: [{ required: true, message: '请选择盘点类型' }] },
      organId: { rules: [{ required: true, message: '请选择盘点仓库' }] },
      organId: { rules: [{ required: true, message: '请选择盘点负责人' }] },
      url: {
        list: '/stocktaking/list',
        add: '/stocktaking/add',
      },
      stockVisible: false,
    }
  },

  methods: {
    addTask() {
      this.stockVisible = true
    },
  },
}
</script>

<style></style>
