ZaiZai 10 kuukautta sitten
vanhempi
commit
ef5fd32486
2 muutettua tiedostoa jossa 22 lisäystä ja 6 poistoa
  1. 9 0
      src/api/certificate/list.js
  2. 13 6
      src/views/certificate/lists/addList.vue

+ 9 - 0
src/api/certificate/list.js

@@ -91,6 +91,15 @@ export const addFileInfo = (data) => {
     })
 }
 
+//上传签名体图片
+export const compressAndUpload = (data) => {
+  return request({
+    url: '/api/blade-manager/signPfxFile/compressAndUpload',
+    method: 'post',
+    data
+  })
+}
+
 //修改
 export const update = (data) => {
     return request({

+ 13 - 6
src/views/certificate/lists/addList.vue

@@ -263,7 +263,7 @@
 </template>
 
 <script>
-import { save, getById, findUserByName, queryRole, queryProjectAndContract, addFileInfo, update, findPfxType, picPresave, prePicture } from "@/api/certificate/list";
+import { save, getById, findUserByName, queryRole, queryProjectAndContract, addFileInfo, update, findPfxType, picPresave, prePicture, compressAndUpload } from "@/api/certificate/list";
 import {getDictionary as getDictbiz} from "@/api/system/dictbiz";
 export default {
   data () {
@@ -394,7 +394,7 @@ export default {
           }
 
           if (this.form.signatureFileUrl[0]&&this.form.signatureFileUrl[0].name && this.form.signatureFileUrl[0].status === "ready") {
-            let fileData = await this.addFileInfo(this.form.signatureFileUrl[0].raw);
+            let fileData = await this.compressAndUploadApi(this.form.signatureFileUrl[0].raw, fromData.wide, fromData.high);
             fromData.signatureFileUrl = fileData.link;
             fromData.signatureFileName = fileData.originalName;
           } else {
@@ -443,6 +443,17 @@ export default {
       })
     },
 
+    async compressAndUploadApi(file, wide, high) {
+      let fromData = new FormData();
+      fromData.append('file', file);
+      fromData.append('wide', wide);
+      fromData.append('high', high);
+      const { data: res } = await compressAndUpload(fromData)
+      if (res.code == 200) {
+        return res.data;
+      }
+    },
+
     deleteSignPfxDeputie (key) {//删除关联项目
       this.form.signPfxDeputieList.splice(key, 1)
     },
@@ -562,7 +573,6 @@ export default {
         // this.form.signPfxDeputieList.forEach((val, key) => {
         //   this.ContractSection.push(res.data[key].contractInfoList)
         // })
-
         if(this.form.signPfxDeputieList.length > 0){
             this.form.signPfxDeputieList.forEach((val, key) => {
               this.projectMeiju.forEach((project, key) => {
@@ -572,7 +582,6 @@ export default {
               })
             })
         }
-
         console.log(this.form.signPfxDeputieList);
       }
     },
@@ -633,10 +642,8 @@ export default {
       if(val==1){
         console.log(this.form.company,'公司');
         this.form.company=2
-
         this.$forceUpdate();//强制刷新视图
         this.updateDependentFieldValidation()
-
       }
     },
     //保存