feat(credit): 添加历史司法数据导入功能
- 新增立案信息历史数据导入API和组件 - 新增送达公告历史数据导入API和组件 - 新增诉前调解历史数据导入API和组件 - 在企业详情页面添加各类型历史数据导入按钮 - 实现Excel文件上传和模板下载功能 - 添加文件类型和大小验证机制
This commit is contained in:
@@ -127,3 +127,30 @@ export async function importCreditCaseFiling(file: File, companyId?: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入历史立案信息司法大数据
|
||||
*/
|
||||
export async function importCreditCaseFilingHistory(
|
||||
file: File,
|
||||
companyId?: number
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-case-filing/import/history',
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -134,3 +134,30 @@ export async function importCreditDeliveryNotice(
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入历史送达公告司法大数据
|
||||
*/
|
||||
export async function importCreditDeliveryNoticeHistory(
|
||||
file: File,
|
||||
companyId?: number
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-delivery-notice/import/history',
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -125,3 +125,30 @@ export async function importCreditMediation(file: File, companyId?: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入历史诉前调解司法大数据
|
||||
*/
|
||||
export async function importCreditMediationHistory(
|
||||
file: File,
|
||||
companyId?: number
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-mediation/import/history',
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<!-- 历史立案信息导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="历史立案信息批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="历史立案信息导入模板.xlsx">
|
||||
下载导入模板
|
||||
</a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditCaseFilingHistory } from '@/api/credit/creditCaseFiling';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
// 关联企业ID(企业详情下导入时需要)
|
||||
companyId?: number;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-case-filing/import/history/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditCaseFilingHistory(file, props.companyId)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -135,6 +135,39 @@
|
||||
</template>
|
||||
导入历史裁判文书
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="tab.key === '立案信息'"
|
||||
type="dashed"
|
||||
:disabled="!form.id"
|
||||
@click="openCaseFilingHistoryImport"
|
||||
>
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
导入历史立案信息
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="tab.key === '诉前调解'"
|
||||
type="dashed"
|
||||
:disabled="!form.id"
|
||||
@click="openMediationHistoryImport"
|
||||
>
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
导入历史诉前调解
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="tab.key === '送达公告'"
|
||||
type="dashed"
|
||||
:disabled="!form.id"
|
||||
@click="openDeliveryNoticeHistoryImport"
|
||||
>
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
导入历史送达公告
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="tab.key === '股权冻结'"
|
||||
type="dashed"
|
||||
@@ -202,6 +235,27 @@
|
||||
@done="handleRelatedImportDone"
|
||||
/>
|
||||
|
||||
<!-- 历史立案信息导入(企业详情-立案信息tab) -->
|
||||
<CreditCaseFilingHistoryImport
|
||||
v-model:visible="showCaseFilingHistoryImport"
|
||||
:companyId="form.id"
|
||||
@done="handleCaseFilingHistoryImportDone"
|
||||
/>
|
||||
|
||||
<!-- 历史诉前调解导入(企业详情-诉前调解tab) -->
|
||||
<CreditMediationHistoryImport
|
||||
v-model:visible="showMediationHistoryImport"
|
||||
:companyId="form.id"
|
||||
@done="handleMediationHistoryImportDone"
|
||||
/>
|
||||
|
||||
<!-- 历史送达公告导入(企业详情-送达公告tab) -->
|
||||
<CreditDeliveryNoticeHistoryImport
|
||||
v-model:visible="showDeliveryNoticeHistoryImport"
|
||||
:companyId="form.id"
|
||||
@done="handleDeliveryNoticeHistoryImportDone"
|
||||
/>
|
||||
|
||||
<!-- 历史行政许可导入(企业详情-行政许可tab) -->
|
||||
<CreditAdministrativeLicenseHistoryImport
|
||||
v-model:visible="showAdministrativeLicenseHistoryImport"
|
||||
@@ -283,6 +337,9 @@
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import CreditCompanyRelatedImport from './credit-company-related-import.vue';
|
||||
import CreditCaseFilingHistoryImport from '@/views/credit/creditCaseFiling/components/credit-case-filing-history-import.vue';
|
||||
import CreditMediationHistoryImport from '@/views/credit/creditMediation/components/credit-mediation-history-import.vue';
|
||||
import CreditDeliveryNoticeHistoryImport from '@/views/credit/creditDeliveryNotice/components/credit-delivery-notice-history-import.vue';
|
||||
import CreditAdministrativeLicenseHistoryImport from '@/views/credit/creditAdministrativeLicense/components/credit-administrative-license-history-import.vue';
|
||||
import CreditBankruptcyHistoryImport from '@/views/credit/creditBankruptcy/components/credit-bankruptcy-history-import.vue';
|
||||
import CreditJudgmentDebtorHistoryImport from '@/views/credit/creditJudgmentDebtor/components/credit-judgment-debtor-history-import.vue';
|
||||
@@ -1517,6 +1574,54 @@
|
||||
reloadTab(activeTab.value);
|
||||
};
|
||||
|
||||
// 历史立案信息导入弹窗(企业详情-立案信息tab)
|
||||
const showCaseFilingHistoryImport = ref(false);
|
||||
|
||||
const openCaseFilingHistoryImport = () => {
|
||||
if (!form.id) {
|
||||
message.error('缺少企业ID,无法导入');
|
||||
return;
|
||||
}
|
||||
showCaseFilingHistoryImport.value = true;
|
||||
};
|
||||
|
||||
const handleCaseFilingHistoryImportDone = () => {
|
||||
resetTabPagination('立案信息');
|
||||
reloadTab('立案信息');
|
||||
};
|
||||
|
||||
// 历史诉前调解导入弹窗(企业详情-诉前调解tab)
|
||||
const showMediationHistoryImport = ref(false);
|
||||
|
||||
const openMediationHistoryImport = () => {
|
||||
if (!form.id) {
|
||||
message.error('缺少企业ID,无法导入');
|
||||
return;
|
||||
}
|
||||
showMediationHistoryImport.value = true;
|
||||
};
|
||||
|
||||
const handleMediationHistoryImportDone = () => {
|
||||
resetTabPagination('诉前调解');
|
||||
reloadTab('诉前调解');
|
||||
};
|
||||
|
||||
// 历史送达公告导入弹窗(企业详情-送达公告tab)
|
||||
const showDeliveryNoticeHistoryImport = ref(false);
|
||||
|
||||
const openDeliveryNoticeHistoryImport = () => {
|
||||
if (!form.id) {
|
||||
message.error('缺少企业ID,无法导入');
|
||||
return;
|
||||
}
|
||||
showDeliveryNoticeHistoryImport.value = true;
|
||||
};
|
||||
|
||||
const handleDeliveryNoticeHistoryImportDone = () => {
|
||||
resetTabPagination('送达公告');
|
||||
reloadTab('送达公告');
|
||||
};
|
||||
|
||||
// 历史行政许可导入弹窗(企业详情-行政许可tab)
|
||||
const showAdministrativeLicenseHistoryImport = ref(false);
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<!-- 历史送达公告导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="历史送达公告批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="历史送达公告导入模板.xlsx">
|
||||
下载导入模板
|
||||
</a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditDeliveryNoticeHistory } from '@/api/credit/creditDeliveryNotice';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
// 关联企业ID(企业详情下导入时需要)
|
||||
companyId?: number;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-delivery-notice/import/history/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditDeliveryNoticeHistory(file, props.companyId)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<!-- 历史诉前调解导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="历史诉前调解批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="历史诉前调解导入模板.xlsx">
|
||||
下载导入模板
|
||||
</a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditMediationHistory } from '@/api/credit/creditMediation';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
// 关联企业ID(企业详情下导入时需要)
|
||||
companyId?: number;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-mediation/import/history/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditMediationHistory(file, props.companyId)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user