浏览代码

工资单-导出-名称修改

jingbb 8 月之前
父节点
当前提交
0916e6da95
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/views/oa/salary_management/personnelSalary/Payroll.vue

+ 4 - 2
src/views/oa/salary_management/personnelSalary/Payroll.vue

@@ -310,6 +310,8 @@
         },
         handleDownload(record){
           this.spinning = true
+          var titleFlie = moment(record.yearWithMonth).format('YYYY年MM月')
+          titleFlie =titleFlie+record.orgName+record.type
           downFile('/salary/salaryManagement/exportXls',{id:record.id,type:record.type}).then(data => {
              this.spinning = false
             if (!data) {
@@ -317,13 +319,13 @@
               return
             }
             if (typeof window.navigator.msSaveBlob !== 'undefined') {
-                window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }),  record.type + '.xlsx')
+                window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }),  titleFlie + '.xlsx')
             } else {
               let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
               let link = document.createElement('a')
               link.style.display = 'none'
               link.href = url
-              link.setAttribute('download',  record.type+'.xlsx')
+              link.setAttribute('download',  titleFlie+'.xlsx')
               document.body.appendChild(link)
               link.click()
               document.body.removeChild(link) // 下载完成移除元素