InspectionCleaning/pages/index/cleanPlan.vue

625 lines
15 KiB
Vue
Raw Normal View History

2025-04-07 09:30:11 +08:00
<template>
<view class="content">
<u-navbar
:is-back="false"
title=""
:background="{ backgroundColor: '#DFEEFD' }"
:border-bottom="false"
>
<view class="slot-wrap">
<u-dropdown :title-size="42" active-color="#211D2F">
<u-dropdown-item
v-model="dropdownValue"
2025-04-09 16:58:50 +08:00
:title="dataInfo.planName"
2025-04-07 09:30:11 +08:00
:options="dropdownOptions"
2025-04-09 16:58:50 +08:00
@change="changeDropdown"
2025-04-07 09:30:11 +08:00
></u-dropdown-item>
</u-dropdown>
2025-04-15 10:32:58 +08:00
<view class="back-icon" @click="backFn">
<!-- <u-icon name="arrow-left" size="50rpx" color="#606266"></u-icon> -->
<uni-icons type="left" size="50rpx" color="#606266"></uni-icons>
</view>
2025-04-07 09:30:11 +08:00
</view>
</u-navbar>
<view class="area-info">
2025-04-09 16:58:50 +08:00
<view class="name">{{
dataInfo.planDate ? dataInfo.planDate.split("T")[0] : ""
}}</view>
<view class="position">
<span v-if="dataInfo.beginTime && dataInfo.endTime">
{{ minutesToTime(dataInfo.beginTime) }}~{{
minutesToTime(dataInfo.endTime)
}}
</span>
</view>
2025-04-07 09:30:11 +08:00
<view class="tabs">
<view
@click="changeTab(i)"
class="tab-item"
v-for="(v, i) in selectTabs"
:key="i"
:class="{ select: selectIdx === i }"
>
{{ v.name }}
</view>
</view>
</view>
2025-04-10 09:39:43 +08:00
<view class="arealist" v-if="dataInfo.areas.length > 0">
2025-04-14 15:10:19 +08:00
<view
class="block-info"
v-for="item in dataInfo.areas"
:key="item.id"
@click="toItemPage(item)"
>
2025-04-09 16:58:50 +08:00
<view v-if="!item.isCompleted" class="schedule schedule-wait"
>待保洁</view
>
<view v-else class="schedule schedule-completed">已完成</view>
2025-04-07 09:30:11 +08:00
<view class="name">
<u-icon size="40" :name="posIcon"></u-icon>
2025-04-09 16:58:50 +08:00
<view class="text">{{ item.aeraNmae }}</view>
2025-04-07 09:30:11 +08:00
</view>
<view class="type">
<view class="value">区域类型</view>
<u-tag
2025-04-09 16:58:50 +08:00
:text="item.areaType"
2025-04-07 09:30:11 +08:00
class="tag"
border-color="transparent"
2025-04-11 17:24:07 +08:00
:type="
item.areaType === '室外'
? 'success'
: item.areaType === '特殊'
? 'warning'
: 'primary'
"
2025-04-07 09:30:11 +08:00
/>
2025-04-09 16:58:50 +08:00
<!-- 特殊先隐藏没有这个字段 -->
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
2025-04-07 09:30:11 +08:00
</view>
<view class="illustrate">
2025-04-09 16:58:50 +08:00
{{ item.note }}
2025-04-07 09:30:11 +08:00
</view>
</view>
</view>
2025-04-14 16:51:36 +08:00
<!-- <button @click="successShow = true">刷卡成功</button> -->
2025-04-14 09:07:59 +08:00
<!-- <button @click="nfcResFn(false)">刷卡失败</button> -->
2025-04-10 09:12:18 +08:00
<!-- nfc刷卡成功弹窗 -->
2025-04-10 09:39:43 +08:00
<u-popup v-model="successShow" mode="center" :round="30">
<view class="success-box">
2025-04-10 09:12:18 +08:00
<view class="box-content">
2025-04-10 10:15:14 +08:00
<view class="logo">
2025-04-10 16:29:39 +08:00
<image
style="width: 100%; height: 100%"
src="/static/images/msg-success.png"
alt=""
/>
2025-04-10 10:15:14 +08:00
</view>
2025-04-10 09:12:18 +08:00
<view class="content-title">刷卡成功</view>
<view class="btn-box">
<view class="btn-cancel" @click="successShow = false">暂不</view>
2025-04-11 11:50:55 +08:00
<view class="btn-success" @click="toUploadPage">上传图片</view>
2025-04-10 09:12:18 +08:00
</view>
</view>
2025-04-10 09:39:43 +08:00
</view>
</u-popup>
2025-04-10 09:12:18 +08:00
<!-- nfc刷卡失败弹窗 -->
2025-04-10 09:39:43 +08:00
<u-popup v-model="errorShow" mode="center" :round="30">
<view class="error-box">
2025-04-10 09:12:18 +08:00
<view class="box-content">
2025-04-10 10:15:14 +08:00
<view class="logo">
2025-04-10 16:29:39 +08:00
<image
style="width: 100%; height: 100%"
src="/static/images/msg-error.png"
alt=""
/>
</view>
<view class="content-title">
2025-04-15 10:32:58 +08:00
{{ errorMsg }}
2025-04-10 10:15:14 +08:00
</view>
2025-04-10 09:12:18 +08:00
<view class="btn-box">
<view class="btn-cancel" @click="errorShow = false">暂不</view>
2025-04-14 16:51:36 +08:00
<view class="btn-success" @click="errorShow = false">异常上报</view>
<!-- <view class="btn-success" @click="exceptionReportFn">异常上报</view> -->
2025-04-10 09:12:18 +08:00
</view>
</view>
2025-04-10 09:39:43 +08:00
</view>
</u-popup>
2025-04-07 09:30:11 +08:00
</view>
</template>
<script>
2025-04-15 10:32:58 +08:00
import {
GetPlanInfoAreaList,
GetTodayPlanList,
GetAwaitUploadAreaApi,
} from "@/api/apiList";
2025-04-09 16:58:50 +08:00
import { minutesToTime } from "@/utils/utils";
2025-04-09 13:44:35 +08:00
2025-04-07 09:30:11 +08:00
export default {
data() {
return {
posIcon: require("@/static/images/pos-icon.png"),
selectIdx: 0,
2025-04-09 16:58:50 +08:00
dropdownValue: "",
2025-04-07 09:30:11 +08:00
dropdownOptions: [
{
label: "保洁计划1",
value: 1,
},
{
label: "保洁计划2",
value: 2,
},
{
label: "保洁计划3",
value: 3,
},
{
label: "保洁计划4",
value: 4,
},
],
selectTabs: [
{
name: "全部",
value: 0,
},
{
name: "待保洁",
value: 1,
},
],
2025-04-09 13:44:35 +08:00
paramsId: "",
2025-04-10 09:12:18 +08:00
// 刷卡成功弹窗
2025-04-10 09:39:43 +08:00
successShow: false,
2025-04-10 09:12:18 +08:00
// 刷卡失败弹窗
2025-04-10 09:39:43 +08:00
errorShow: false,
2025-04-15 10:32:58 +08:00
errorMsg: "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息",
2025-04-09 16:58:50 +08:00
dataInfo: {
planName: "",
2025-04-10 09:39:43 +08:00
areas: [],
2025-04-09 16:58:50 +08:00
},
2025-04-07 09:30:11 +08:00
};
},
2025-04-09 13:44:35 +08:00
2025-04-09 16:58:50 +08:00
computed: {
// dropdownTitle() {
// // 通过 dropdownValue 匹配 对应的项,展示 label
// const item = this.dropdownOptions.find(
// (item) => item.value === this.dropdownValue
// );
// return item ? item.label : "";
// },
},
2025-04-09 13:44:35 +08:00
onLoad(options) {
2025-04-09 16:58:50 +08:00
// this.paramsId = options.id;
this.dropdownValue = options.id;
2025-04-10 09:12:18 +08:00
window.nfcFn = this.nfcResFn;
// this.nfcResFn();
2025-04-09 13:44:35 +08:00
},
created() {
2025-04-09 16:58:50 +08:00
this.getTodayPlanList();
2025-04-09 13:44:35 +08:00
this.getPlanInfoAreaList();
},
2025-04-07 09:30:11 +08:00
methods: {
2025-04-10 09:39:43 +08:00
minutesToTime,
2025-04-10 14:21:16 +08:00
2025-04-15 10:32:58 +08:00
backFn() {
// console.log("%c%s", "color:red", "返回");
uni.navigateBack();
},
async nfcResFn(data) {
2025-04-14 09:07:59 +08:00
if (!data) {
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
2025-04-15 10:32:58 +08:00
}
2025-04-14 09:07:59 +08:00
// uni.showModal({
// title: "查看initFn",
// content: JSON.stringify(data) || "未传入参数 initFn",
// showCancel: true,
// success: function (res) {},
// });
let cardID = data.cardID;
let nimei = data.nimei;
const req = {
2025-04-15 10:32:58 +08:00
Nimei: nimei,
2025-04-14 09:07:59 +08:00
// Nimei:'"78F04BC3E9A6DE4782C11A2346F39C68'
2025-04-15 10:32:58 +08:00
};
const res = await GetAwaitUploadAreaApi(req);
console.log(res, "res---");
2025-04-14 09:07:59 +08:00
// 刷卡失败
2025-04-15 10:32:58 +08:00
if (!res.succeed) {
2025-04-14 09:07:59 +08:00
console.log("%c%s", "color:red", "刷卡失败");
// 提示信息
2025-04-15 10:32:58 +08:00
this.errorMsg =
res.error || "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息";
2025-04-14 09:07:59 +08:00
this.errorShow = true;
// 同时关闭成功弹窗
this.successShow = false;
2025-04-15 10:32:58 +08:00
return;
2025-04-14 09:07:59 +08:00
}
// 刷卡成功
this.successShow = true;
// 同时关闭失败弹窗
this.errorShow = false;
2025-04-15 10:32:58 +08:00
return;
2025-04-10 09:39:43 +08:00
if (data) {
console.log("%c%s", "color:red", "nfc刷卡成功");
2025-04-10 09:12:18 +08:00
this.successShow = true;
2025-04-14 09:07:59 +08:00
// 同时关闭失败弹窗
this.errorShow = false;
2025-04-10 09:39:43 +08:00
} else {
console.log("%c%s", "color:red", "刷卡失败");
2025-04-10 09:12:18 +08:00
this.errorShow = true;
2025-04-14 09:07:59 +08:00
// 同时关闭成功弹窗
this.successShow = false;
2025-04-10 09:12:18 +08:00
}
},
// 上传图片
2025-04-11 11:50:55 +08:00
toUploadPage() {
2025-04-10 09:39:43 +08:00
console.log("%c%s", "color:red", "上传图片");
2025-04-10 16:29:39 +08:00
2025-04-11 11:50:55 +08:00
const params = {
planName: this.dataInfo.planName,
2025-04-14 15:10:19 +08:00
id: this.dataInfo.areas[this.dataInfo.areas.length - 1].id,
2025-04-11 11:50:55 +08:00
aeraNmae: this.dataInfo.areas[this.dataInfo.areas.length - 1].aeraNmae,
};
console.log(params);
2025-04-10 14:40:35 +08:00
// 先关闭弹窗再跳转
this.successShow = false;
2025-04-10 09:39:43 +08:00
uni.navigateTo({
2025-04-11 17:24:07 +08:00
url:
"/pages/index/uploadPhoto?params=" +
encodeURIComponent(JSON.stringify(params)),
2025-04-10 09:39:43 +08:00
});
2025-04-10 09:12:18 +08:00
},
// 异常上报
2025-04-10 09:39:43 +08:00
exceptionReportFn() {
console.log("%c%s", "color:red", "异常上报");
2025-04-10 14:40:35 +08:00
// 先关闭弹窗再跳转
this.errorShow = false;
2025-04-10 09:39:43 +08:00
uni.navigateTo({
url: "/pages/index/list",
});
2025-04-10 09:12:18 +08:00
},
2025-04-11 17:24:07 +08:00
toItemPage(item) {
2025-04-14 15:10:19 +08:00
console.log("%c%s", "color:red", "跳转至详情页", item);
const combinedData = {
...item, // 展开 item 的所有属性
planName: this.dataInfo.planName, // 添加 planName 属性
};
const params = encodeURIComponent(JSON.stringify(combinedData));
if (item.isCompleted) {
// 已保洁
uni.navigateTo({
url: "/pages/index/cleanDetails?params=" + params,
});
return;
} else {
// 未保洁
uni.navigateTo({
url: "/pages/index/list?params=" + params,
});
}
2025-04-11 17:24:07 +08:00
},
2025-04-10 09:39:43 +08:00
openFn() {},
closeFn() {},
2025-04-07 09:30:11 +08:00
changeTab(i) {
this.selectIdx = i;
2025-04-09 16:58:50 +08:00
this.getPlanInfoAreaList();
},
changeDropdown(e) {
this.dropdownValue = e;
this.getPlanInfoAreaList();
},
// 获取今日计划
async getTodayPlanList() {
const res = await GetTodayPlanList();
if (res.succeed) {
this.dropdownOptions = res.data.map((item) => ({
label: item.name,
value: item.id,
}));
}
2025-04-07 09:30:11 +08:00
},
2025-04-09 13:44:35 +08:00
// 获取计划区域列表
async getPlanInfoAreaList() {
const res = await GetPlanInfoAreaList({
2025-04-09 16:58:50 +08:00
id: this.dropdownValue,
isCompleted: this.selectIdx === 0 ? true : false,
2025-04-09 13:44:35 +08:00
});
if (res.succeed) {
2025-04-09 16:58:50 +08:00
this.dataInfo = res.data;
2025-04-09 13:44:35 +08:00
}
},
2025-04-07 09:30:11 +08:00
},
};
</script>
<style lang="scss" scoped>
2025-04-14 15:10:19 +08:00
page {
background-color: #f3f5fa !important;
}
2025-04-07 09:30:11 +08:00
.content {
2025-04-09 16:58:50 +08:00
// height: 100vh;
2025-04-07 09:30:11 +08:00
background: #f7f8fc;
.slot-wrap {
2025-04-15 10:32:58 +08:00
position: relative;
2025-04-07 09:30:11 +08:00
display: flex;
align-items: center;
justify-content: center;
flex: 1;
/deep/ .u-dropdown-item__options {
width: 100%;
}
2025-04-15 10:32:58 +08:00
.back-icon {
position: absolute;
left: 12rpx;
top: 12rpx;
z-index: 20;
}
2025-04-07 09:30:11 +08:00
}
.title {
line-height: 1;
border-left: 10rpx solid #5a7ee9;
padding-left: 16rpx;
font-weight: bold;
font-size: 36rpx;
color: #000000;
}
.area-info {
padding: 24rpx 32rpx;
padding-top: 72rpx;
display: flex;
flex-direction: column;
2025-04-08 14:13:28 +08:00
background: url("@/static/images/plan-icon-bg2.png") no-repeat 95% 40%;
2025-04-07 09:30:11 +08:00
background-size: 40%;
background-color: #dfeefd;
.name {
font-weight: 800;
font-size: 48rpx;
color: #1d1d1d;
}
.position {
margin-top: 40rpx;
font-weight: 500;
font-size: 34rpx;
color: #465161;
}
.tabs {
margin-top: 38rpx;
display: flex;
justify-content: space-between;
.tab-item {
z-index: 99;
pointer-events: auto; /* 确保可点击 */
background: #ffffff;
border-radius: 30rpx;
2025-04-08 14:13:28 +08:00
padding: 12rpx 0;
2025-04-07 09:30:11 +08:00
width: 48%;
display: flex;
align-items: center;
justify-content: center;
color: #383535;
}
.select {
color: #ffffff;
background: #4278f4;
}
}
}
.arealist {
display: flex;
flex-direction: column;
padding: 32rpx;
.block-info {
position: relative;
background: #ffffff;
border-radius: 18rpx;
padding: 65rpx 46rpx;
2025-04-09 16:58:50 +08:00
margin-bottom: 32rpx;
2025-04-07 09:30:11 +08:00
.schedule {
position: absolute;
right: 0;
top: 0;
display: flex;
align-items: center;
justify-content: center;
2025-04-09 16:58:50 +08:00
// background-color: #feeded; /* 背景颜色 */
2025-04-08 14:13:28 +08:00
color: white;
width: 160rpx;
height: 45rpx;
font-size: 30rpx;
2025-04-09 16:58:50 +08:00
// color: #db3636;
2025-04-08 14:13:28 +08:00
border-bottom-left-radius: 500rpx; /* 切角 */
2025-04-07 09:30:11 +08:00
}
2025-04-09 16:58:50 +08:00
.schedule-completed {
color: #4278f4;
background-color: #e5ebff;
}
.schedule-wait {
color: #db3636;
background-color: #feeded;
}
2025-04-07 09:30:11 +08:00
.name {
display: flex;
align-items: center;
.text {
margin-left: 20rpx;
font-size: 38rpx;
color: #32353b;
}
}
.type {
display: flex;
margin: 38rpx 0;
.value {
margin-right: 10rpx;
font-size: 32rpx;
color: #8896b4;
}
.tag {
margin: 0 16rpx;
}
}
.illustrate {
padding: 46rpx;
background: #f3f6f7;
border-radius: 21rpx;
font-size: 32rpx;
color: #353535;
line-height: 57rpx;
}
}
}
}
2025-04-10 09:39:43 +08:00
.success-box {
2025-04-10 09:12:18 +08:00
// overflow:hidden;
2025-04-10 09:39:43 +08:00
width: 650rpx;
padding-top: 50rpx;
background-color: transparent;
.box-content {
height: 450rpx;
2025-04-10 09:12:18 +08:00
background-color: #ffffff;
2025-04-10 09:39:43 +08:00
background: linear-gradient(to bottom, #a7dafc, white 60%, white);
border-radius: 30rpx;
2025-04-10 09:12:18 +08:00
// border:1px solid red;
2025-04-10 16:29:39 +08:00
position: relative;
.logo {
position: absolute;
top: -50rpx;
left: 50%;
transform: translateX(-50%);
width: 200rpx;
height: 200rpx;
2025-04-10 09:12:18 +08:00
}
2025-04-10 09:39:43 +08:00
.content-title {
position: absolute;
top: 40%;
width: 100%;
color: black;
font-size: 40rpx;
text-align: center;
2025-04-10 09:12:18 +08:00
}
2025-04-10 09:39:43 +08:00
.btn-box {
position: absolute;
bottom: 10%;
width: 100%;
display: flex;
justify-content: space-evenly;
.btn-cancel {
width: 200rpx;
height: 70rpx;
background-color: #f3f6f7;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: #32353b;
2025-04-10 09:12:18 +08:00
}
2025-04-10 09:39:43 +08:00
.btn-success {
width: 200rpx;
height: 70rpx;
background-color: #4278f4;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: white;
2025-04-10 09:12:18 +08:00
}
}
}
}
2025-04-10 09:39:43 +08:00
.error-box {
2025-04-10 09:12:18 +08:00
// overflow:hidden;
2025-04-10 09:39:43 +08:00
width: 650rpx;
padding-top: 50rpx;
background-color: transparent;
.box-content {
height: 450rpx;
2025-04-10 09:12:18 +08:00
background-color: #ffffff;
2025-04-10 16:29:39 +08:00
background: linear-gradient(to bottom, #ffeddf, white 60%, white);
border-radius: 30rpx;
2025-04-10 09:12:18 +08:00
// border:1px solid red;
2025-04-10 16:29:39 +08:00
position: relative;
.logo {
position: absolute;
top: -50rpx;
left: 50%;
transform: translateX(-50%);
width: 200rpx;
height: 200rpx;
2025-04-10 10:15:14 +08:00
// background-color:red;
2025-04-10 09:12:18 +08:00
}
2025-04-10 09:39:43 +08:00
.content-title {
position: absolute;
top: 40%;
2025-04-10 16:29:39 +08:00
left: 50%;
transform: translateX(-50%);
width: 80%;
2025-04-10 09:39:43 +08:00
color: black;
2025-04-10 16:29:39 +08:00
font-size: 32rpx;
2025-04-10 09:39:43 +08:00
text-align: center;
2025-04-10 09:12:18 +08:00
}
2025-04-10 09:39:43 +08:00
.btn-box {
position: absolute;
bottom: 10%;
width: 100%;
display: flex;
justify-content: space-evenly;
.btn-cancel {
width: 200rpx;
height: 70rpx;
background-color: #f3f6f7;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: #32353b;
2025-04-10 09:12:18 +08:00
}
2025-04-10 16:29:39 +08:00
.btn-success {
width: 200rpx;
height: 70rpx;
background-color: #f76590;
border-radius: 50rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: white;
2025-04-10 09:12:18 +08:00
}
}
}
}
2025-04-10 09:39:43 +08:00
::v-deep .u-mode-center-box {
margin-top: -500rpx !important;
background-color: transparent !important;
2025-04-10 09:12:18 +08:00
}
2025-04-07 09:30:11 +08:00
</style>