Browse Source

文件类型特殊处理

liyuan 1 month ago
parent
commit
0c143b0179

+ 44 - 3
src/views/iosBasicData/SeafreightExportF/bills/assembly/mail-component.vue

@@ -111,7 +111,41 @@ export default {
                 attachments: [
                     { required: true, message: '请输入附件名', trigger: 'blur' }
                 ]
-            }
+            },
+            fileTypeList: [
+                {
+                    key: 'Pdf',
+                    value: 'pdf'
+                },
+                {
+                    key: 'ImageSvg',
+                    value: 'svg'
+                },
+                {
+                    key: 'Excel2007',
+                    value: 'xls'
+                },
+                {
+                    key: 'Text',
+                    value: 'txt'
+                },
+                {
+                    key: 'Html',
+                    value: 'html'
+                },
+                {
+                    key: 'Word2007',
+                    value: 'doc'
+                },
+                {
+                    key: 'Csv',
+                    value: 'csv'
+                },
+                {
+                    key: 'Csv',
+                    value: 'csv'
+                }
+            ]
         }
     },
     watch: {
@@ -149,13 +183,20 @@ export default {
         },
         sendEmail() {
             this.sending = true
+            let fileContentStrList = ["ImageSvg", "Html"]
+            let nowFile = this.fileTypeList.find(f => f.key === this.formData.fileType)
             let param = {
                 fileName: this.formData.attachments,
-                fileType: this.formData.fileType,
+                fileType: nowFile.value,
                 sendTo: this.formData.to,
                 mailTitle: this.formData.subject,
-                mailContent: this.formData.message,
+                mailContent: this.formData.content,
                 fileContent: this.formData.fileContent,
+                fileContentStr: ''
+            }
+            if (fileContentStrList.indexOf(this.formData.fileType) !== -1) {
+                param.fileContent = null
+                param.fileContentStr = this.formData.fileContent
             }
             generateMailFile(param).then(res => {
                 console.info(res)