<template>
  <div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
      <el-form-item label="关键字" prop="soNo">
        <el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、备注"/>
      </el-form-item>
      <el-form-item label="日期" prop="searchTimeArray">
        <el-date-picker
          v-model="queryParams.searchTimeArray"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item v-if="TicketType === 'tp'"  label="服务顾问" prop="userId">
        <StaffChoose />
      </el-form-item>
      <el-form-item v-if="TicketType === 'tu'" label="维修类别" prop="repairType">
        <el-select v-model="queryParams.repairType" size="small">
          <el-option v-for="item in this.getDictDatas(DICT_TYPE.REPAIR_TYPE)" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="TicketType === 'tp'" label="类型" prop="repairType">
        <RepairTypeChoose @selected="getRepairType" />
      </el-form-item>
      <el-form-item label="门店" prop="userId">
        <SupplierChoose />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" >搜索</el-button>
        <el-button icon="el-icon-refresh" >重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5" v-if="!(TicketType === 'tv')">
        <el-button type="primary" plain icon="el-icon-download" size="mini"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch"></right-toolbar>
    </el-row>
    <TicketTable :ticket-type="TicketType"/>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
    />
  </div>
</template>

<script>
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
import TicketTable from "@/views/repair/tickets/Components/TicketTable.vue";
import RepairTypeChoose from "@/views/repair/Components/RepairTypeChoose.vue";

export default {
  name: "TicketSearch",
  components: {
    TicketTable,
    StaffChoose,
    SupplierChoose,
    RepairTypeChoose
  },
  props:{
    TicketType:{
      type: String,
      defaultValue: 'tp',
      required: true
    }
  },
  data() {
    return {
      queryParams:{},
      showSearch: true,
      total: 0,
    }
  },
  methods: {
    // 类型选择
    getRepairType(data){
      console.log(data)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
