Commit 200c6fb0 by chenwq

```

feat(claims): 添加核赔订单批量导入功能

- 新增批量导入核赔订单API接口(batchImportGHClaims)
- 新增导出批量导入错误文件API接口(exportBatchImportError)
- 创建批量导入组件(src/views/claims/components/batchImport.vue)
- 在核赔订单列表页面添加导入按钮和功能
- 支持xlsx格式文件导入和错误文件导出
- 实现导入进度显示和结果统计功能
```
1 parent 78f2b91c
...@@ -135,6 +135,31 @@ const getGHClaimsListApi = params => { ...@@ -135,6 +135,31 @@ const getGHClaimsListApi = params => {
sign: true sign: true
}) })
} }
// 批量导入核赔订单
const batchImportGHClaims = params => {
params.method = 'scrm.api.equity.service.claims.batch.import'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file'],
returnAll: true
})
}
// 导出核赔订单批量导入错误文件
const exportBatchImportError = params => {
params.method = 'scrm.api.equity.service.claims.batch.import.error.export'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 新增跟进记录 // 新增跟进记录
const addGHClaimFollowsListApi = params => { const addGHClaimFollowsListApi = params => {
params.method = 'scrm.api.equity.service.claims.operate.followLog.create' params.method = 'scrm.api.equity.service.claims.operate.followLog.create'
...@@ -472,4 +497,4 @@ const getFollowListApi = params => { ...@@ -472,4 +497,4 @@ const getFollowListApi = params => {
sign: true sign: true
}) })
} }
export default { renewalAudit, getMerchantApi, getMidMerchantApi, getBigMerchantApi, saveSign, saveClaimsCG, saveCG, cancelClaims, batchPassApi, checkClaimsOrderApi, checkOrderApi, getOrderOherInfo, uploadImgApi, getGHCountApi, getGHPhoneImageApi, getGHattachmentApi, getGHClaimsDetailApi, getGHhistoryListApi, checkGHClaimsListApi, exportGHClaimsListApi, getExportUrlApi, getGHClaimFollowsListApi, addGHClaimFollowsListApi, getGHClaimsListApi, getclaimsList, getclaimsCount, resubmitOrder, commitClaimsOrder, getClaimsDetail, exportClaimsData, checkContractNo, getDetailByWOCode, getBankList, getCityList, getAccountInfo, getFollowPersonList, delFollowPerson, addFollowPerson, getMerchantSubList, delCaseApi, getDjClaimsDetailApi, checkDjOrderApi, checkDjClaimsOrderApi, getFollowListApi } export default { renewalAudit, getMerchantApi, getMidMerchantApi, getBigMerchantApi, saveSign, saveClaimsCG, saveCG, cancelClaims, batchPassApi, checkClaimsOrderApi, checkOrderApi, getOrderOherInfo, uploadImgApi, getGHCountApi, getGHPhoneImageApi, getGHattachmentApi, getGHClaimsDetailApi, getGHhistoryListApi, checkGHClaimsListApi, exportGHClaimsListApi, getExportUrlApi, getGHClaimFollowsListApi, addGHClaimFollowsListApi, getGHClaimsListApi, batchImportGHClaims, exportBatchImportError, getclaimsList, getclaimsCount, resubmitOrder, commitClaimsOrder, getClaimsDetail, exportClaimsData, checkContractNo, getBankList, getCityList, getAccountInfo, getFollowPersonList, delFollowPerson, addFollowPerson, getMerchantSubList, delCaseApi, getDjClaimsDetailApi, checkDjOrderApi, checkDjClaimsOrderApi, getFollowListApi }
<template>
<el-dialog title="批量导入" width="800px" :visible="visible" :close-on-click-modal="false" :close-on-press-escape="!importing" :show-close="!importing" :before-close="handleClose" @update:visible="handleDialogVisible">
<div class="import-content">
<div class="form-item">
<span class="label">导入文件:</span>
<div class="file-area">
<el-button size="small" icon="el-icon-plus" :disabled="importing" @click="$refs.fileInput.click()">导入文件</el-button>
<input ref="fileInput" class="file-input" type="file" accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" :disabled="importing" @change="selectFile" />
<a class="template-link" :href="templateUrl" download>模板下载</a>
<p v-if="file.name" class="file-name">
{{ file.name }}
<el-button type="text" :disabled="importing" icon="el-icon-close" @click="removeFile"></el-button>
</p>
</div>
</div>
<p v-if="importing" class="importing-tip">导入中,请稍候...</p>
<div v-if="hasResult" class="result">
<p>共导入{{ result.totalCount }}条,成功{{ result.successCount }}条,失败{{ result.failCount }}条</p>
<el-button v-if="result.failCount > 0" type="text" @click="downloadErrorFile">导出错误文件</el-button>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button v-if="importing" disabled>导入中,请稍候...</el-button>
<template v-else>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="startImport">确定</el-button>
</template>
</span>
</el-dialog>
</template>
<script>
const TEMPLATE_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/xlsx/核赔订单导入模板.xlsx'
export default {
name: 'ClaimsBatchImport',
props: { visible: { type: Boolean, default: false } },
data() {
return {
file: {},
importing: false,
hasResult: false,
templateUrl: TEMPLATE_URL,
result: { totalCount: 0, successCount: 0, failCount: 0, batchId: '' }
}
},
methods: {
selectFile(event) {
const file = event.target.files[0]
if (!file) return
if (file.name.substring(file.name.lastIndexOf('.')).toLowerCase() !== '.xlsx') {
this.$message.error('仅支持上传xlsx格式的文件')
this.$refs.fileInput.value = ''
return
}
this.file = file
this.clearResult()
},
removeFile() {
if (this.importing) return
this.file = {}
this.clearResult()
this.$refs.fileInput.value = ''
},
clearResult() {
this.hasResult = false
this.result = { totalCount: 0, successCount: 0, failCount: 0, batchId: '' }
},
startImport() {
if (!this.file.size) return this.$message.error('请上传文件')
const reader = new FileReader()
this.importing = true
reader.readAsDataURL(this.file)
reader.onload = event => {
const base64 = event.target.result.split(',')[1]
const fileType = this.file.name.split('.').pop()
this.$apis.claims
.batchImportGHClaims({ file: `${fileType}@${base64}` })
.then(res => {
if (res.code !== 0 && res.code !== '0') {
this.$message.error(res.message || '导入失败,请检查文件后重试')
return
}
this.setResult(res.data || {})
if (this.result.successCount > 0) this.$emit('success')
})
.catch(() => {})
.finally(() => {
this.importing = false
})
}
reader.onerror = () => {
this.importing = false
this.$message.error('文件读取失败,请重新上传')
}
},
setResult(res) {
const successCount = Number(res.successCount || res.successNum || res.successfulCount || 0)
const failCount = Number(res.failCount || res.failedCount || res.failNum || 0)
this.result = {
totalCount: Number(res.totalCount || res.importCount || res.total || successCount + failCount),
successCount,
failCount,
batchId: res.batchId || res.batchID || ''
}
this.hasResult = true
},
downloadErrorFile() {
if (!this.result.batchId) return this.$message.error('未获取到导入批次,请联系管理员')
this.$apis.claims
.exportBatchImportError({ batchId: this.result.batchId })
.then(res => {
if (res.code !== 0 && res.code !== '0') return this.$message.error(res.message || '错误文件导出失败')
const data = res.data || {}
const fileUrl = typeof data === 'string' ? data : data.fileUrl || data.url || data.downloadUrl || data.exportUrl || ''
if (!fileUrl) return this.$message.error('未获取到错误文件,请联系管理员')
window.location.href = fileUrl
})
.catch(() => {})
},
handleClose(done) {
if (this.importing) return
this.file = {}
this.clearResult()
if (this.$refs.fileInput) this.$refs.fileInput.value = ''
this.$emit('update:visible', false)
if (done) done()
},
handleDialogVisible(visible) {
if (!visible) this.handleClose()
}
}
}
</script>
<style lang="scss" scoped>
.import-content {
min-height: 150px;
padding: 12px 20px;
.form-item {
display: flex;
align-items: flex-start;
.label {
width: 88px;
line-height: 32px;
text-align: right;
}
.file-area {
position: relative;
.file-input {
display: none;
}
.template-link {
margin-left: 12px;
line-height: 32px;
color: #5850ff;
}
.file-name {
margin: 8px 0 0;
color: #666;
}
}
}
.importing-tip {
margin: 24px 0 0 88px;
color: #999;
}
.result {
margin: 50px 0 0 88px;
text-align: left;
p {
display: inline-block;
margin-right: 12px;
}
}
}
</style>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<span>核赔订单列表</span> <span>核赔订单列表</span>
<div class="table_top_btn flex_sc"> <div class="table_top_btn flex_sc">
<GLButton size="small" fn="订单详情" type="primary" @click="handleEdit(1)">新增核赔</GLButton> <GLButton size="small" fn="订单详情" type="primary" @click="handleEdit(1)">新增核赔</GLButton>
<GLButton size="small" plain fn="导入" type="primary" @click="handleImport">导入</GLButton>
<GLButton size="small" plain fn="跟进人配置" type="primary" @click="handleConfig">跟进人配置</GLButton> <GLButton size="small" plain fn="跟进人配置" type="primary" @click="handleConfig">跟进人配置</GLButton>
<GLButton size="small" plain fn="批量审核" type="primary" @click="batchAudit">批量审核通过</GLButton> <GLButton size="small" plain fn="批量审核" type="primary" @click="batchAudit">批量审核通过</GLButton>
<el-button plain size="small" @click="exportList">导出</el-button> <el-button plain size="small" @click="exportList">导出</el-button>
...@@ -109,10 +110,12 @@ ...@@ -109,10 +110,12 @@
</GLDialog> </GLDialog>
<!-- 跟进人配置 --> <!-- 跟进人配置 -->
<follow-pop ref="followRef" @handleClose="handleClose" :isFollowSync="isFollowSync" v-if="isFollowSync"></follow-pop> <follow-pop ref="followRef" @handleClose="handleClose" :isFollowSync="isFollowSync" v-if="isFollowSync"></follow-pop>
<batch-import :visible.sync="importVisible" @success="handleImportSuccess"></batch-import>
</div> </div>
</template> </template>
<script> <script>
import followPop from './components/followPop' import followPop from './components/followPop'
import batchImport from './components/batchImport'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
//服务状态:0-待提交国任 1-待支付 2-校验不通过 3-支付成功 4-支付失败 //服务状态:0-待提交国任 1-待支付 2-校验不通过 3-支付成功 4-支付失败
const statusList = [ const statusList = [
...@@ -261,6 +264,7 @@ export default { ...@@ -261,6 +264,7 @@ export default {
data() { data() {
return { return {
isFollowSync: false, isFollowSync: false,
importVisible: false,
signImage: '', signImage: '',
showUpload: false, showUpload: false,
delReasonObj: { delReasonObj: {
...@@ -793,7 +797,8 @@ export default { ...@@ -793,7 +797,8 @@ export default {
} }
}, },
components: { components: {
followPop followPop,
batchImport
}, },
created() { created() {
this.getClaimsCount() this.getClaimsCount()
...@@ -810,6 +815,12 @@ export default { ...@@ -810,6 +815,12 @@ export default {
window.sessionStorage.setItem('ghPageInfo', JSON.stringify(ghPageInfo)) window.sessionStorage.setItem('ghPageInfo', JSON.stringify(ghPageInfo))
}, },
methods: { methods: {
handleImport() {
this.importVisible = true
},
handleImportSuccess() {
this.handleOkFn()
},
getFollowPersonList() { getFollowPersonList() {
this.$apis.claims this.$apis.claims
.getFollowPersonList({ .getFollowPersonList({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!