<template>
  <div>
    <save-form inline :model="search" @submit="FetchList" @reset="FetchList">
      <el-form-item prop="organIds">
        <el-select
          multiple
          clearable
          filterable
          collapse-tags
          v-model="search.organIds"
        >
          <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"/>
    <title-item
      v-else
      type="warning"
      v-for="(item, index) in list"
      :key="index"
      :data="[{name: item.desc, num: item.num}]"
    >
      <el-button @click="$router.push({
        path: '/business/teamDetail',
        query: {
          search: (item.result || []).join(',')
        }
      })" type="text">立即处理<i class="el-icon-d-arrow-right"/></el-button>
    </title-item>
  </div>
</template>
<script>
import { getRemindMatterData } from '@/views/main/api'
import title from '../abnormal/title'
export default {
  components: {
    'title-item': title
  },
  data() {
    return {
      search: {
        organIds: []
      },
      list: [],
    }
  },
  mounted() {
    this.FetchList()
  },
  methods: {
    async FetchList() {
      try {
        const res = await getRemindMatterData()
        this.list = res.data
      } catch (error) {}
    }
  }
}
</script>
