<!-- 搜索表单 -->
<template>
  <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
</template>

<script>
  import dictMixins from '@/mixins/dictMixins';

  export default {
    props: {},
    mixins: [dictMixins],
    data() {
      return {
        typeList: [],
        reportWorkTypeList: []
      };
    },
    computed: {
      // 表格列配置
      seekList() {
        return [
          {
            label: '规则编码:',
            value: 'code',
            type: 'input',
            placeholder: '规则编码'
          },
          {
            label: '规则名称:',
            value: 'name',
            type: 'input',
            placeholder: '规则名称'
          },
          {
            label: '记录规则分类',
            value: 'classify',
            type: 'select',
            placeholder: '记录表分类',
            planList: this.typeList
          },
          {
            label: '模块分类',
            value: 'reportWorkType',
            type: 'select',
            placeholder: '模块分类',
            planList: this.reportWorkTypeList
          },
          {
            label: '状态:',
            value: 'publishStatus',
            type: 'select',
            placeholder: '状态',
            // 0-草稿，1-已发布，2-已撤销
            planList: [
              {
                label: '草稿',
                value: '0'
              },
              {
                label: '已发布',
                value: '1'
              },
              {
                label: '已撤销',
                value: '2'
              }
            ]
          },
          {
            label: '是否启用:',
            value: 'enable',
            type: 'select',
            placeholder: '是否启用',
            // 0-草稿，1-已发布，2-已撤销
            planList: [
              {
                label: '启用',
                value: '1'
              },
              {
                label: '停用',
                value: '0'
              }
            ]
          }
        ];
      }
    },
    mounted() {
      this.requestDict('记录规则类型').then(() => {
        if (this.$store.state.dict['record_sheet']) {
          this.typeList = this.$store.state.dict['record_sheet'].map((i) => {
            return { label: i.dictValue, value: i.dictCode };
          });
        }
      });
      this.requestDict('记录规则报工类型').then(() => {
        if (this.$store.state.dict['record_rules_report_work_type']) {
          this.reportWorkTypeList = this.$store.state.dict[
            'record_rules_report_work_type'
          ].map((i) => {
            return { label: i.dictValue, value: i.dictCode };
          });
        }
      });
    },
    methods: {
      /* 搜索 */
      search(e) {
        this.$emit('search', {
          ...e
        });
      }
    }
  };
</script>
