<template>
  <div class="page">
    <el-form :model="search" ref="headerForm" label-width="100px" size="mini">
      <el-form-item label="档号：" style="width:25%">
        <el-input style="width:80%" v-model="search.archiveNo" placeholder="请输入档号" clearable></el-input>
      </el-form-item>
      <el-form-item label="保管期限：" style="width:25%">
        <el-select v-model="search.retention" placeholder="请选择" style="width: 100%" @change="changeField">
          <el-option v-for="item in retentionOptions" :key="item.id" :label="item.label" :value="item.label">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="题名：" style="width:25%">
        <el-input style="width:80%" v-model="search.maintitle" placeholder="请输入题名" clearable></el-input>
      </el-form-item>
      <el-form-item label="归档年度" style="width:25%">
        <el-input style="width:80%" v-model="search.filingYear" placeholder="请输入归档年度" clearable></el-input>
      </el-form-item>
      <el-form-item label="盒号：" style="width:25%">
        <el-input style="width:80%" v-model="search.caseNo" placeholder="请输入盒号" clearable></el-input>
      </el-form-item>
      <div class="btn">
        <el-button type="primary" size="mini" @click="searchClick"><i class="iconfont icon-sousuo"></i>搜索</el-button>
        <el-button type="info" size="mini" @click="resetClick"><i class="iconfont icon-sousuo"></i>重置</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
import { getFindList } from "@/api/system-management/templateSetting";
  export default {
    data() {
      return {
        retentionOptions:[], // 保管期限
      };
    },
    props: {
      search: {
        type: Object,
        default: () => {},
      },
    },
    methods: {
      // 获取保管期限
      getRetention(){
        getFindList({
          type: "retention",
        }).then((res) => {
          this.retentionOptions = res.body.list;
        });
      },
      changeField(val){
        console.log(val)
      },
      searchClick() {
        this.$emit("searchClick",this.search);
      },
      resetClick() {
        this.$emit("resetClick");
      }
    },
    created(){
      this.getRetention();
    }
  };

</script>

<style lang="scss" scoped>
  .page {
    width: 100%;
    background-color: #fff;
    padding: 10px 10px 0 10px;
    box-sizing: border-box;

    .el-form {
      display: flex;
      flex-wrap: wrap;

      .el-form-item {
        margin-bottom: 10px;
      }

      .btn {
        width: 20%;
        text-align: right;
      }
    }
  }

</style>
