<template>
  <div>
    <el-card className="el-card">
      <el-form :model="filterQuery" class="query-form" size="mini" label-width="100px" v-show="showSearch">
        <el-row>
          <el-col :span="6">
            <el-form-item class="query-form-item" label="单号:">
              <el-input v-model="filterQuery.billNo" placeholder="单号"
                        style="width: 90%"
                        clearable="true"></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item class="query-form-item" label="单据类型:">
              <el-select v-model="filterQuery.billType" placeholder="请选择单据类型" style="width: 90%">
                <el-option
                  v-for="item in busTypes"
                  :key="item.name"
                  :label="item.name"
                  :value="item.action">
                  <span style="float: left">{{ item.name }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item class="query-form-item" label="单据状态:">
              <el-select v-model="filterQuery.orderStatus" placeholder="请选择单据状态" style="width: 90%">
                <el-option
                  v-for="item in orderStatusList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value">
                  <span style="float: left">{{ item.label }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item class="query-form-item" label="提交状态:">
              <el-select v-model="filterQuery.submitStatus" placeholder="请选择提交状态" style="width: 90%">
                <el-option
                  v-for="item in submitStatusList"
                  :key="item.label"
                  :label="item.label"
                  :value="item.value">
                  <span style="float: left">{{ item.label }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :span="6">
            <el-form-item class="query-form-item" label="往来单位:">
              <el-input
                v-model="filterQuery.corpName"
                placeholder="请输入往来单位"
                style="width: 90%"
                clearable="true"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item class="query-form-item" label="往来单位:">
              <el-date-picker
                :picker-options="pickerOptions"
                v-model="actDateRange"
                type="daterange"
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="width: 90%"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div class="top-right-btn">
        <el-button-group>
          <el-button icon="el-icon-view" type="primary" @click="hideSearch">显示/隐藏搜索栏</el-button>
          <el-button
            type="primary"
            icon="el-icon-refresh"
            @click="onReset"
          >重置
          </el-button>
          <el-button type="primary" icon="el-icon-search" @click="onSubmit"
          >查询
          </el-button
          >
        </el-button-group>
      </div>
      <el-divider style="margin: 15px"></el-divider>
    </el-card>

  </div>
</template>

<script>


const formJson = {
  site_id: "",
  site_name: "",
  describe: "",
  ads: [],
};

export default {
  name: "uploadSetting",
  data() {
    return {
      filterQuery: {
        billType: null,
        corpName: null,
        invCode: null,
        startTime: null,
        endTime: null,
        billNo: null,
        orderStatus: null,
        submitStatus: null,
        page: 1,
        limit: 10
      },
      showSearch: true,
      busTypes: [],
      orderStatusList: [
        {
          label: '未配货',
          value: '2'
        },
        {
          label: '待校验',
          value: '3'
        },
        {
          label: '已校验',
          value: '4'
        },
        {
          label: '已验收',
          value: '5'
        }
      ],
      submitStatusList: [
        {
          label: '未提交',
          value: 0
        },
        {
          label: '已提交',
          value: 1
        },
        {
          label: '提交失败',
          value: 2
        },
      ],
      actDateRange: null,
      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]);
            },
          },
        ],
      }
    };
  },
  components: {},
  methods: {
    hideSearch() {
      this.showSearch = !this.showSearch;
    },
    onReset() {

    },

  },
  filters: {
    statusFilterType(status) {
      const statusMap = {
        false: "success",
        true: "warning",
      };
      return statusMap[status];
    },
  },
  mounted() {
    document.body.ondrop = function (event) {
      event.preventDefault();
      event.stopPropagation();
    };
  },
  created() {
  },
};
</script>

<style type="text/scss" lang="scss">
</style>

