| | |
| | | clearable /> |
| | | </u-form-item> |
| | | <u-form-item label="保养状态" |
| | | prop="status" |
| | | prop="maintenancestatusText" |
| | | required |
| | | border-bottom> |
| | | <u-input v-model="maintenancestatusText" |
| | |
| | | style="margin-right: 5px;"></u-icon> |
| | | {{ uploading ? '上传中...' : '拍照' }} |
| | | </u-button> |
| | | <u-button type="success" |
| | | <!-- <u-button type="success" |
| | | @click="chooseMedia('video')" |
| | | :loading="uploading" |
| | | :disabled="uploadFiles.length >= uploadConfig.limit" |
| | |
| | | color="#fff" |
| | | style="margin-right: 5px;"></uni-icons> |
| | | {{ uploading ? '上传中...' : '拍视频' }} |
| | | </u-button> |
| | | </u-button> --> |
| | | </view> |
| | | <!-- 上传进度 --> |
| | | <view v-if="uploading" |
| | |
| | | :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'" |
| | |
| | | </view> |
| | | <view v-if="uploadFiles.length === 0" |
| | | class="empty-state"> |
| | | <text>请选择要上传的保养图片或视频</text> |
| | | <text>请选择要上传的保养图片</text> |
| | | </view> |
| | | </view> |
| | | </u-form-item> |
| | |
| | | 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}`; |
| | | }; |
| | | |
| | | // 上传成功处理 |