<template>
  <div class="app-container" style="padding-top:15px">
    <div id="guideLine" style="background:#fff;padding-bottom:62px; padding-top: 20px">
      <div class="title" style="margin-bottom: 20px">办事指南</div>
      <el-input
        v-model="listQuery.keyword"
        placeholder="输入关键字查询办事指南"
        prefix-icon="el-icon-search"
        clearable
        style="width:200px;margin-left:15px"
      />
      <el-select v-model="listQuery.deptId" clearable placeholder="请选择部门" style="width:200px;margin-left:10px">
        <el-option v-for="item of depts" :key="item.id" :value="item.id" :label="item.name" />
      </el-select>
      <el-button
        type="primary"
        style="padding:9px 28px ;margin-left:10px"
        @click="handleSearch"
      >搜索</el-button>
      <ul class="guideList">
        <li v-for="item in list" :key="item.id" @click="toDetail(item.id)">
          {{ item.title }}
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
// import Pagination from '@/components/Pagination'
import { workBookList, deptList } from '@/api/workBook'

export default {
  // components: { Pagination },
  data() {
    return {
      listLoading: false,
      loading: false,
      list: [],
      listQuery: {
        lastPageIndex: 1,
        size: 99999,
        keyword: undefined,
        category: 'HANDLING_GUIDELINE',
        deptId: undefined
      },

      depts: []
    }
  },
  created() {
    this.getList()
    this.getDepts()
  },
  methods: {
    getList() {
      this.listLoading = true
      workBookList(this.listQuery).then(res => {
        // console.log(res)
        this.listLoading = false
        this.list = res.d.records
      })
    },
    getDepts() {
      deptList({ size: 99999 }).then(res => {
        this.depts = res.d.records
      })
    },
    handleSearch() {
      this.getList()
    },
    toDetail(id) {
      this.$router.push({
        path: '/serviceGuide/detail',
        query: { id }
      })
    }
  }
}
</script>

<style scoped>
.workBookLayout {
  padding-top: 20px;
  background: #fff;
  height: 100%;
}
.app-container .title {
  border-left: 5px solid #1890ff;
  padding-left: 8px;
  font-size: 18px;
  color: #000000;
}
.img {
  width: 486px;
  height: 268px;
}
.guideList {
  list-style: none;
  padding-left: 15px;
  /* border: 1px solid #e5e5e5; */
}
.guideList li {
  padding: 18px 21px;
  border: 1px solid #e5e5e5;
  margin: 0 0 -1px -1px;
  font-size: 14px;
  cursor: pointer;
}
.guideList li:hover {
  color: #4081ff;
}
.searchInput {
  width: 681px;
  height: 50px;
  line-height: 50px;
  margin: 18px 0 0 15px;
}
#guideLine .el-input--medium .el-input__inner {
  height: 50px !important;
  line-height: 50px !important;
}
</style>
