From 66922ca2c9360f4c06e10eea57691170eea9288a Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 02 三月 2026 16:07:08 +0800
Subject: [PATCH] 设备保养重构\设备巡检修改
---
src/pages/equipmentManagement/upkeep/detail.vue | 505 ++++++++++++++
src/pages/equipmentManagement/upkeep/index.vue | 54
src/pages.json | 7
src/api/equipmentManagement/upkeep.js | 9
src/pages/inspectionUpload/index.vue | 33
src/pages/equipmentManagement/upkeep/maintain.vue | 1401 +++++++++++++++++++++++++++++++++--------
6 files changed, 1,697 insertions(+), 312 deletions(-)
diff --git a/src/api/equipmentManagement/upkeep.js b/src/api/equipmentManagement/upkeep.js
index 7c71d1e..d6814af 100644
--- a/src/api/equipmentManagement/upkeep.js
+++ b/src/api/equipmentManagement/upkeep.js
@@ -97,3 +97,12 @@
});
}
+
+// 鏌ヨ澶囦欢閫夐」
+export const getSparePartsOptions = (params) => {
+ return request({
+ url: "/spareParts/getByIdDeviceId",
+ method: "get",
+ params,
+ });
+};
diff --git a/src/pages.json b/src/pages.json
index b345bf6..3448002 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -541,6 +541,13 @@
}
},
{
+ "path": "pages/equipmentManagement/upkeep/detail",
+ "style": {
+ "navigationBarTitleText": "淇濆吇璇︽儏",
+ "navigationStyle": "custom"
+ }
+ },
+ {
"path": "pages/equipmentManagement/upkeep/add",
"style": {
"navigationBarTitleText": "鏂板淇濆吇璁″垝",
diff --git a/src/pages/equipmentManagement/upkeep/detail.vue b/src/pages/equipmentManagement/upkeep/detail.vue
new file mode 100644
index 0000000..3af1809
--- /dev/null
+++ b/src/pages/equipmentManagement/upkeep/detail.vue
@@ -0,0 +1,505 @@
+<template>
+ <view class="upkeep-detail">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="淇濆吇璇︽儏"
+ @back="goBack" />
+ <!-- 璇︽儏鍐呭 -->
+ <view class="detail-section"
+ v-if="detailData">
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon">
+ <up-icon name="file-text"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">{{ detailData.deviceName || '-' }}</text>
+ <view class="status-tag">
+ <u-tag v-if="detailData.status === 1"
+ type="success">瀹岀粨</u-tag>
+ <u-tag v-else-if="detailData.status === 0"
+ type="error">寰呬繚鍏�</u-tag>
+ <u-tag v-else-if="detailData.status === 2"
+ type="warning">澶辫触</u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-content">
+ <view class="detail-row">
+ <text class="detail-label">璁惧鍚嶇О</text>
+ <text class="detail-value">{{ detailData.deviceName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ detailData.deviceModel || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">璁″垝淇濆吇鏃ユ湡</text>
+ <text class="detail-value">{{ formatDate(detailData.maintenancePlanTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹為檯淇濆吇浜�</text>
+ <text class="detail-value">{{ detailData.maintenanceActuallyName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹為檯淇濆吇鏃ユ湡</text>
+ <text class="detail-value">{{ formatDateTime(detailData.maintenanceActuallyTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">淇濆吇缁撴灉</text>
+ <text class="detail-value">{{detailData.maintenanceResult || '-'}}
+ </text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆浜�</text>
+ <text class="detail-value">{{ detailData.createUserName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆鏃ユ湡</text>
+ <text class="detail-value">{{ formatDateTime(detailData.createTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">澶囨敞</text>
+ <text class="detail-value">{{ detailData.remark || '-' }}</text>
+ </view>
+ </view>
+ </view>
+ <!-- 璁惧澶囦欢 -->
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon secondary">
+ <up-icon name="setting"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">璁惧澶囦欢</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="spare-parts-list"
+ v-if="sparePartsList.length > 0">
+ <view v-for="(item, index) in sparePartsList"
+ :key="index"
+ class="spare-part-item">
+ <text class="spare-part-name">{{ item.sparePartName || item.name || '-' }}</text>
+ <text class="spare-part-code">{{ item.sparePartCode || item.code || '-' }}</text>
+ </view>
+ </view>
+ <view v-else
+ class="empty-content">
+ <text class="empty-text">鏆傛棤璁惧澶囦欢</text>
+ </view>
+ </view>
+ <!-- 淇濆吇闄勪欢 -->
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon tertiary">
+ <up-icon name="photo"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">淇濆吇闄勪欢</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="file-list"
+ v-if="fileList.length > 0">
+ <view v-for="(file, index) in fileList"
+ :key="index"
+ class="file-item"
+ @click="previewFile(file)">
+ <image v-if="file.type.includes('image')"
+ :src="file.url"
+ class="file-preview"
+ mode="aspectFill" />
+ <view v-else
+ class="file-placeholder">
+ <up-icon name="play-circle"
+ size="32"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="empty-content">
+ <text class="empty-text">鏆傛棤淇濆吇闄勪欢</text>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <up-icon name="info-circle"
+ size="48"
+ color="#ccc"></up-icon>
+ <text class="no-data-text">鏆傛棤淇濆吇璇︽儏鏁版嵁</text>
+ </view>
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="footer-btns"
+ v-if="detailData">
+ <u-button type="primary"
+ class="action-btn"
+ :disabled="detailData.status === 1"
+ @click="goMaintain">
+ 淇濆吇
+ </u-button>
+ <u-button type="error"
+ plain
+ class="action-btn"
+ @click="deleteUpkeep">
+ 鍒犻櫎
+ </u-button>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import { delUpkeep } from "@/api/equipmentManagement/upkeep";
+ import config from "@/config";
+ import dayjs from "dayjs";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ defineOptions({
+ name: "淇濆吇璇︽儏",
+ });
+
+ // 璇︽儏鏁版嵁
+ const detailData = ref(null);
+ // 璁惧澶囦欢鍒楄〃
+ const sparePartsList = ref([]);
+ // 闄勪欢鍒楄〃
+ const fileList = ref([]);
+ // 椤甸潰ID
+ const pageId = ref(null);
+
+ // 鏍煎紡鍖栨棩鏈�
+ const formatDate = dateStr => {
+ if (!dateStr) return "";
+ return dayjs(dateStr).format("YYYY-MM-DD");
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateStr => {
+ if (!dateStr) return "";
+ return dayjs(dateStr).format("YYYY-MM-DD HH:mm:ss");
+ };
+
+ // 鏍煎紡鍖栨枃浠禪RL
+ const formatFileUrl = url => {
+ if (!url) return "";
+ if (url.startsWith("http://") || url.startsWith("https://")) {
+ return url;
+ }
+ const uploadsIndex = url.indexOf("uploads");
+ if (uploadsIndex !== -1) {
+ const relativePath = url.substring(uploadsIndex);
+ return `${config.baseUrl}/profile/${relativePath}`;
+ }
+ return `${config.baseUrl}/profile/${url}`;
+ };
+
+ // 鍒ゆ柇鏄惁涓哄浘鐗囨枃浠�
+ const isImageFile = file => {
+ if (file.contentType && file.contentType.startsWith("image/")) {
+ return true;
+ }
+ if (file.type === "image") return true;
+ const name = file.bucketFilename || file.originalFilename || file.name || "";
+ const ext = name.split(".").pop()?.toLowerCase();
+ return ["jpg", "jpeg", "png", "gif", "webp"].includes(ext);
+ };
+
+ // 棰勮鏂囦欢
+ const previewFile = file => {
+ if (file.type.includes("image")) {
+ uni.previewImage({
+ urls: [file.url],
+ current: file.url,
+ });
+ } else {
+ // 瑙嗛棰勮
+ const videoUrl = formatFileUrl(file.url || file.downloadUrl);
+ uni.navigateTo({
+ url: `/pages/common/videoPreview?url=${encodeURIComponent(videoUrl)}`,
+ });
+ }
+ };
+
+ // 鑾峰彇璇︽儏鏁版嵁
+ const getDetailData = () => {
+ try {
+ const dataStr = uni.getStorageSync("upkeepDetailData");
+ if (!dataStr) {
+ showToast("鍙傛暟閿欒");
+ return null;
+ }
+ return JSON.parse(dataStr);
+ } catch (e) {
+ showToast("鏁版嵁瑙f瀽澶辫触");
+ return null;
+ }
+ };
+
+ // 鑾峰彇淇濆吇璇︽儏
+ const getDetail = () => {
+ const data = getDetailData();
+ if (!data) {
+ return;
+ }
+
+ detailData.value = data;
+ pageId.value = data.id;
+ // 澶勭悊澶囦欢鏁版嵁 - 鏀寔澶氱鏁版嵁缁撴瀯
+ sparePartsList.value = data.spareParts || data.sparePartList || [];
+ // 澶勭悊闄勪欢鏁版嵁 - 鏀寔澶氱鏁版嵁缁撴瀯
+ console.log(data.imagesFile);
+ fileList.value = data.imagesFile;
+ };
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.removeStorageSync("upkeepDetailData");
+ uni.navigateBack();
+ };
+
+ // 璺宠浆鍒颁繚鍏婚〉闈�
+ const goMaintain = () => {
+ if (detailData.value.status === 1) {
+ showToast("璇ヤ繚鍏讳换鍔″凡瀹岀粨");
+ return;
+ }
+ uni.setStorageSync("repairId", pageId.value);
+ uni.navigateTo({
+ url: "/pages/equipmentManagement/upkeep/maintain",
+ });
+ };
+
+ // 鍒犻櫎淇濆吇
+ const deleteUpkeep = () => {
+ uni.showModal({
+ title: "璀﹀憡",
+ content: "纭鍒犻櫎淇濆吇鏁版嵁, 姝ゆ搷浣滀笉鍙��?",
+ confirmText: "纭畾",
+ cancelText: "鍙栨秷",
+ success: async res => {
+ if (!res.confirm) return;
+ try {
+ const response = await delUpkeep(pageId.value);
+ if (response.code === 200) {
+ showToast("鍒犻櫎鎴愬姛");
+ setTimeout(() => {
+ goBack();
+ }, 1500);
+ } else {
+ showToast(response.msg || "鍒犻櫎澶辫触");
+ }
+ } catch (e) {
+ showToast("鍒犻櫎澶辫触");
+ }
+ },
+ });
+ };
+
+ onShow(() => {
+ getDetail();
+ });
+
+ onMounted(() => {
+ getDetail();
+ });
+</script>
+
+<style scoped lang="scss">
+ .upkeep-detail {
+ min-height: 100vh;
+ background: #f5f5f5;
+ padding-bottom: 80px;
+ }
+
+ .detail-section {
+ padding: 15px;
+ }
+
+ .detail-card {
+ background: #fff;
+ border-radius: 12px;
+ padding: 16px;
+ margin-bottom: 12px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ }
+
+ .card-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ }
+
+ .header-icon {
+ width: 40px;
+ height: 40px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+ }
+
+ .header-icon.secondary {
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
+ }
+
+ .header-icon.tertiary {
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
+ }
+
+ .header-title {
+ flex: 1;
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ }
+
+ .status-tag {
+ margin-left: auto;
+ }
+
+ .detail-content {
+ padding-top: 8px;
+ }
+
+ .detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .detail-row:last-child {
+ border-bottom: none;
+ }
+
+ .detail-label {
+ font-size: 14px;
+ color: #666;
+ min-width: 100px;
+ }
+
+ .detail-value {
+ font-size: 14px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ // 澶囦欢鍒楄〃
+ .spare-parts-list {
+ padding-top: 8px;
+ }
+
+ .spare-part-item {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .spare-part-item:last-child {
+ border-bottom: none;
+ }
+
+ .spare-part-name {
+ font-size: 14px;
+ color: #333;
+ }
+
+ .spare-part-code {
+ font-size: 12px;
+ color: #999;
+ }
+
+ // 鏂囦欢鍒楄〃
+ .file-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ padding-top: 8px;
+ }
+
+ .file-item {
+ width: calc(33.33% - 7px);
+ aspect-ratio: 1;
+ border-radius: 8px;
+ overflow: hidden;
+ background: #f5f5f5;
+ }
+
+ .file-preview {
+ width: 100%;
+ height: 100%;
+ }
+
+ .file-placeholder {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #f0f0f0;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 60px 20px;
+ }
+
+ .no-data-text {
+ margin-top: 16px;
+ font-size: 14px;
+ color: #999;
+ }
+
+ // 绌哄唴瀹规彁绀�
+ .empty-content {
+ padding: 30px 0;
+ text-align: center;
+ }
+
+ .empty-text {
+ font-size: 14px;
+ color: #999;
+ }
+
+ // 搴曢儴鎸夐挳
+ .footer-btns {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #fff;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ padding: 12px 20px;
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
+ z-index: 1000;
+ }
+
+ .action-btn {
+ flex: 1;
+ margin: 0 8px;
+ }
+</style>
diff --git a/src/pages/equipmentManagement/upkeep/index.vue b/src/pages/equipmentManagement/upkeep/index.vue
index cca1b04..f14712f 100644
--- a/src/pages/equipmentManagement/upkeep/index.vue
+++ b/src/pages/equipmentManagement/upkeep/index.vue
@@ -41,7 +41,9 @@
<u-tag v-if="item.status === 1"
type="success">瀹岀粨</u-tag>
<u-tag v-if="item.status === 0"
- type="error">寰呬繚鍏�</u-tag>
+ type="warning">寰呬繚鍏�</u-tag>
+ <u-tag v-if="item.status === 2"
+ type="error">澶辫触</u-tag>
</view>
</view>
<up-divider></up-divider>
@@ -72,35 +74,24 @@
</view>
<view class="detail-row">
<text class="detail-label">淇濆吇缁撴灉</text>
- <view class="detail-value">
- <u-tag v-if="item.maintenanceResult === 1"
- type="success"
- size="mini">
- 瀹屽ソ
- </u-tag>
- <u-tag v-if="item.maintenanceResult === 0"
- type="error"
- size="mini">
- 缁翠慨
- </u-tag>
- <text v-if="item.maintenanceResult === undefined || item.maintenanceResult === null">-</text>
- </view>
+ <text class="detail-value">{{item.maintenanceResult || '-'}}
+ </text>
</view>
</view>
<!-- 鎸夐挳鍖哄煙 -->
<view class="action-buttons">
- <u-button type="primary"
+ <!-- <u-button type="primary"
size="small"
class="action-btn"
:disabled="item.status === 1"
@click.stop="edit(item.id)">
缂栬緫
- </u-button>
+ </u-button> -->
<u-button type="warning"
size="small"
class="action-btn"
:disabled="item.status === 1"
- @click.stop="addMaintain(item.id)">
+ @click.stop="addMaintain(item.id, item)">
淇濆吇
</u-button>
<u-button type="error"
@@ -110,12 +101,18 @@
@click.stop="delUpkeepByIds(item.id)">
鍒犻櫎
</u-button>
- <u-button type="warning"
+ <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewDetail(item)">
+ 璇︽儏
+ </u-button>
+ <!-- <u-button type="warning"
size="small"
class="action-btn"
@click.stop="addFile(item.id)">
闄勪欢
- </u-button>
+ </u-button> -->
</view>
</view>
</view>
@@ -236,19 +233,34 @@
};
// 鏂板淇濆吇 - 璺宠浆鍒颁繚鍏婚〉闈�
- const addMaintain = id => {
+ const addMaintain = (id, item) => {
if (!id && multipleList.value.length !== 1) {
showToast("璇烽�夋嫨涓�鏉¤褰�");
return;
}
const targetId = id || multipleList.value[0].id;
- // 浣跨敤鏈湴瀛樺偍浼犻�抜d
+ const targetItem = item || multipleList.value[0];
+ // 浣跨敤鏈湴瀛樺偍浼犻�抜d鍜屽畬鏁存暟鎹�
uni.setStorageSync("repairId", targetId);
+ uni.setStorageSync("upkeepItemData", JSON.stringify(targetItem));
uni.navigateTo({
url: "/pages/equipmentManagement/upkeep/maintain",
});
};
+ // 鏌ョ湅璇︽儏 - 璺宠浆鍒拌鎯呴〉闈�
+ const viewDetail = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ // 浣跨敤鏈湴瀛樺偍浼犻�掓暣鏉℃暟鎹�
+ uni.setStorageSync("upkeepDetailData", JSON.stringify(item));
+ uni.navigateTo({
+ url: "/pages/equipmentManagement/upkeep/detail",
+ });
+ };
+
// 鏂板璁″垝 - 璺宠浆鍒版柊澧為〉闈�
const addPlan = () => {
uni.navigateTo({
diff --git a/src/pages/equipmentManagement/upkeep/maintain.vue b/src/pages/equipmentManagement/upkeep/maintain.vue
index 7ffb435..9edeff4 100644
--- a/src/pages/equipmentManagement/upkeep/maintain.vue
+++ b/src/pages/equipmentManagement/upkeep/maintain.vue
@@ -1,315 +1,1158 @@
<template>
- <view class="upkeep-maintain">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="鏂板淇濆吇" @back="goBack" />
-
- <!-- 琛ㄥ崟鍐呭 -->
- <u-form ref="formRef" :model="form" :rules="formRules" label-width="110px" :error-type="['message']">
- <!-- 鍩烘湰淇℃伅 -->
- <u-form-item label="瀹為檯淇濆吇浜�" prop="maintenanceActuallyName" required border-bottom>
- <u-input
- v-model="form.maintenanceActuallyName"
- placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
- clearable
- />
- </u-form-item>
-
- <u-form-item label="瀹為檯淇濆吇鏃ユ湡" prop="maintenanceActuallyTime" required border-bottom>
- <u-input
- v-model="form.maintenanceActuallyTime"
- placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
- readonly
- @click="showDatePicker"
- clearable
- />
- <template #right>
- <u-icon name="arrow-right" @click.stop="showDatePicker" />
- </template>
- </u-form-item>
-
- <u-form-item label="淇濆吇缁撴灉" prop="maintenanceResult" required border-bottom>
- <u-input
- v-model="maintenanceResultText"
- placeholder="璇烽�夋嫨淇濆吇缁撴灉"
- readonly
- @click="showResultPicker"
- clearable
- />
- <template #right>
- <u-icon name="arrow-right" @click.stop="showResultPicker" />
- </template>
- </u-form-item>
-
- <!-- 鎻愪氦鎸夐挳 -->
- <view class="footer-btns">
- <u-button class="cancel-btn" @click="goBack">鍙栨秷</u-button>
- <u-button class="save-btn" @click="sendForm" :loading="loading">淇濆瓨</u-button>
- </view>
- </u-form>
-
- <!-- 鏃ユ湡閫夋嫨鍣� -->
- <u-popup v-model="showDate" mode="bottom" :closeable="true">
- <u-datetime-picker
- v-model="form.maintenanceActuallyTime"
- mode="date"
- title="閫夋嫨鏃ユ湡"
- @confirm="onDateConfirm"
- @cancel="showDate = false"
- />
- </u-popup>
-
- <!-- 淇濆吇缁撴灉閫夋嫨鍣� -->
- <up-action-sheet
- :show="showResult"
- :actions="resultColumns"
- title="閫夋嫨淇濆吇缁撴灉"
- @select="onResultConfirm"
- @close="showResult = false"
- />
- </view>
+ <view class="upkeep-maintain">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鏂板淇濆吇"
+ @back="goBack" />
+ <!-- 琛ㄥ崟鍐呭 -->
+ <u-form ref="formRef"
+ :model="form"
+ :rules="formRules"
+ label-width="110px"
+ :error-type="['message']">
+ <!-- 鍩烘湰淇℃伅 -->
+ <u-form-item label="瀹為檯淇濆吇浜�"
+ prop="maintenanceActuallyName"
+ required
+ border-bottom>
+ <u-input v-model="form.maintenanceActuallyName"
+ placeholder="璇疯緭鍏ュ疄闄呬繚鍏讳汉"
+ clearable />
+ </u-form-item>
+ <u-form-item label="瀹為檯淇濆吇鏃ユ湡"
+ prop="maintenanceActuallyTime"
+ required
+ border-bottom>
+ <u-input v-model="form.maintenanceActuallyTime"
+ placeholder="璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡"
+ readonly
+ @click="showDatePicker"
+ clearable />
+ <template #right>
+ <u-icon name="arrow-right"
+ @click.stop="showDatePicker" />
+ </template>
+ </u-form-item>
+ <u-form-item label="淇濆吇缁撴灉"
+ prop="maintenanceResult"
+ required
+ border-bottom>
+ <u-input v-model="form.maintenanceResult"
+ placeholder="璇疯緭鍏ヤ繚鍏荤粨鏋�"
+ clearable />
+ </u-form-item>
+ <u-form-item label="淇濆吇鐘舵��"
+ prop="status"
+ required
+ border-bottom>
+ <u-input v-model="maintenancestatusText"
+ placeholder="璇烽�夋嫨淇濆吇鐘舵��"
+ readonly
+ @click="showResultPicker"
+ clearable />
+ <template #right>
+ <u-icon name="arrow-right"
+ @click="showResultPicker" />
+ </template>
+ </u-form-item>
+ <u-form-item label="璁惧澶囦欢"
+ prop="sparePartsIds"
+ border-bottom>
+ <view class="spare-parts-container"
+ @click="showSparePartPicker">
+ <view v-if="selectedSpareParts.length > 0"
+ class="spare-parts-list">
+ <view v-for="(item, index) in selectedSpareParts"
+ :key="index"
+ class="spare-part-tag">
+ <text>{{ item.name }}</text>
+ <u-icon name="close"
+ size="12"
+ color="#fff"
+ @click="removeSparePart(index)" />
+ </view>
+ </view>
+ <text v-else
+ class="placeholder">璇烽�夋嫨璁惧澶囦欢</text>
+ </view>
+ <template #right>
+ <u-icon name="arrow-right"
+ @click="showSparePartPicker" />
+ </template>
+ </u-form-item>
+ <!-- 涓婁紶闄勪欢 -->
+ <u-form-item v-if="form.status == '1'"
+ label="淇濆吇闄勪欢"
+ border-bottom>
+ <view class="simple-upload-area">
+ <view class="upload-buttons">
+ <u-button type="primary"
+ @click="chooseMedia('image')"
+ :loading="uploading"
+ :disabled="uploadFiles.length >= uploadConfig.limit"
+ :customStyle="{ marginRight: '10px', flex: 1 }">
+ <u-icon name="camera"
+ size="18"
+ color="#fff"
+ style="margin-right: 5px;"></u-icon>
+ {{ uploading ? '涓婁紶涓�...' : '鎷嶇収' }}
+ </u-button>
+ <u-button type="success"
+ @click="chooseMedia('video')"
+ :loading="uploading"
+ :disabled="uploadFiles.length >= uploadConfig.limit"
+ :customStyle="{ flex: 1 }">
+ <uni-icons type="videocam"
+ name="videocam"
+ size="18"
+ color="#fff"
+ style="margin-right: 5px;"></uni-icons>
+ {{ uploading ? '涓婁紶涓�...' : '鎷嶈棰�' }}
+ </u-button>
+ </view>
+ <!-- 涓婁紶杩涘害 -->
+ <view v-if="uploading"
+ class="upload-progress">
+ <u-line-progress :percentage="uploadProgress"
+ :showText="true"
+ activeColor="#409eff"></u-line-progress>
+ </view>
+ <!-- 涓婁紶鐨勬枃浠跺垪琛� -->
+ <view v-if="uploadFiles.length > 0"
+ class="file-list">
+ <view v-for="(file, index) in uploadFiles"
+ :key="index"
+ class="file-item">
+ <view class="file-preview-container">
+ <image v-if="file.type === 'image' || isImageFile(file)"
+ :src="file.url || file.tempFilePath || file.path || file.downloadUrl"
+ class="file-preview"
+ mode="aspectFill" />
+ <view v-else-if="file.type === 'video'"
+ class="video-preview">
+ <uni-icons type="videocam"
+ name="videocam"
+ size="18"
+ color="#fff"
+ style="margin-right: 5px;"></uni-icons>
+ <text class="video-text">瑙嗛</text>
+ </view>
+ <!-- 鍒犻櫎鎸夐挳 -->
+ <view class="delete-btn"
+ @click="removeFile(index)">
+ <u-icon name="close"
+ size="12"
+ color="#fff"></u-icon>
+ </view>
+ </view>
+ <view class="file-info">
+ <text class="file-name">{{ file.bucketFilename || file.name || (file.type === 'image' ? '鍥剧墖' : '瑙嗛')
+ }}</text>
+ <text class="file-size">{{ formatFileSize(file.size) }}</text>
+ </view>
+ </view>
+ </view>
+ <view v-if="uploadFiles.length === 0"
+ class="empty-state">
+ <text>璇烽�夋嫨瑕佷笂浼犵殑淇濆吇鍥剧墖鎴栬棰�</text>
+ </view>
+ </view>
+ </u-form-item>
+ <!-- 鎻愪氦鎸夐挳 -->
+ <view class="footer-btns">
+ <u-button class="cancel-btn"
+ @click="goBack">鍙栨秷</u-button>
+ <u-button class="save-btn"
+ @click="sendForm"
+ :loading="loading">淇濆瓨</u-button>
+ </view>
+ </u-form>
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <u-popup v-model="showDate"
+ mode="bottom"
+ :closeable="true">
+ <u-datetime-picker v-model="form.maintenanceActuallyTime"
+ mode="date"
+ title="閫夋嫨鏃ユ湡"
+ @confirm="onDateConfirm"
+ @cancel="showDate = false" />
+ </u-popup>
+ <!-- 淇濆吇缁撴灉閫夋嫨鍣� -->
+ <up-action-sheet :show="showResult"
+ :actions="resultColumns"
+ title="閫夋嫨淇濆吇缁撴灉"
+ @select="onResultConfirm"
+ @close="showResult = false" />
+ <!-- 璁惧澶囦欢閫夋嫨鍣� -->
+ <up-popup :show="showSparePart"
+ mode="bottom"
+ :closeable="true"
+ @close="showSparePart = false">
+ <view class="spare-part-popup">
+ <view class="popup-header">
+ <text class="popup-title">閫夋嫨璁惧澶囦欢</text>
+ <up-button type="primary"
+ size="small"
+ @click="confirmSparePartSelection">纭畾</up-button>
+ </view>
+ <view class="spare-part-options">
+ <view v-for="(item, index) in sparePartOptions"
+ :key="index"
+ class="spare-part-option"
+ :class="{ 'selected': isSparePartSelected(item.id) }"
+ @click="toggleSparePartSelection(item)">
+ <text>{{ item.name }}</text>
+ <u-icon v-if="isSparePartSelected(item.id)"
+ name="checkmark"
+ color="#2c7be5" />
+ </view>
+ </view>
+ </view>
+ </up-popup>
+ </view>
</template>
<script setup>
-import { ref, onMounted } from 'vue';
-import { onShow } from '@dcloudio/uni-app';
-import PageHeader from '@/components/PageHeader.vue';
-import { addMaintenance } from '@/api/equipmentManagement/upkeep';
-import useUserStore from "@/store/modules/user";
-import dayjs from "dayjs";
-import { formatDateToYMD } from '@/utils/ruoyi';
+ import { ref, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import {
+ addMaintenance,
+ getSparePartsOptions,
+ } from "@/api/equipmentManagement/upkeep";
+ import useUserStore from "@/store/modules/user";
+ import dayjs from "dayjs";
+ import { formatDateToYMD } from "@/utils/ruoyi";
+ import config from "@/config";
-// 鏄剧ず鎻愮ず淇℃伅
-const showToast = (message) => {
- uni.showToast({
- title: message,
- icon: 'none'
- })
-};
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
-defineOptions({
- name: "璁惧淇濆吇琛ㄥ崟",
-});
+ defineOptions({
+ name: "璁惧淇濆吇琛ㄥ崟",
+ });
-const userStore = useUserStore();
+ const userStore = useUserStore();
-// 琛ㄥ崟寮曠敤
-const formRef = ref(null);
-const loading = ref(false);
-const showDate = ref(false);
-const showResult = ref(false);
-const currentDate = ref([new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate()]);
-const resultPickerValue = ref([]);
-const maintenanceResultText = ref('');
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref(null);
+ const loading = ref(false);
+ const showDate = ref(false);
+ const showResult = ref(false);
+ const showSparePart = ref(false);
+ const currentDate = ref([
+ new Date().getFullYear(),
+ new Date().getMonth() + 1,
+ new Date().getDate(),
+ ]);
+ const resultPickerValue = ref([]);
+ const maintenancestatusText = ref("");
+ const selectedSpareParts = ref([]);
+ const tempSelectedSpareParts = ref([]);
-// 淇濆吇缁撴灉閫夐」
-const resultColumns = [
- { name: '瀹屽ソ', value: 1 },
- { name: '缁翠慨', value: 0 }
-];
+ // 鏂囦欢涓婁紶鐩稿叧
+ const uploadFiles = ref([]);
+ const uploading = ref(false);
+ const uploadProgress = ref(0);
+ const number = ref(0);
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const formRules = {
- maintenanceActuallyName: [{ required: true, trigger: "blur", message: "璇疯緭鍏ュ疄闄呬繚鍏讳汉" }],
- maintenanceActuallyTime: [{ required: true, trigger: "change", message: "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡" }],
- maintenanceResult: [{ required: true, trigger: "change", message: "璇烽�夋嫨淇濆吇缁撴灉" }],
-};
+ // 涓婁紶閰嶇疆
+ const uploadConfig = {
+ limit: 9,
+ fileType: ["jpg", "jpeg", "png", "gif", "webp", "mp4", "mov", "avi", "wmv"],
+ maxVideoDuration: 60,
+ };
-// 浣跨敤 ref 澹版槑琛ㄥ崟鏁版嵁
-const form = ref({
- maintenanceActuallyName: userStore.nickName || '', // 榛樿浣跨敤褰撳墠鐢ㄦ埛鏄电О
- maintenanceResult: undefined, // 淇濆吇缁撴灉
- maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 瀹為檯淇濆吇鏃ユ湡锛堝彧鏄剧ず鏃ユ湡锛�
-});
+ // 涓婁紶鏂囦欢URL
+ const uploadFileUrl = ref(`${config.baseUrl}/file/upload`);
-// 娓呴櫎琛ㄥ崟鏍¢獙鐘舵��
-const clearValidate = () => {
- // uview-plus涓嶉渶瑕佹墜鍔ㄦ竻闄ら獙璇佺姸鎬侊紝閲嶇疆琛ㄥ崟鏃朵細鑷姩娓呴櫎
-};
+ // 淇濆吇缁撴灉閫夐」
+ const resultColumns = [
+ { name: "瀹岀粨", value: 1 },
+ { name: "寰呬繚鍏�", value: 0 },
+ { name: "澶辫触", value: 2 },
+ ];
-// 閲嶇疆琛ㄥ崟鏁版嵁鍜屾牎楠岀姸鎬�
-const resetForm = () => {
- form.value = {
- maintenanceActuallyName: userStore.nickName || '',
- maintenanceResult: undefined,
- maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
- };
- maintenanceResultText.value = '';
-};
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const formRules = {
+ maintenanceActuallyName: [
+ { required: true, trigger: "blur", message: "璇疯緭鍏ュ疄闄呬繚鍏讳汉" },
+ ],
+ maintenanceActuallyTime: [
+ { required: true, trigger: "change", message: "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡" },
+ ],
+ maintenanceResult: [
+ { required: true, trigger: "change", message: "璇烽�夋嫨淇濆吇缁撴灉" },
+ ],
+ };
-const resetFormAndValidate = () => {
- resetForm();
- // clearValidate(); // 鍒犻櫎杩欒锛孷ant4浼氳嚜鍔ㄥ鐞�
-};
+ // 浣跨敤 ref 澹版槑琛ㄥ崟鏁版嵁
+ const form = ref({
+ maintenanceActuallyName: userStore.nickName || "", // 榛樿浣跨敤褰撳墠鐢ㄦ埛鏄电О
+ maintenanceResult: undefined, // 淇濆吇缁撴灉
+ maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 瀹為檯淇濆吇鏃ユ湡锛堝彧鏄剧ず鏃ユ湡锛�
+ sparePartsIds: undefined, // 璁惧澶囦欢ID
+ });
-// 鎻愪氦琛ㄥ崟
-const sendForm = async () => {
- try {
- // 鎵嬪姩楠岃瘉琛ㄥ崟
- let isValid = true;
- let errorMessage = '';
- if (!form.value.maintenanceActuallyName) {
- isValid = false;
- errorMessage = '璇疯緭鍏ュ疄闄呬繚鍏讳汉';
- } else if (!form.value.maintenanceActuallyTime) {
- isValid = false;
- errorMessage = '璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡';
- } else if (form.value.maintenanceResult === undefined) {
- isValid = false;
- errorMessage = '璇烽�夋嫨淇濆吇缁撴灉';
- }
+ // 娓呴櫎琛ㄥ崟鏍¢獙鐘舵��
+ const clearValidate = () => {
+ // uview-plus涓嶉渶瑕佹墜鍔ㄦ竻闄ら獙璇佺姸鎬侊紝閲嶇疆琛ㄥ崟鏃朵細鑷姩娓呴櫎
+ };
- if (!isValid) {
- showToast(errorMessage);
- return;
- }
+ // 閲嶇疆琛ㄥ崟鏁版嵁鍜屾牎楠岀姸鎬�
+ const resetForm = () => {
+ form.value = {
+ maintenanceActuallyName: userStore.nickName || "",
+ maintenanceResult: undefined,
+ maintenanceActuallyTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
+ sparePartsIds: [],
+ };
+ maintenancestatusText.value = "";
+ selectedSpareParts.value = [];
+ tempSelectedSpareParts.value = [];
+ };
- // 楠岃瘉閫氳繃
- submitFormData();
- } catch (e) {
- showToast('琛ㄥ崟楠岃瘉澶辫触');
- }
-};
+ const resetFormAndValidate = () => {
+ resetForm();
+ // clearValidate(); // 鍒犻櫎杩欒锛孷ant4浼氳嚜鍔ㄥ鐞�
+ };
+ // 鍒ゆ柇鏄惁涓哄浘鐗囨枃浠�
+ const isImageFile = file => {
+ // 妫�鏌ontentType瀛楁
+ if (file.contentType && file.contentType.startsWith("image/")) {
+ return true;
+ }
-// 鎻愪氦琛ㄥ崟鏁版嵁
-const submitFormData = async () => {
- try {
- loading.value = true;
- const id = getPageId();
-
- if (!id) {
- showToast('鍙傛暟閿欒');
- loading.value = false;
- return;
- }
-
- // 鍑嗗鎻愪氦鏁版嵁锛宮aintenanceActuallyTime 鍔犱笂褰撳墠鏃跺垎绉�
- const submitData = { ...form.value };
- const { code } = await addMaintenance({ id: id, ...submitData });
-
- if (code == 200) {
- showToast('鏂板淇濆吇鎴愬姛');
- resetFormAndValidate();
- setTimeout(() => {
- uni.navigateBack();
- }, 1500);
- } else {
- loading.value = false;
- }
- } catch (e) {
- loading.value = false;
- showToast('鎿嶄綔澶辫触');
- }
-};
+ // 妫�鏌ュ師鏈夌殑type瀛楁
+ if (file.type === "image") return true;
-// 杩斿洖涓婁竴椤�
-const goBack = () => {
- // 娓呴櫎瀛樺偍鐨刬d
- uni.removeStorageSync('repairId');
- uni.navigateBack();
-};
+ // 妫�鏌ユ枃浠舵墿灞曞悕
+ const name = file.bucketFilename || file.originalFilename || file.name || "";
+ const ext = name.split(".").pop()?.toLowerCase();
+ return ["jpg", "jpeg", "png", "gif", "webp"].includes(ext);
+ };
-// 鑾峰彇椤甸潰ID
-const getPageId = () => {
- // 浠庢湰鍦板瓨鍌ㄨ幏鍙杋d
- return uni.getStorageSync('repairId');
-};
+ // 鎻愪氦琛ㄥ崟
+ const sendForm = async () => {
+ try {
+ // 鎵嬪姩楠岃瘉琛ㄥ崟
+ let isValid = true;
+ let errorMessage = "";
+ if (!form.value.maintenanceActuallyName) {
+ isValid = false;
+ errorMessage = "璇疯緭鍏ュ疄闄呬繚鍏讳汉";
+ } else if (!form.value.maintenanceActuallyTime) {
+ isValid = false;
+ errorMessage = "璇烽�夋嫨瀹為檯淇濆吇鏃ユ湡";
+ } else if (form.value.maintenanceResult === undefined) {
+ isValid = false;
+ errorMessage = "璇烽�夋嫨淇濆吇缁撴灉";
+ } else if (uploadFiles.value.length === 0 && form.value.status == "1") {
+ isValid = false;
+ errorMessage = "璇蜂笂浼犱繚鍏荤収鐗�";
+ }
-// 鏄剧ず鏃ユ湡閫夋嫨鍣�
-const showDatePicker = () => {
- showDate.value = true;
-};
+ if (!isValid) {
+ showToast(errorMessage);
+ return;
+ }
-// 纭鏃ユ湡閫夋嫨
-const onDateConfirm = (e) => {
- // 鍙繚瀛樺勾鏈堟棩锛屼笉鍖呭惈鏃跺垎绉�
- form.value.maintenanceActuallyTime = dayjs(e.value).format('YYYY-MM-DD HH:mm:ss');
- showDate.value = false;
-};
+ // 楠岃瘉閫氳繃
+ submitFormData();
+ } catch (e) {
+ showToast("琛ㄥ崟楠岃瘉澶辫触");
+ }
+ };
-// 鏄剧ず淇濆吇缁撴灉閫夋嫨鍣�
-const showResultPicker = () => {
- showResult.value = true;
-};
+ // 鎻愪氦琛ㄥ崟鏁版嵁
+ const submitFormData = async () => {
+ try {
+ loading.value = true;
+ const id = getPageId();
-// 纭淇濆吇缁撴灉閫夋嫨
-const onResultConfirm = (selected) => {
- form.value.maintenanceResult = selected.value;
- maintenanceResultText.value = selected.name;
- showResult.value = false;
-};
+ if (!id) {
+ showToast("鍙傛暟閿欒");
+ loading.value = false;
+ return;
+ }
+ // 鍑嗗鎻愪氦鏁版嵁锛宮aintenanceActuallyTime 鍔犱笂褰撳墠鏃跺垎绉�
+ const submitData = {
+ ...form.value,
+ imagesFile: form.value.status == "1" ? uploadFiles.value : [],
+ sparePartsIds: form.sparePartsIds ? form.sparePartsIds.join(",") : "",
+ };
+ const { code } = await addMaintenance({ id: id, ...submitData });
-// 鍒濆鍖栬〃鍗曟暟鎹�
-const initForm = () => {
- // 璁剧疆淇濆吇浜轰负褰撳墠鐢ㄦ埛鏄电О
- form.value.maintenanceActuallyName = userStore.nickName || '';
- // 璁剧疆褰撳墠鏃ユ湡锛堝彧鍖呭惈骞存湀鏃ワ級
- form.value.maintenanceActuallyTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
- currentDate.value = [new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate()];
-};
+ if (code == 200) {
+ showToast("鏂板淇濆吇鎴愬姛");
+ resetFormAndValidate();
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ } else {
+ loading.value = false;
+ }
+ } catch (e) {
+ loading.value = false;
+ showToast("鎿嶄綔澶辫触");
+ }
+ };
-onShow(() => {
- // 椤甸潰鏄剧ず鏃跺垵濮嬪寲琛ㄥ崟
- initForm();
-});
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ // 娓呴櫎瀛樺偍鐨刬d鍜屾暟鎹�
+ uni.removeStorageSync("repairId");
+ uni.removeStorageSync("upkeepItemData");
+ uni.navigateBack();
+ };
-onMounted(() => {
- // 椤甸潰鍔犺浇鏃跺垵濮嬪寲琛ㄥ崟
- initForm();
-});
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙杋d
+ return uni.getStorageSync("repairId");
+ };
+
+ // 鑾峰彇璁惧淇℃伅
+ const getUpkeepItemData = () => {
+ try {
+ const dataStr = uni.getStorageSync("upkeepItemData");
+ if (!dataStr) {
+ return null;
+ }
+ return JSON.parse(dataStr);
+ } catch (e) {
+ console.error("瑙f瀽璁惧鏁版嵁澶辫触:", e);
+ return null;
+ }
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const onDateConfirm = e => {
+ // 鍙繚瀛樺勾鏈堟棩锛屼笉鍖呭惈鏃跺垎绉�
+ form.value.maintenanceActuallyTime = dayjs(e.value).format(
+ "YYYY-MM-DD HH:mm:ss"
+ );
+ showDate.value = false;
+ };
+
+ // 鏄剧ず淇濆吇缁撴灉閫夋嫨鍣�
+ const showResultPicker = () => {
+ showResult.value = true;
+ };
+
+ // 纭淇濆吇缁撴灉閫夋嫨
+ const onResultConfirm = selected => {
+ form.value.status = selected.value;
+ maintenancestatusText.value = selected.name;
+ showResult.value = false;
+ };
+
+ // 鏄剧ず璁惧澶囦欢閫夋嫨鍣�
+ const showSparePartPicker = () => {
+ tempSelectedSpareParts.value = [...selectedSpareParts.value];
+ showSparePart.value = true;
+ };
+
+ // 妫�鏌ュ浠舵槸鍚﹀凡閫変腑
+ const isSparePartSelected = value => {
+ return tempSelectedSpareParts.value.some(item => item.value === value);
+ };
+
+ // 鍒囨崲澶囦欢閫変腑鐘舵��
+ const toggleSparePartSelection = item => {
+ const index = tempSelectedSpareParts.value.findIndex(
+ selected => selected.value === item.value
+ );
+ if (index > -1) {
+ tempSelectedSpareParts.value.splice(index, 1);
+ } else {
+ tempSelectedSpareParts.value.push(item);
+ }
+ };
+
+ // 纭澶囦欢閫夋嫨
+ const confirmSparePartSelection = () => {
+ selectedSpareParts.value = [...tempSelectedSpareParts.value];
+ form.value.sparePartsIds = selectedSpareParts.value.map(item => item.value);
+ showSparePart.value = false;
+ };
+
+ // 绉婚櫎宸查�夊浠�
+ const removeSparePart = index => {
+ selectedSpareParts.value.splice(index, 1);
+ form.value.sparePartsIds = selectedSpareParts.value.map(item => item.value);
+ };
+
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ const initForm = () => {
+ // 鑾峰彇璁惧淇℃伅
+ const itemData = getUpkeepItemData();
+
+ // 閲嶇疆閫夋嫨鐨勫浠�
+ selectedSpareParts.value = [];
+ // 閲嶇疆涓婁紶鐨勬枃浠�
+ uploadFiles.value = [];
+ uploading.value = false;
+ uploadProgress.value = 0;
+ maintenancestatusText.value = "";
+
+ // 璁剧疆淇濆吇浜轰负褰撳墠鐢ㄦ埛鏄电О
+ form.value.maintenanceActuallyName = userStore.nickName || "";
+ // 璁剧疆褰撳墠鏃ユ湡锛堝彧鍖呭惈骞存湀鏃ワ級
+ form.value.maintenanceActuallyTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
+ currentDate.value = [
+ new Date().getFullYear(),
+ new Date().getMonth() + 1,
+ new Date().getDate(),
+ ];
+
+ // 濡傛灉鏈夎澶囦俊鎭紝濉厖宸叉湁鐨勪繚鍏绘暟鎹�
+ if (itemData) {
+ // 濉厖瀹為檯淇濆吇浜�
+ if (itemData.maintenanceActuallyName) {
+ form.value.maintenanceActuallyName = itemData.maintenanceActuallyName;
+ }
+ // 濉厖淇濆吇缁撴灉
+ if (
+ itemData.maintenanceResult !== undefined &&
+ itemData.maintenanceResult !== null
+ ) {
+ form.value.maintenanceResult = itemData.maintenanceResult;
+ }
+ // 濉厖瀹為檯淇濆吇鏃ユ湡
+ if (itemData.maintenanceActuallyTime) {
+ form.value.maintenanceActuallyTime = itemData.maintenanceActuallyTime;
+ // 瑙f瀽鏃ユ湡璁剧疆鍒版棩鏈熼�夋嫨鍣�
+ const date = dayjs(itemData.maintenanceActuallyTime);
+ currentDate.value = [date.year(), date.month() + 1, date.date()];
+ }
+ // 濉厖淇濆吇鐘舵��
+ if (itemData.status) {
+ const statusMap = {
+ 0: "寰呬繚鍏�",
+ 1: "瀹岀粨",
+ 2: "澶辫触",
+ };
+ maintenancestatusText.value = statusMap[itemData.status] || "";
+ }
+ // 濉厖澶囦欢鏁版嵁
+ if (itemData.spareParts && itemData.spareParts.length > 0) {
+ selectedSpareParts.value = itemData.spareParts.map(sparePart => ({
+ id: sparePart.id || sparePart.sparePartId || sparePart.value,
+ name: sparePart.name || sparePart.sparePartName,
+ code: sparePart.code || sparePart.sparePartCode,
+ value: sparePart.id || sparePart.sparePartId || sparePart.value,
+ }));
+ // 璁剧疆澶囦欢IDs
+ form.value.sparePartsIds = selectedSpareParts.value
+ .map(item => item.value)
+ .join(",");
+ }
+ // 濉厖闄勪欢鏁版嵁
+ if (itemData.files && itemData.files.length > 0) {
+ uploadFiles.value = itemData.files.map(file => ({
+ id: file.id,
+ name: file.name || file.bucketFilename || file.originalFilename,
+ url: file.url || file.downloadUrl,
+ type:
+ file.type ||
+ (file.contentType && file.contentType.startsWith("image/")
+ ? "image"
+ : "video"),
+ size: file.size || file.byteSize,
+ }));
+ } else if (itemData.uploadFiles && itemData.uploadFiles.length > 0) {
+ uploadFiles.value = itemData.uploadFiles.map(file => ({
+ id: file.id,
+ name: file.name || file.bucketFilename || file.originalFilename,
+ url: file.url || file.downloadUrl || file.tempFilePath || file.path,
+ type: file.type,
+ size: file.size,
+ }));
+ }
+ }
+ };
+
+ onShow(() => {
+ // 椤甸潰鏄剧ず鏃跺垵濮嬪寲琛ㄥ崟
+ initForm();
+ fetchSparePartOptions(getPageId());
+ });
+ const sparePartOptions = ref([]);
+ const fetchSparePartOptions = deviceLedgerId => {
+ getSparePartsOptions({ deviceLedgerId: deviceLedgerId }).then(res => {
+ if (res.code == 200) {
+ sparePartOptions.value = res.data || [];
+ }
+ });
+ };
+
+ // 鏍煎紡鍖栨枃浠禪RL
+ const formatFileUrl = url => {
+ if (!url) return "";
+
+ // 濡傛灉宸茬粡鏄畬鏁寸殑URL锛坔ttp鎴杊ttps寮�澶达級锛岀洿鎺ヨ繑鍥�
+ if (url.startsWith("http://") || url.startsWith("https://")) {
+ return url;
+ }
+
+ // 濡傛灉鏄湰鍦拌矾寰勶紙濡� D:\\ruoyi\\prod\\uploads...锛夛紝闇�瑕佽浆鎹负缃戠粶URL
+ // 浠庤矾寰勪腑鎻愬彇uploads鍚庨潰鐨勯儴鍒�
+ const uploadsIndex = url.indexOf("uploads");
+ if (uploadsIndex !== -1) {
+ const relativePath = url.substring(uploadsIndex);
+ // 浣跨敤baseUrl + /profile/ + 鐩稿璺緞
+ return `http://192.168.1.35:8888/profile/${relativePath}`;
+ }
+
+ // 鍏朵粬鎯呭喌锛屽皾璇曠洿鎺ユ嫾鎺�
+ return `http://192.168.1.35:8888/profile/${url}`;
+ };
+
+ // 鏍煎紡鍖栨枃浠跺ぇ灏�
+ const formatFileSize = size => {
+ if (!size) return "";
+ if (size < 1024) return size + "B";
+ if (size < 1024 * 1024) return (size / 1024).toFixed(1) + "KB";
+ return (size / (1024 * 1024)).toFixed(1) + "MB";
+ };
+
+ // 鎷嶇収/鎷嶈棰�
+ const chooseMedia = type => {
+ if (uploadFiles.value.length >= uploadConfig.limit) {
+ uni.showToast({
+ title: `鏈�澶氬彧鑳介�夋嫨${uploadConfig.limit}涓枃浠禶,
+ icon: "none",
+ });
+ return;
+ }
+
+ const remaining = uploadConfig.limit - uploadFiles.value.length;
+
+ // 浼樺厛锛歝hooseMedia锛堟敮鎸� image/video锛�
+ if (typeof uni.chooseMedia === "function") {
+ uni.chooseMedia({
+ count: Math.min(remaining, 1),
+ mediaType: [type || "image"],
+ sizeType: ["compressed", "original"],
+ sourceType: ["camera"], // 鏀寔鐩告満鍜岀浉鍐�
+ success: res => {
+ try {
+ const files = res?.tempFiles || [];
+ if (!files.length) throw new Error("鏈幏鍙栧埌鏂囦欢");
+
+ files.forEach((tf, idx) => {
+ const filePath = tf.tempFilePath || tf.path || "";
+ const fileType = tf.fileType || type || "image";
+ const ext = fileType === "video" ? "mp4" : "jpg";
+ const file = {
+ tempFilePath: filePath,
+ path: filePath,
+ type: fileType,
+ name: `${fileType}_${Date.now()}_${idx}.${ext}`,
+ size: tf.size || 0,
+ duration: tf.duration || 0,
+ createTime: Date.now(),
+ uid: Date.now() + Math.random() + idx,
+ };
+
+ console.log("chooseMedia 鎴愬姛鑾峰彇鏂囦欢:", file);
+ handleBeforeUpload(file);
+ });
+ } catch (e) {
+ console.error("澶勭悊鎷嶆憚缁撴灉澶辫触:", e);
+ uni.showToast({ title: "澶勭悊鏂囦欢澶辫触", icon: "error" });
+ }
+ },
+ fail: err => {
+ console.error("鎷嶆憚澶辫触:", err);
+ uni.showToast({ title: "鎷嶆憚澶辫触", icon: "error" });
+ },
+ });
+ return;
+ }
+
+ // 闄嶇骇锛歝hooseImage / chooseVideo
+ if (type === "video") {
+ uni.chooseVideo({
+ sourceType: ["camera", "album"],
+ maxDuration: uploadConfig.maxVideoDuration,
+ camera: "back",
+ success: res => {
+ try {
+ if (!res.tempFilePath) {
+ throw new Error("鏈幏鍙栧埌瑙嗛鏂囦欢");
+ }
+
+ const file = {
+ tempFilePath: res.tempFilePath,
+ path: res.tempFilePath,
+ type: "video",
+ name: `video_${Date.now()}.mp4`,
+ size: res.size || 0,
+ duration: res.duration || 0,
+ createTime: new Date().getTime(),
+ uid: Date.now() + Math.random(),
+ };
+
+ handleBeforeUpload(file);
+ } catch (error) {
+ console.error("澶勭悊鎷嶈棰戠粨鏋滃け璐�:", error);
+ uni.showToast({ title: "澶勭悊瑙嗛澶辫触", icon: "error" });
+ }
+ },
+ fail: err => {
+ console.error("鎷嶈棰戝け璐�:", err);
+ uni.showToast({ title: "鎷嶈棰戝け璐�", icon: "error" });
+ },
+ });
+ } else {
+ uni.chooseImage({
+ count: 1,
+ sizeType: ["compressed", "original"],
+ sourceType: ["camera", "album"],
+ success: res => {
+ const tempFilePath = res?.tempFilePaths?.[0];
+ const tempFile = res?.tempFiles?.[0] || {};
+ if (!tempFilePath) return;
+ handleBeforeUpload({
+ tempFilePath,
+ path: tempFilePath,
+ type: "image",
+ name: `photo_${Date.now()}.jpg`,
+ size: tempFile.size || 0,
+ createTime: Date.now(),
+ uid: Date.now() + Math.random(),
+ });
+ },
+ });
+ }
+ };
+
+ // 鍒犻櫎鏂囦欢
+ const removeFile = index => {
+ uni.showModal({
+ title: "纭鍒犻櫎",
+ content: "纭畾瑕佸垹闄よ繖涓枃浠跺悧锛�",
+ success: res => {
+ if (res.confirm) {
+ uploadFiles.value.splice(index, 1);
+ uni.showToast({
+ title: "鍒犻櫎鎴愬姛",
+ icon: "success",
+ });
+ }
+ },
+ });
+ };
+
+ // 涓婁紶鍓嶆牎楠�
+ const handleBeforeUpload = async file => {
+ // 鏍¢獙鏂囦欢绫诲瀷
+ if (
+ uploadConfig.fileType &&
+ Array.isArray(uploadConfig.fileType) &&
+ uploadConfig.fileType.length > 0
+ ) {
+ const fileName = file.name || "";
+ const fileExtension = fileName
+ ? fileName.split(".").pop().toLowerCase()
+ : "";
+
+ // 鏍规嵁鏂囦欢绫诲瀷纭畾鏈熸湜鐨勬墿灞曞悕
+ let expectedTypes = [];
+ if (file.type === "image") {
+ expectedTypes = ["jpg", "jpeg", "png", "gif", "webp"];
+ } else if (file.type === "video") {
+ expectedTypes = ["mp4", "mov", "avi", "wmv"];
+ }
+
+ // 妫�鏌ユ枃浠舵墿灞曞悕鏄惁鍦ㄥ厑璁哥殑绫诲瀷涓�
+ if (fileExtension && expectedTypes.length > 0) {
+ const isAllowed = expectedTypes.some(
+ type => uploadConfig.fileType.includes(type) && type === fileExtension
+ );
+
+ if (!isAllowed) {
+ uni.showToast({
+ title: `鏂囦欢鏍煎紡涓嶆敮鎸侊紝璇锋媿鎽� ${expectedTypes.join("/")} 鏍煎紡鐨勬枃浠禶,
+ icon: "none",
+ });
+ return false;
+ }
+ }
+ }
+
+ // 鏍¢獙閫氳繃锛屽紑濮嬩笂浼�
+ uploadFile(file);
+ return true;
+ };
+
+ // 鏂囦欢涓婁紶澶勭悊
+ const uploadFile = async file => {
+ uploading.value = true;
+ uploadProgress.value = 0;
+ number.value++;
+
+ // 纭繚token瀛樺湪
+ const token = userStore.token;
+ if (!token) {
+ handleUploadError("鐢ㄦ埛鏈櫥褰�");
+ return;
+ }
+
+ uploadWithUniUploadFile(file, file.tempFilePath || file.path || "", token);
+ };
+
+ // 浣跨敤uni.uploadFile涓婁紶
+ const uploadWithUniUploadFile = (file, filePath, token) => {
+ if (!filePath) {
+ handleUploadError("鏂囦欢璺緞涓嶅瓨鍦�");
+ return;
+ }
+
+ const uploadTask = uni.uploadFile({
+ url: uploadFileUrl.value,
+ filePath: filePath,
+ name: "file",
+ formData: {
+ type: 10, // 淇濆吇闄勪欢绫诲瀷
+ },
+ header: {
+ Authorization: `Bearer ${token}`,
+ },
+ success: res => {
+ try {
+ if (res.statusCode === 200) {
+ const response = JSON.parse(res.data);
+ if (response.code === 200) {
+ handleUploadSuccess(response, file);
+ uni.showToast({
+ title: "涓婁紶鎴愬姛",
+ icon: "success",
+ });
+ } else {
+ handleUploadError(response.msg || "鏈嶅姟鍣ㄨ繑鍥為敊璇�");
+ }
+ } else {
+ handleUploadError(`鏈嶅姟鍣ㄩ敊璇紝鐘舵�佺爜: ${res.statusCode}`);
+ }
+ } catch (e) {
+ console.error("瑙f瀽鍝嶅簲澶辫触:", e);
+ console.error("鍘熷鍝嶅簲鏁版嵁:", res.data);
+ handleUploadError("鍝嶅簲鏁版嵁瑙f瀽澶辫触: " + e.message);
+ }
+ },
+ fail: err => {
+ console.error("涓婁紶澶辫触:", err.errMsg || err);
+ number.value--;
+
+ let errorMessage = "涓婁紶澶辫触";
+ if (err.errMsg) {
+ if (err.errMsg.includes("statusCode: null")) {
+ errorMessage = "缃戠粶杩炴帴澶辫触锛岃妫�鏌ョ綉缁滆缃�";
+ } else if (err.errMsg.includes("timeout")) {
+ errorMessage = "涓婁紶瓒呮椂锛岃閲嶈瘯";
+ } else if (err.errMsg.includes("fail")) {
+ errorMessage = "涓婁紶澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�";
+ } else {
+ errorMessage = err.errMsg;
+ }
+ }
+
+ handleUploadError(errorMessage);
+ },
+ complete: () => {
+ uploading.value = false;
+ uploadProgress.value = 0;
+ },
+ });
+
+ // 鐩戝惉涓婁紶杩涘害
+ if (uploadTask && uploadTask.onProgressUpdate) {
+ uploadTask.onProgressUpdate(res => {
+ uploadProgress.value = res.progress;
+ });
+ }
+ };
+
+ // 涓婁紶鎴愬姛澶勭悊
+ const handleUploadSuccess = (res, file) => {
+ console.log("涓婁紶鎴愬姛鍝嶅簲:", res);
+
+ // 澶勭悊涓嶅悓鐨勬暟鎹粨鏋勶細鍙兘鏄暟缁勶紝涔熷彲鑳芥槸鍗曚釜瀵硅薄
+ let uploadedFile = null;
+ uploadedFile = res.data;
+
+ if (!uploadedFile) {
+ console.error("鏃犳硶瑙f瀽涓婁紶鍝嶅簲鏁版嵁:", res);
+ number.value--;
+ handleUploadError("涓婁紶鍝嶅簲鏁版嵁鏍煎紡閿欒", false);
+ return;
+ }
+ console.log("涓婁紶鎴愬姛鏂囦欢鏁版嵁:", uploadedFile, file);
+
+ // 纭繚涓婁紶鐨勬枃浠舵暟鎹畬鏁达紝鍖呭惈id鍜宼ype
+ const fileData = {
+ name: uploadedFile.originalName,
+ type: file.type,
+ url: uploadedFile.tempPath,
+ };
+
+ uploadFiles.value.push(fileData);
+ number.value = 0;
+ };
+
+ // 涓婁紶澶辫触澶勭悊
+ const handleUploadError = (message = "涓婁紶鏂囦欢澶辫触", showRetry = false) => {
+ uploading.value = false;
+ uploadProgress.value = 0;
+
+ if (showRetry) {
+ uni.showModal({
+ title: "涓婁紶澶辫触",
+ content: message + "锛屾槸鍚﹂噸璇曪紵",
+ success: res => {
+ if (res.confirm) {
+ // 鐢ㄦ埛閫夋嫨閲嶈瘯锛岃繖閲屽彲浠ラ噸鏂拌Е鍙戜笂浼�
+ }
+ },
+ });
+ } else {
+ uni.showToast({
+ title: message,
+ icon: "error",
+ });
+ }
+ };
+
+ onMounted(() => {
+ // 椤甸潰鍔犺浇鏃跺垵濮嬪寲琛ㄥ崟
+ initForm();
+ });
</script>
<style scoped lang="scss">
-@import '@/static/scss/form-common.scss';
-.upkeep-maintain {
- min-height: 100vh;
- background: #f8f9fa;
- padding-bottom: 5rem;
-}
+ @import "@/static/scss/form-common.scss";
+ .upkeep-maintain {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 5rem;
+ }
-.footer-btns {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background: #fff;
- display: flex;
- justify-content: space-around;
- align-items: center;
- padding: 0.75rem 0;
- box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05);
- z-index: 1000;
-}
+ .footer-btns {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #fff;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ padding: 0.75rem 0;
+ box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
+ z-index: 1000;
+ }
-.cancel-btn {
- font-weight: 400;
- font-size: 1rem;
- color: #FFFFFF;
- width: 6.375rem;
- background: #C7C9CC;
- box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
- border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
-}
+ .cancel-btn {
+ font-weight: 400;
+ font-size: 1rem;
+ color: #ffffff;
+ width: 6.375rem;
+ background: #c7c9cc;
+ box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
-.save-btn {
- font-weight: 400;
- font-size: 1rem;
- color: #FFFFFF;
- width: 14rem;
- background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%);
- box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
- border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
-}
+ .save-btn {
+ font-weight: 400;
+ font-size: 1rem;
+ color: #ffffff;
+ width: 14rem;
+ background: linear-gradient(140deg, #00baff 0%, #006cfb 100%);
+ box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
-// 鍝嶅簲寮忚皟鏁�
-@media (max-width: 768px) {
- .submit-section {
- padding: 12px;
- }
-}
+ // 鍝嶅簲寮忚皟鏁�
+ @media (max-width: 768px) {
+ .submit-section {
+ padding: 12px;
+ }
+ }
-.tip-text {
- padding: 4px 16px 0 16px;
- font-size: 12px;
- color: #888;
-}
+ .tip-text {
+ padding: 4px 16px 0 16px;
+ font-size: 12px;
+ color: #888;
+ }
+
+ /* 璁惧澶囦欢澶氶�夋牱寮� */
+ .spare-parts-container {
+ flex: 1;
+ min-height: 40px;
+ display: flex;
+ align-items: center;
+ }
+
+ .spare-parts-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
+
+ .spare-part-tag {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ background: #2c7be5;
+ color: #fff;
+ padding: 4px 8px;
+ border-radius: 4px;
+ font-size: 12px;
+ }
+
+ .placeholder {
+ color: #c0c4cc;
+ font-size: 14px;
+ }
+
+ /* 澶囦欢閫夋嫨寮圭獥鏍峰紡 */
+ .spare-part-popup {
+ padding: 16px;
+ max-height: 60vh;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 16px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #e8e8e8;
+ }
+
+ .popup-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ }
+
+ .spare-part-options {
+ flex: 1;
+ overflow-y: auto;
+ }
+
+ .spare-part-option {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 12px 0;
+ border-bottom: 1px solid #f0f0f0;
+ font-size: 14px;
+ color: #333;
+ }
+
+ .spare-part-option.selected {
+ color: #2c7be5;
+ font-weight: 500;
+ }
+
+ /* 鏂囦欢涓婁紶鏍峰紡 */
+ .simple-upload-area {
+ width: 100%;
+ }
+
+ .upload-buttons {
+ display: flex;
+ margin-bottom: 12px;
+ }
+
+ .upload-progress {
+ margin: 12px 0;
+ }
+
+ .file-list {
+ margin-top: 12px;
+ }
+
+ .file-item {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ padding: 10px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .file-preview-container {
+ position: relative;
+ margin-right: 12px;
+ }
+
+ .file-preview {
+ width: 80px;
+ height: 80px;
+ border-radius: 4px;
+ }
+
+ .video-preview {
+ width: 80px;
+ height: 80px;
+ background: #333;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: #fff;
+ font-size: 12px;
+ }
+
+ .delete-btn {
+ position: absolute;
+ top: -8px;
+ right: -8px;
+ width: 20px;
+ height: 20px;
+ background: #f56c6c;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .file-info {
+ flex: 1;
+ }
+
+ .file-name {
+ display: block;
+ font-size: 14px;
+ color: #333;
+ margin-bottom: 4px;
+ line-height: 1.4;
+ }
+
+ .file-size {
+ font-size: 12px;
+ color: #999;
+ }
+
+ .empty-state {
+ padding: 20px 0;
+ text-align: center;
+ color: #999;
+ font-size: 14px;
+ }
</style>
\ No newline at end of file
diff --git a/src/pages/inspectionUpload/index.vue b/src/pages/inspectionUpload/index.vue
index 86a9b80..b6578e4 100644
--- a/src/pages/inspectionUpload/index.vue
+++ b/src/pages/inspectionUpload/index.vue
@@ -27,7 +27,7 @@
fontSize: '12px',
marginRight: '8px'
}">
- 鎵爜涓婁紶
+ 宸℃涓婁紶
</u-button>
<u-button type="success"
size="small"
@@ -180,6 +180,13 @@
:key="index"
class="file-item">
<view class="file-preview-container">
+ <!-- 鍒犻櫎鎸夐挳 -->
+ <view class="delete-btn"
+ @click="removeFile(index)">
+ <u-icon name="close"
+ size="12"
+ color="#fff"></u-icon>
+ </view>
<image v-if="file.type === 'image' || (file.type !== 'video' && !file.type)"
:src="file.url || file.tempFilePath || file.path || file.downloadUrl"
class="file-preview"
@@ -192,13 +199,6 @@
color="#fff"
style="margin-right: 5px;"></uni-icons>
<text class="video-text">瑙嗛</text>
- </view>
- <!-- 鍒犻櫎鎸夐挳 -->
- <view class="delete-btn"
- @click="removeFile(index)">
- <u-icon name="close"
- size="12"
- color="#fff"></u-icon>
</view>
</view>
<view class="file-info">
@@ -410,7 +410,7 @@
// 璁$畻涓婁紶URL
const uploadFileUrl = computed(() => {
- const baseUrl = "http://192.168.1.35:8888";
+ const baseUrl = config.baseUrl;
return baseUrl + uploadConfig.action;
});
@@ -825,6 +825,11 @@
// 鎻愪氦涓婁紶
const submitUpload = async () => {
+ // console.log("鎻愪氦涓婁紶鏁版嵁:", {
+ // before: beforeModelValue.value,
+ // after: afterModelValue.value,
+ // issue: issueModelValue.value,
+ // });
try {
// 妫�鏌ユ槸鍚﹂�夋嫨浜嗗紓甯哥姸鎬�
if (hasException.value === null) {
@@ -857,12 +862,15 @@
let arr = [];
if (beforeModelValue.value.length > 0) {
arr.push(...beforeModelValue.value);
+ infoData.value.beforeModelValue = beforeModelValue.value;
}
if (afterModelValue.value.length > 0) {
arr.push(...afterModelValue.value);
+ infoData.value.afterModelValue = afterModelValue.value;
}
if (issueModelValue.value.length > 0) {
arr.push(...issueModelValue.value);
+ infoData.value.issueModelValue = issueModelValue.value;
}
// 浼犵粰鍚庣鐨勪复鏃舵枃浠禝D鍒楄〃锛坱empFileIds锛�
@@ -1045,7 +1053,7 @@
};
// 鏂囦欢璁块棶鍩虹鍩燂紙鍚庣瑕佹眰鍓嶇紑锛�
- const filePreviewBase = "http://192.168.1.35:8888";
+ const filePreviewBase = config.baseUrl;
// 灏嗗悗绔繑鍥炵殑鏂囦欢鍦板潃瑙勮寖鎴愬彲璁块棶URL
// 鍏煎鍦烘櫙锛�
@@ -1558,7 +1566,7 @@
};
uploadList.value.push(fileData);
-
+ console.log("娣诲姞鍒板垎绫诲墠:", fileData);
// 绔嬪嵆娣诲姞鍒板搴旂殑鍒嗙被锛屼笉绛夊緟鎵�鏈夋枃浠朵笂浼犲畬鎴�
switch (currentUploadType.value) {
case "before":
@@ -1783,7 +1791,7 @@
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
- z-index: 10000;
+ z-index: 100;
display: flex;
align-items: center;
justify-content: center;
@@ -1922,6 +1930,7 @@
cursor: pointer;
box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
transition: all 0.3s ease;
+ z-index: 1000;
}
.delete-btn:hover {
--
Gitblit v1.9.3