linwenxin hai 6 meses
pai
achega
b6c7af876e

+ 9 - 31
src/components/logistics2/common-logistics.vue

@@ -32,7 +32,7 @@
                   v-for="(url, index_) in (item.imgSrc || '').split(',').filter(u => u != '')"
                   v-for="(url, index_) in (item.imgSrc || '').split(',').filter(u => u != '')"
                   :key="index_"
                   :key="index_"
                   style="margin-left: 10px; color: blue"
                   style="margin-left: 10px; color: blue"
-                  @tap="downloadFile(url)"
+                  @click="downloadFile(url)"
                   >{{ `附件${index_ + 1}` }}</text
                   >{{ `附件${index_ + 1}` }}</text
                 >
                 >
               </view>
               </view>
@@ -55,6 +55,7 @@ export default {
   computed: {},
   computed: {},
   methods: {
   methods: {
     downloadFile(url) {
     downloadFile(url) {
+      console.log(url)
       return new Promise((resolve, reject) => {
       return new Promise((resolve, reject) => {
         // 提取文件名和类型
         // 提取文件名和类型
         const filename = url.split('/').pop().split('?')[0] // 获取文件名
         const filename = url.split('/').pop().split('?')[0] // 获取文件名
@@ -66,36 +67,13 @@ export default {
           url: url,
           url: url,
           success: res => {
           success: res => {
             if (res.statusCode === 200) {
             if (res.statusCode === 200) {
-              const tempFilePath = res.tempFilePath
-              if (
-                fileExtension === 'jpg' ||
-                fileExtension === 'jpeg' ||
-                fileExtension === 'png' ||
-                fileExtension === 'gif' ||
-                fileExtension === 'mp4'
-              ) {
-                // 下载到相册
-                uni.saveImageToPhotosAlbum({
-                  filePath: tempFilePath,
-                  success: () => {
-                    resolve('Image saved to gallery.')
-                  },
-                  fail: err => {
-                    reject('Failed to save image: ' + err)
-                  }
-                })
-              } else {
-                // 其他类型文件保存到临时文件
-                uni.saveFile({
-                  tempFilePath: tempFilePath,
-                  success: saveRes => {
-                    resolve(saveRes.savedFilePath)
-                  },
-                  fail: err => {
-                    reject('Failed to save file: ' + err)
-                  }
-                })
-              }
+              // H5环境下下载
+              const link = document.createElement('a')
+              link.href = res.tempFilePath
+              link.download = `${filename}.${fileExtension}` // 设置下载文件名
+              document.body.appendChild(link)
+              link.click()
+              document.body.removeChild(link)
             } else {
             } else {
               reject('Download failed: ' + res.statusCode)
               reject('Download failed: ' + res.statusCode)
             }
             }

+ 78 - 69
src/packageWorkorder/pages/overDetail.vue

@@ -1,108 +1,117 @@
 <template>
 <template>
   <!-- #ifdef H5 -->
   <!-- #ifdef H5 -->
-	<zj-page-layout
-		:isScroll="true"
-		:hasFooter="false"
-		:refresherTriggered="refresherTriggered"
-		@refresherrefresh="refresherrefresh">
-		<view class="list-container">
-			<view class="item" v-for="(item, index) in dataList" :key="index">
+  <zj-page-layout
+    :isScroll="true"
+    :hasFooter="false"
+    :refresherTriggered="refresherTriggered"
+    @refresherrefresh="refresherrefresh"
+  >
+    <view class="list-container">
+      <view class="item" v-for="(item, index) in dataList" :key="index">
         <view class="row">
         <view class="row">
           <view class="label">采集时间</view>
           <view class="label">采集时间</view>
-          <view class="value">{{item.giveTime}}</view>
+          <view class="value">{{ item.giveTime }}</view>
         </view>
         </view>
         <view class="row">
         <view class="row">
           <view class="label">采集状态</view>
           <view class="label">采集状态</view>
-          <view class="value">{{item.status | statusFilter}}</view>
+          <view class="value">{{ item.status | statusFilter }}</view>
         </view>
         </view>
         <view class="row">
         <view class="row">
           <view class="label">主工程师</view>
           <view class="label">主工程师</view>
-          <view class="value">{{item.workerName}}</view>
+          <view class="value">{{ item.workerName }}</view>
         </view>
         </view>
-        <view class="row" v-if="item.pgOrderWorkers.filter(o=>!o.isMaster).length">
+        <view class="row" v-if="item.pgOrderWorkers.filter(o => !o.isMaster).length">
           <view class="label">辅工程师</view>
           <view class="label">辅工程师</view>
-          <view class="value">{{item.pgOrderWorkers.filter(o=>!o.isMaster).map(o => o.workerName).join(',')}}</view>
+          <view class="value">{{
+            item.pgOrderWorkers
+              .filter(o => !o.isMaster)
+              .map(o => o.workerName)
+              .join(',')
+          }}</view>
         </view>
         </view>
         <view class="row">
         <view class="row">
           <view class="label">采集图片</view>
           <view class="label">采集图片</view>
           <view class="images">
           <view class="images">
             <view class="it" v-for="(it, idx) in item.pgOrderProductDetails" :key="idx">
             <view class="it" v-for="(it, idx) in item.pgOrderProductDetails" :key="idx">
               <image :src="it.fileUrl" mode="aspectFill"></image>
               <image :src="it.fileUrl" mode="aspectFill"></image>
-              <view class="text">{{it.fileName}}</view>
+              <view class="text">{{ it.fileName }}</view>
             </view>
             </view>
           </view>
           </view>
         </view>
         </view>
-			</view>
-		</view>
+      </view>
+    </view>
 
 
-		<Loading :type="2" :loadStatus="loadStatus" :dataList="dataList" />
-	</zj-page-layout>
+    <Loading :type="2" :loadStatus="loadStatus" :dataList="dataList" />
+  </zj-page-layout>
   <!-- #endif -->
   <!-- #endif -->
 
 
   <!-- #ifndef H5 -->
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageWorkorder/pages/overDetail`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageWorkorder/pages/overDetail`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
   <!-- #endif -->
 </template>
 </template>
 
 
 <script>
 <script>
-  // #ifdef H5
-	export default {
-    filters: {
-      statusFilter(val) {
-        const MAP = {
-          WAIT: '待采集',
-          WAIT_SAVE: '待完善',
-          OK: '已采集',
-        }
-        return MAP[val]
-      }
-    },
+ // #ifdef H5
+export default {
+   filters: {
+     statusFilter(val) {
+       const MAP = {
+         WAIT: '待采集',
+         WAIT_SAVE: '待完善',
+         OK: '已采集',
+       }
+       return MAP[val]
+     }
+   },
 
 
-		data() {
-			return {
-				loadStatus: 1,
-				refresherTriggered: false,
-				dataList: [],
-			}
-		},
+	data() {
+		return {
+			loadStatus: 1,
+			refresherTriggered: false,
+			dataList: [],
+		}
+	},
+
+	async onLoad({id}) {
+		this.id = id;
+		this.getList();
+	},
 
 
-		async onLoad({id}) {
-			this.id = id;
+	methods: {
+		refresherrefresh(e) {
+			this.refresherTriggered = true;
 			this.getList();
 			this.getList();
 		},
 		},
 
 
-		methods: {
-			refresherrefresh(e) {
-				this.refresherTriggered = true;
-				this.getList();
-			},
-
-			getList() {
-				this.$api.post('/changeOrder/productDetailList', {
-          workerOrderId: this.id,
-				}).then(res => {
-					this.dataList = res.data;
-				}).finally(res => {
-					this.loadStatus = 0;
-					this.refresherTriggered = false;
-				})
-			},
-		}
+		getList() {
+			this.$api.post('/changeOrder/productDetailList', {
+         workerOrderId: this.id,
+			}).then(res => {
+				this.dataList = res.data;
+			}).finally(res => {
+				this.loadStatus = 0;
+				this.refresherTriggered = false;
+			})
+		},
 	}
 	}
+}
 
 
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
-    onLoad(pam) {
-      this.pam = pam;
-    }
-  }
-  // #endif
+ // #endif
+ // #ifndef H5
+ export default {
+   data() {
+     return {
+       pam: {},
+     }
+   },
+   onLoad(pam) {
+     this.pam = pam;
+   }
+ }
+ // #endif
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>