|
@@ -64,7 +64,7 @@
|
|
|
import moment from 'moment'
|
|
|
import pick from 'lodash.pick'
|
|
|
import { FormTypes } from '@/utils/JEditableTableUtil'
|
|
|
- import { putAction,getAction,postAction } from '@/api/manage'
|
|
|
+ import { putAction,getAction,postAction,downFile } from '@/api/manage'
|
|
|
export default {
|
|
|
name: 'uploadModal',
|
|
|
components: {
|
|
@@ -126,6 +126,7 @@
|
|
|
}
|
|
|
},
|
|
|
handleOk(){
|
|
|
+
|
|
|
this.$refs.form.validate((valid,err) => {
|
|
|
if (valid) {
|
|
|
if(this.formState.type=='加班工资单'){
|
|
@@ -141,8 +142,20 @@
|
|
|
}
|
|
|
|
|
|
this.loading = true
|
|
|
+ let that = this;
|
|
|
postAction('/salary/salaryManagement/generatePayroll', this.formState).then((res) => {
|
|
|
if (res.success) {
|
|
|
+
|
|
|
+ if(res.data.ZZ){
|
|
|
+ that.handleDownload(res.data.ZZ,that.formState.type,"正织");
|
|
|
+ }
|
|
|
+ if(res.data.MFY){
|
|
|
+ that.handleDownload(res.data.MFY,that.formState.type,"马菲羊");
|
|
|
+ }
|
|
|
+ if(res.data.NBSY){
|
|
|
+ that.handleDownload(res.data.NBSY,that.formState.type,"宁波森宇");
|
|
|
+ }
|
|
|
+
|
|
|
this.$message.success(res.message);
|
|
|
this.handleCancel()
|
|
|
this.$emit('ok')
|
|
@@ -156,6 +169,30 @@
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ handleDownload(id,type,name){
|
|
|
+ downFile('/salary/salaryManagement/exportXls2',{id:id,type:type}).then(data => {
|
|
|
+
|
|
|
+ this.$message.success(name+type+"数据导出中,请稍后");
|
|
|
+
|
|
|
+ if (!data) {
|
|
|
+ this.$message.warning('文件下载失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
+ window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), name+type + '.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', name+type+'.xlsx')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link) // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
changeData(value){
|
|
|
this.formState.DateTime = value
|
|
|
},
|