<template>
  <div>
    <button @click="jumpReport()" class="mt10 top_buttom">
      <van-icon name="plus" />
      新增年度计划
    </button>
    <div class="list">
      <div
        class="list-row"
        v-for="(item, index) in list"
        @click="junmpMyMechantsDetails(item.id)"
        :key="index"
      >
        <div class="cell_1">
          <div class="width100 height44rpx">
            <div class="first_title">
              {{ item.attributiveYear }}年 {{ "     " + item.companyName }}
            </div>
          </div>
        </div>
        <img
          src="../../../static/mine/youjiantou.png"
          style="width: 40rpx; height: 40rpx"
          alt=""
        />
      </div>
    </div>
  </div>
</template>

<script>
import { findSafetySelfCheckingPlanList, getByCodes } from "@/js_sdk/http";

export default {
  data() {
    return {
      search: {
        pageSize: 20,
        pageNum: 1,
      },
      list: [],
    };
  },
  onShow() {
    this.search = { pageSize: 20, pageNum: 1 };
    this.findSafetySelfCheckingPlanList();
  },
  methods: {
    async getMoreListData() {
      let that = this;

      that.search.pageNum = that.search.pageNum + 1;
      let data = await findSafetySelfCheckingPlanList(this.search);

      if (data.rows == 0) {
        that.$showToast("没有更多数据了");
      } else {
        data.rows.forEach((e) => {
          that.list.push(e);
        });
      }
    },
    onReachBottom() {
      this.getMoreListData();
    }, //下拉执行的时候触发 （下拉刷新）
    async findSafetySelfCheckingPlanList() {
      let data = await findSafetySelfCheckingPlanList(this.search);
      this.list = data.rows;
    },
    jumpReport() {
      uni.navigateTo({
        url: "/pages/subPackages/secureselfplan/addplan?id=" + null,
      });
    },
    junmpMyMechantsDetails(id) {
      uni.navigateTo({
        url: "/pages/subPackages/secureselfplan/addplan?id=" + id,
      });
    },
  },
};
</script>

<style>
.top_buttom {
  background: #1d18bc;
  color: white;
  /* width: 240rpx; */
  float: right;
  padding: 25rpx;
  margin-right: 32rpx;
  margin-bottom: 32rpx;
}
</style>