<template>
    <div>
        <el-dialog
          title="高级查询"
          :visible="moreQueryVisible"
          @close="close"
          width="66%">
          <el-form
            inline
            ref="queryForm"
            label-position="top"
            :model="formData">
            <el-form-item
              label="费用名称"
              prop="feeNameCode">
              <PublicQuery
              title="费用名称"
              single
              baseUrl="/chg_web/chgweb"
              cfgKey="chgWmsFeeName"
              :valueField.sync="formData.feeNameCode"
              :textField.sync="formData.feeName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="费用类别"
              prop="feeType">
              <el-select v-model="formData.feeType">
                <el-option label="运输费用" value="TRANSPORT_CHARGE"></el-option>
                <el-option label="特殊费用" value="SPECIAL_CHARGE"></el-option>
                <el-option label="增值服务费用" value="APPENDED_CHARGE"></el-option>
                <el-option label="服务费用" value="SERVICE_CHARGE"></el-option>
                <el-option label="全部" value="ALL"></el-option>
                <el-option label="理赔费用" value="CLAIM_CHARGE"></el-option>
                <el-option label="实际报账费用" value="DRIVER_REIMBURSE"></el-option>
                <el-option label="库存费用" value="KCFY"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="货主"
              prop="feeNameCode">
              <PublicQuery
              title="货主"
              baseUrl="/chg_web/chgweb"
              cfgKey="chgWmsCustomer"
              :valueField.sync="formData.ownerCode"
              :textField.sync="formData.ownerName">
              </PublicQuery>
            </el-form-item>
            <el-form-item
              label="费用时间"
              prop="remark">
              <el-date-picker
                v-model="date"
                type="datetimerange"
                format="yyyy-MM-dd HH:mm"
                value-format="yyyy-MM-dd HH:mm:ss"
                :default-time="['00:00:00', '23:59:59']"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :picker-options="pickerOptions2"
                @change="getTime1">
              </el-date-picker>
            </el-form-item>
          </el-form>
          <div class="more-query-btn">
            <el-button v-auth="50300030101" type="primary" @click="submitForm">查询</el-button>
            <el-button v-auth="50300030101" @click="resetForm">重置</el-button>
          </div>
        </el-dialog>
    </div>
</template>
<script>
import { time } from 'apec-fe-utils'
import { today, yesterday, week, month, twoMonths, threeMonths } from '@/config/shortcuts'
export default {
  data () {
    return {
      formData: {},
      pickerOptions2: {
        shortcuts: [today, yesterday, week, month, twoMonths, threeMonths]
      },
      date: [new Date(), new Date((new Date() - 3600 * 1000 * 24 * 29))],
    }
  },
  props: {
    moreQueryVisible: Boolean
  },
  methods: {

    // 获得生效时间
    getTime1 (val) {
      this.formData.feeDateFm = val[0]
      this.formData.feeDateTo = val[1]
    },

    // 关闭弹窗
    close () {
      this.$emit('close')
    },

    // 提交表单
    submitForm () {
      this.$emit('toGetList', this.formData)
      this.$refs.queryForm.resetFields()
    },

    // 重置表单
    resetForm () {
      this.$refs.queryForm.resetFields()
    },

  },
  watch: {
    // feeData:{
    //   handler(item){
    //     this.formData.feeName=item.ebfhNameCn
    //   }
    // }
  }
}
</script>
