<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-col :span="24" class="one_1"> 公务用枪枪证信息查询 </el-col>
          <el-col :span="24" class="one_2">
            <el-form ref="searchFrom" :model="searchFrom" label-width="160px">
              <el-col :span="24" class="one_2txt">
                <el-col :span="8">
                  <el-form-item label="企业名称">
                    <el-input v-model="searchFrom.company_name"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="企业类别">
                    <el-select v-model="searchFrom.industry_type" clearable placeholder="请选择">
                      <el-option v-for="(item, index) in industry_typeList" :key="index" :label="item" :value="item"> </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="管辖单位名称">
                    <el-input v-model="searchFrom.tube_company"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="one_2txt">
                <el-col :span="16">
                  <el-form-item label="许可证发证日期">
                    <el-date-picker v-model="searchFrom.gun_date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="公务用枪枪证编码">
                    <el-input v-model="searchFrom.gun_num"></el-input>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="24" class="one_2txt">
                <el-col :span="24" class="btn">
                  <el-button type="primary" size="mini" @click="search()">查询</el-button>
                </el-col>
              </el-col>
            </el-form>
          </el-col>
        </el-col>
        <el-col :span="24" class="two">
          <data-table @query="search" :fields="fields" :opera="opera" :data="list" :total="total" @edit="toEdit" @view="toView"> </data-table>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
const { exam_grade, industry_type } = require('@common/src/layout/deploy/dict');
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'index',
  props: {},
  components: {},
  data: function () {
    return {
      // 查询
      searchFrom: {},
      // 列表
      fields: [
        { label: '企业名称 ', model: 'company_name' },
        { label: '公务用枪编码', model: 'gun_num' },
        { label: '发证单位名称', model: 'gun_officename' },
        { label: '发证日期', model: 'gun_date' },
        { label: '管辖单位名称', model: 'tube_company' },
        { label: '企业类别', model: 'industry_type' },
      ],
      opera: [
        { label: '维护', method: 'edit' },
        { label: '详情', method: 'view' },
      ],
      list: [],
      total: 0,
      industry_typeList: industry_type,
    };
  },
  created() {},
  methods: {
    async search() {
      console.log(this.searchFrom);
    },
    // 维护
    toEdit({ data }) {},
    // 详情
    toView({ data }) {},
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .one {
    .one_1 {
      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid #ccc;
      margin: 0 0 10px 0;
      font-size: 18px;
      font-weight: bold;
    }
    .one_2 {
      .one_2txt {
        border: 1px solid #ccc;
        /deep/.el-form-item {
          margin: 0;
        }
        /deep/.el-date-editor.el-input,
        .el-date-editor.el-input__inner {
          width: 100%;
        }
        /deep/.el-select {
          width: 100%;
        }
        .btn {
          text-align: right;
          padding: 5px 5px;
        }
      }
    }
  }
}
</style>
