导出申请评估记录
This commit is contained in:
@@ -40,3 +40,13 @@ export function parseAssessmentApplyFromText(data) {
|
|||||||
timeout: 120000
|
timeout: 120000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 按租户与申请日期时间范围导出申请评估 Excel */
|
||||||
|
export function exportLbAssessmentApply(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbAssessmentApply/export',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<el-card class="action-container" shadow="never">
|
<el-card class="action-container" shadow="never">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button type="success" icon="el-icon-download" :loading="exportLoading" @click="openExportDialog">导出</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="table-container" shadow="never">
|
<el-card class="table-container" shadow="never">
|
||||||
@@ -65,6 +66,26 @@
|
|||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog title="导出申请评估" :visible.sync="exportDialogVisible" width="520px" @close="resetExportForm">
|
||||||
|
<el-form ref="exportFormRef" :model="exportForm" :rules="exportRules" label-width="140px">
|
||||||
|
<el-form-item label="申请日期" prop="applicationDateRange">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.applicationDateRange"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="exportLoading" @click="submitExport">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-dialog-drag :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
<el-dialog v-dialog-drag :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
||||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
||||||
<template v-if="!isEdit">
|
<template v-if="!isEdit">
|
||||||
@@ -208,6 +229,7 @@
|
|||||||
import {
|
import {
|
||||||
addLbAssessmentApply,
|
addLbAssessmentApply,
|
||||||
deleteLbAssessmentApply,
|
deleteLbAssessmentApply,
|
||||||
|
exportLbAssessmentApply,
|
||||||
getLbAssessmentApplyList,
|
getLbAssessmentApplyList,
|
||||||
parseAssessmentApplyFromText,
|
parseAssessmentApplyFromText,
|
||||||
updateLbAssessmentApply
|
updateLbAssessmentApply
|
||||||
@@ -221,6 +243,8 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
parseAiLoading: false,
|
parseAiLoading: false,
|
||||||
|
exportLoading: false,
|
||||||
|
exportDialogVisible: false,
|
||||||
assessmentApplyText: '',
|
assessmentApplyText: '',
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -272,6 +296,12 @@ export default {
|
|||||||
formRules: {
|
formRules: {
|
||||||
applicantName: [{ required: true, message: '请输入申请人', trigger: 'blur' }],
|
applicantName: [{ required: true, message: '请输入申请人', trigger: 'blur' }],
|
||||||
applicantPhone: [{ required: true, message: '请输入申请人电话', trigger: 'blur' }]
|
applicantPhone: [{ required: true, message: '请输入申请人电话', trigger: 'blur' }]
|
||||||
|
},
|
||||||
|
exportForm: {
|
||||||
|
applicationDateRange: []
|
||||||
|
},
|
||||||
|
exportRules: {
|
||||||
|
applicationDateRange: [{ required: true, message: '请选择申请日期范围', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -416,6 +446,61 @@ export default {
|
|||||||
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
openExportDialog() {
|
||||||
|
this.exportDialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.exportFormRef) this.$refs.exportFormRef.clearValidate()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submitExport() {
|
||||||
|
this.$refs.exportFormRef.validate((valid) => {
|
||||||
|
if (!valid) return
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const range = this.exportForm.applicationDateRange || []
|
||||||
|
const startDate = range[0]
|
||||||
|
const endDate = range[1]
|
||||||
|
if (!startDate || !endDate) {
|
||||||
|
this.$message.warning('请选择申请日期范围')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const applicationDatetimeStart = `${startDate} 00:00:00`
|
||||||
|
const applicationDatetimeEnd = `${endDate} 23:59:59`
|
||||||
|
this.exportLoading = true
|
||||||
|
exportLbAssessmentApply({
|
||||||
|
tenantId,
|
||||||
|
applicationDatetimeStart,
|
||||||
|
applicationDatetimeEnd
|
||||||
|
})
|
||||||
|
.then((blob) => {
|
||||||
|
const safeBlob = blob instanceof Blob ? blob : new Blob([blob], {
|
||||||
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
})
|
||||||
|
const url = window.URL.createObjectURL(safeBlob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = `lbAssessmentApply_${startDate}_${endDate}_${tenantId}.xlsx`
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
this.$message.success('导出成功')
|
||||||
|
this.exportDialogVisible = false
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.exportLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetExportForm() {
|
||||||
|
if (this.$refs.exportFormRef) this.$refs.exportFormRef.resetFields()
|
||||||
|
this.exportForm = {
|
||||||
|
applicationDateRange: []
|
||||||
|
}
|
||||||
|
},
|
||||||
handleEdit(row) {
|
handleEdit(row) {
|
||||||
this.dialogTitle = '编辑评估申请'
|
this.dialogTitle = '编辑评估申请'
|
||||||
this.isEdit = true
|
this.isEdit = true
|
||||||
|
|||||||
Reference in New Issue
Block a user