<template>
    <div class="app-container">
      <van-nav-bar
        left-arrow
        fixed
        placeholder
        @click-left="$router.back(-1)"
      >
        <template #title>
          <p style="font-weight: bold;">任务上报</p>
        </template>
      </van-nav-bar>
      <van-list
        v-model="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="getList"
      >
        <van-swipe-cell v-for="(item,index) in applicationList" :key="index">
          <van-cell :value="item.taskSubjectStatus" center>
            <template #title>
              <p class="van-ellipsis">{{item.title}}</p>
            </template>
            <template #icon>
              <van-icon name="../../../static/images/onlineHome/icon_zjd10.png" size="30" color="#539FFD" style="margin-right: 10px;" />
            </template>
            <template #label>
              <p>{{item.reportDeadline}}</p>
            </template>
          </van-cell>
          <template #right>
            <van-row>
              <van-col>
                <van-button square text="上报" :to="{name:'taskCloseCaseAdd', query: {id:item.id}}" type="info" class="delete-button" />
              </van-col>
              <van-col>
                <van-button color="#FFA63E" square :to="{name:'taskDetailedList', query: {id:item.id}}" type="info" class="delete-button" >
                    上报<br/>情况
                </van-button>
              </van-col>
            </van-row>
          </template>
        </van-swipe-cell>
      </van-list>
    </div>
</template>

<script>
import { getList } from "@/api/onlineHome/homestead/reporting";
export default {
  name: "paidExit",
  data() {
    return {
      applicationList:[],
      houseApplyStatus:[],
      taskSubjectStatusStatus:[],
      loading: false,
      finished: false,
      queryParams:{
        pageNum:1,
        pageSize:10,
        orderByColumn:'createTime',
        isAsc:'desc',
        taskSubjectStatus:'2'
      }
    };
  },
  created() {
    this.houseGetDicts("task_subject_status").then((res) => {
      this.taskSubjectStatusStatus = res.data;
    });
  },
  methods: {
    getList(){
      setTimeout(() => {
        getList(this.queryParams).then(response => {
          for (var i = 0; i < response.rows.length; i++) {
            response.rows[i].taskSubjectStatus = this.selectDictLabel(this.taskSubjectStatusStatus, response.rows[i].taskSubjectStatus)

            response.rows[i].title=response.rows[i].title.replace(/<[^>]+>/g,"").replace(/&nbsp;/ig,"");//截取html标签

            this.applicationList.push(response.rows[i]);
          }
          if(this.applicationList.length >= response.total){
            this.finished = true;
            return;
          }else{
            this.loading = false;
            this.queryParams.pageNum += 1 ;
          }
        });
      }, 1000);
    },
  },
}
</script>

<style scoped lang="scss">
  .app-container {
    padding: 0.2rem 3%;
  }
  /deep/.van-cell__title{
    flex: 0.7;
    width: 50%!important;
  }
  /deep/.van-cell__title span{
    font-family: Arial;
    font-size: 0.4rem;
    font-weight: normal;
  }
  /deep/.van-cell__value{
    flex: 0.3;
    color: #1D6FE9;
    font-weight: bold;
  }
  /deep/.van-swipe-cell{
    margin-bottom: 0.2rem;
    border-radius: 0.2rem;
    overflow: hidden;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  }
  /deep/van-ellipsis{
    font-weight: bold;
  }
  .delete-button {
    height: 100%;
  }
  .van-row{
    height: 100%;
  }
  .van-col{
    height: 100%;
  }
</style>
