|
|
@@ -244,14 +244,14 @@ |
|
|
|
v-if="IsPermission(route, 'BLD_IMPORT')" |
|
|
|
:action="BaseService.getFileUploadUrl()" @success="onHandlePointImportSuccess" |
|
|
|
accept=".xls, .xlsx" :limit="1" |
|
|
|
:on-exceed="handleExceed" :show-file-list="false" :multiple="false"> |
|
|
|
:on-exceed="handlePointExceed" :show-file-list="false" :multiple="false"> |
|
|
|
<el-button type="success" icon="Upload" @click="handleImport(currentServiceHallId,'1')">导入办理点</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-upload style="display: inline-block; margin: 0 10px" ref="handlePointUpload2" :data="data" |
|
|
|
v-if="IsPermission(route, 'NO_BLD_IMPORT')" |
|
|
|
:action="BaseService.getFileUploadUrl()" @success="onHandlePointImportSuccess2" |
|
|
|
accept=".xls, .xlsx" :limit="1" |
|
|
|
:on-exceed="handleExceed" :show-file-list="false" :multiple="false"> |
|
|
|
:on-exceed="handlePointExceed2" :show-file-list="false" :multiple="false"> |
|
|
|
<el-button type="danger" icon="Upload" @click="handleImport(currentServiceHallId,'2')">导入禁办点</el-button> |
|
|
|
</el-upload> |
|
|
|
</div> |
|
|
@@ -634,6 +634,26 @@ const handleExceed: UploadProps['onExceed'] = (files) => { |
|
|
|
upload.value!.submit() |
|
|
|
} |
|
|
|
|
|
|
|
// 办理点上传组件的handleExceed处理 |
|
|
|
const handlePointUpload = ref<UploadInstance>() |
|
|
|
const handlePointUpload2 = ref<UploadInstance>() |
|
|
|
|
|
|
|
const handlePointExceed: UploadProps['onExceed'] = (files) => { |
|
|
|
handlePointUpload.value!.clearFiles() |
|
|
|
const file = files[0] as UploadRawFile |
|
|
|
file.uid = genFileId() |
|
|
|
handlePointUpload.value!.handleStart(file) |
|
|
|
handlePointUpload.value!.submit() |
|
|
|
} |
|
|
|
|
|
|
|
const handlePointExceed2: UploadProps['onExceed'] = (files) => { |
|
|
|
handlePointUpload2.value!.clearFiles() |
|
|
|
const file = files[0] as UploadRawFile |
|
|
|
file.uid = genFileId() |
|
|
|
handlePointUpload2.value!.handleStart(file) |
|
|
|
handlePointUpload2.value!.submit() |
|
|
|
} |
|
|
|
|
|
|
|
// 搜索重置 |
|
|
|
function refreshLeft() { |
|
|
|
searchForm.value = { |
|
|
@@ -894,9 +914,11 @@ function onSuccess(response: any) { |
|
|
|
} |
|
|
|
|
|
|
|
function importData(url) { |
|
|
|
console.log('网点导入开始,URL:', url) |
|
|
|
//判断url是否以/开头,剔除/ |
|
|
|
url = url.startsWith('/') ? url.substring(1) : url |
|
|
|
// importFn('a8f9dac698cb4793bb15f26fd608d2b3', getList(), { excelFileUrl: url }) |
|
|
|
console.log('调用registerFullBath接口,参数:', {excelFileUrl: url}) |
|
|
|
BaseService.postN('/userw/serviceHall/registerFullBath', {excelFileUrl: url}).then((res: any) => { |
|
|
|
if (res && res.code === 0) { |
|
|
|
// console.log(res) |
|
|
@@ -1120,6 +1142,8 @@ function selectDataHandle(data: IObject[]): IObject[] { |
|
|
|
|
|
|
|
//导入 |
|
|
|
function handleImport(row, type) { |
|
|
|
// 办理点导入不再需要设置全局变量,因为使用独立的处理函数 |
|
|
|
// 保留此函数是为了兼容其他可能的调用 |
|
|
|
if (typeof row === 'string') { |
|
|
|
// 来自弹框的导入 |
|
|
|
serviceHallId.value = row |
|
|
@@ -1385,12 +1409,51 @@ function downloadHandlePointTemplate() { |
|
|
|
|
|
|
|
// 导入办理点成功回调 |
|
|
|
function onHandlePointImportSuccess(response: any) { |
|
|
|
handleAvatarSuccess(response, { serviceHallId: currentServiceHallId.value }) |
|
|
|
handlePointImportSuccess(response, '1') |
|
|
|
} |
|
|
|
|
|
|
|
// 导入禁办点成功回调 |
|
|
|
function onHandlePointImportSuccess2(response: any) { |
|
|
|
handleAvatarSuccess(response, { serviceHallId: currentServiceHallId.value }) |
|
|
|
handlePointImportSuccess(response, '2') |
|
|
|
} |
|
|
|
|
|
|
|
// 办理点导入成功处理函数 |
|
|
|
function handlePointImportSuccess(response: any, type: string) { |
|
|
|
console.log('办理点导入开始,类型:', type, '网点ID:', currentServiceHallId.value) |
|
|
|
const {ossFilePath, originalFileName} = response.data |
|
|
|
const fileUrl = ossFilePath |
|
|
|
|
|
|
|
console.log('调用registerLocationBath接口,参数:', { |
|
|
|
excelFileUrl: fileUrl, |
|
|
|
serviceHallId: currentServiceHallId.value, |
|
|
|
type: type |
|
|
|
}) |
|
|
|
|
|
|
|
BaseService.postN('/userw/serviceHall/registerLocationBath', { |
|
|
|
excelFileUrl: fileUrl, |
|
|
|
serviceHallId: currentServiceHallId.value, |
|
|
|
type: type |
|
|
|
}).then((res: any) => { |
|
|
|
console.log('registerLocationBath接口响应:', res) |
|
|
|
if (res && res.code === 0) { |
|
|
|
const errUrl = res.data?.path ?? '' |
|
|
|
if (errUrl) { |
|
|
|
ElMessage.error("导入失败,请查看下载到本地文件的具体错误信息"); |
|
|
|
BaseService.getDownload( |
|
|
|
import.meta.env.VITE_APP_EXPORT_URL_NEW + errUrl, |
|
|
|
'错误信息文件' |
|
|
|
) |
|
|
|
} else { |
|
|
|
ElMessage.success("导入成功"); |
|
|
|
// 导入成功后刷新办理点列表 |
|
|
|
getHandlePointList() |
|
|
|
} |
|
|
|
} else { |
|
|
|
ElMessage.error(res.message || "导入失败"); |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
console.error('registerLocationBath接口调用失败:', error) |
|
|
|
}) |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |