diff --git a/pages/index/cleanPlan.vue b/pages/index/cleanPlan.vue index fdea5fa..37e04b8 100644 --- a/pages/index/cleanPlan.vue +++ b/pages/index/cleanPlan.vue @@ -26,7 +26,11 @@ dataInfo.planDate ? dataInfo.planDate.split("T")[0] : "" }} - + {{ minutesToTime(dataInfo.beginTime) }}~{{ minutesToTime(dataInfo.endTime) }} @@ -202,10 +206,14 @@ export default { }, onLoad(options) { + // debugger // this.paramsId = options.id; this.dropdownValue = options.id; window.nfcFn = this.nfcResFn; // this.nfcResFn(); + if(options.type == 'all'){ + this.selectIdx = 0 + } }, created() { @@ -297,10 +305,11 @@ export default { toItemPage(item) { console.log("%c%s", "color:red", "跳转至详情页", item); - const combinedData = { ...item, // 展开 item 的所有属性 planName: this.dataInfo.planName, // 添加 planName 属性 + beginTime: this.dataInfo.beginTime, + endTime: this.dataInfo.endTime, }; const params = encodeURIComponent(JSON.stringify(combinedData)); diff --git a/pages/index/index.vue b/pages/index/index.vue index 55c760e..e7097e1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -74,7 +74,7 @@ :percent="(todayCompletion.completed / todayCompletion.total) * 100" > - + 待保洁区域 @@ -222,12 +222,25 @@ export default { } }, handleTaskClick(item) { - console.log(item); + // console.log(item); uni.navigateTo({ 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() { diff --git a/pages/index/list.vue b/pages/index/list.vue index bb61939..468e08a 100644 --- a/pages/index/list.vue +++ b/pages/index/list.vue @@ -287,20 +287,47 @@ export default { const res1 = await ReportingNFCDanger(params); if (res1.succeed) { - const queryParams = encodeURIComponent(JSON.stringify(this.params)); - uni.showModal({ - title: "提示", - content: "清扫工作已完成,上传图片记录", - confirmText: "去上传图片", - showCancel: false, - success: function (res) { - if (res.confirm) { - uni.navigateTo({ - url: "/pages/index/uploadPhoto?params=" + queryParams, - }); - } - }, - }); + 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)); + uni.showModal({ + title: "提示", + content: "清扫工作已完成,上传图片记录", + confirmText: "去上传图片", + showCancel: false, + success: function (res) { + if (res.confirm) { + uni.navigateTo({ + url: "/pages/index/uploadPhoto?params=" + queryParams, + }); + } + }, + }); + } else { + // 不在保洁时间 + uni.showModal({ + title: "提示", + content: "异常上报已完成,当前时间不在保洁计划时间内", + confirmText: "返回首页", + showCancel: false, + success: function (res) { + if (res.confirm) { + uni.navigateTo({ + url: "/pages/index/index", + }); + } + }, + }); + } } }, }, diff --git a/pages/index/planList.vue b/pages/index/planList.vue index 22b28c9..38c67c0 100644 --- a/pages/index/planList.vue +++ b/pages/index/planList.vue @@ -69,6 +69,7 @@ ? completedPlanList : incompletePlanList" :key="index" + @click="toItemPage(item)" > {{ item.name }} - + {{ item.areas }} @@ -117,6 +118,8 @@ import { GetPlanList } from "@/api/apiList"; import { GetNowTime } from "@/utils/common"; import { getDateDiff } from "@/utils/utils"; +import dayjs from "@/uni_modules/uview-ui/libs/util/dayjs"; + export default { data() { 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`, + }); + }, }, }; @@ -216,7 +228,7 @@ page { padding: 32rpx 0; margin: 0 32rpx 32rpx; border-bottom: none; - -webkit-border-bottom: none; // 针对 WebKit 内核 + -webkit-border-bottom: none; // 针对 WebKit 内核 .tab-item { flex: 1; @@ -226,7 +238,7 @@ page { position: relative; z-index: 1; border-bottom: none; - -webkit-border-bottom: none; // 针对 WebKit 内核 + -webkit-border-bottom: none; // 针对 WebKit 内核 .label { font-size: 28rpx;