<template>
  <oa-scroll
    customClass="bg-white scroll-height"
    :pageSize="pageSize"
    :total="total"
    :refresherLoad="true"
    :refresherLoadTitle="false"
    :refresherEnabled="true"
    :refresherEnabledTitle="false"
    :refresherDefaultStyle="'none'"
    :refresherThreshold="44"
    :refresherBackground="'#f5f6f7'"
    @load="load"
    @refresh="refresh"
    :data-theme="'theme-' + proxy.$settingStore.themeColor.type"
  >
    <template #default>
      <view class="menu-list m0">
        <view class="list-cell list-cell-arrow" style="line-height: 25px" v-for="(base, index) in dataList" :key="index" @click="handleToDetails(base.productCode, base.productName)">
          <view class="menu-item">
            <image class="image-bg" style="width: 80rpx; height: 80rpx; margin: auto 10px auto 0" :src="base.typeImg"> </image>
            <view style="width: calc(100% - 51px); display: flex; justify-content: space-between; padding-right: 10px">
              <view class="deviceHeader">
                <view class="deviceName text-ellipsis">{{ base.productName }}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </template>
  </oa-scroll>
</template>

<script setup>
import { onReady, onLoad, onShow, onNavigationBarButtonTap, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
import { dmpProductInfo, baseAlarmTypeList } from "@/api/business/fireIot/alarmManage.js";

const { proxy } = getCurrentInstance();

const dataList = ref([
  {
    productName: "人工督察单",
    productCode: "501_JK",
    deviceType: 501,
    total: 819,
    untreated: 26,
    processed: 793,
    processRate: 96.82539,
    deviceCount: 661,
    offLineUntreated: 0,
    offLineProcessed: 0,
    offLineProcessRate: 0,
    typeImg: "/static/images/fireInspect/rg.png",
  },
  {
    productName: "电子督察单",
    productCode: "509_HJ",
    deviceType: 509,
    total: 3,
    untreated: 0,
    processed: 3,
    processRate: 100,
    deviceCount: 1,
    offLineUntreated: 0,
    offLineProcessed: 0,
    offLineProcessRate: 0,
    typeImg: "/static/images/fireInspect/dz.png",
  },
]);
const pageSize = ref(20);
const total = ref(2);



function handleToDetails(productCode, productName) {
  proxy.$tab.navigateTo(`/pages/business/zhxf/fireInspect/inspectDetailsList/index?productCode=${productCode}&productName=${productName}`);
}

/**
 * @scrollView加载数据
 */
function load() {
  pageSize.value += 10;
}

/**
 * @scrollView刷新数据
 */
function refresh() {
  pageSize.value = 20;
}

onShow(() => {
  //调用系统主题颜色
  proxy.$settingStore.systemThemeColor([1]);

});
</script>
