
<template>
  <div class="div1">

    <div class="div2" style="padding-bottom: 10px">
      <el-form ref="form" :model="param" label-width="80px">
        <el-row :gutter="24">
          <el-col :span="4">
            <el-form-item label="库位号:">
              <el-input type="textarea" v-model="param.locCode" :rows="1"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="料号:" >
              <el-input  type="textarea" v-model="param.itemCode" :rows="1"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="物料描述:">
              <el-input type="text" v-model="param.itemName" :rows="1"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="LOC">
              <el-select v-model="param.propC2"  multiple filterable placeholder="请选择库区" style="width: 100%;">
                <el-option
                    v-for="item in LOCS"
                    :key="item.ID"
                    :label="item.PROP_C2"
                    :value="item.PROP_C2"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="库存状态:">
              <el-select v-model="param.status"  multiple filterable placeholder="请选择库存状态" style="width: 100%;">
                <el-option
                    v-for="item in Zt"
                    :key="item.index"
                    :label="item.STATUS"
                    :value="item.STATUS"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="库区">
              <el-select v-model="param.kqName"  multiple filterable placeholder="请选择库区" style="width: 100%;">
                <el-option
                    v-for="item in Ku"
                    :key="item.index"
                    :label="item.name"
                    :value="item.name"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24" v-show="isShow">
          <el-col :span="4">
            <el-form-item label="批次号:">
              <el-input type="textarea" v-model="param.propC1" :rows="1"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="特殊标记:" ref="all">
              <el-input type="text" v-model="param.propC3"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="存货日期:">
              <el-date-picker style="width: 325px"
                              v-model="param.storageDate"
                              type="daterange"
                              align="right"
                              unlink-panels
                              range-separator="至"
                              start-placeholder="开始日期"
                              end-placeholder="结束日期"
                              :picker-options="pickerOptions">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="供应商号:">
              <el-input type="text" v-model="param.propC5"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="4">
            <el-form-item label="是否盘点:">
              <el-select v-model="param.coun_Plan"  placeholder="请选择" style="width: 100%;">
                <el-option
                    v-for="item in pd"
                    :key="item.label"
                    :label="item.values"
                    :value="item.label"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
       </el-row>
        <el-row :gutter="24" v-show="isShow">
        <el-col :span="4">
          <el-form-item label="是否批次号管理:">
            <el-select v-model="param.SINGLE_ITEM"  placeholder="请选择" style="width: 100%;">
              <el-option
                  v-for="item in pc"
                  :key="item.label"
                  :label="item.values"
                  :value="item.label"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="4">
          <el-form-item label="是否有效期管理:">
            <el-select v-model="param.validity"    placeholder="请选择" style="width: 100%;">
              <el-option
                  v-for="item in yxq"
                  :key="item.label"
                  :label="item.values"
                  :value="item.label"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>

          <el-col :span="4">
            <el-form-item label="退料状态:">
              <el-select v-model="param.statuss"   placeholder="请选择" style="width: 100%;">
                <el-option
                    v-for="item in tl"
                    :key="item.label"
                    :label="item.values"
                    :value="item.label"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-button type="success" @click="find">查找</el-button>
        <el-button type="success" @click="rest">重置</el-button>&nbsp;&nbsp;
        <el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
      </el-form>
    </div>

    <el-table
        v-loading="this.tableloding"
        :height="MaxHeight"
        :header-cell-style="{background:'#000',color:'#fff'}"
        :data="tableData"
        id="educe-table"
        ref="tableData"
        style="width: 100%;">
      <el-table-column
          type="selection"
          width="55">
      </el-table-column>
      <el-table-column
          fixed
          label="序号"
          v-if="false"
          width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.id }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="ID"-->
<!--          width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.id}}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="库位号"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.locCode }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="料号"
          width="160">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.itemCode }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          :show-overflow-tooltip="true"
          label="描述"
          width="180">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.itemName }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="序列号"-->
<!--          width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.barCode }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="状态"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.status }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="库位ID"-->
<!--          width="100">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.LOCATION_ID }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column-->
<!--          label="料号属性ID"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.ITEM_KEY_ID }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="库存数量"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.quantity}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="占用数量"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.queuedQuantity }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="批次号"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC1 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="LOC"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC2 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="特殊标记"
          width="60">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC3 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="部门"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC4 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="供应商编号"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC5 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="申请人编号"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC6 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="申请人"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC7 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          :show-overflow-tooltip="true"
          label="暂存原因"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC8 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="工厂"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.propC9 }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="入库单号"-->
<!--          width="160">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.soi }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="生产日期"
          width="180">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{scope.row.prop_D1!=null?new Date(scope.row.prop_D1).toISOString().replace('T','').substring(0,10):scope.row.prop_D1}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="到日期"
          width="180">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{scope.row.prop_D2!=null?new Date(scope.row.prop_D2).toISOString().replace('T','').substring(0,10):scope.row.prop_D1}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="库区"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.kqName }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="库区ID"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.ZONE_ID }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="是否盘点"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.lock==1?"是":"否"}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="AGV库位"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.LSname }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="是否SAP料号"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.Be_SAP_Item==1?"是":"否"}}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="体积"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.VOLUME }}</span>
          </div>
        </template>
      </el-table-column><el-table-column
        label="是否危化品"
        width="80">
      <template slot-scope="scope">
        <div slot="reference" class="name-wrapper">
          <span>{{ scope.row.BE_WEIGHT==1?"是":"否" }}</span>
        </div>
      </template>
    </el-table-column>
      <el-table-column
          label="库存价值等级"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.SHIP_RULES }}</span>
          </div>
        </template>
     </el-table-column>
<!--  <el-table-column-->
<!--        label="OA料号"-->
<!--        width="80">-->
<!--      <template slot-scope="scope">-->
<!--        <div slot="reference" class="name-wrapper">-->
<!--          <span>{{ scope.row.FEE_TYPE }}</span>-->
<!--        </div>-->
<!--      </template>-->
<!--    </el-table-column>-->
      <el-table-column
          label="是否批号管理"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.SINGLE_ITEM==1?"是":"否" }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="是否序列号"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.BE_MARK_WEIGHT ==1?"是":"否"}}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="单位"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.UNIT }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="备注"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.STR_EXTEND1 }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          label="币种"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.STR_EXTEND2 }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="标准价"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.STR_EXTEND3 }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column-->
<!--          label="库存单位"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.STR_EXTEND4 }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="是否在GAV仓"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.agvFlag==1?"是":"否" }}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--          label="库位id"-->
<!--          width="80">-->
<!--        <template slot-scope="scope">-->
<!--          <div slot="reference" class="name-wrapper">-->
<!--            <span>{{ scope.row.locId }}</span>-->
<!--          </div>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column
          label="库位类型"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.lts_name }}</span>
          </div>
        </template>
      </el-table-column> <el-table-column
        label="是否有效期管理"
        width="80">
      <template slot-scope="scope">
        <div slot="reference" class="name-wrapper">
          <span>{{ scope.row.validity==1?"是":"否" }}</span>
        </div>
      </template>
    </el-table-column>
      <el-table-column
          label="库存日期"
          width="100">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ new Date(scope.row.storageDate).toISOString().replace('T','').substring(0,10)}}</span>
          </div>
        </template>
      </el-table-column>
<!--      <el-table-column-->
<!--        label="工作站"-->
<!--        width="80">-->
<!--      <template slot-scope="scope">-->
<!--        <div slot="reference" class="name-wrapper">-->
<!--          <span>{{ scope.row.moveStatus }}</span>-->
<!--        </div>-->
<!--      </template>-->
<!--    </el-table-column>-->
      <el-table-column
          label="退料标记"
          width="80">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.inv_status }}</span>
          </div>
        </template>
      </el-table-column> <el-table-column
        label="重量"
        width="80">
      <template slot-scope="scope">
        <div slot="reference" class="name-wrapper">
          <span>{{ scope.row.WEIGHT }}</span>
        </div>
      </template>
    </el-table-column>
    </el-table>
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNum"
        :page-sizes="[ 50, 100, 200,500]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
    </el-pagination>
  </div>

</template>

<script>
export default {
  data() {
    return {
      //是否盘点
      pd: [
        {
          label:0,
          values:"否",
        },{
          label:1,
          values:"是",
        }
      ],
      //是否批次号管理
      pc: [
        {
          label:0,
          values:"否",
        },{
          label:1,
          values:"是",
        }
      ],
      //是否有效期管理
      yxq: [
        {
          label:0,
          values:"否",
        },{
          label:1,
          values:"是",
        }
      ],
      //退料状态
      tl: [
        {
          label:0,
          values:"否",
        },{
          label:1,
          values:"是",
        }
      ],
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },
      tableloding: false,
      isShow:false,//是否展示全部搜索条件
      value1: '',
      value2: '',
      tableData: [],
      pageSize: 50,
      pageNum: 1,
      total: 3,
      param: {
        itemCode: '',
        locCode: '',
        //物料描述
        itemName: '',
        //批次号
        propC1: '',
        //库存状态
        status: '',
        //库区
        kqName: '',
        //Loc
        propC2: [],
        //特殊标记
        propC3: '',
        //存货日期
        storageDate: [],
        //供应商号
        propC5: '',
        //盘点是否锁定
        coun_Plan: '',
        //是否批次号管理
        SINGLE_ITEM: '',
        //是否有效期管理
        validity: '',
        //退料状态
        statuss: '',
      },
      LOCS: [],
      Ku: [],
      Zt: [],
      checked: false,
    }
  },computed:{
    MaxHeight(){
      return  window.innerHeight - 240 +"px";
    }
  },
   mounted: function () {
    this.queryUser();
    this.LOC();
    this.KuS();
    this.ZtS();
  },
  methods: {

    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageNum = 1;
      this.pageSize = val;
      this.queryUser();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pageNum = val;
      this.queryUser();
    },
    LOC(){
      //LOC下拉列表数据加载
      this.$axios.post(this.$httpUrl + '/Rukuzhengli/LOC', {

      }).then(res => res.data)
          .then(res => {
            if (res.code == 200) {
              this.LOCS = res.data;
            } else {
              this.$message.error('获取数据失败');
            }

            // eslint-disable-next-line no-unused-vars
          },err=>{
            this.tableloding=false;
          })
    },
    KuS(){
      //库区下拉列表数据加载
      this.$axios.post(this.$httpUrl + '/Kucunhuizong/ku', {

      }).then(res => res.data)
          .then(res => {
            if (res.code == 200) {
              this.Ku = res.data;
            } else {
              this.$message.error('获取数据失败');
            }

            // eslint-disable-next-line no-unused-vars
          },err=>{
            this.tableloding=false;
          })
    },
    ZtS(){
      //状态下拉列表数据加载
      this.$axios.post(this.$httpUrl + '/Kucunhuizong/zt', {

      }).then(res => res.data)
          .then(res => {
            if (res.code == 200) {
              this.Zt = res.data;
            } else {
              this.$message.error('获取数据失败');
            }

            // eslint-disable-next-line no-unused-vars
          },err=>{
            this.tableloding=false;
          })
    },
    queryUser() {
      //列表数据加载
      this.$axios.post(this.$httpUrl + '/Kucunhuizong/queryAll', {
        pageSize: this.pageSize,
        pageNum: this.pageNum,
        param: this.param,
      }).then(res => res.data)
          .then(res => {
            if (res.code == 200) {
              this.tableData = res.data
              this.total = res.total
            } else {
              this.$message.error('获取数据失败');
            }

            // eslint-disable-next-line no-unused-vars
          },err=>{
            this.tableloding=false;
          })

    },
    find(){
      this.queryUser();
    },
    Allquesr(){
      //查询按钮
      if(this.checked){
        this.isShow=true;
      }else {
        this.isShow=false;
      }
    },
    rest() {
      //条件查询重置
      this.checked=false;
      this.isShow=false;
      this.param={};
    },
  }
}
</script>
<style scoped>

</style>
