<template>
  <!-- 运输实绩信息页面 -->
  <div class="transportInfo">
    <div class="top">
      <el-form :inline="true" style="margin-top: 0.5rem;">
        <el-form-item>
          <label class="el-form-item__label" style="width: auto;">时间段</label>
         <el-date-picker
      v-model="dateValue"
      type="daterange"
      range-separator="至"
      start-placeholder="开始日期"
      end-placeholder="结束日期">
    </el-date-picker>
        </el-form-item>
        <el-form-item>
      <label class="el-form-item__label" style="width: auto;">产品分类</label>
      <el-autocomplete
        popper-class="my-autocomplete"
        v-model="inputValue"
        :fetch-suggestions="querySearch"
        placeholder="请输入内容" 
      >
        <i class="el-icon-edit el-input__icon" slot="suffix"> </i>
      </el-autocomplete>
        </el-form-item>
      <el-form-item>
      <label class="el-form-item__label" style="width: auto;margin-top: 0.4rem;">车牌号</label>
      </el-form-item>
      <el-form-item>
          <el-input class="el-form-item__content" v-model="capacityNumber1" placeholder="请输入内容"></el-input>
      </el-form-item>
      <el-form-item>
          <label class="el-form-item__label" style="width: auto;margin-top: 0.4rem;">收货单位</label>
      </el-form-item>
      <el-form-item>
          <el-input v-model="consigneeCompanyName1" placeholder="请输入内容"></el-input>
      </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSearch"><i class="el-icon-search"></i>查询</el-button>
        </el-form-item>
      </el-form>
    </div>

    <dilTable ref="tab" v-bind.sync="option">
    </dilTable>
  </div>
</template>


<script>

export default {
  name: "transportInfo",
  data() {
    return {
      dateValue:[new Date(), new Date()],
      inputValue:"",
      capacityNumber1:"",
      consigneeCompanyName1:"",
      status: "",
      state: "",
      option: {       
        // 表格请求数据的地址
        requestUrl: "api/v1/tms/getTransportationInfo?apiId=166",
      },
    };
  },
  mounted() {
    this.restaurants = this.loadAll();
  },
  methods: {
 querySearch(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createFilter(queryString))
        : restaurants;
      cb(results);
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    loadAll() {
      return [
        { value: "带钢"},
        { value: "微粉"},
        { value: "螺纹钢"},
        { value: "钢坯"},
        { value: "其他"},
      ];
    },


    onSearch(){
      //改变查询条件
      this.$refs.tab.setDataRequestQuery({"startTime":sjTime(this.dateValue[0]),
                      "endTime": sjTime(this.dateValue[1]),
                      "productClassification": this.inputValue,
                      "capacityNumber1": this.capacityNumber1,
                      "consigneeCompanyName1": this.consigneeCompanyName1});                         
    },
    },
};
</script>
<style lang='scss' scoped>
.homeworkPath {
  .top {
    padding: 20px 30px;
  }
}
</style>