import HeadForm from "../component/HeadForm"
import Tables from "../component/Tables"
export default {
  components: {
    HeadForm,
    Tables
  },
  data() {
    return {

    }
  },
  mounted() {

  },
  methods: {
    formParams(){
      let condtion = {}
      let reqData = {}
      this.formData.forEach(item => {
        if(item.value || (item.value && item.value.length)) {
          if(item.fieldName == 'time') {
            condtion[item.startTime] = item.value[0];
            condtion[item.endTime] = item.value[1];
            return
          }
          condtion[item.fieldName] = item.value
        }
      })
      Object.keys(condtion).forEach(key => {
        if(condtion[key]) {
          reqData[key] = condtion[key]
        }
      })
      if(this.queryParams && Object.keys(this.queryParams)) {
        reqData = Object.assign(reqData, this.queryParams)
      }
      return reqData
    },
    //条件
    handleSearch(){
      let params = this.formParams()
      params.pageNum = 1
      this.handleQuery(params)
    },
    //分页
    handleCurrentChange(e){
      console.log(e)
      let params = this.formParams()
      params.pageNum = e
      this.handleQuery(params)
    },
    handleSizeChange(e){

    },
    //排序
    sortChange(e){
      console.log(e)
    }
  }
}
