Files
hnxdcount-uniapp/unpackage/dist/dev/mp-alipay/pages/piles/piles.js
PC-202306242200\Administrator dac42e3b0c first commit
2026-03-28 23:09:02 +08:00

120 lines
4.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
require("../../uni_modules/uview-plus/index.js");
const uni_modules_uviewPlus_libs_function_index = require("../../uni_modules/uview-plus/libs/function/index.js");
if (!Array) {
const _easycom_up_subsection2 = common_vendor.resolveComponent("up-subsection");
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
(_easycom_up_subsection2 + _easycom_z_paging2)();
}
const _easycom_up_subsection = () => "../../uni_modules/uview-plus/components/u-subsection/u-subsection.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
(_easycom_up_subsection + _easycom_z_paging)();
}
const _sfc_main = {
__name: "piles",
setup(__props) {
const paging = common_vendor.ref(null);
let dataList = common_vendor.ref([]);
let dataFrom = common_vendor.reactive({
deviceStatus: 1
});
let count = common_vendor.ref({});
common_vendor.onLoad(async () => {
count.value = await api_api.getDeviceCount();
});
let isPagingRefNotFound = () => {
return !paging.value;
};
common_vendor.onPullDownRefresh(() => {
if (isPagingRefNotFound())
return;
paging.value.reload().catch(() => {
});
});
common_vendor.onPageScroll((e) => {
if (isPagingRefNotFound())
return;
paging.value.updatePageScrollTop(e.scrollTop);
e.scrollTop < 10 && paging.value.doChatRecordLoadMore();
});
common_vendor.onReachBottom(() => {
if (isPagingRefNotFound())
return;
paging.value.pageReachBottom();
});
const queryList = (pageNo, pageSize) => {
const params = {
current: pageNo,
pageSize,
...dataFrom
};
api_api.getDeviceInfo(params).then((res) => {
paging.value.complete(res.records);
}).catch((res) => {
paging.value.complete(false);
});
};
const list = common_vendor.ref([
{
name: "已安装",
id: 1
},
{
name: "待安装",
id: 0
}
]);
const current = common_vendor.ref(0);
const upChange = (e) => {
current.value = e;
dataFrom.deviceStatus = list.value[e].id;
paging.value.reload();
};
return (_ctx, _cache) => {
return {
a: common_vendor.t(common_vendor.unref(count).installCount || 0),
b: common_vendor.t(common_vendor.unref(count).installNotCount || 0),
c: common_vendor.o(upChange),
d: common_vendor.p({
list: list.value,
keyName: "name",
current: current.value
}),
e: common_vendor.f(common_vendor.unref(dataList), (i, k0, i0) => {
return common_vendor.e(current.value == 0 ? {
a: common_vendor.t(i.stationName || "-"),
b: common_vendor.t(i.id),
c: common_vendor.t(i.deviceType),
d: common_vendor.t(i.stationAddress || "-"),
e: common_vendor.t(common_vendor.unref(uni_modules_uviewPlus_libs_function_index.timeFormat)(new Date(i.createTime).getTime(), "yyyy-mm-dd hh:MM"))
} : {}, current.value == 1 ? {
f: common_vendor.t(i.id),
g: common_vendor.t(i.deviceType),
h: common_vendor.t(common_vendor.unref(uni_modules_uviewPlus_libs_function_index.timeFormat)(new Date(i.createTime).getTime(), "yyyy-mm-dd hh:MM"))
} : {}, {
i
});
}),
f: current.value == 0,
g: current.value == 1,
h: () => ({
r: paging,
k: "paging"
}),
i: common_vendor.o(queryList),
j: common_vendor.o(($event) => common_vendor.isRef(dataList) ? dataList.value = $event : dataList = $event),
k: common_vendor.p({
["use-page-scroll"]: true,
modelValue: common_vendor.unref(dataList)
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3d8d5798"]]);
_sfc_main.__runtimeHooks = 1;
my.createPage(MiniProgramPage);