<!--高级检索-->
<template>
  <el-dialog :visible.sync="dialogFormVisible" class="searchMoreDialog" title="高级检索" append-to-body @close="cancel">
    <el-scrollbar>
      <el-form ref="dataForm" :label-position="labelPosition" :model="listQuery" label-width="120px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="案卷编号">
              <el-input v-model.trim="listQuery.caseid" type="text" placeholder="案卷编号"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="案卷状态">
              <el-select v-model="listQuery.caseState" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseStateList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事件来源">
              <el-select v-model="listQuery.source" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseSourceList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="超期查询">
              <el-select v-model="listQuery.specialQuery" clearable placeholder="请选择">
                <el-option
                  v-for="item in specialQueryList"
                  :key="item.state"
                  :label="item.stateName"
                  :value="item.state"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题描述">
              <el-input v-model.trim="listQuery.description" type="text" placeholder="问题描述"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="发生地点">
              <el-input v-model.trim="listQuery.fieldintro" type="text" placeholder="发生地点"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="案卷类别">
              <el-select v-model="listQuery.eorc" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseTypeList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="案卷大类">
              <el-select v-model="listQuery.casetypeCode" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseBigTypeList"
                  :key="item.id"
                  :label="item.typeName"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="案卷小类">
              <el-select v-model="listQuery.casetypeDetailCode" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseDetailTypeList"
                  :key="item.typeDetailCode"
                  :label="item.typeDetailName"
                  :value="item.typeDetailCode"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="上报人员">
              <el-select v-model="listQuery.createUser" clearable placeholder="请选择">
                <el-option
                  v-for="item in supervisorList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="业务单位">
              <el-select v-model="listQuery.source" clearable placeholder="请选择">
                <el-option
                  v-for="item in caseSourceList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="归档类型">
              <el-select v-model="listQuery.filingType" clearable placeholder="请选择">
                <el-option
                  v-for="item in filingTypeList"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="上报开始时间">
              <el-date-picker
                v-model="listQuery.createTimeBegin"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择上报开始时间"/>
            </el-form-item>
          </el-col>
          <el-col :span="10" :offset="1">
            <el-form-item label="上报结束时间">
              <el-date-picker
                v-model="listQuery.createTimeEnd"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择上报结束时间"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="立案开始时间">
              <el-date-picker
                v-model="listQuery.registerTimeBegin"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择立案开始时间"/>
            </el-form-item>
          </el-col>
          <el-col :span="10" :offset="1">
            <el-form-item label="立案结束时间">
              <el-date-picker
                v-model="listQuery.registerTimeEnd"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择立案结束时间"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="结案开始时间">
              <el-date-picker
                v-model="listQuery.registerTimeBegin"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择结案开始时间"/>
            </el-form-item>
          </el-col>
          <el-col :span="10" :offset="1">
            <el-form-item label="结案结束时间">
              <el-date-picker
                v-model="listQuery.registerTimeEnd"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择结案结束时间"/>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>

    </el-scrollbar>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="search">保存</el-button>
      <el-button type="info" icon="el-icon-delete" @click="clearForm">清空</el-button>
      <el-button @click="cancel">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>

import { getCaseSourceList, getSupervisorList, getCaseStateList, getCaseTypeList, getCaseBigTypeList, getCaseDetailTypeList, getFilingTypeList, getSpecialQueryList } from '@/api/seo/seo'

export default {
  name: 'SearchMore',
  data() {
    return {
      dialogFormVisible: false, // 对话框是否显示
      listQuery: {
        caseid: '', // 案卷编号
        caseState: '', // 案卷状态
        source: '', // 案卷来源
        description: '', // 案卷描述
        fieldintro: '', // 地点描述
        eorc: '', // 案卷类型，
        casetypeCode: '', // 大类
        casetypeDetailCode: '', // 小类
        onedeptid: '', // 业务单位id
        filingType: '', // 归档类型
        isShopCase: '', // 是否五包案卷,
        specialQuery: '', // 超期查询字典值
        area: '', // 街道
        createUser: '', // 上报人员id
        createTimeBegin: '', // 案卷录入开始时间
        createTimeEnd: '', // 案卷录入结束时间
        registerTimeBegin: '', // 立案开始时间
        registerTimeEnd: '', // 立案结束时间
        closeTimeBegin: '', // 结案开始时间
        closeTimeEnd: '', // 结案结束时间
        offset: 1,
        limit: 10,
        sort: '',
        order: ''
      }, // 表单
      labelPosition: 'right', // label的位置
      caseStateList: [], // 案卷状态列表
      caseSourceList: [], // 案卷来源列表
      specialQueryList: [], // 超期类型列表
      caseTypeList: [], // 案卷类别列表
      caseBigTypeList: [], // 案卷大类别列表
      caseDetailTypeList: [], // 案卷小类别列表
      filingTypeList: [], // 归档类型
      deptList: [], // 业务单位列表
      supervisorList: [] // 上报人员列表
    }
  },
  watch: {
    'listQuery.eorc'(val) { // 监控权属单位变化
      if (val !== '') {
        this.getCaseBigType()
      }
    },
    'listQuery.casetypeCode'(val) {
      if (val !== '') {
        this.getCaseDetailType()
      }
    }
  },
  mounted() {
    this.getCaseSource()
    this.getCaseState()
    this.getCaseType()
    this.getCaseBigType()
    this.getCaseDetailType()
    this.getFilingTypeList()
    this.getSpecialQueryList()
    this.getSuperVisorList()
  },
  methods: {
    // 初始化对话框
    initDialog: function(dialogFormVisible) {
      this.dialogFormVisible = dialogFormVisible
    },
    // 获取案卷等级列表
    getSuperVisorList() {
      getSupervisorList().then(response => {
        this.supervisorList = response.data
      })
    },
    // 获取超期类型查询列表
    getSpecialQueryList() {
      getSpecialQueryList().then(response => {
        this.specialQueryList = response.data
      })
    },
    // 获取案卷来源列表
    getCaseSource() {
      getCaseSourceList().then(response => {
        this.caseSourceList = response.data
      })
    },
    // 获取案卷状态列表
    getCaseState() {
      getCaseStateList().then(response => {
        this.caseStateList = response.data
      })
    },
    // 获取案卷状态列表
    getFilingTypeList() {
      getFilingTypeList().then(response => {
        this.filingTypeList = response.data
      })
    },
    // 获取案卷类别
    getCaseType() {
      getCaseTypeList().then(response => {
        this.caseTypeList = response.data
      })
    },
    // 获取案卷大类
    getCaseBigType() {
      const params = {
        eorc: this.listQuery.eorc
      }
      getCaseBigTypeList(params).then(response => {
        this.caseBigTypeList = response.data
      })
    },
    // 获取案卷小类
    getCaseDetailType() {
      const params = {
        eorc: this.listQuery.eorc,
        typeId: this.listQuery.casetypeCode
      }
      getCaseDetailTypeList(params).then(response => {
        this.caseDetailTypeList = response.data
      })
    },
    // 取消
    cancel() {
      this.dialogFormVisible = false
      // this.clearForm()
    },
    // 保存数据
    search: function() {
      this.$emit('searchMore', this.listQuery)
    },
    clearForm() {
      this.listQuery = {
        caseid: '', // 案卷编号
        caseState: '', // 案卷状态
        source: '', // 案卷来源
        description: '', // 案卷描述
        fieldintro: '', // 地点描述
        eorc: '', // 案卷类型，
        casetypeCode: '', // 大类
        casetypeDetailCode: '', // 小类
        onedeptid: '', // 业务单位id
        filingType: '', // 归档类型
        isShopCase: '', // 是否五包案卷,
        specialQuery: '', // 超期查询字典值
        area: '', // 街道
        createUser: '', // 上报人员id
        createTimeBegin: '', // 案卷录入开始时间
        createTimeEnd: '', // 案卷录入结束时间
        registerTimeBegin: '', // 立案开始时间
        registerTimeEnd: '', // 立案结束时间
        closeTimeBegin: '', // 结案开始时间
        closeTimeEnd: '' // 结案结束时间
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
  .hide .el-upload--picture-card {
    display: none;
  }

  .searchMoreDialog {
    .el-dialog {
      width: 950px;
      margin-top: 10vh !important;
      .el-dialog__body {
      }
      .el-scrollbar {
        height: 435px !important;
        width: 100%;
      }
      .el-scrollbar__wrap {
        /*overflow: scroll;*/
        overflow-x: auto;
        overflow-y: auto;
      }
      .el-scrollbar__view {
        width: 98%;
      }
      .el-date-editor{
        width: 100%;
      }
    }
  }

  .el-select {
    width: 100%;
  }

  .line {
    width: 50px;
    margin-left: 5px;
  }

  .hide .el-upload-–picture-card {
    display: none;
  }

  .imgBox {
    width: 100%;
    text-align: center;
  }
</style>
