From c3fb43d145a6ea5979334bd86be02fae49fa2956 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期四, 18 十二月 2025 18:01:58 +0800
Subject: [PATCH] 海川开心-巡检任务列表增加日期字段
---
src/pages/inspectionUpload/index.vue | 95 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 79 insertions(+), 16 deletions(-)
diff --git a/src/pages/inspectionUpload/index.vue b/src/pages/inspectionUpload/index.vue
index a31902d..4320a6e 100644
--- a/src/pages/inspectionUpload/index.vue
+++ b/src/pages/inspectionUpload/index.vue
@@ -58,6 +58,10 @@
<text class="detail-label">鎵ц浜�</text>
<text class="detail-value">{{ item.inspector }}</text>
</view>
+ <view class="detail-item">
+ <text class="detail-label">浠诲姟涓嬪彂鏃ユ湡</text>
+ <text class="detail-value">{{ item.dateStr }}</text>
+ </view>
</view>
</view>
</view>
@@ -174,7 +178,7 @@
<view class="upload-buttons">
<u-button
type="primary"
- @click="chooseImage"
+ @click="chooseMedia('image')"
:loading="uploading"
:disabled="getCurrentFiles().length >= uploadConfig.limit"
:customStyle="{ marginRight: '10px', flex: 1 }"
@@ -184,12 +188,12 @@
</u-button>
<u-button
type="success"
- @click="chooseVideo"
+ @click="chooseMedia('video')"
:loading="uploading"
:disabled="getCurrentFiles().length >= uploadConfig.limit"
:customStyle="{ flex: 1 }"
>
- <u-icon name="video" size="18" color="#fff" style="margin-right: 5px;"></u-icon>
+ <uni-icons type="videocam" name="videocam" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
{{ uploading ? '涓婁紶涓�...' : '鎷嶈棰�' }}
</u-button>
</view>
@@ -212,13 +216,13 @@
>
<view class="file-preview-container">
<image
- v-if="file.type === 'image'"
- :src="file.url || file.tempFilePath || file.path"
+ v-if="file?.path?.fileType === 'image'"
+ :src="file?.url || file?.tempFilePath?.tempFilePath || file?.path?.tempFilePath"
class="file-preview"
mode="aspectFill"
/>
<view v-else class="video-preview">
- <u-icon name="video" size="24" color="#409eff"></u-icon>
+ <uni-icons type="videocam" name="videocam" size="18" color="#fff" style="margin-right: 5px;"></uni-icons>
<text class="video-text">瑙嗛</text>
</view>
@@ -439,9 +443,9 @@
if (process.env.VUE_APP_BASE_API) {
baseUrl = process.env.VUE_APP_BASE_API;
} else if (process.env.NODE_ENV === 'development') {
- baseUrl = 'http://192.168.1.147:9036';
+ baseUrl = 'http://114.132.189.42:9068';
} else {
- baseUrl = 'http://192.168.1.147:9036';
+ baseUrl = 'http://114.132.189.42:9068';
}
return baseUrl + uploadConfig.action;
@@ -815,7 +819,6 @@
infoData.value.storageBlobDTO = arr;
// 娣诲姞寮傚父鐘舵�佷俊鎭�
infoData.value.hasException = hasException.value;
-
const result = await uploadInspectionTask({...infoData.value});
// 妫�鏌ユ彁浜ょ粨鏋�
@@ -938,7 +941,19 @@
const getAttachmentsByType = (typeValue) => {
return attachmentList.value.filter(file => file.type === typeValue) || []
}
-
+// 鑾峰彇type鍊�
+const getTabType = () => {
+ switch (currentUploadType.value) {
+ case 'before':
+ return 0
+ case 'after':
+ return 1
+ case 'issue':
+ return 2
+ default:
+ return 0
+ }
+}
// 鑾峰彇褰撳墠鏌ョ湅绫诲瀷鐨勯檮浠�
const getCurrentViewAttachments = () => {
switch (currentViewType.value) {
@@ -1007,6 +1022,54 @@
})
}
+// 浣跨敤鐩告満
+const chooseMedia = (type) => {
+ let mediaPamaes={
+ count: 1,
+ mediaType:[type||'image'],
+ sizeType: ['compressed', 'original'],
+ sourceType: ['camera'],
+ }
+ uni.chooseMedia({
+ ...mediaPamaes,
+ success: (res) => {
+ try {
+ if (!res.tempFiles || res.tempFiles.length === 0) {
+ throw new Error('鏈幏鍙栧埌鍥剧墖鏂囦欢');
+ }
+
+ const tempFilePath = res.tempFiles[0];
+ const tempFile = res.tempFiles && res.tempFiles[0] ? res.tempFiles[0] : {};
+
+ const file = {
+ tempFilePath: tempFilePath,
+ path: tempFilePath, // 淇濇寔鍏煎鎬�
+ type: 'image',
+ name: `photo_${Date.now()}.jpg`,
+ size: tempFile.size || 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: '鎷嶇収澶辫触: ' + (err.errMsg || '鏈煡閿欒'),
+ icon: 'error'
+ });
+ }
+ })
+}
+
// 鎷嶇収
const chooseImage = () => {
if (uploadFiles.value.length >= uploadConfig.limit) {
@@ -1017,17 +1080,18 @@
return;
}
- uni.chooseImage({
+ uni.chooseMedia({
count: 1,
+ mediaType:['image', 'video'],
sizeType: ['compressed', 'original'],
sourceType: ['camera'],
success: (res) => {
try {
- if (!res.tempFilePaths || res.tempFilePaths.length === 0) {
+ if (!res.tempFiles || res.tempFiles.length === 0) {
throw new Error('鏈幏鍙栧埌鍥剧墖鏂囦欢');
}
- const tempFilePath = res.tempFilePaths[0];
+ const tempFilePath = res.tempFiles[0];
const tempFile = res.tempFiles && res.tempFiles[0] ? res.tempFiles[0] : {};
const file = {
@@ -1229,7 +1293,7 @@
number.value++; // 澧炲姞涓婁紶璁℃暟
// 纭繚鏂囦欢璺緞姝g‘
- const filePath = file.tempFilePath || file.path;
+ const filePath = file.tempFilePath?.tempFilePath || file.path?.tempFilePath||'';
if (!filePath) {
handleUploadError('鏂囦欢璺緞涓嶅瓨鍦�');
return;
@@ -1248,13 +1312,12 @@
filePath: filePath,
name: 'files',
formData: {
- type: uploadStatusType.value || 0
+ type: getTabType() || 0
},
header: {
'Authorization': `Bearer ${token}`
}
};
-
const uploadTask = uni.uploadFile({
...uploadParams,
success: (res) => {
--
Gitblit v1.9.3