diff --git a/src/api/fee/addOweFeeCallableApi.js b/src/api/fee/addOweFeeCallableApi.js index 29f1b40..03db4d5 100644 --- a/src/api/fee/addOweFeeCallableApi.js +++ b/src/api/fee/addOweFeeCallableApi.js @@ -49,11 +49,8 @@ export function listFeeConfigs(params) { params }).then(response => { const res = response.data - if (res.code === 0) { resolve(res) - } else { - reject(new Error(res.msg)) - } + }).catch(error => { reject(error) }) @@ -69,11 +66,8 @@ export function queryFloors(params) { params }).then(response => { const res = response.data - if (res.code === 0) { resolve(res) - } else { - reject(new Error(res.msg)) - } + }).catch(error => { reject(error) }) @@ -89,11 +83,8 @@ export function queryReportOweFee(params) { params }).then(response => { const res = response.data - if (res.code === 0) { resolve(res) - } else { - reject(new Error(res.msg)) - } + }).catch(error => { reject(error) }) diff --git a/src/api/fee/exportFeeImportExcelApi.js b/src/api/fee/exportFeeImportExcelApi.js index 1bf5b5e..4a1783b 100644 --- a/src/api/fee/exportFeeImportExcelApi.js +++ b/src/api/fee/exportFeeImportExcelApi.js @@ -27,11 +27,8 @@ export function listFeeConfigs(params) { params }).then(response => { const res = response.data - if (res.code === 0) { resolve(res) - } else { - reject(new Error(res.msg || 'Failed to list fee configs')) - } + }).catch(error => { reject(error) }) @@ -46,11 +43,8 @@ export function queryFloors(params) { params }).then(response => { const res = response.data - if (res.code === 0) { resolve(res) - } else { - reject(new Error(res.msg || 'Failed to query floors')) - } + }).catch(error => { reject(error) }) diff --git a/src/components/fee/doImportCreateFee.vue b/src/components/fee/doImportCreateFee.vue index eb4a0a3..035fae6 100644 --- a/src/components/fee/doImportCreateFee.vue +++ b/src/components/fee/doImportCreateFee.vue @@ -1,20 +1,9 @@ @@ -57,37 +42,37 @@ export default { this.visible = true this.reset() }, - + handleFileChange(file) { if (!this.checkFileType(file.name)) { this.$message.error(this.$t('doImportCreateFee.validate.invalidFileType')) return false } - + if (!this.checkFileSize(file.size)) { this.$message.error(this.$t('doImportCreateFee.validate.fileTooLarge')) return false } - + this.file = file.raw this.fileName = file.name }, - + checkFileType(filename) { const ext = filename.split('.').pop().toLowerCase() return ['xls', 'xlsx'].includes(ext) }, - + checkFileSize(size) { return size <= 2 * 1024 * 1024 // 2MB }, - + handleImport() { const formData = new FormData() formData.append('uploadFile', this.file) formData.append('communityId', this.communityId) formData.append('importAdapt', 'importCustomFee') - + importData(formData).then(response => { const res = response.data if (res.code === 0) { @@ -101,12 +86,12 @@ export default { this.$message.error(error.message) }) }, - + handleClose() { this.visible = false this.reset() }, - + reset() { this.file = null this.fileName = '' diff --git a/src/components/fee/exportFeeImportExcel.vue b/src/components/fee/exportFeeImportExcel.vue index 8bf41b3..8005c68 100644 --- a/src/components/fee/exportFeeImportExcel.vue +++ b/src/components/fee/exportFeeImportExcel.vue @@ -1,42 +1,20 @@