Pārlūkot izejas kodu

Merge branch 'requirement_372' into debug

cldu 3 nedēļas atpakaļ
vecāks
revīzija
5f09ccedfa
1 mainītis faili ar 17 papildinājumiem un 13 dzēšanām
  1. 17 13
      src/views/datasheet_manage/customSheetEdit.vue

+ 17 - 13
src/views/datasheet_manage/customSheetEdit.vue

@@ -388,25 +388,29 @@ export default {
 
       if(!document.getElementsByClassName('table')[0]) return this.$message.warning(this.$t('OnlineExcelPage.please_add_table_msg') )
 
-      let canvas = await html2canvas(document.getElementsByClassName('table')[0],{
-        scale:2,
-        useCORS: true,
-        backgroundColor:null,
-        imageTimeout:0,
-        allowTaint:true,
-      })
-      let imagesrc = canvas.toDataURL('image/png');
-      // console.log(imagesrc)
-      const formData = new FormData();
-      formData.append('Image',imagesrc);
-      const { Data } = await dataBaseInterface.uploadImg(formData)
+      let Data = {};
+      if(!this.sheetId) {
+        let canvas = await html2canvas(document.getElementsByClassName('table')[0],{
+          scale:2,
+          useCORS: true,
+          backgroundColor:null,
+          imageTimeout:0,
+          allowTaint:true,
+        })
+        let imagesrc = canvas.toDataURL('image/png');
+        const formData = new FormData();
+        formData.append('Image',imagesrc);
+        const r = await dataBaseInterface.uploadImg(formData);
+        if(r.Ret != 200) return;
+        Data = r.Data;
+      }
 
       
       let params = {
         ExcelName: name,
         ExcelType: sheetType,
         ExcelClassifyId: classify,
-        ExcelImage: Data.ResourceUrl,
+        ExcelImage: this.sheetId ? '' : Data.ResourceUrl,
         Source: 2,
         TableData: this.$refs.customTableRef.getSaveParams(),
         SourcesFrom:this.sheetForm.SourcesFrom