<template>
  <div class="worklist" v-loading="loading">
    <el-card>
      <div class="searchDiv">
        <div class="searchValue">
          <input type="text" placeholder="搜索关键字" v-model="searchKey">
          <div class="searchBtn" @click="initData">
            <img src="/kczy/searchIcon.png" alt="">
          </div>
        </div>
      </div>
      <div class="resultDiv">
        <div class="recordDiv" v-for="(item, index) in resultData" :key="index">
          <div class="record-list">
            <div class="left">
              <div style="margin: 10px 0 0 15px;">{{item.yzk_name}}</div>
            </div>
            <div class="right">
              <el-button size="mini" type="primary" plain @click="lookDetail(item.yzk_id)">查看</el-button>
            </div>
          </div>
          <el-divider border-style="dashed" />
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
      searchKey: "",
      resultData: [

      ],
    }
  },
  methods: {
    initData() {
      this.loading = true;
      request({
        url: '/yzy/zy_kczy/index',
        data: {
          keyword: this.searchKey,

        }
      }).then(res => {
        if (res.code == 1) {
          this.resultData = res.data.page_data;
          console.log(this.resultData, 111);
          this.loading = false;
        }
      })
    },
    lookDetail(id) {
      this.$router.push({ name: "xs_homework_kczy", params: { id } });
    },
  },
  created() {


    this.initData();

  }
}
</script>

<style lang="scss" scoped>
.worklist {
  .searchDiv {
    display: flex;
    justify-content: flex-end;
    .searchValue {
      width: 350px;
      height: 50px;
      background: #ffffff;
      border-radius: 8px;
      overflow: hidden;
      position: relative;
      input {
        width: 100%;
        height: 100%;
        outline: 0;
        box-sizing: border-box;
        padding-left: 10px;
        background: #f6f8fa;
      }
      .searchBtn {
        width: 26px;
        height: 26px;
        background: #00a3ff;
        border-radius: 6px;
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        vertical-align: middle;
        cursor: pointer;
        img {
          display: block;
          text-align: center;
          margin: 6px auto 0;
        }
      }
    }
  }
  .resultDiv {
    .recordDiv {
      .record-list {
        padding: 0 30px;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        font-size: 14px;
        .right {
          .el-button--primary.is-plain {
            padding: 0 16px;
            height: 24px;
            line-height: 24px;
            color: #019ff9;
            border: 1px solid #00a3ff;
            border-radius: 12px;
            background: transparent;
            font-size: 12px;
          }
        }
      }
      .el-divider--horizontal {
        margin: 15px 0;
      }
    }
  }
}
</style>