fix: 保洁bug

This commit is contained in:
yangzhe 2025-05-08 16:57:01 +08:00
parent 4d49bb990d
commit 3d82baf9a0
4 changed files with 82 additions and 21 deletions

View File

@ -26,7 +26,11 @@
dataInfo.planDate ? dataInfo.planDate.split("T")[0] : "" dataInfo.planDate ? dataInfo.planDate.split("T")[0] : ""
}}</view> }}</view>
<view class="position"> <view class="position">
<span v-if="dataInfo.beginTime && dataInfo.endTime"> <span
v-if="
(dataInfo.beginTime || dataInfo.beginTime == 0) && dataInfo.endTime
"
>
{{ minutesToTime(dataInfo.beginTime) }}~{{ {{ minutesToTime(dataInfo.beginTime) }}~{{
minutesToTime(dataInfo.endTime) minutesToTime(dataInfo.endTime)
}} }}
@ -202,10 +206,14 @@ export default {
}, },
onLoad(options) { onLoad(options) {
// debugger
// this.paramsId = options.id; // this.paramsId = options.id;
this.dropdownValue = options.id; this.dropdownValue = options.id;
window.nfcFn = this.nfcResFn; window.nfcFn = this.nfcResFn;
// this.nfcResFn(); // this.nfcResFn();
if(options.type == 'all'){
this.selectIdx = 0
}
}, },
created() { created() {
@ -297,10 +305,11 @@ export default {
toItemPage(item) { toItemPage(item) {
console.log("%c%s", "color:red", "跳转至详情页", item); console.log("%c%s", "color:red", "跳转至详情页", item);
const combinedData = { const combinedData = {
...item, // item ...item, // item
planName: this.dataInfo.planName, // planName planName: this.dataInfo.planName, // planName
beginTime: this.dataInfo.beginTime,
endTime: this.dataInfo.endTime,
}; };
const params = encodeURIComponent(JSON.stringify(combinedData)); const params = encodeURIComponent(JSON.stringify(combinedData));

View File

@ -74,7 +74,7 @@
:percent="(todayCompletion.completed / todayCompletion.total) * 100" :percent="(todayCompletion.completed / todayCompletion.total) * 100"
></u-line-progress> ></u-line-progress>
</view> </view>
<view class="unfinish"> <view class="unfinish" @click="handleTaskClick2">
<view class="point"></view> <view class="point"></view>
<view class="title">待保洁区域</view> <view class="title">待保洁区域</view>
<view class="count-rate"> <view class="count-rate">
@ -222,12 +222,25 @@ export default {
} }
}, },
handleTaskClick(item) { handleTaskClick(item) {
console.log(item); // console.log(item);
uni.navigateTo({ uni.navigateTo({
url: `/pages/index/cleanPlan?id=${item.id}`, url: `/pages/index/cleanPlan?id=${item.id}`,
}); });
}, },
handleTaskClick2() {
if (this.planList.length == 0) return;
const firstIncompletePlan = this.planList.find(
(item) => item.isCompleted === 0
);
if (firstIncompletePlan) {
uni.navigateTo({
url: `/pages/index/cleanPlan?id=${firstIncompletePlan.id}`,
});
}
},
// //
async getPlanByDate() { async getPlanByDate() {

View File

@ -287,6 +287,17 @@ export default {
const res1 = await ReportingNFCDanger(params); const res1 = await ReportingNFCDanger(params);
if (res1.succeed) { if (res1.succeed) {
const currentMinutes = this.reportingTime
.split(" ")[1]
.split(":")
.reduce((h, m) => Number(h) * 60 + Number(m));
const inRange =
currentMinutes >= Number(this.params.beginTime) &&
currentMinutes <= Number(this.params.endTime);
if (inRange) {
//
const queryParams = encodeURIComponent(JSON.stringify(this.params)); const queryParams = encodeURIComponent(JSON.stringify(this.params));
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
@ -301,6 +312,22 @@ export default {
} }
}, },
}); });
} else {
//
uni.showModal({
title: "提示",
content: "异常上报已完成,当前时间不在保洁计划时间内",
confirmText: "返回首页",
showCancel: false,
success: function (res) {
if (res.confirm) {
uni.navigateTo({
url: "/pages/index/index",
});
}
},
});
}
} }
}, },
}, },

View File

@ -69,6 +69,7 @@
? completedPlanList ? completedPlanList
: incompletePlanList" : incompletePlanList"
:key="index" :key="index"
@click="toItemPage(item)"
> >
<view class="plan-header"> <view class="plan-header">
<image <image
@ -83,7 +84,7 @@
<view class="plan-content"> <view class="plan-content">
<view class="plan-content-top"> <view class="plan-content-top">
<view class="place">{{ item.name }}</view> <view class="place">{{ item.name }}</view>
<u-tag text="9:00~12:00" type="info" border-color="transparent" /> <u-tag :text="item.time" type="info" border-color="transparent" />
</view> </view>
<view class="plan-content-main"> <view class="plan-content-main">
{{ item.areas }} {{ item.areas }}
@ -117,6 +118,8 @@ import { GetPlanList } from "@/api/apiList";
import { GetNowTime } from "@/utils/common"; import { GetNowTime } from "@/utils/common";
import { getDateDiff } from "@/utils/utils"; import { getDateDiff } from "@/utils/utils";
import dayjs from "@/uni_modules/uview-ui/libs/util/dayjs";
export default { export default {
data() { data() {
const todayStr = GetNowTime(new Date()); const todayStr = GetNowTime(new Date());
@ -192,6 +195,15 @@ export default {
} }
} }
}, },
toItemPage(item) {
// const isToday = dayjs(item.date).isSame(dayjs(), "day");
// if (!isToday) return;
uni.navigateTo({
url: `/pages/index/cleanPlan?id=${item.id}&type=all`,
});
},
}, },
}; };
</script> </script>