| | |
| | | clearable /> |
| | | </u-form-item> |
| | | <u-form-item label="保养状态" |
| | | prop="status" |
| | | prop="maintenancestatusText" |
| | | required |
| | | border-bottom> |
| | | <u-input v-model="maintenancestatusText" |
| | |
| | | :key="index" |
| | | class="file-item"> |
| | | <view class="file-preview-container"> |
| | | <!-- {{formatFileUrl(file.url)}} --> |
| | | <image v-if="file.type === 'image' || isImageFile(file)" |
| | | :src="file.url || file.tempFilePath || file.path || file.downloadUrl" |
| | | :src="formatFileUrl(file.url || file.tempFilePath || file.path || file.downloadUrl)" |
| | | class="file-preview" |
| | | mode="aspectFill" /> |
| | | <view v-else-if="file.type === 'video'" |
| | |
| | | await fetchSparePartOptions(pageId); |
| | | } |
| | | // 页面显示时初始化表单 |
| | | initForm(); |
| | | }); |
| | | const sparePartOptions = ref([]); |
| | | const fetchSparePartOptions = deviceLedgerId => { |
| | |
| | | }; |
| | | |
| | | // 格式化文件URL |
| | | const formatFileUrl = url => { |
| | | if (!url) return ""; |
| | | // const formatFileUrl = url => { |
| | | // if (!url) return ""; |
| | | |
| | | // 如果已经是完整的URL(http或https开头),直接返回 |
| | | if (url.startsWith("http://") || url.startsWith("https://")) { |
| | | return url; |
| | | } |
| | | // // 如果已经是完整的URL(http或https开头),直接返回 |
| | | // 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}`; |
| | | } |
| | | // // 如果是本地路径(如 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}`; |
| | | }; |
| | | // // 其他情况,尝试直接拼接 |
| | | // return `http://192.168.1.35:8888/profile/${url}`; |
| | | // }; |
| | | |
| | | // 格式化文件大小 |
| | | const formatFileSize = size => { |
| | |
| | | uploadProgress.value = res.progress; |
| | | }); |
| | | } |
| | | }; // 格式化文件URL |
| | | 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.fileUrl}/${relativePath}`; |
| | | // } |
| | | return `${config.fileUrl}/${url}`; |
| | | }; |
| | | |
| | | // 上传成功处理 |