<template>
  <el-dialog :visible.sync="ishow" append-to-body title="盘点登记" width="68%">
    <div class="head-container">
    <!-- 搜索 -->
    <el-form  :inline="true" ref="form2" :model="form2"  size="small" label-width="60px" style="width: 80%">
      <el-form-item label="单号">
        <el-input v-model="form2.code" style="width: 120px;" disabled />
      </el-form-item>
      <el-form-item label="类型" prop="type">
        <el-select v-model="form2.type" filterable placeholder="请选择" style="width: 120px;" disabled >
          <el-option
            v-for="item in dict.count_type"
            :key="item.id"
            :label="item.label"
            :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="form2.remark" style="width: 120px;" />
      </el-form-item>
    </el-form>

      <!-- 导出 -->
      <div style="display: inline-block;">
        <el-button
          :loading="downloadLoading"
          size="mini"
          class="filter-item"
          type="warning"
          icon="el-icon-download"
          @click="downloadMethod"
        >导出
        </el-button>
      </div>

    <!--表格渲染-->
    <el-table v-loading="loading" :data="data" style="width: 100%;margin-top: -10px;">
      <el-table-column type="selection" width="40" />
      <el-table-column prop="item.code" label="物料序号" />
      <el-table-column prop="item.name" label="物料序号" />
      <el-table-column prop="srcStockCode" label="源容器编码" />
      <el-table-column prop="srcPointCode" label="源点位编码" />
      <el-table-column prop="planQty" label="计划数量" width="80px"/>
      <el-table-column prop="countQty" label="盘点数量" width="80px"/>
      <el-table-column prop="countQty" label="盘点登记" width="80px">
      <template slot-scope="scope">
        <el-input v-model="scope.row.planQty" placeholder="请输入内容" ></el-input>
      </template>
      </el-table-column>
      <el-table-column prop="updateBy" label="修改人" />
      <el-table-column prop="updateTime" label="修改时间" />
    </el-table>
    <!--分页组件-->
    <el-pagination
      :total="total"
      :current-page="page + 1"
      :page-size="6"
      style="margin-top:8px;"
      layout="total, prev, pager, next"
      @size-change="sizeChange"
      @current-change="pageChange"
    />
    </div>
  </el-dialog>

</template>

<script>
import crud from '@/mixins/crud'
import DateRangePicker from '@/components/DateRangePicker'
import {getCountRecord} from "@/api/countRecord";
import DonMessage from '@/utils/message'

export default {
  components: {DateRangePicker},
  mixins: [crud],
  dicts: ['count_type'],
  data() {
    return {
      ishow:false,
      form2: {id:null,remark: null,code: null,type:null},
      data:"",
      title: '盘点登记'
    }
  },
  methods: {
    doInit(parent) {
      this.data = null;
      this.ishow=true;
       getCountRecord(parent.id).then(res => {
        this.data = res;
        this.form2.id=parent.id
        this.form2.remark=parent.remark
        this.form2.code=parent.code
        this.form2.type=parent.type
        this.loading = false;

      })
    },
    indexMethod(index) {
      return index * 1 + 1;
    }
  }
}
</script>

<style scoped>
.java.hljs {
  color: #444;
  background: #ffffff !important;
}

::v-deep .el-dialog__body {
  padding: 0 20px 10px 20px !important;
}
</style>
