费用结算导出接口对接
This commit is contained in:
parent
7f33b1a081
commit
6dcf7aae60
|
|
@ -12,7 +12,7 @@ import store from './store'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import directive from './directive' // directive
|
import directive from './directive' // directive
|
||||||
import plugins from './plugins' // plugins
|
import plugins from './plugins' // plugins
|
||||||
import { download } from '@/utils/request'
|
import { download,downloadCost } from '@/utils/request'
|
||||||
|
|
||||||
import './assets/icons' // icon
|
import './assets/icons' // icon
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
|
|
@ -48,6 +48,7 @@ Vue.prototype.addDateRange = addDateRange
|
||||||
Vue.prototype.selectDictLabel = selectDictLabel
|
Vue.prototype.selectDictLabel = selectDictLabel
|
||||||
Vue.prototype.selectDictLabels = selectDictLabels
|
Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
|
Vue.prototype.downloadCost = downloadCost
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
|
|
||||||
// 全局组件挂载
|
// 全局组件挂载
|
||||||
|
|
|
||||||
|
|
@ -149,4 +149,30 @@ export function download(url, params, filename, config) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 通用下载方法
|
||||||
|
export function downloadCost(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' },
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
<el-row style="width: 100%;">
|
<el-row style="width: 100%;">
|
||||||
<el-col :span="18">
|
<el-col :span="18">
|
||||||
<el-button type="primary" size="mini" >租赁明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport1">租赁明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >丢失明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport2">丢失明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >维修明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport3">维修明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >报废明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport4">报废明细导出</el-button>
|
||||||
<el-button type="warning" size="mini" >全部明细导出</el-button>
|
<el-button type="warning" size="mini" @click="handleExportAll">全部明细导出</el-button>
|
||||||
<el-button type="success" size="mini" @click="handleAdd">提交</el-button>
|
<el-button type="success" size="mini" @click="handleAdd">提交</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAgreementList,getUnitList, getProjectList } from "@/api/claimAndRefund/receive";
|
import { getAgreementList,getUnitList, getProjectList } from "@/api/claimAndRefund/receive";
|
||||||
import { getSltInfo,submitFee } from "@/api/cost/cost";
|
import { getSltInfo,submitFee,exportLease } from "@/api/cost/cost";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Agreement",
|
name: "Agreement",
|
||||||
|
|
@ -389,10 +389,28 @@
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
//租赁
|
||||||
// this.download('material/agreementInfo/export', {
|
handleExport1() {
|
||||||
// ...this.queryParams
|
this.downloadCost('material/sltAgreementInfo/exportLease',JSON.stringify(this.rowData), `租赁费用明细_${new Date().getTime()}.xlsx`)
|
||||||
// }, `协议_${new Date().getTime()}.xlsx`)
|
},
|
||||||
|
//丢失
|
||||||
|
handleExport2() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportLose',JSON.stringify(this.rowData), `丢失费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
// 维修
|
||||||
|
handleExport3() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportRepair',JSON.stringify(this.rowData), `维修费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
//报废
|
||||||
|
handleExport4() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportScrap',JSON.stringify(this.rowData), `报废费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
handleExportAll() {
|
||||||
|
this.handleExport1()
|
||||||
|
this.handleExport2()
|
||||||
|
this.handleExport3()
|
||||||
|
this.handleExport4()
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
<el-row style="width: 100%;">
|
<el-row style="width: 100%;">
|
||||||
<el-col :span="18">
|
<el-col :span="18">
|
||||||
<el-button type="primary" size="mini" >租赁明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport1">租赁明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >丢失明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport2">丢失明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >维修明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport3">维修明细导出</el-button>
|
||||||
<el-button type="primary" size="mini" >报废明细导出</el-button>
|
<el-button type="primary" size="mini" @click="handleExport4">报废明细导出</el-button>
|
||||||
<el-button type="warning" size="mini" >全部明细导出</el-button>
|
<el-button type="warning" size="mini" @click="handleExportAll">全部明细导出</el-button>
|
||||||
<el-button type="success" size="mini" @click="handleExame">审批</el-button>
|
<el-button type="success" size="mini" @click="handleExame">审批</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-button type="danger" size="mini" style="float: right;" @click="handleBack">返回</el-button>
|
<el-button type="danger" size="mini" style="float: right;" @click="handleBack">返回</el-button>
|
||||||
|
|
@ -350,10 +350,28 @@ export default {
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
//租赁
|
||||||
// this.download('material/agreementInfo/export', {
|
handleExport1() {
|
||||||
// ...this.queryParams
|
this.downloadCost('material/sltAgreementInfo/exportLease',JSON.stringify(this.rowData), `租赁费用明细_${new Date().getTime()}.xlsx`)
|
||||||
// }, `协议_${new Date().getTime()}.xlsx`)
|
},
|
||||||
|
//丢失
|
||||||
|
handleExport2() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportLose',JSON.stringify(this.rowData), `丢失费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
// 维修
|
||||||
|
handleExport3() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportRepair',JSON.stringify(this.rowData), `维修费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
//报废
|
||||||
|
handleExport4() {
|
||||||
|
this.downloadCost('material/sltAgreementInfo/exportScrap',JSON.stringify(this.rowData), `报废费用明细_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
handleExportAll() {
|
||||||
|
this.handleExport1()
|
||||||
|
this.handleExport2()
|
||||||
|
this.handleExport3()
|
||||||
|
this.handleExport4()
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue