From af4f45eaa2703ecf991bd10f07f6df179f2677d9 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 十一月 2025 10:04:45 +0800
Subject: [PATCH] Merge branch 'refs/heads/yyb'
---
src/pages/routingInspection/index.vue | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 164 insertions(+), 0 deletions(-)
diff --git a/src/pages/routingInspection/index.vue b/src/pages/routingInspection/index.vue
new file mode 100644
index 0000000..ddad4be
--- /dev/null
+++ b/src/pages/routingInspection/index.vue
@@ -0,0 +1,164 @@
+<template>
+ <view>
+ <wd-row>
+ <wd-col :span="21">
+ <wd-search
+ v-model="searchKeyword"
+ placeholder="璇疯緭鍏ョ彮缁勫悕绉�"
+ placeholder-left
+ hide-cancel
+ @search="handleSearch"
+ @clear="handleClear"
+ ></wd-search>
+ </wd-col>
+ <wd-col :span="3">
+ <view class="scan_box" @click="openScan">
+ <wd-icon name="scan" size="24px" color="#0D867F"></wd-icon>
+ </view>
+ </wd-col>
+ </wd-row>
+ <wd-tabs v-model="tab" auto-line-width slidable="always" :map-num="patrolList.length">
+ <wd-tab
+ v-for="(item, index) in patrolList"
+ :key="index"
+ :title="`${item.deviceModel}锛堝緟妫�鏌�${item.pendingNum}鏉★級`"
+ class="tab_bg"
+ >
+ <ProductList
+ :key="searchKey"
+ :api="RoutingInspectionApi.getInspectListByPatrol"
+ :ProList="{ ...item, teamName: searchKeyword }"
+ />
+ </wd-tab>
+ </wd-tabs>
+ <wd-toast />
+ </view>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive, computed, onMounted, onUnmounted } from "vue";
+import { onShow, onHide } from "@dcloudio/uni-app";
+import ProductList from "./list/index.vue";
+import { useUserStore } from "@/store/modules/user";
+import reportApi from "@/api/work/report";
+import { useToast } from "wot-design-uni";
+import RoutingInspectionApi from "@/api/routingInspection/routingInspection";
+import { useScanCode } from "@/composables/useScanCode";
+
+const userStore = useUserStore();
+const userInfo: any = computed(() => userStore.userInfo);
+const toast = useToast();
+const tab = ref<number>(0);
+const patrolList = ref<any[]>([]); // 宸℃璁惧鍒楄〃鏁版嵁
+const searchKeyword = ref<string>(""); // 鎼滅储鍏抽敭璇嶏紙鐝粍鍚嶇О锛�
+const searchKey = ref<number>(0); // 鐢ㄤ簬寮哄埗鍒锋柊鍒楄〃
+
+// 浣跨敤鎵爜绠$悊 composable锛堝叏灞�鐩戝惉鍣紝涓嶉殢椤甸潰鍒囨崲鍏抽棴锛�
+const { deviceUid, deviceModel, hasScanned, displayText, loadFromCache, enableListener } =
+ useScanCode("scanIndex");
+
+const handlePatrolData = (index: number, count: number) => {
+ // 鍙互鍦ㄨ繖閲屾洿鏂扮壒瀹氬贰妫�璁惧鐨勫緟妫�鏌ユ暟閲�
+ // 渚嬪锛歱atrolList.value[index].pendingNum = count;
+};
+
+// 澶勭悊鎼滅储
+const handleSearch = (value: string) => {
+ console.log("鎼滅储鐝粍:", value);
+ searchKey.value++; // 鏇存柊 key 寮哄埗鍒锋柊鍒楄〃
+};
+
+// 澶勭悊娓呯┖鎼滅储
+const handleClear = () => {
+ console.log("娓呯┖鎼滅储");
+ searchKeyword.value = "";
+ searchKey.value++; // 鏇存柊 key 寮哄埗鍒锋柊鍒楄〃
+};
+
+const openScan = () => {
+ console.log("index.vue - 鐐瑰嚮鎵爜鎸夐挳锛堝叏灞�鎵爜妯″紡锛屾棤闇�鎵嬪姩瑙﹀彂锛�");
+ // 鍏ㄥ眬鎵爜妯″紡涓嬶紝纭欢鎵爜浼氳嚜鍔ㄨЕ鍙戯紝鏃犻渶鎵嬪姩璋冪敤
+ uni.showToast({
+ title: "璇蜂娇鐢ㄦ壂鐮佹灙鎵弿",
+ icon: "none",
+ });
+};
+
+// 鑾峰彇宸℃璁惧鍒楄〃
+const loadPatrolList = async () => {
+ try {
+ const { data } = await RoutingInspectionApi.getDeviceInspectListByPatrol({});
+ if (data) {
+ patrolList.value = data;
+ }
+ } catch (error) {
+ toast.error("鑾峰彇宸℃璁惧鍒楄〃澶辫触");
+ }
+};
+
+onMounted(() => {
+ // 椤甸潰鍔犺浇鏃惰幏鍙栧贰妫�璁惧鍒楄〃
+ loadPatrolList();
+ // 鍚敤鍏ㄥ眬鐩戝惉鍣�
+ enableListener();
+ console.log("index.vue - onMounted");
+});
+
+onShow(() => {
+ console.log("========== index.vue - onShow 瑙﹀彂 ==========");
+ // 椤甸潰鏄剧ず鏃堕噸鏂板惎鐢ㄧ洃鍚櫒锛堢‘淇濈洃鍚櫒鏈夋晥锛�
+ enableListener();
+ // 鍔犺浇缂撳瓨锛堟洿鏂癠I鏄剧ず锛�
+ loadFromCache();
+
+ // 妫�鏌ユ槸鍚﹂渶瑕佸埛鏂板垪琛紙鍙湁鎻愪氦鎴愬姛鍚庢墠鍒锋柊锛�
+ const needRefresh = uni.getStorageSync("needRefreshInspectionList");
+ if (needRefresh) {
+ console.log("妫�娴嬪埌闇�瑕佸埛鏂板垪琛紝寮�濮嬪埛鏂�...");
+ // 閲嶆柊鍔犺浇宸℃璁惧鍒楄〃锛堝埛鏂板緟妫�鏌ユ暟閲忥級
+ loadPatrolList();
+ // 寮哄埗鍒锋柊 ProductList 缁勪欢
+ searchKey.value++;
+ // 娓呴櫎鍒锋柊鏍囪
+ uni.removeStorageSync("needRefreshInspectionList");
+ }
+});
+</script>
+
+<style lang="scss" scoped>
+::v-deep .wd-search__block {
+ border-radius: unset;
+}
+.scan_box {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 38px;
+ height: 38px;
+ padding: 6px;
+ background: #fff;
+}
+::v-deep .wd-tabs__line {
+ background: #0d867f;
+}
+::v-deep .wd-tabs__nav {
+ border-bottom: 1px #dddddd solid;
+}
+.tab_bg {
+ background: #f3f9f8;
+}
+
+.icon_box {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 20px;
+ height: 20px;
+ background: #e7f4ec99;
+ border-radius: 50%;
+}
+
+.statistics_box {
+ margin: 15px;
+}
+</style>
--
Gitblit v1.9.3