<template>
  <div class="container">
    <save-form inline :model="search" @submit="FetchList" @reset="reset" saveKey="/main/main/reminders">
      <el-form-item prop="organIds">
        <el-select
          clearable
          filterable
          v-model="search.organId"
        >
          <el-option v-for="(item,index) in selects.branchs"
            :key="index"
            :label="item.name"
            :value="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-button native-type="submit" type="primary">搜索</el-button>
      <el-button native-type="reset" type="danger">重置</el-button>
    </save-form>
    <empty desc="暂无需要处理异常" v-if="!list.length"/>
    <el-button @click="$router.push({
        path: '/business/teamDetail',
        query: {
          filter_type: item.errorType,
          search: (item.result || []).join(',')
        }
      })"
      style="width: 100%;color: #303133;"
      v-else
      v-for="(item, index) in list"
      :key="index"
      :disabled="item.result ?  !item.result.length : !item.result" type="text"
    >
      <title-item
        type="warning"
        :data="[{name: item.desc, num: item.num}]"
      >
        <span style="color: #14928A;">立即处理<i class="el-icon-d-arrow-right"/></span>
      </title-item>
    </el-button>
  </div>
</template>
<script>
import { getRemindMatterData } from '@/views/main/api'
import title from '../abnormal/title'
const initSearch = {
  organId: null
}
export default {
  components: {
    'title-item': title
  },
  data() {
    return {
      search: {
        ...initSearch
      },
      list: [],
    }
  },
  mounted() {
    this.FetchList()
    this.$store.dispatch('setBranchs')
  },
  methods: {
    async FetchList() {
      try {
        const res = await getRemindMatterData({
          ...this.search
        })
        this.list = res.data
      } catch (error) {}
    },
    reset() {
      this.search = {...initSearch}
      this.FetchList()
    },
  }
}
</script>
<style lang="less" scoped>
  .container{
    /deep/ .is-disabled {
      .title{
        >span{
          color: #C0C4CC!important;
        }
      }
    }
  }
</style>
