licp
2024-06-07 32a95699e59c5c65e18c08643266c9cbfa380ee4
src/components/do/b3-work-time-management/work-time-management.vue
@@ -333,6 +333,7 @@
               requiredAdd: [],
               requiredUp: []
         },
      addFileVisible:false,
      entityCopy1: {},
      upIndex1:100,
      weekList:[
@@ -467,9 +468,13 @@
      let entity = {}
      if(this.entity.week1&&this.entity.week2){
        entity.week = JSON.stringify([this.entity.week1,this.entity.week2])
      }else{
        entity.week = ''
      }
      if(this.entity.dateTime){
        entity.dateTime = JSON.stringify(this.entity.dateTime)
      }else{
        entity.dateTime = ''
      }
      entity.weekDay = this.entity.weekDay
      entity.name = this.entity.name
@@ -698,35 +703,16 @@
    },
    handleOut(){
      this.outLoading = true
      this.$axios.post(this.$api.auxiliaryOutputWorkingHours.exportWorkingHours,{responseType: 'blob'}).then(res => {
      this.$axios.get(this.$api.auxiliaryOutputWorkingHours.exportWorkingHours,{responseType: "blob"}).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        // let fileName="日工时汇总表";
        // const blob = new Blob([res], {
        //   type: 'application/force-download'
        // })
        // const filename = decodeURI(fileName+'.xlsx')
        // // 创建一个超链接,将文件流赋进去,然后实现这个超链接的单击事件
        // const elink = document.createElement('a')
        // elink.download = filename
        // elink.style.display = 'none'
        // elink.href = URL.createObjectURL(blob)
        // document.body.appendChild(elink)
        // elink.click()
        // URL.revokeObjectURL(elink.href) // 释放URL 对象
        // document.body.removeChild(elink)
        const blob = new Blob([res], {
          type: 'application/force-download'
        })
        const link = document.createElement('a')
        link.href = URL.createObjectURL(blob)
        link.download = decodeURI('日工时汇总表'+'.xlsx')
        document.body.appendChild(link)
        link.click()
        window.setTimeout(function () {
            URL.revokeObjectURL(blob)
            document.body.removeChild(link)
        }, 0)
        const blob = new Blob([res]);
        console.log(blob)
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '日工时汇总表.xlsx';
        link.click();
      })
    },
  }