<!-- 延时监火页面 列表 -->
<template>
  <view class="content">
    <u-list @scrolltolower="scrolltolower" v-if="list.length > 0">
      <u-list-item v-for="(item, index) in list" :key="index">
        <view @click="goToDetail(item)">
          <view class="flex-between main-title bold">
            <text>作业证编号: {{ item.JOB_NUMBER }}</text>
            <text>动火等级: {{ item.HOT_WORK_LEVEL_NAME }}</text>
          </view>
          <view class="flex-between main-title">
            <text>申请办理人: {{ item.APPLY_USER_NAME }}</text>
            <text>作业类型: {{ item.JOB_TYPE_NAME }}</text>
          </view>
          <view class="flex-between main-title">
            <text>现场负责人：{{ item.SITE_LEADER_NAME }}</text>
            <text>动火单位负责人：{{ item.HOT_WORK_UNIT_LEADER_NAME }}</text>
          </view>
          <view class="flex-between main-title">
            <text>动火部位：{{ item.HOT_WORK_POSITION }}</text>
            <text>作业内容：{{ item.JOB_CONTENT }}</text>
          </view>
          <view class="flex-between main-title">
            <text>审核状态：延时监火</text>
          </view>
        </view>
        <view class="flex-between mt-10 subtitle">
          <view></view>
          <view class="flex-between">
            <u-button type="primary" text="延时监火" size="mini" class="bth-mini ml-10"
              @click="goToDelay(item.HOTWORKAPPLICATION_ID)" />
          </view>
        </view>
      </u-list-item>
    </u-list>
    <empty v-else></empty>
  </view>
</template>

<script>
export default {
  data() {
    return {
      type: '',
      title: '',
      pageSize: 10,
      currentPage: 1,
      totalPage: 0,
      list: [],
      EW_RU_TASK_ID: '',
      EW_RU_JOB_ID: '',
      TYPE: ''
    }
  },
  onLoad(query) {
    this.type = query.type
    this.title = query.title
    this.EW_RU_TASK_ID = query.taskId
    this.EW_RU_JOB_ID = query.EW_RU_JOB_ID
    this.TYPE = query.TYPE
  },
  onShow() {
    this.resetList()
  },
  methods: {
    async getData() {
      // 这里请求列表数据
      // let resData = await getToDoTaskList({
      //   showCount: this.pageSize,
      //   currentPage: this.currentPage,
      //   TYPE: this.type,
      //   vectors: '0'
      // });
      const mockData = [
        {
          HOTWORKAPPLICATION_ID: '0',
          JOB_NUMBER: 'DFIO-FPI',
          HOT_WORK_LEVEL_NAME: '一级',
          APPLY_USER_NAME: '孙喊问',
          JOB_TYPE_NAME: '内部作业',
          SITE_LEADER_NAME: '王某某',
          HOT_WORK_UNIT_LEADER_NAME: '王某某',
          HOT_WORK_POSITION: '测试',
          JOB_CONTENT: '测试',
          taskId: 'f4eb31f4b61b408e8a88e849017558d4',
          jobId: 'c4f007f2ef5c487d96c31e297f5ff29b'
        }
      ]
      this.list = mockData || [];
      this.totalPage = 0;
    },
    resetList() {
      this.pageSize = 10
      this.currentPage = 1
      this.list = []
      this.getData()
    },
    goToDetail(item) {
      uni.$u.route({
        url: '/pages/eight_assignments/hot_work/delay_fire_monitoring/detail',
        params: {
          taskId: item.taskId,
          jobId: item.jobId,
          type: this.type,
          title: this.title
        }
      })
    },
    goToDelay(HOTWORKAPPLICATION_ID) {
      uni.$u.route({
        url: '/pages/eight_assignments/hot_work/delay_fire_monitoring/delay',
        params: { id: HOTWORKAPPLICATION_ID }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  .bold {
    font-weight: bold;
  }
}
</style>
