批量导出月结明细表
This commit is contained in:
parent
a732a51b9a
commit
ab0c96fdc8
|
|
@ -107,11 +107,6 @@ export const getUnitListByProjetctIds = (params) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 费用维修审核-提交
|
// 费用维修审核-提交
|
||||||
export function auditSltApi(data) {
|
export function auditSltApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
@ -121,7 +116,15 @@ export function auditSltApi(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
export function exportLeaseAll(data) {
|
||||||
|
return request({
|
||||||
|
url: 'material/sltAgreementInfo/exportLeaseAll',
|
||||||
|
method: 'post',
|
||||||
|
responseType: 'blob',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import router from './router'
|
||||||
import directive from './directive' // directive
|
import directive from './directive' // directive
|
||||||
import VueDOMPurifyHTML from 'vue-dompurify-html'
|
import VueDOMPurifyHTML from 'vue-dompurify-html'
|
||||||
import plugins from './plugins' // plugins
|
import plugins from './plugins' // plugins
|
||||||
import { download, downloadJson } from '@/utils/request'
|
import { download, downloadJson,downloadZip } from '@/utils/request'
|
||||||
|
|
||||||
import './assets/icons' // icon
|
import './assets/icons' // icon
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
|
|
@ -63,6 +63,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
|
||||||
Vue.prototype.selectDictLabels = selectDictLabels
|
Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
Vue.prototype.downloadJson = downloadJson
|
Vue.prototype.downloadJson = downloadJson
|
||||||
|
Vue.prototype.downloadZip = downloadZip
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
Vue.prototype.globalUrl = global_
|
Vue.prototype.globalUrl = global_
|
||||||
Vue.prototype.indexContinuation = indexContinuation
|
Vue.prototype.indexContinuation = indexContinuation
|
||||||
|
|
|
||||||
|
|
@ -270,4 +270,43 @@ export function downloadJson(url, params, filename, config) {
|
||||||
downloadLoadingInstance.close()
|
downloadLoadingInstance.close()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 通用下载方法
|
||||||
|
export function downloadZip(url, params, filename, config) {
|
||||||
|
downloadLoadingInstance = Loading.service({
|
||||||
|
text: '正在下载数据,请稍候',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
|
})
|
||||||
|
return service
|
||||||
|
.post(url, params, {
|
||||||
|
transformRequest: [
|
||||||
|
(params) => {
|
||||||
|
return params
|
||||||
|
},
|
||||||
|
],
|
||||||
|
headers: { 'Content-Type': 'application/json',encryptResponse: false },
|
||||||
|
responseType: 'blob',
|
||||||
|
...config,
|
||||||
|
})
|
||||||
|
.then(async (data) => {
|
||||||
|
const isBlob = blobValidate(data)
|
||||||
|
if (isBlob) {
|
||||||
|
const blob = new Blob([data])
|
||||||
|
saveAs(blob, filename)
|
||||||
|
} else {
|
||||||
|
const resText = await data.text()
|
||||||
|
const rspObj = JSON.parse(resText)
|
||||||
|
const errMsg =
|
||||||
|
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg)
|
||||||
|
}
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
|
.catch((r) => {
|
||||||
|
console.error(r)
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
|
}
|
||||||
export default service
|
export default service
|
||||||
|
|
|
||||||
|
|
@ -146,8 +146,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getUnitList, getProjectList } from '@/api/claimAndRefund/receive'
|
import { getUnitList, getProjectList } from '@/api/claimAndRefund/receive'
|
||||||
import { getSltAgreementInfo,getProjectListByUnitIds,getUnitListByProjetctIds } from '@/api/cost/cost'
|
import { getSltAgreementInfo,getProjectListByUnitIds,getUnitListByProjetctIds,exportLeaseAll } from '@/api/cost/cost'
|
||||||
|
import { downloadFile } from '@/utils/download'
|
||||||
import ExportDialog from './component/exportDialog.vue'
|
import ExportDialog from './component/exportDialog.vue'
|
||||||
import MonthRecord from './component/monthRecord.vue'
|
import MonthRecord from './component/monthRecord.vue'
|
||||||
import FinishAndDetails from './component/finishAndDetails.vue'
|
import FinishAndDetails from './component/finishAndDetails.vue'
|
||||||
|
|
@ -383,7 +383,10 @@ export default {
|
||||||
this.ids.forEach((e) => {
|
this.ids.forEach((e) => {
|
||||||
this.exportParams.push({
|
this.exportParams.push({
|
||||||
agreementId: e.agreementId,
|
agreementId: e.agreementId,
|
||||||
|
agreementCode: e.agreementCode,
|
||||||
costBearingParty: '',
|
costBearingParty: '',
|
||||||
|
projectName: e.projectName,
|
||||||
|
unitName: e.unitName,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -395,16 +398,19 @@ export default {
|
||||||
},
|
},
|
||||||
/** 确定按钮 */
|
/** 确定按钮 */
|
||||||
handleSubmit(form) {
|
handleSubmit(form) {
|
||||||
|
console.log("ppppppppppppppppp",form)
|
||||||
if (form.length === 1) {
|
if (form.length === 1) {
|
||||||
this.exportParams.forEach((e) => {
|
this.exportParams.forEach((e) => {
|
||||||
e.costBearingParty = form[0]
|
e.costBearingParty = form[0]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// exportLeaseAll(this.exportParams).then(res => {
|
||||||
this.downloadJson(
|
// downloadFile({ fileName: `月结明细_${new Date().getTime()}.zip`, fileData: res, fileType: 'application/zip;charset=utf-8' })
|
||||||
'material/sltAgreementInfo/exportSltInfoMonth',
|
// })
|
||||||
|
this.downloadZip(
|
||||||
|
'material/sltAgreementInfo/exportLeaseAll',
|
||||||
JSON.stringify(this.exportParams),
|
JSON.stringify(this.exportParams),
|
||||||
`月结明细${new Date().getTime()}.xlsx`,
|
`月结明细${new Date().getTime()}.zip`,
|
||||||
)
|
)
|
||||||
|
|
||||||
this.exportDialogVisible = false
|
this.exportDialogVisible = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue