<template>
  <view class="container">
    <z-paging ref="paging" v-model="dataList" @query="queryList" :auto="false" >

      <view class="ul fs-p20">
        <view class="li fs-bg__white fs-p30 fs-size__h4 fs-radius__sm fs-mt20 cad-box-shadow" v-for="(item, index) in dataList" :key="'planName'+item.hotlinenumber">
          <view @click="toReport(item)">
<!--            <view class="fs-flex__between">-->
<!--              <view class="fs-weight__bold fs-flex1 fs-ellipsis">{{item.planName}}</view>-->
<!--              <tui-text v-if="item.planStatus" text="已完成" type="success"></tui-text>-->
<!--              <tui-text v-else text="未完成" type="danger"></tui-text>-->
<!--            </view>-->
            <view class="fs-flex fs-flex__between fs-mt20">
              <view class="fs-flex1 fs-ellipsis">编码：{{item.hotlinenumber}}</view>
              <view class="" style="color: #f00">待派单</view>
            </view>
            <view class="fs-flex fs-mt20">
              <view class="fs-flex1 fs-ellipsis">所在街道：{{item.streetVo}}</view>
            </view>
            <view class="fs-flex fs-mt20">
              <view class="fs-flex1 fs-ellipsis">详细地址：{{item.address}}{{item.address}}{{item.address}}</view>
            </view>
            <view class="fs-flex__between fs-mt20">
              <view class="fs-flex1 fs-ellipsis">截止日期：{{item.endTime}}</view>
            </view>
          </view>

        </view>
      </view>
    </z-paging>
  </view>
</template>

<script>

import { hotlinecaseList } from '@/api/work'
import { useCounterStore } from '@/stores/counter'
export default {
  data() {
    return {
      dataList: [],
      qqmapsdk:null
    }
  },
  onLoad() {

  },
  onShow(){
    if (this.$refs.paging) {
      this.$refs.paging.refresh() // 重置到第一页并触发query事件
    }

  },
  methods: {
    // 获取巡检列表
    queryList(pageNo, pageSize) {
      const useCounter = useCounterStore()
      console.log(useCounter.userInfo.userId)
      const params = {
        dispperson:useCounter.userInfo.userId,
        taskstate:'gdtype02',
        pageReq: {pageNum: pageNo, pageSize: pageSize},
      }
      hotlinecaseList({data:params}).then(res => {
        this.$refs.paging.complete(res.rows)
      })
    },

    // 跳转详情
    toReport(i) {
      // uni.$tui.href(`/pages/work/daily/work/reporting?hotlinenumber=${hotlinenumber}`)
      console.log(i)
      uni.navigateTo({
        url:`/pages/work/daily/reporting?hotlinenumber=${i.hotlinenumber}`, // B页面路径
        // 1. （可选）监听B页面的回调（如需双向通信）
        events: {
          sendBackData: (data) => {
            console.log('B页面回传的数据：', data);
          }
        },
        // 2. 向B页面传递数据
        success: (res) => {
          // 通过 eventChannel 发送数据，key 可自定义（如 "largeDataFromA"）
          res.eventChannel.emit('largeDataFromWorkOrder', i);
        }
      });

    },

  }
}
</script>

<style lang="scss" scoped>
.ul .li:first-child {
  margin-top: 0;
}
</style>
