Просмотр исходного кода

1.成本中心SOC COC 修改汇率日期 计算时 费用明细 汇率赋值错误的问题

Qukatie 7 месяцев назад
Родитель
Сommit
7f58370185

+ 7 - 0
src/api/iosBasicData/reports.js

@@ -79,4 +79,11 @@ export const fingenlegGetReportData = (row) => {
     method: 'get',
     params: row
   })
+}
+export const generateMailFile = (row) => {
+    return request({
+        url: '/api/blade-los/reports/generateMailFileAndSend',
+        method: 'post',
+        data: row
+    })
 }

+ 272 - 0
src/components/iosbasic-data/mail-component.vue

@@ -0,0 +1,272 @@
+<template>
+    <el-dialog title="发送邮件" :visible.sync="dialogVisible" append-to-body width="50%" :close-on-click-modal="false"
+        custom-class="email-dialog">
+        <el-form ref="emailForm" :model="formData" :rules="formRules" label-width="80px" label-position="right">
+            <el-form-item label="收件人" prop="to">
+                <el-input v-model="formData.to" placeholder="多个收件人用分号(;)分隔" clearable></el-input>
+            </el-form-item>
+
+            <el-form-item label="抄送" prop="cc">
+                <el-input v-model="formData.cc" placeholder="多个抄送人用分号(;)分隔" clearable></el-input>
+            </el-form-item>
+
+            <el-form-item label="密送" prop="bcc">
+                <el-input v-model="formData.bcc" placeholder="多个密送人用分号(;)分隔" clearable></el-input>
+            </el-form-item>
+
+            <el-form-item label="主题" prop="subject">
+                <el-input v-model="formData.subject" placeholder="请输入邮件主题" clearable></el-input>
+            </el-form-item>
+
+            <el-form-item label="正文" prop="content">
+                <avue-ueditor v-model="formData.content" :options="options"></avue-ueditor>
+            </el-form-item>
+
+            <el-form-item label="附件">
+                <el-input v-model="formData.attachments" placeholder="请输入文件名" clearable></el-input>
+            </el-form-item>
+        </el-form>
+
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="dialogVisible = false" size="medium">取 消</el-button>
+            <el-button type="primary" @click="submitForm" size="medium" :loading="sending">发 送</el-button>
+        </span>
+    </el-dialog>
+</template>
+
+<script>
+import { getToken } from "@/util/auth";
+import { generateMailFile } from "@/api/iosBasicData/reports";
+
+
+export default {
+    name: 'EmailDialog',
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        }
+    },
+    data() {
+        return {
+            dialogVisible: this.visible,
+            sending: false,
+            options: {
+                //普通上传地址
+                action: "/api/blade-resource/oss/endpoint/put-file",
+                customConfig: {
+                    menus: [
+                        'head',
+                        'bold',
+                        'fontSize',
+                        'fontName',
+                        'italic',
+                        'underline',
+                        'strikeThrough',
+                        'foreColor',
+                        'backColor',
+                        'link',
+                        'list',
+                        'justify',
+                        'quote',
+                        'emoticon',
+                        'image',
+                        'table',
+                        'undo',
+                        'redo'
+                    ],
+                },
+                headers: { "Blade-Auth": "Bearer " + getToken() },
+                props: {
+                    res: "data",
+                    url: 'link'
+                }
+            },
+            formData: {
+                to: '',
+                cc: '',
+                bcc: '',
+                subject: '',
+                content: '',
+                attachments: '',
+                fileType: '',
+                fileContent: ''
+            },
+            formRules: {
+                to: [
+                    { required: true, message: '请输入收件人邮箱', trigger: 'blur' },
+                    {
+                        validator: this.validateEmails,
+                        message: '邮箱格式不正确',
+                        trigger: 'blur'
+                    }
+                ],
+                subject: [
+                    { required: true, message: '请输入邮件主题', trigger: 'blur' },
+                    { max: 100, message: '主题长度不能超过100个字符', trigger: 'blur' }
+                ],
+                content: [
+                    { required: true, message: '请输入邮件正文', trigger: 'blur' }
+                ],
+                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: {
+        visible(newVal) {
+            this.dialogVisible = newVal
+        },
+        dialogVisible(newVal) {
+            this.$emit('update:visible', newVal)
+            if (!newVal) {
+                this.resetForm()
+            }
+        }
+    },
+    methods: {
+        validateEmails(rule, value, callback) {
+            if (!value) return callback()
+
+            const emails = value.split(';').filter(e => e.trim())
+            const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
+
+            for (const email of emails) {
+                if (!emailRegex.test(email.trim())) {
+                    return callback(new Error(rule.message))
+                }
+            }
+
+            callback()
+        },
+        submitForm() {
+            this.$refs.emailForm.validate(valid => {
+                if (valid) {
+                    this.sendEmail()
+                }
+            })
+        },
+        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: nowFile.value,
+                sendTo: this.formData.to,
+                mailTitle: this.formData.subject,
+                mailContent: this.formData.content,
+                fileContent: this.formData.fileContent,
+                fileContentStr: '',
+                sendCc: this.formData.cc,
+                sendBcc: this.formData.bcc
+            }
+            if (fileContentStrList.indexOf(this.formData.fileType) !== -1) {
+                param.fileContent = null
+                param.fileContentStr = this.formData.fileContent
+            }
+            generateMailFile(param).then(res => {
+                console.info(res)
+            })
+            // 模拟发送请求
+            setTimeout(() => {
+                this.$message.success('邮件发送成功')
+                this.sending = false
+                this.dialogVisible = false
+            }, 1500)
+        },
+        resetForm() {
+            this.$refs.emailForm.resetFields()
+            this.formData.attachments = ''
+        }
+    }
+}
+</script>
+
+<style lang="scss">
+.email-dialog {
+    border-radius: 8px;
+    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
+
+    .el-dialog__header {
+        border-bottom: 1px solid #f0f0f0;
+        padding: 15px 20px;
+
+        .el-dialog__title {
+            font-size: 18px;
+            font-weight: 600;
+            color: #333;
+        }
+    }
+
+    .el-dialog__body {
+        padding: 20px 30px;
+
+        .el-form-item {
+            margin-bottom: 22px;
+
+            .el-form-item__label {
+                color: #666;
+                font-weight: normal;
+            }
+
+            .el-input__inner,
+            .el-textarea__inner {
+                border-radius: 4px;
+                transition: border-color 0.3s;
+
+                &:focus {
+                    border-color: #409eff;
+                    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
+                }
+            }
+        }
+    }
+
+    .el-dialog__footer {
+        border-top: 1px solid #f0f0f0;
+        padding: 15px 20px;
+        text-align: right;
+
+        .el-button {
+            min-width: 80px;
+            border-radius: 4px;
+        }
+    }
+}
+</style>

+ 1 - 0
src/main.js

@@ -33,6 +33,7 @@ import './util/directives.js'
 import Avue from '@smallwei/avue';
 import '@smallwei/avue/lib/index.css';
 Vue.use(Avue);
+Vue.use(avueUeditor)
 //地图回放
 import trackPlayback from "@/components/trackPlayback"
 //客户选择组件

+ 3 - 5
src/views/iosBasicData/OceanFreightImport/bills/assembly/feecenter.vue

@@ -2495,7 +2495,7 @@ export default {
                         //     }
                         // })
                         // 计算金额
-                        this.$set(row, 'amount', Number(row.price) * Number(row.quantity ? row.quantity : 0))
+                        this.$set(row, 'amount', Number(row.price?row.price:0) * Number(row.quantity ? row.quantity : 0))
                         if (row.curCode == this.getLocalCurrency()) {
                             this.$set(row, 'rmbAmount', row.amount.toFixed(2))
                             this.$set(row, 'usdAmount', '')
@@ -2615,8 +2615,7 @@ export default {
         },
         // 单价
         priceinputfun(value, row) {
-            let price = Number(row.price),
-                qty = Number(row.quantity)
+            let price = Number(row.price?row.price:0), qty = Number(row.quantity?row.quantity:0)
             if (isNaN(price)) {
                 price = 0.00
                 this.$set(row, 'price', price)
@@ -2660,8 +2659,7 @@ export default {
         },
         // 数量
         quantityinputfun(row) {
-            let price = Number(row.price),
-                qty = Number(row.quantity)
+            let price = Number(row.price?row.price:0), qty = Number(row.quantity?row.quantity:0)
             if (isNaN(price)) {
                 price = 0.00
                 this.$set(row, 'price', price)

+ 1 - 0
src/views/iosBasicData/SeafreightExportF/bills/assembly/DocumentCenter.vue

@@ -449,6 +449,7 @@ export default {
                 res.data.data.data.vgmDeadline = res.data.data.data.cyTrailerTime
                 res.data.data.data.vgmDeadline2 = res.data.data.data.cyReturnTime
                 res.data.data.data.hlclBoxenvoy=res.data.data.data.polFreeBoxUseDays
+               res.data.data.data.forwarding=res.data.data.data.foreignAgencyDetails
                 this.documentForm = res.data.data.data
                 // 联系人
                 this.documentForm.corpAttnName = this.documentForm.corpAttnName + '' + this.documentForm.corpAttnTel

+ 36 - 24
src/views/iosBasicData/SeafreightExportF/bills/assembly/businessReports.vue

@@ -12,6 +12,7 @@
       </template>
     </avue-crud>
     <reportContainer ref="reportContainer"></reportContainer>
+    <mail-component ref="mailComponentRef" />
   </div>
 </template>
 
@@ -22,10 +23,11 @@ import { mapGetters } from "vuex";
 import { billsDetail } from '@/api/iosBasicData/bills'
 import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
 import reportContainer from "@/views/iosBasicData/report-container/report-container.vue"
-
+import mailComponent from "@/components/iosbasic-data/mail-component.vue";
 export default {
   components: {
-    reportContainer
+    reportContainer,
+    mailComponent
   },
   props: {
     id: {
@@ -35,10 +37,10 @@ export default {
       type: Boolean,
       default: false,
     },
-      classifycode:{
-          type: String,
-          default: '',
-      },
+    classifycode: {
+      type: String,
+      default: '',
+    },
   },
   data() {
     return {
@@ -142,27 +144,27 @@ export default {
     };
   },
   async created() {
-      if(!!this.classifycode) {
-          this.query.classifyCode = this.classifycode;
-          this.classifyCodeReadonly = true;
-          let col = this.optionBack.column.find(c=>c.prop=="classifyCode")
-          if(col){
-              col.search = false;
-          }
+    if (!!this.classifycode) {
+      this.query.classifyCode = this.classifycode;
+      this.classifyCodeReadonly = true;
+      let col = this.optionBack.column.find(c => c.prop == "classifyCode")
+      if (col) {
+        col.search = false;
       }
+    }
 
-      this.option = await this.getColumnData(this.getColumnName(312.4), this.optionBack);
-      console.log('report.create', this.option)
+    this.option = await this.getColumnData(this.getColumnName(312.4), this.optionBack);
+    console.log('report.create', this.option)
 
-      getUserApprovalList().then(res => {
-          this.findObject(this.option.column, "authorizedUsersId").dicData = res.data.data
-      })
-      // 获取业务类型
-      bbusinesstypeList(1, 20).then(res => {
-          this.findObject(this.option.column, "businessType").dicData = res.data.data.records
-      })
+    getUserApprovalList().then(res => {
+      this.findObject(this.option.column, "authorizedUsersId").dicData = res.data.data
+    })
+    // 获取业务类型
+    bbusinesstypeList(1, 20).then(res => {
+      this.findObject(this.option.column, "businessType").dicData = res.data.data.records
+    })
   },
-  async mounted () {
+  async mounted() {
   },
   computed: {
     ...mapGetters(["permission"]),
@@ -542,6 +544,13 @@ export default {
         this.handleReportPreview(url, res.data.data.data)
       })
     },
+    testMail(e) {
+      console.info('eeeeeeeeeeeeeeeeeeee----', e)
+      this.$refs.mailComponentRef.dialogVisible = true
+      this.$refs.mailComponentRef.formData.attachments = e.fileName
+      this.$refs.mailComponentRef.formData.fileType = e.formatName
+      this.$refs.mailComponentRef.formData.fileContent = e.data
+    },
     // 预览报表
     handleReportPreview(url, row) {
       Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
@@ -563,6 +572,9 @@ export default {
       options.exports.showExportToDocument = false // 显示导出到文档
       options.toolbar.showParametersButton = true // 显示参数按钮
       options.appearance.bookmarksPrint = true // 书签打印
+      options.toolbar.showSendEmailButton = true // 显示发送邮件按钮
+      options.email.showEmailDialog = false
+      options.email.showExportDialog = false
       // options.toolbar.showPrintButton = false // 打印按钮是否显示   下面直接自定义控制打印弹窗是否开启
 
       // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
@@ -573,7 +585,7 @@ export default {
       options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
       // 是创建一个 Stimulsoft 报表查看器的实例的代码
       let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
-
+      viewer.onEmailReport = this.testMail
       // 报表
       console.log("创建一个报表实例");
       let report = new window.Stimulsoft.Report.StiReport();

+ 7 - 7
src/views/iosBasicData/SeafreightExportF/bills/assembly/feecenter.vue

@@ -167,12 +167,12 @@
                 </template>
                 <template slot="price" slot-scope="{ row }">
                     <el-input-number v-if="row.edit" v-model="row.price" size="small" :controls="false" :precision="3"
-                        placeholder="请输入" @blur="priceinputfun($event, row)"></el-input-number>
+                        placeholder="请输入" @blur="priceinputfun($event, row)" style="width: 100%;"></el-input-number>
                     <span v-else>{{ row.price }}</span>
                 </template>
                 <template slot="quantity" slot-scope="{ row }">
                     <el-input-number v-if="row.edit" v-model="row.quantity" size="small" :controls="false"
-                        :precision="3" placeholder="请输入" @blur="quantityinputfun(row)"></el-input-number>
+                        :precision="3" placeholder="请输入" @blur="quantityinputfun(row)" style="width: 100%;"></el-input-number>
                     <span v-else>{{ row.quantity }}</span>
                 </template>
                 <template slot="remarks" slot-scope="{ row }">
@@ -317,12 +317,12 @@
                 </template>
                 <template slot="price" slot-scope="{ row }">
                     <el-input-number v-if="row.edit" v-model="row.price" size="small" :controls="false" :precision="2"
-                        placeholder="请输入" @blur="priceinputfun($event, row)"></el-input-number>
+                        placeholder="请输入" @blur="priceinputfun($event, row)" style="width: 100%;"></el-input-number>
                     <span v-else>{{ row.price }}</span>
                 </template>
                 <template slot="quantity" slot-scope="{ row }">
                     <el-input-number v-if="row.edit" v-model="row.quantity" size="small" :controls="false"
-                        :precision="3" placeholder="请输入" @blur="quantityinputfun(row)"></el-input-number>
+                        :precision="3" placeholder="请输入" @blur="quantityinputfun(row)" style="width: 100%;"></el-input-number>
                     <span v-else>{{ row.quantity }}</span>
                 </template>
                 <template slot="remarks" slot-scope="{ row }">
@@ -2461,7 +2461,7 @@ export default {
                         //     }
                         // })
                         // 计算金额
-                        this.$set(row, 'amount', Number(row.price) * Number(row.quantity ? row.quantity : 0))
+                        this.$set(row, 'amount', Number(row.price?row.price:0) * Number(row.quantity ? row.quantity : 0))
                         if (row.curCode == this.getLocalCurrency()) {
                             this.$set(row, 'rmbAmount', row.amount.toFixed(2))
                             this.$set(row, 'usdAmount', '')
@@ -2579,7 +2579,7 @@ export default {
         },
         // 单价
         priceinputfun(value, row) {
-            let price = Number(row.price), qty = Number(row.quantity)
+            let price = Number(row.price?row.price:0), qty = Number(row.quantity?row.quantity:0)
             if (isNaN(price)) {
                 price = 0.00
                 this.$set(row, 'price', price)
@@ -2623,7 +2623,7 @@ export default {
         },
         // 数量
         quantityinputfun(row) {
-            let price = Number(row.price), qty = Number(row.quantity)
+            let price = Number(row.price?row.price:0), qty = Number(row.quantity?row.quantity:0)
             if (isNaN(price)) {
                 price = 0.00
                 this.$set(row, 'price', price)

+ 2 - 2
src/views/iosBasicData/costcenter/coc/detailsPage.vue

@@ -1220,7 +1220,7 @@ export default {
                 item.podIncome = 0
                 item.exrate = this.getExchangeRate(item.curCode, 'D', 1)
                 this.polFeeList.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         polSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         polIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))
@@ -1229,7 +1229,7 @@ export default {
                     }
                 })
                 this.podFeeList.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         podSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         podIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))

+ 5 - 5
src/views/iosBasicData/costcenter/soc/detailsPage.vue

@@ -1862,7 +1862,7 @@ export default {
                 item.podIncomeTwo = 0
                 item.exrate = this.getExchangeRate(item.curCode, 'D', 1)
                 this.polFeeList.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         polSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         polIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))
@@ -1871,7 +1871,7 @@ export default {
                     }
                 })
                 this.podFeeList.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         podSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         podIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))
@@ -1880,7 +1880,7 @@ export default {
                     }
                 })
                 this.polFeeList2.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         polSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         polIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))
@@ -1889,7 +1889,7 @@ export default {
                     }
                 })
                 this.podFeeList2.forEach(e => {
-                    e.exrate = this.getExchangeRate(item.curCode, 'D', 1)
+                    e.exrate = this.getExchangeRate(e.curCode, 'D', 1)
                     if (item.boxType == e.boxType) {
                         podSUM += _.multiply(Number(e.costPrice ? e.costPrice : 0), Number(e.exrate ? e.exrate : 0))
                         podIncomeSUM += _.multiply(Number(e.salesPrice ? e.salesPrice : 0), Number(e.exrate ? e.exrate : 0))
@@ -2229,7 +2229,7 @@ export default {
                 }
             }
             if (name == 'exrateDate') {
-                await this.checkRate(null, this.form.exrateDate, null, 1, this.form.belongingCompanyId)
+                await this.checkRate(null, row, null, 1, this.form.belongingCompanyId)
                 this.exrateDateCount()
             }