|
@@ -0,0 +1,480 @@
|
|
|
+<template>
|
|
|
+ <scroll-view scroll-y class="grayBackgroundColor">
|
|
|
+ <view class="grayBackgroundColor">
|
|
|
+ <view>
|
|
|
+ <el-calendar id="calendar" ref="calendar" v-model="currentDatevalue" @touchstart="touchStart" @touchend="touchEnd">
|
|
|
+ <template #header="{ date }">
|
|
|
+ <view style="display: flex; width: 100%">
|
|
|
+ <view>{{ date }}</view>
|
|
|
+ <view style="margin: auto"></view>
|
|
|
+ <view style="display: flex">
|
|
|
+ <view style="margin: 0px 10px">
|
|
|
+ <span style="margin-right: 5px">合格</span>
|
|
|
+ <span style="color: #00cdac">{{ JSON.stringify(currentDateList) === "{}" ? 0 : currentDateList.patrolledCount }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="margin-left-xs">
|
|
|
+ <span style="margin-right: 5px">漏检</span>
|
|
|
+ <span style="color: #f07d28">{{ JSON.stringify(currentDateList) === "{}" ? 0 : currentDateList.undetectedCount }}</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <template #dateCell="{ data }">
|
|
|
+ <view @click="calendarClick(data)">
|
|
|
+ <p :class="data.isSelected ? 'is-selected' : ''">
|
|
|
+ {{ data.day.split("-").slice(2).join("-") }}
|
|
|
+ </p>
|
|
|
+ <view v-if="data.isSelected" class="filter"></view>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ </el-calendar>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <view class="padding-sm" style="display: flex; margin: 10px; padding: 10px 5rem">
|
|
|
+ <u-subsection :list="list" :current="tabPosition" inactiveColor="#303133" activeColor="#3c9cff" @change="tabPositionChange"></u-subsection>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <view id="planTimeline1" v-if="activities.length > 0">
|
|
|
+ <view style="margin: 0px -3.5px; font-size: 13px; color: #409eff" @click="activitiesSortClick()"> 排序 </view>
|
|
|
+ <view v-for="(activity, index) in activities" :key="index" v-show="tabPosition == 0">
|
|
|
+ <view style="display: flex; height: 25px; line-height: 25px">
|
|
|
+ <view style="margin: auto 0">
|
|
|
+ <u-icon name="info-circle-fill" color="#409eff" size="18"></u-icon>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex; width: 100%; margin-left: 15px">
|
|
|
+ <view style="font-size: 15px; color: #000000">
|
|
|
+ {{ activity.planName }}
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"> </view>
|
|
|
+ <view style="font-size: 14px; color: #b5b5b5">
|
|
|
+ {{ activity.timestamp }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view style="display: flex">
|
|
|
+ <view style="width: 18px; display: flex">
|
|
|
+ <view v-if="index != activities.length - 1" style="width: 2px; background-color: #e4e7ed; margin: -5px auto"></view>
|
|
|
+ </view>
|
|
|
+ <view style="width: 100%; margin: 15px 0px 15px 15px; padding: 15px; background-color: #fff; border-radius: 10px">
|
|
|
+ <view style="display: flex" v-if="activity.planStatus == 2">
|
|
|
+ <view>
|
|
|
+ <view>巡检任务结束</view>
|
|
|
+ <br />
|
|
|
+ <view style="padding: 0; font-size: 14px; color: #409eff" @click="reportClick(activity)"> 点击查看 </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"></view>
|
|
|
+ <view style="display: flex">
|
|
|
+ <el-progress style="margin: auto" type="circle" :percentage="activity.completion" :width="50" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex" v-if="activity.planStatus == 1">
|
|
|
+ <view>
|
|
|
+ <view>巡检任务执行中,还需完成 {{ activity.undetectedSiteCount }}个 </view>
|
|
|
+ <br />
|
|
|
+ <view @click="reportClick(activity)" style="padding: 0; font-size: 14px; color: #409eff"> 点击巡检 </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"></view>
|
|
|
+ <view style="display: flex">
|
|
|
+ <el-progress style="margin: auto" type="circle" :percentage="activity.completion" :width="50" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex" v-if="activity.planStatus == 3">
|
|
|
+ <view>
|
|
|
+ <view>巡检任务结束</view>
|
|
|
+ <br />
|
|
|
+ <view>
|
|
|
+ <span style="margin-right: 20px">
|
|
|
+ 合格:
|
|
|
+ <span style="color: #00cdac">
|
|
|
+ {{ activity.patrolledSiteCount }}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <span>
|
|
|
+ 漏检:
|
|
|
+ <span style="color: #f07d28">
|
|
|
+ {{ activity.undetectedSiteCount }}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"></view>
|
|
|
+ <view style="display: flex">
|
|
|
+ <el-progress style="margin: auto" type="circle" :percentage="activity.completion" :width="50" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-for="(activity, index) in activities" :key="index" v-show="tabPosition == 1">
|
|
|
+ <view style="display: flex; height: 25px; line-height: 25px">
|
|
|
+ <view style="margin: auto 0">
|
|
|
+ <u-icon name="info-circle-fill" color="#409eff" size="18"></u-icon>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex; width: 100%; margin-left: 15px">
|
|
|
+ <view style="font-size: 15px; color: #000000">
|
|
|
+ {{ activity.areaName }}
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"> </view>
|
|
|
+ <view style="font-size: 14px; color: #b5b5b5">
|
|
|
+ {{ activity.createTime }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view style="display: flex">
|
|
|
+ <view style="width: 18px; display: flex">
|
|
|
+ <view v-if="index != activities.length - 1" style="width: 2px; background-color: #e4e7ed; margin: -5px auto"></view>
|
|
|
+ </view>
|
|
|
+ <view style="width: 100%; margin: 15px 0px 15px 15px; padding: 15px; background-color: #fff; border-radius: 10px">
|
|
|
+ <view style="display: flex">
|
|
|
+ <view>
|
|
|
+ <view>已检查{{ activity.contentCount }}项内容</view>
|
|
|
+ <br />
|
|
|
+ <view style="padding: 0; font-size: 14px; color: #409eff" @click="reportClick(activity)"> 点击查看 </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin: auto"></view>
|
|
|
+ <view style="display: flex; font-size: 15px; color: #30bb00">
|
|
|
+ <view style="margin: auto">
|
|
|
+ {{ activity.siteStatus == 0 ? "未定位" : "已定位" }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view id="planTimeline" style="text-align: center; color: #bdbdbd; font-size: 14px" v-else> 暂无数据 </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view style="position: fixed; right: 0; bottom: 50px">
|
|
|
+ <u-image width="67" height="67" src="@/static/images/xunjian/plan-scan.png" shape="circle" @click="scanClick()"></u-image>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <drawer v-if="scanArray.length > 0" :scanArray="scanArray" :scanBool="scanBool" @scanClose="scanClose"></drawer>
|
|
|
+ </scroll-view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import drawer from "./components/drawer.vue";
|
|
|
+
|
|
|
+import { onLoad, onShow, onLaunch } from "@dcloudio/uni-app";
|
|
|
+import { ref, onMounted, inject, shallowRef } from "vue";
|
|
|
+const myRequest = inject("$myRequest");
|
|
|
+
|
|
|
+import useXunJianStore from "@/store/modules/xunJian";
|
|
|
+const settingsStore = useXunJianStore(); //全局变量值Store
|
|
|
+
|
|
|
+/**
|
|
|
+ * @点击巡检
|
|
|
+ * @点击事件
|
|
|
+ */
|
|
|
+async function reportClick(obj) {
|
|
|
+ if (tabPosition.value == 0) {
|
|
|
+ settingsStore.planSonId = obj.id;
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/business/mhxf/xunJian/plan/components/report",
|
|
|
+ });
|
|
|
+ } else if (tabPosition.value == 1) {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/recordList",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ siteId: obj.id,
|
|
|
+ planSonId: obj.planSonId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ const res1 = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/recordOption",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ siteId: res.data.data[0].siteId,
|
|
|
+ recordId: res.data.data[0].id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ res.data.data[0].inspectionStatus = 2;
|
|
|
+ res.data.data[0].pictureUrl = obj.pictureUrl;
|
|
|
+
|
|
|
+ settingsStore.contentArray = {
|
|
|
+ contentList: [res1.data.data.contentList],
|
|
|
+ siteList: res.data.data[0],
|
|
|
+ };
|
|
|
+ settingsStore.siteId = undefined;
|
|
|
+ settingsStore.siteNubmber = undefined;
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/business/mhxf/xunJian/plan/components/siteDetails",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @扫一扫
|
|
|
+ * @点击事件
|
|
|
+ */
|
|
|
+const scanArray = ref([]);
|
|
|
+const scanBool = ref(false);
|
|
|
+function scanClick() {
|
|
|
+ uni.scanCode({
|
|
|
+ success: async (e) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "扫码成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ settingsStore.inspectionStatus = 1;
|
|
|
+ let res = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/planList",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ siteNubmber: e.result,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ scanArray.value = res.data.data;
|
|
|
+ scanBool.value = true;
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "此点位下暂无数据,请切换点位重试!",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "扫码失败",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ console.log("扫码失败", err);
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: "扫码结束",
|
|
|
+ // icon: "none",
|
|
|
+ // });
|
|
|
+ console.log("扫码结束");
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @抽屉emit
|
|
|
+ * @关闭事件
|
|
|
+ */
|
|
|
+function scanClose(flag) {
|
|
|
+ scanBool.value = flag;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @巡检任务
|
|
|
+ * @巡检记录
|
|
|
+ * @api接口请求
|
|
|
+ */
|
|
|
+const activities = ref([]);
|
|
|
+async function activitiesApi() {
|
|
|
+ activities.value = [];
|
|
|
+ if (tabPosition.value == 0) {
|
|
|
+ let res = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/patrolInspectionPlan",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ currentDate: currentDate.value,
|
|
|
+ sort: activitiesSort.value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ res.data.data.forEach((el) => {
|
|
|
+ activities.value.push({
|
|
|
+ id: el.id,
|
|
|
+ planName: el.planName,
|
|
|
+ timestamp:
|
|
|
+ (el.startTime == null || el.startTime == "" ? "" : el.startTime.split(":")[0] + ":" + el.startTime.split(":")[1] + "~") +
|
|
|
+ (el.endTime == null || el.endTime == "" ? "" : el.endTime.split(":")[0] + ":" + el.endTime.split(":")[1]),
|
|
|
+
|
|
|
+ planStatus: el.planStatus,
|
|
|
+ completion: el.completion,
|
|
|
+ patrolledSiteCount: el.patrolledSiteCount,
|
|
|
+ undetectedSiteCount: el.undetectedSiteCount,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ } else if (tabPosition.value == 1) {
|
|
|
+ let res = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/recordList",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ currentDate: currentDate.value,
|
|
|
+ sort: activitiesSort.value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ res.data.data.forEach((el) => {
|
|
|
+ activities.value.push({
|
|
|
+ areaName: el.areaName,
|
|
|
+ siteName: el.siteName,
|
|
|
+ contentCount: el.contentCount,
|
|
|
+ createTime: el.createTime.replace("T", " "),
|
|
|
+ siteStatus: el.siteStatus,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @统计
|
|
|
+ * @api接口请求
|
|
|
+ */
|
|
|
+const currentDate = ref(settingsStore.getDate().year + "-" + settingsStore.getDate().month + "-" + settingsStore.getDate().dates); //统计时间数据存储
|
|
|
+const currentDatevalue = ref(new Date());
|
|
|
+const currentDateList = ref({}); //统计list数据存储
|
|
|
+async function currentApi() {
|
|
|
+ const res = await myRequest({
|
|
|
+ url: "/service-fire/appPatrolInspection/appPlanStatistics",
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=utf-8",
|
|
|
+ },
|
|
|
+ method: "GET",
|
|
|
+ data: {
|
|
|
+ currentDate: currentDate.value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ currentDateList.value = res.data.data;
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @排序按钮
|
|
|
+ */
|
|
|
+const activitiesSort = ref("DESC");
|
|
|
+function activitiesSortClick() {
|
|
|
+ if (activitiesSort.value == "ASC") {
|
|
|
+ activitiesSort.value = "DESC";
|
|
|
+ } else {
|
|
|
+ activitiesSort.value = "ASC";
|
|
|
+ }
|
|
|
+ activitiesApi();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @tabs切换change事件
|
|
|
+ */
|
|
|
+const list = ref(["巡检任务", "巡检记录"]);
|
|
|
+const tabPosition = ref(settingsStore.planTabs);
|
|
|
+function tabPositionChange(index) {
|
|
|
+ tabPosition.value = index;
|
|
|
+ activitiesApi();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @日期click事件
|
|
|
+ */
|
|
|
+const calendar = ref(); //获取日期refs元素
|
|
|
+function calendarClick(data) {
|
|
|
+ currentDate.value = data.day;
|
|
|
+ currentApi();
|
|
|
+ activitiesApi();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @触摸开始
|
|
|
+ **/
|
|
|
+let touchStartX = 0; // 触屏起始点x
|
|
|
+let touchStartY = 0; // 触屏起始点y
|
|
|
+function touchStart(e) {
|
|
|
+ console.log("触摸开始");
|
|
|
+ touchStartX = e.touches[0].clientX;
|
|
|
+ touchStartY = e.touches[0].clientY;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @触摸结束
|
|
|
+ **/
|
|
|
+function touchEnd(e) {
|
|
|
+ console.log("触摸结束");
|
|
|
+ let deltaX = e.changedTouches[0].clientX - touchStartX;
|
|
|
+ let deltaY = e.changedTouches[0].clientY - touchStartY;
|
|
|
+ if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
|
+ if (deltaX >= 0) {
|
|
|
+ console.log("左滑");
|
|
|
+
|
|
|
+ calendar.value.selectDate("prev-month");
|
|
|
+ } else {
|
|
|
+ console.log("右滑");
|
|
|
+ calendar.value.selectDate("next-month");
|
|
|
+ }
|
|
|
+ } else if (Math.abs(deltaY) > 50 && Math.abs(deltaX) < Math.abs(deltaY)) {
|
|
|
+ if (deltaY < 0) {
|
|
|
+ console.log("上滑");
|
|
|
+ } else {
|
|
|
+ console.log("下滑");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("可能是误触!");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onLoad((options) => {
|
|
|
+ currentApi();
|
|
|
+ activitiesApi();
|
|
|
+
|
|
|
+ // 从详情页返回该页面的获取数据
|
|
|
+ uni.$on("planSelect", () => {
|
|
|
+ currentApi();
|
|
|
+ activitiesApi();
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+onMounted(() => {});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.is-selected {
|
|
|
+ color: #1989fa;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+body,
|
|
|
+uni-page-body,
|
|
|
+uni-page-refresh,
|
|
|
+.grayBackgroundColor {
|
|
|
+ background: rgb(241, 241, 241);
|
|
|
+}
|
|
|
+</style>
|