<template>
  <div class="app-container">
    <div class="rightCont">
      <el-form label-width="110px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="计划名称：">
              <el-input v-model="search.fjhname" style="width:206px" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="计划类型：">
              <el-input v-model="search.ftypestr" style="width:206px" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="班次：">
              <el-input v-model="search.fbc" style="width:206px" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="角色名称：">
              <el-input v-model="search.froleidstr" style="width:206px" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="审批状态：">
              <el-input v-model="search.fspstatusstr" style="width:206px" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="计划生成日期：">
              <el-date-picker v-model="search.CHECK_TIME" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" style="width: 100%;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="10px">
              <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
                搜索
              </el-button>
              <el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
                重置
              </el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div>
        <el-table
          ref="multipleTable"
          :data="varList"
          :row-key="getRowKey"
          border
          tooltip-effect="dark"
          style="width: 100%">
          <el-table-column type="selection" width="55" align="center"/>
          <el-table-column type="index" label="序号" width="55" align="center"/>
          <el-table-column prop="fjhname" label="计划名称"/>
          <el-table-column prop="ftypestr" label="计划类型"/>
          <el-table-column prop="fbc" label="班次"/>
          <el-table-column prop="froleidstr" label="角色名称"/>
          <el-table-column prop="fadddate" label="计划生成时间"/>
          <el-table-column prop="freason" label="未点检原因"/>
          <el-table-column prop="fdelReason" label="删除原因"/>
          <el-table-column prop="fstatestr" label="点检状态"/>
          <el-table-column prop="fspstatusstr" label="审批状态"/>
          <el-table-column prop="fspTypeStr" label="审批类型"/>
          <el-table-column prop="fsumitUserStr" label="提交人"/>
          <el-table-column prop="fsubmitDate" label="提交时间"/>
          <el-table-column prop="fspUserStr" label="审批人"/>
          <el-table-column prop="fspDate" label="审批时间"/>
          <el-table-column prop="fuserstr" label="接单人"/>
          <el-table-column prop="fuserdate" label="接单时间"/>
          <el-table-column prop="fcurrentdeptstr" label="部门"/>
          <!--          <el-table-column prop="fmodiuserstr" label="修改时间"/>-->
          <!--          <el-table-column prop="fmodidate" label="修改人"/>-->
          <el-table-column label="操作" width="200px">
            <template slot-scope="{row}">
              <el-button
                type="primary"
                icon="el-icon-edit"
                size="mini"
                @click="handleShow(row)">查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="page-btn-group">
          <div/>
          <pagination
            :total="total"
            :page.sync="listQuery.page"
            :limit.sync="listQuery.limit"
            @pagination="getList()"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Pagination from '@/components/Pagination'
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves'
// waves directive
import SelectTree from '@/components/SelectTree'

export default {
  components: { Pagination, SelectTree },
  directives: { waves },
  data() {
    return {
      config: config,
      listLoading: false,
      varList: [],
      search: {
        fjhname: '',
        froleidstr: '',
        ftypestr: '',
        fspstatusstr: '',
        CHECK_TIME: [],
        fbc: '',
        fuserstr: ''
      },
      total: 0,
      listQuery: {
        page: 1,
        limit: 20
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    handleShow(row) {
      console.log(row)
      this.$parent.activeName = 'RecordInfo'
      this.$parent.FID = row.fid
      console.log(this.$parent.FID)
    },
    getRowKey(row) {
      return row.FIRE_DEVICE_ID
    },
    // 添加
    // 搜索
    getQuery() {
      this.getList()
    },
    // 获取列表
    getList() {
      this.listLoading = true
      requestFN(
        '/app/ryCheck/getRyCheckJh?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
        {
          fjhname: this.search.fjhname,
          fbc: this.search.fbc,
          froleidstr: this.search.froleidstr,
          ftypestr: this.search.ftypestr,
          fspstatusstr: this.search.fspstatusstr,
          startTime: this.search.CHECK_TIME[0],
          endTime: this.search.CHECK_TIME[1],
          fuserstr: this.search.fuserstr
        }
      ).then((data) => {
        this.listLoading = false
        this.varList = data.varList
        this.total = data.page.totalResult
      }).catch((e) => {
        this.listLoading = false
      })
    },
    goKeyReset() {
      this.search = {
        fjhname: '',
        froleidstr: '',
        ftypestr: '',
        fspstatusstr: '',
        CHECK_TIME: [],
        fbc: '',
        fuserstr: ''
      }
      this.getList()
    }
  }
}
</script>

<style scoped>

</style>
