From 991f6f78fccb86b2718ab96969a69304daafe2b4 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 03 十一月 2025 17:32:50 +0800
Subject: [PATCH] fix: 完成巡查
---
src/pages/routingInspection/detail/indexLS.vue | 799 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 600 insertions(+), 199 deletions(-)
diff --git a/src/pages/routingInspection/detail/indexLS.vue b/src/pages/routingInspection/detail/indexLS.vue
index ad3ccac..31b72e3 100644
--- a/src/pages/routingInspection/detail/indexLS.vue
+++ b/src/pages/routingInspection/detail/indexLS.vue
@@ -34,179 +34,354 @@
淇濆瓨
</wd-button>
<view class="placeholder"></view>
+ <view class="scan-info">
+ <text class="scan-device-text">褰撳墠鎵爜鏈哄彴: {{ scannedDeviceModel || "鏈壂鐮�" }}</text>
+ </view>
<view class="scan-wrapper" @click="openScan">
<wd-icon name="scan" size="24px" color="#0D867F"></wd-icon>
</view>
</view>
</view>
<view class="list">
- <div class="inspection-report">
- <!-- 鍩烘湰淇℃伅妯″潡 -->
- <wd-row>
- <view style="margin: 10rpx">
- <text class="title">{{ "鍩烘湰淇℃伅" }}</text>
- </view>
- <wd-col :span="24">
- <wd-form-item label="鏃ユ湡" prop="recordDate">
- {{ formatDate(detailData.fixedInfo?.recordDate) }}
- </wd-form-item>
- <wd-form-item label="鏈哄彴" prop="deviceModel">
- {{ formatValue(detailData.fixedInfo?.deviceModel) }}
- </wd-form-item>
- <wd-form-item label="鐝" prop="workShift">
- {{ formatValue(detailData.fixedInfo?.workShift) }}
- </wd-form-item>
- <wd-form-item label="鐝粍" prop="teamName">
- {{ formatValue(detailData.fixedInfo?.teamName) }}
- </wd-form-item>
- <wd-form-item label="鍗曚笣瑙勬牸" prop="model">
- {{ formatValue(detailData.fixedInfo?.model) }}
- </wd-form-item>
- <wd-form-item label="鐢熶骇杞存暟" prop="outputNumber">
- {{ formatValue(detailData.fixedInfo?.outputNumber, "杞�") }}
- </wd-form-item>
- <wd-form-item label="鍨嬪彿" prop="poleModel">
- {{ formatValue(detailData.fixedInfo?.poleModel) }}
- </wd-form-item>
+ <!-- 鍩烘湰淇℃伅妯″潡 -->
+ <wd-row>
+ <view style="margin: 10rpx">
+ <text class="title">{{ "鍩烘湰淇℃伅" }}</text>
+ </view>
+ <wd-col :span="24">
+ <wd-form-item label="鏃ユ湡" prop="recordDate">
+ {{ formatDate(detailData.fixedInfo?.recordDate) }}
+ </wd-form-item>
+ <wd-form-item label="鏈哄彴" prop="deviceModel">
+ {{ formatValue(detailData.fixedInfo?.deviceModel) }}
+ </wd-form-item>
+ <wd-form-item label="鐝" prop="workShift">
+ {{ formatValue(detailData.fixedInfo?.workShift) }}
+ </wd-form-item>
+ <wd-form-item label="鐝粍" prop="teamName">
+ {{ formatValue(detailData.fixedInfo?.teamName) }}
+ </wd-form-item>
+ <wd-form-item label="鍗曚笣瑙勬牸" prop="model">
+ {{ formatValue(detailData.fixedInfo?.model) }}
+ </wd-form-item>
+ <wd-form-item label="鐢熶骇杞存暟" prop="outputNumber">
+ {{ formatValue(detailData.fixedInfo?.outputNumber, "杞�") }}
+ </wd-form-item>
+ <wd-form-item label="鍨嬪彿" prop="poleModel">
+ {{ formatValue(detailData.fixedInfo?.poleModel) }}
+ </wd-form-item>
+ <wd-form-item label="鎵规" prop="poleNumber">
+ {{ formatValue(detailData.fixedInfo?.poleNumber) }}
+ </wd-form-item>
+ <wd-form-item label="璁板綍浜�" prop="createUserName">
+ {{ formatValue(detailData.fixedInfo?.createUserName) }}
+ </wd-form-item>
+ <wd-form-item label="棣栨鐩樺彿" prop="firstNo">
+ {{ formatValue(detailData.fixedInfo?.firstNo) }}
+ </wd-form-item>
+ </wd-col>
+ </wd-row>
- <wd-form-item label="鎵规" prop="poleNumber">
- {{ formatValue(detailData.fixedInfo?.poleNumber) }}
- </wd-form-item>
- <wd-form-item label="璁板綍浜�" prop="createUserName">
- {{ formatValue(detailData.fixedInfo?.createUserName) }}
- </wd-form-item>
- <wd-form-item label="棣栨鐩樺彿" prop="firstNo">
- {{ formatValue(detailData.fixedInfo?.firstNo) }}
- </wd-form-item>
- </wd-col>
- </wd-row>
- <!-- 鑷璁板綍璇︽儏妯″潡 -->
- <wd-row>
- <view style="margin: 10rpx">
- <text class="title">{{ "鑷璁板綍璇︽儏" }}</text>
- </view>
- <wd-col :span="24">
- <wd-form-item label="宸℃鍛�" prop="processInspectionUserName">
- {{ detailData.processInspectionUserName || "-" }}
- </wd-form-item>
- <wd-form-item label="鐘舵��" prop="status">
- <wd-tag custom-class="space" :type="getStatusType(detailData.status)">
- {{ getStatusText(detailData.status) }}
- </wd-tag>
- </wd-form-item>
- </wd-col>
- </wd-row>
- <!-- 妫�楠岀粨鏋� -->
- <wd-row>
- <view style="margin: 10rpx">
- <text class="title">{{ "妫�楠岀粨鏋�" }}</text>
- </view>
- <wd-col :span="24">
- <wd-form-item label="鍗曚笣鐩村緞" prop="dia">
- {{ formatValue(detailData.inspectionResult?.dia, "mm") || "-" }}
- </wd-form-item>
- <wd-form-item label="鏈�澶х洿寰�" prop="maxDia">
+ <!-- 鑷璁板綍璇︽儏妯″潡 -->
+ <wd-row>
+ <view style="margin: 10rpx">
+ <text class="title">{{ "鑷璁板綍璇︽儏" }}</text>
+ </view>
+ <wd-col :span="24">
+ <wd-form-item label="宸℃鍛�" prop="processInspectionUserName">
+ {{ detailData.processInspectionUserName || "-" }}
+ </wd-form-item>
+ <wd-form-item label="鐘舵��" prop="status">
+ <wd-tag custom-class="space" :type="getStatusType(detailData.status)">
+ {{ getStatusText(detailData.status) }}
+ </wd-tag>
+ </wd-form-item>
+ </wd-col>
+ </wd-row>
+
+ <!-- 妫�楠岀粨鏋� -->
+ <wd-row>
+ <view style="margin: 10rpx">
+ <text class="title">{{ "妫�楠岀粨鏋�" }}</text>
+ </view>
+ <wd-col :span="24">
+ <wd-form-item label="鍗曚笣鐩村緞" prop="dia">
+ {{ formatValue(detailData.inspectionResult?.dia, "mm") || "-" }}
+ </wd-form-item>
+
+ <wd-form-item label="鏈�澶х洿寰�" prop="maxDia" required>
+ <template v-if="isEdit">
+ <wd-input v-model="formData.maxDia" placeholder="璇疯緭鍏ユ渶澶х洿寰�(mm)" type="number" />
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.maxDia, "mm") || "-" }}
- </wd-form-item>
- <wd-form-item label="鏈�灏忕洿寰�" prop="minDia">
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="鏈�灏忕洿寰�" prop="minDia" required>
+ <template v-if="isEdit">
+ <wd-input v-model="formData.minDia" placeholder="璇疯緭鍏ユ渶灏忕洿寰�(mm)" type="number" />
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.minDia, "mm") || "-" }}
- </wd-form-item>
- <wd-form-item label="澶栬" prop="appearance">
- {{ formatProductAppearance(detailData.inspectionResult?.appearance) || "-" }}
- </wd-form-item>
- <wd-form-item label="鍗风粫绱у瘑" prop="windingTightness">
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="澶栬" prop="appearance" required>
+ <template v-if="isEdit">
+ <view style="display: flex; flex-wrap: wrap; gap: 10px">
+ <wd-checkbox
+ v-for="(opt, idx) in appearanceOptions"
+ :key="idx"
+ :value="opt.value"
+ :modelValue="formData.appearance?.includes(opt.value) || false"
+ @click="handleAppearanceClick(opt.value)"
+ style="width: 100px"
+ >
+ {{ opt.label }}
+ </wd-checkbox>
+ </view>
+ </template>
+ <template v-else>
+ {{ formatProductAppearance(formData.appearance) }}
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="鍗风粫绱у瘑" prop="windingTightness" required>
+ <template v-if="isEdit">
+ <wd-radio-group
+ v-model="formData.windingTightness"
+ inline
+ class="conclusion-radio-group"
+ >
+ <wd-radio
+ v-for="(opt, idx) in sampleCompleteOptions"
+ :key="idx"
+ :value="opt.value"
+ shape="dot"
+ >
+ {{ opt.label }}
+ </wd-radio>
+ </wd-radio-group>
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.windingTightness) }}
- </wd-form-item>
- <wd-form-item label="鎺掑垪鏁撮綈" prop="arrangementNeatness">
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="鎺掑垪鏁撮綈" prop="arrangementNeatness" required>
+ <template v-if="isEdit">
+ <wd-radio-group
+ v-model="formData.arrangementNeatness"
+ inline
+ class="conclusion-radio-group"
+ >
+ <wd-radio
+ v-for="(opt, idx) in sampleCompleteOptions"
+ :key="idx"
+ :value="opt.value"
+ shape="dot"
+ >
+ {{ opt.label }}
+ </wd-radio>
+ </wd-radio-group>
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.arrangementNeatness) }}
- </wd-form-item>
- <wd-form-item
- label="澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�"
- prop="aluminumWireDistance"
- label-width="500rpx"
- >
+ </template>
+ </wd-form-item>
+
+ <wd-form-item
+ label="澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�"
+ prop="aluminumWireDistance"
+ label-width="360rpx"
+ required
+ >
+ <template v-if="isEdit">
+ <wd-input
+ v-model="formData.aluminumWireDistance"
+ placeholder="璇疯緭鍏ヨ窛绂�(mm)"
+ type="number"
+ />
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.aluminumWireDistance, "mm") || "-" }}
- </wd-form-item>
- <wd-form-item label="鎴愬搧妯″悗鎺ュご鎯呭喌" prop="jointCondition" label-width="250rpx">
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="鎴愬搧妯″悗鎺ュご鎯呭喌" prop="jointCondition" label-width="280rpx" required>
+ <template v-if="isEdit">
+ <wd-radio-group v-model="formData.jointCondition" inline class="conclusion-radio-group">
+ <wd-radio
+ v-for="(opt, idx) in jointConditionOptions"
+ :key="idx"
+ :value="opt.value"
+ shape="dot"
+ >
+ {{ opt.label }}
+ </wd-radio>
+ </wd-radio-group>
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.jointCondition) || "-" }}
- </wd-form-item>
- <wd-form-item label="缁撹" prop="conclusion">
+ </template>
+ </wd-form-item>
+
+ <wd-form-item label="缁撹" prop="conclusion" required>
+ <template v-if="isEdit">
+ <wd-radio-group v-model="formData.conclusion" inline class="conclusion-radio-group">
+ <wd-radio
+ v-for="(opt, idx) in conclusionOptions"
+ :key="idx"
+ :value="opt.value"
+ shape="dot"
+ >
+ {{ opt.label }}
+ </wd-radio>
+ </wd-radio-group>
+ </template>
+ <template v-else>
{{ formatValue(detailData.inspectionResult?.conclusion) || "-" }}
- </wd-form-item>
- </wd-col>
- </wd-row>
- <!-- 宸℃缁撴灉 -->
- <wd-row v-if="detailData.processInspectionResult?.isFully">
- <view style="margin: 10rpx">
- <text class="title">{{ "宸℃缁撴灉" }}</text>
- </view>
- <wd-col :span="24">
- <wd-form-item label="閾濇潌鍓嶃�佷腑銆佸熬鏍峰搧鏄惁榻愬叏" prop="processInspectionUserName">
+ </template>
+ </wd-form-item>
+ </wd-col>
+ </wd-row>
+
+ <!-- 宸℃缁撴灉 -->
+ <wd-row v-if="detailData.processInspectionResult?.isFully">
+ <view style="margin: 10rpx">
+ <text class="title">{{ "宸℃缁撴灉" }}</text>
+ </view>
+ <wd-col :span="24">
+ <wd-form-item label="閾濇潌鍓嶃�佷腑銆佸熬鏍峰搧鏄惁榻愬叏" prop="isFully" required>
+ <template v-if="isEdit">
+ <wd-radio-group v-model="formData.isFully" inline class="conclusion-radio-group">
+ <wd-radio
+ v-for="(opt, idx) in sampleCompleteOptions"
+ :key="idx"
+ :value="opt.value"
+ shape="dot"
+ >
+ {{ opt.label }}
+ </wd-radio>
+ </wd-radio-group>
+ </template>
+ <template v-else>
<wd-tag
custom-class="space"
:type="detailData.processInspectionResult?.isFully ? 'success' : 'danger'"
>
{{ detailData.processInspectionResult?.isFully ? "鏄�" : "鍚�" }}
</wd-tag>
- </wd-form-item>
- </wd-col>
- </wd-row>
- <!-- 闄勪欢妯″潡 -->
- <wd-row class="attachment-section" v-if="detailData.files && detailData.files.length > 0">
- <view style="margin: 10rpx">
- <text class="title">{{ "闄勪欢" }}</text>
- </view>
- <view class="attachment-grid">
- <wd-col v-for="(file, index) in detailData.files" :key="index" class="attachment-item">
- <wd-img :width="80" :height="80" :src="file.url" @click="previewImage(file.url)">
- <template #error>
- <view class="error-wrap">鍔犺浇澶辫触</view>
- </template>
- <template #loading>
- <view class="loading-wrap">
- <wd-loading />
- </view>
- </template>
- </wd-img>
- </wd-col>
- </view>
- </wd-row>
- </div>
+ </template>
+ </wd-form-item>
+ </wd-col>
+ </wd-row>
+
+ <!-- 闄勪欢妯″潡 -->
+ <wd-row class="attachment-section" v-if="detailData.files && detailData.files.length > 0">
+ <view style="margin: 10rpx">
+ <text class="title">{{ "闄勪欢" }}</text>
+ </view>
+ <wd-col :span="24">
+ <AttachmentUpload
+ :detailData="detailData"
+ :isEdit="isEdit"
+ :deviceType="paramsType"
+ ref="attachmentRef"
+ />
+ </wd-col>
+ </wd-row>
<wd-popup v-model="show" custom-style="border-radius:32rpx;" @close="handleClose">
<div class="image-preview">
<img :src="previewImageUrl" alt="棰勮鍥剧墖" style="width: 100%; height: auto" />
</div>
</wd-popup>
+ <wd-toast />
</view>
</template>
<script setup lang="ts">
-import { onLoad } from "@dcloudio/uni-app";
+import { ref, reactive, computed, onUnmounted } from "vue";
+import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import RoutingInspectionApi from "@/api/routingInspection/routingInspection";
+import { useToast } from "wot-design-uni";
+import AttachmentUpload from "../upload.vue";
+import { useUserStore } from "@/store/modules/user";
+import { useScanCode } from "@/composables/useScanCode";
+// 鏍稿績鐘舵��
const paramsId = ref("");
+const paramsType = ref("");
const detailData = ref<any>({});
const show = ref(false);
const previewImageUrl = ref("");
const isEdit = ref(false);
+const tempFiles = ref<any[]>([]);
+const toast = useToast();
+const attachmentRef = ref<any>(null);
-// 鐘舵�佺被鍨嬫槧灏�
+// 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
+const userStore = useUserStore();
+const userInfo: any = computed(() => userStore.userInfo);
+
+// 浣跨敤鎵爜绠$悊 composable锛堝叏灞�鐩戝惉鍣紝涓嶉殢椤甸潰鍒囨崲鍏抽棴锛�
+const {
+ deviceUid,
+ deviceModel: scannedDeviceModel,
+ loadFromCache,
+ enableListener,
+} = useScanCode("scanLS");
+
+// 琛ㄥ崟鏁版嵁
+const formData = reactive({
+ dia: "",
+ maxDia: "",
+ minDia: "",
+ appearance: [] as string[],
+ windingTightness: "",
+ arrangementNeatness: "",
+ aluminumWireDistance: "",
+ jointCondition: "",
+ conclusion: "",
+ isFully: "",
+});
+
+// 澶栬閫夐」
+const appearanceOptions = [
+ { label: "鏃犲瑙傞棶棰�", value: "鏃犲瑙傞棶棰�" },
+ { label: "琛ㄩ潰鍒掍激", value: "琛ㄩ潰鍒掍激" },
+ { label: "鐩村緞涓嶅潎", value: "鐩村緞涓嶅潎" },
+ { label: "鍏朵粬缂洪櫡", value: "鍏朵粬缂洪櫡" },
+];
+const sampleCompleteOptions = [
+ { label: "鏄�", value: "鏄�" },
+ { label: "鍚�", value: "鍚�" },
+];
+const jointConditionOptions = [
+ { label: "鏈�", value: "鏈�" },
+ { label: "鏃�", value: "鏃�" },
+];
+const conclusionOptions = [
+ { label: "鍚堟牸", value: "鍚堟牸" },
+ { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
+];
+// 鐘舵�佹槧灏�
const getStatusType = (status: number) => {
switch (status) {
case 0:
- return "warning"; // 寰呭贰妫�
+ return "warning";
case 1:
- return "danger"; // 宸查┏鍥�
+ return "danger";
case 2:
- return "info"; // 寰呭鏍�
+ return "primary";
case 3:
- return "success"; // 閫氳繃
+ return "success";
default:
- return "info";
+ return "default";
}
};
-// 鐘舵�佹枃鏈槧灏�
const getStatusText = (status: number) => {
switch (status) {
case 0:
@@ -222,25 +397,54 @@
}
};
-// 鑾峰彇澶栬鏂囨湰
-const getAppearanceText = (appearance: string[]) => {
- if (!appearance || appearance.length === 0) return "-";
- return appearance.join("銆�");
-};
-
-// 鏍煎紡鍖栦骇鍝佸瑙傛樉绀�
+// 鏍煎紡鍖栧伐鍏�
const formatProductAppearance = (productAppearance: string[]) => {
- if (!productAppearance || productAppearance.length === 0) return "-";
+ if (!productAppearance || !Array.isArray(productAppearance) || !productAppearance.length) {
+ return "-";
+ }
return productAppearance.join("銆�");
};
-// 鏍煎紡鍖栨暟鍊兼樉绀�
+// 澶勭悊澶栬閫夋嫨鐨勪簰鏂ラ�昏緫
+const handleAppearanceClick = (value: string) => {
+ // 纭繚 appearance 鏄暟缁�
+ if (!Array.isArray(formData.appearance)) {
+ formData.appearance = [];
+ }
+
+ const currentValues = [...formData.appearance];
+ const isCurrentlyChecked = currentValues.includes(value);
+
+ let newSelection: string[] = [];
+
+ if (value === "鏃犲瑙傞棶棰�") {
+ if (isCurrentlyChecked) {
+ // 鍙栨秷閫変腑"鏃犲瑙傞棶棰�"
+ newSelection = [];
+ } else {
+ // 閫変腑"鏃犲瑙傞棶棰�"锛屾竻绌哄叾浠栭�夐」
+ newSelection = ["鏃犲瑙傞棶棰�"];
+ }
+ } else {
+ // 鐐瑰嚮鍏朵粬閫夐」
+ if (isCurrentlyChecked) {
+ // 鍙栨秷閫変腑璇ラ�夐」
+ newSelection = currentValues.filter((v) => v !== value);
+ } else {
+ // 閫変腑璇ラ�夐」锛岀Щ闄�"鏃犲瑙傞棶棰�"
+ const filteredValues = currentValues.filter((v) => v !== "鏃犲瑙傞棶棰�");
+ newSelection = [...filteredValues, value];
+ }
+ }
+
+ formData.appearance = newSelection;
+};
+
const formatValue = (value: any, unit?: string) => {
if (value === null || value === undefined || value === "") return "-";
return unit ? `${value}${unit}` : value;
};
-// 鏍煎紡鍖栨棩鏈熸樉绀�
const formatDate = (date: string) => {
if (!date) return "-";
return new Date(date).toLocaleDateString("zh-CN", {
@@ -250,89 +454,229 @@
});
};
-// 鏍煎紡鍖栫粨鏋勫�兼樉绀�
-const formatStructureValue = (value1: any, value2: any) => {
- const val1 = value1 || "-";
- const val2 = value2 ? `${value2}mm` : "-";
- return { count: val1, diameter: val2 };
+// 鍒濆鍖栬〃鍗�
+const initFormData = () => {
+ const inspectionResult = detailData.value.inspectionResult || {};
+ const processInspectionResult = detailData.value.processInspectionResult || {};
+ formData.dia = inspectionResult.dia || "";
+ formData.maxDia = inspectionResult.maxDia || "";
+ formData.minDia = inspectionResult.minDia || "";
+ // 纭繚 appearance 鏄暟缁�
+ formData.appearance = Array.isArray(inspectionResult.appearance)
+ ? inspectionResult.appearance
+ : inspectionResult.appearance
+ ? [inspectionResult.appearance]
+ : [];
+ formData.windingTightness = inspectionResult.windingTightness || "";
+ formData.arrangementNeatness = inspectionResult.arrangementNeatness || "";
+ formData.aluminumWireDistance = inspectionResult.aluminumWireDistance || "";
+ formData.jointCondition = inspectionResult.jointCondition || "";
+ formData.conclusion = inspectionResult.conclusion || "";
+ formData.isFully = processInspectionResult.isFully ? "鏄�" : "鍚�";
};
+// 鑾峰彇璇︽儏
const getDetailData = async (id: string, deviceType: string) => {
try {
- let response;
- // 鑾峰彇鎷変笣鍗曚釜缁撴瀯
- response = await RoutingInspectionApi.getDrawInspectInfoById({
- id: id,
- });
+ const response = await RoutingInspectionApi.getDrawInspectInfoById({ id });
detailData.value = response.data;
- console.log(detailData.value);
+
+ // 濡傛灉宸℃鍛樹负绌猴紝榛樿璁剧疆涓哄綋鍓嶇櫥褰曠敤鎴�
+ if (!detailData.value.processInspectionUserName) {
+ detailData.value.processInspectionUserName =
+ userInfo.value?.nickName || userInfo.value?.userName || "";
+ }
+
+ tempFiles.value = [];
+ initFormData();
} catch (error) {
console.error("鑾峰彇璇︽儏澶辫触:", error);
}
};
+// 椤甸潰鍔犺浇
onLoad((options: any) => {
paramsId.value = options.id;
+ paramsType.value = options.deviceType;
getDetailData(options.id, options.deviceType);
});
-const previewImage = (url: string) => {
- previewImageUrl.value = url;
- show.value = true;
+// 缂栬緫鍒囨崲
+const editList = () => {
+ isEdit.value = true;
+};
+
+// 鍙栨秷缂栬緫
+const close = () => {
+ isEdit.value = false;
+ tempFiles.value = [];
+ initFormData();
+};
+
+// 淇濆瓨缂栬緫
+const saveList = async () => {
+ // 鏍¢獙
+ if (!formData.maxDia) return uni.showToast({ title: "鏈�澶х洿寰勪负蹇呭~椤�", icon: "none" });
+ if (!formData.minDia) return uni.showToast({ title: "鏈�灏忕洿寰勪负蹇呭~椤�", icon: "none" });
+ if (!formData.appearance.length) return uni.showToast({ title: "澶栬涓哄繀濉」", icon: "none" });
+ if (!formData.windingTightness) return uni.showToast({ title: "鍗风粫绱у瘑涓哄繀濉」", icon: "none" });
+ if (!formData.arrangementNeatness)
+ return uni.showToast({ title: "鎺掑垪鏁撮綈涓哄繀濉」", icon: "none" });
+ if (!formData.aluminumWireDistance)
+ return uni.showToast({ title: "澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂讳负蹇呭~椤�", icon: "none" });
+ if (!formData.jointCondition)
+ return uni.showToast({ title: "鎴愬搧妯″悗鎺ュご鎯呭喌涓哄繀濉」", icon: "none" });
+ if (!formData.conclusion) return uni.showToast({ title: "缁撹涓哄繀濉」", icon: "none" });
+ if (!formData.isFully) return uni.showToast({ title: "閾濇潌鏍峰搧鏄惁榻愬叏涓哄繀濉」", icon: "none" });
+
+ // 楠岃瘉鎵爜鏁版嵁锛堜粠缂撳瓨鎴栨柊鎵爜鑾峰彇锛�
+ console.log("淇濆瓨鍓嶆鏌� deviceUid:", deviceUid.value);
+ if (!deviceUid.value) {
+ return uni.showToast({
+ title: "璇峰厛鎵弿璁惧浜岀淮鐮�",
+ icon: "none",
+ duration: 2000,
+ });
+ }
+ const { newFiles } = attachmentRef.value.getSubmitFiles();
+ console.log("newFiles", newFiles);
+ const allFileIds = [...newFiles];
+ // 鎻愪氦
+ try {
+ const res = await RoutingInspectionApi.drawPatrolCheckInspection({
+ deviceUid: deviceUid.value,
+ id: paramsId.value,
+ result: {
+ dia: formData.dia,
+ maxDia: formData.maxDia,
+ minDia: formData.minDia,
+ appearance: formData.appearance,
+ windingTightness: formData.windingTightness,
+ arrangementNeatness: formData.arrangementNeatness,
+ aluminumWireDistance: formData.aluminumWireDistance,
+ jointCondition: formData.jointCondition,
+ conclusion: formData.conclusion,
+ },
+ inspectionResult: { isFully: formData.isFully },
+ processInspectionAttachmentList: allFileIds,
+ });
+ if (res.code === 200) {
+ // 璁剧疆鍒锋柊鏍囪锛屽憡璇夊垪琛ㄩ〉闇�瑕佸埛鏂�
+ uni.setStorageSync("needRefreshInspectionList", true);
+
+ uni.showToast({
+ title: "淇濆瓨鎴愬姛",
+ icon: "success",
+ duration: 1500,
+ });
+ // 寤惰繜杩斿洖鍒楄〃椤碉紝璁╃敤鎴风湅鍒版垚鍔熸彁绀�
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1,
+ });
+ }, 1500);
+ } else {
+ uni.showModal({ title: res.msg || "淇濆瓨澶辫触", icon: "error" });
+ }
+ } catch (e) {
+ console.error("淇濆瓨澶辫触:", e);
+ uni.showModal({ title: e.message || "淇濆瓨澶辫触", icon: "error" });
+ }
};
const handleClose = () => {
show.value = false;
};
-// 缂栬緫鍒楄〃
-const editList = () => {};
-
-// 鍏抽棴
-const close = () => {};
-
-// 淇濆瓨鍒楄〃
-const saveList = async () => {
- // try {
- // let response;
- // // 淇濆瓨鍒楄〃
- // response = await RoutingInspectionApi.saveStrandedInspectionStructureInfo({
- // id: paramsId.value,
- // structureInfo: recordData.value.structureInfo,
- // });
- // if (response.code === 200) {
- // uni.showToast({
- // title: "淇濆瓨鎴愬姛",
- // icon: "success",
- // });
- // // 鍒锋柊璇︽儏鏁版嵁
- // getDetailData(paramsId.value, recordData.value.deviceType);
- // } else {
- // uni.showToast({
- // title: response.msg || "淇濆瓨澶辫触",
- // icon: "error",
- // });
- // }
- // } catch (error) {
- // console.error("淇濆瓨鍒楄〃澶辫触:", error);
- // uni.showToast({
- // title: "淇濆瓨澶辫触",
- // icon: "error",
- // });
- // }
+const openScan = () => {
+ console.log("indexLS - 鐐瑰嚮鎵爜鎸夐挳锛堝叏灞�鎵爜妯″紡锛屾棤闇�鎵嬪姩瑙﹀彂锛�");
+ // 鍏ㄥ眬鎵爜妯″紡涓嬶紝纭欢鎵爜浼氳嚜鍔ㄨЕ鍙戯紝鏃犻渶鎵嬪姩璋冪敤
+ uni.showToast({
+ title: "璇蜂娇鐢ㄦ壂鐮佹灙鎵弿",
+ icon: "none",
+ });
};
-</script>
-<style lang="scss" scoped>
-.list {
- height: calc(100vh - 80px);
- padding: 12px;
- background: #f3f9f8;
- :deep() {
- .round {
- border-radius: 4px;
+// 椤甸潰鏄剧ず鏃剁殑澶勭悊
+onShow(() => {
+ console.log("========== indexLS - onShow 瑙﹀彂 ==========");
+ // 閲嶆柊鍚敤鐩戝惉鍣紙纭繚鐩戝惉鍣ㄦ湁鏁堬級
+ enableListener();
+ // 鍔犺浇缂撳瓨锛堟洿鏂癠I鏄剧ず锛�
+ const cachedData = loadFromCache();
+
+ // 濡傛灉娌℃湁缂撳瓨鏁版嵁锛屾彁绀虹敤鎴烽渶瑕佹壂鐮�
+ if (!cachedData || !cachedData.uid) {
+ console.log("鈿狅笍 鏈娴嬪埌鎵爜缂撳瓨锛岀敤鎴烽渶瑕佹壂鎻忚澶囦簩缁寸爜");
+ // 鍦ㄧ紪杈戞ā寮忎笅鎵嶆彁绀�
+ if (isEdit.value) {
+ setTimeout(() => {
+ uni.showToast({
+ title: "璇锋壂鎻忚澶囦簩缁寸爜鍚庡啀淇濆瓨",
+ icon: "none",
+ duration: 2000,
+ });
+ }, 500);
}
}
+});
+</script>
+
+<style lang="scss" scoped>
+.fixed-header {
+ position: fixed;
+ top: 44;
+ left: 0;
+ right: 0;
+ background: #f3f9f8;
+ z-index: 999;
+ padding: 12px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ min-height: 60px;
+ box-sizing: border-box;
+ overflow: visible;
+}
+
+.header-container {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ gap: 10px;
+}
+
+.placeholder {
+ flex: 1;
+}
+
+.scan-info {
+ display: flex;
+ align-items: center;
+ margin-right: 10px;
+
+ .scan-device-text {
+ font-size: 14px;
+ color: #0d867f;
+ font-weight: 500;
+ }
+}
+
+.scan-wrapper {
+ width: 38px;
+ height: 38px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 6px;
+ flex-shrink: 0;
+}
+
+.list {
+ padding: 12px;
+ padding-top: 84px;
+ background: #f3f9f8;
+ min-height: 100vh;
+ box-sizing: border-box;
+ overflow-y: auto;
}
.title {
@@ -361,22 +705,79 @@
.attachment-grid {
display: flex;
flex-wrap: wrap;
- /* 瓒呭嚭鑷姩鎹㈣ */
gap: 10px;
- /* 鍥剧墖涔嬮棿鐨勯棿璺� */
padding: 10px 0;
}
.attachment-item {
width: calc(25% - 10px);
- /* 姣忚4寮狅紝闂磋窛鐢眊ap鎺у埗锛岄渶璁$畻瀹藉害 */
+ box-sizing: border-box;
+ position: relative;
+}
+
+.upload-btn {
+ width: 80px;
+ height: 80px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: 1px dashed #ccc;
+ border-radius: 4px;
box-sizing: border-box;
}
-/* 閫傞厤灏忓睆骞曪紝鍙皟鏁存瘡琛屾暟閲忥紙濡傛瘡琛�2寮狅級 */
+.upload-icon {
+ font-size: 32px;
+ color: #0d867f;
+}
+
+.delete-icon {
+ position: absolute;
+ top: -8px;
+ right: -8px;
+ width: 24px;
+ height: 24px;
+ background-color: rgba(255, 0, 0, 0.8);
+ color: white;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 10;
+}
+
@media (max-width: 768px) {
.attachment-item {
width: calc(25% - 10px);
+ margin: 10;
}
}
-</style>
\ No newline at end of file
+
+:deep(.wd-form-item) {
+ margin-bottom: 8rpx;
+}
+
+:deep(.wd-input, .wd-select, .wd-radio-group, .wd-checkbox-group) {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+:deep(.wd-form-item__label)::after {
+ content: "*";
+ color: red;
+ margin-left: 4rpx;
+}
+
+:deep(.wd-select) {
+ width: 100%;
+}
+
+:deep(.wd-checkbox) {
+ margin-right: 0;
+}
+.conclusion-radio-group {
+ display: flex;
+ align-items: flex-start; // 鍨傜洿鏂瑰悜椤堕儴瀵归綈锛堜笂绉诲叧閿級
+ gap: 20rpx; // 閫夐」涔嬮棿鐨勯棿璺�
+}
+</style>
--
Gitblit v1.9.3