From 711f1644225a5ff10afa24dec8cafb1eb5343e6a Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期三, 22 十一月 2023 10:13:14 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before

---
 src/views/quality/exception/exception.vue |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/views/quality/exception/exception.vue b/src/views/quality/exception/exception.vue
index 1179697..0c49eae 100644
--- a/src/views/quality/exception/exception.vue
+++ b/src/views/quality/exception/exception.vue
@@ -31,8 +31,8 @@
             action="/mes/exception/upload"
             :headers="headers"
             :before-upload="submitUpload"
-            :on-preview="handlePreview"
             :on-remove="handleRemove"
+            :on-preview="handlePreview"
             :on-success="uploadSuccess"
             :data="paramData"
             :file-list="fileList"
@@ -41,7 +41,7 @@
           >
             <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button>
             <div slot="tip" class="el-upload__tip">
-              鍙兘涓婁紶jpg鍥剧墖锛屼笖涓嶈秴杩�2MB
+              鍙兘涓婁紶jpg/png鍥剧墖锛屼笖涓嶈秴杩�5MB
             </div>
           </el-upload>
         </el-col>
@@ -53,6 +53,9 @@
         @refreshDataList="getData"
       ></table-form>
     </div>
+    <el-dialog title="鍥剧墖棰勮" width="60%" :visible.sync="previewVisible" top="5vh">
+        <img style="width:100%;height: 70vh" :src="dialogImageUrl" alt="">
+    </el-dialog>
   </div>
 </template>
 <style lang="scss" scoped>
@@ -111,6 +114,8 @@
   },
   data() {
     return {
+      previewVisible: false,
+      dialogImageUrl: null,
       fileList: [],
       headers: {
         Authorization: 'Bearer ' + getStore({ name: 'access_token' })
@@ -293,7 +298,7 @@
       }
     },
     handlePreview(file) {
-      window.open(file.url)
+      this.previewVisible = true
     },
     uploadSuccess(response, file, fileList) {
       this.getFileList()
@@ -312,6 +317,7 @@
               fileEl = {}
               fileEl.name = attachment.original
               fileEl.url = attachment.url
+              this.dialogImageUrl = attachment.url
               fileEl.id = attachment.id
               fileEl.fileName = attachment.fileName
               this.fileList.push(fileEl)
@@ -320,10 +326,22 @@
         })
       }
     },
-    submitUpload() {
+    submitUpload(file) {
       console.info(this.currentRow && this.currentRow.id)
+      console.log(file);
       if (this.currentRow && this.currentRow.id) {
+        const maxSize = 5 * 1024 *1024
+        let jpgType = 'image/jpeg'
+        let pngType = 'image/png'
+        if(file.type != jpgType && file.type != pngType){
+          this.$message.error('鍙兘涓婁紶.jpg/.png绫诲瀷鐨勫浘鐗�')
+          return false
+        }
+        if(file.szie > maxSize){
+          this.$message.error('鍥剧墖澶у皬涓嶈兘瓒呰繃5MB')
+        }
         this.paramData.exceptionId = this.currentRow.id
+
       } else {
         this.$message.error('璇峰厛閫夋嫨鐢熶骇寮傚父璁板綍')
         return false

--
Gitblit v1.9.3