feat(credit): 新增客户导入与数据导出功能

- 在信用客户模块中添加了导入客户的功能,支持通过文件上传方式导入客户数据
- 实现了多个信用相关模块的数据导出功能,包括企业、司法案件、风险关系、供应商及用户模块
- 更新了搜索组件以支持导出事件,并在各模块中实现了具体的导出逻辑
- 简化了部分表单项的标签显示并移除了冗余字段,优化了用户体验
- 修复了一些潜在的代码格式问题和不必要的注释块
This commit is contained in:
2025-12-22 10:00:49 +08:00
parent ebdc9b5933
commit ecd571c60b
11 changed files with 389 additions and 473 deletions

View File

@@ -19,6 +19,7 @@
@remove="removeBatch"
@batchMove="openMove"
@importData="openImport"
@exportData="exportData"
/>
</template>
<template #bodyCell="{ column, record }">
@@ -88,7 +89,7 @@
</template>
<script lang="ts" setup>
import { createVNode, ref, computed } from 'vue';
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
@@ -102,6 +103,7 @@
import CreditCompanyEdit from './components/creditCompanyEdit.vue';
import {
pageCreditCompany,
listCreditCompany,
removeCreditCompany,
removeBatchCreditCompany
} from '@/api/credit/creditCompany';
@@ -111,6 +113,7 @@
} from '@/api/credit/creditCompany/model';
import CreditCompanyImport from './components/credit-company-import.vue';
import CreditCompanyInfo from './components/creditCompanyInfo.vue';
import { exportCreditData } from '../utils/export';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -129,27 +132,33 @@
const showInfo = ref(false);
// 加载状态
const loading = ref(true);
// 搜索关键词
const searchText = ref('');
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
where = {},
orders,
filters
}) => {
const params: CreditCompanyParam = { ...where };
if (filters) {
where.status = filters.status;
(params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
}
return pageCreditCompany({
...where,
...params,
...orders,
page,
limit
});
};
// 完整的列配置(包含所有字段)
// 关键信息列
const columns = ref<ColumnItem[]>([
{
title: '操作',
@@ -158,12 +167,6 @@
fixed: 'left',
align: 'center'
},
// {
// title: 'ID',
// dataIndex: 'id',
// key: 'id',
// width: 90
// },
{
title: '原文件导入名称',
dataIndex: 'name',
@@ -185,18 +188,6 @@
ellipsis: true,
width: 200
},
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// width: 120
// },
// {
// title: '上级id, 0是顶级',
// dataIndex: 'parentId',
// key: 'parentId',
// width: 120
// },
{
title: '登记状态',
dataIndex: 'registrationStatus',
@@ -218,13 +209,6 @@
ellipsis: true,
width: 120
},
{
title: '实缴资本',
dataIndex: 'paidinCapital',
key: 'paidinCapital',
ellipsis: true,
width: 120
},
{
title: '成立日期',
dataIndex: 'establishDate',
@@ -232,13 +216,6 @@
ellipsis: true,
width: 120
},
{
title: '企业地址',
dataIndex: 'address',
key: 'address',
ellipsis: true,
width: 120
},
{
title: '电话',
dataIndex: 'tel',
@@ -246,27 +223,6 @@
ellipsis: true,
width: 150
},
{
title: '更多电话',
dataIndex: 'moreTel',
key: 'moreTel',
ellipsis: true,
width: 120
},
{
title: '邮箱',
dataIndex: 'email',
key: 'email',
ellipsis: true,
width: 150
},
{
title: '更多邮箱',
dataIndex: 'moreEmail',
key: 'moreEmail',
ellipsis: true,
width: 120
},
{
title: '所属省份',
dataIndex: 'province',
@@ -281,195 +237,6 @@
ellipsis: true,
width: 120
},
{
title: '所属区县',
dataIndex: 'region',
key: 'region',
ellipsis: true,
width: 120
},
{
title: '企业(机构)类型',
dataIndex: 'institutionType',
key: 'institutionType',
ellipsis: true,
width: 140
},
{
title: '纳税人识别号',
dataIndex: 'taxpayerCode',
key: 'taxpayerCode',
ellipsis: true,
width: 120
},
{
title: '注册号',
dataIndex: 'registrationNumber',
key: 'registrationNumber',
ellipsis: true,
width: 120
},
{
title: '组织机构代码',
dataIndex: 'organizationalCode',
key: 'organizationalCode',
ellipsis: true,
width: 120
},
{
title: '参保人数',
dataIndex: 'numberOfInsuredPersons',
key: 'numberOfInsuredPersons',
ellipsis: true,
width: 120
},
{
title: '参保人数所属年报',
dataIndex: 'annualReport',
key: 'annualReport',
ellipsis: true,
width: 140
},
{
title: '营业期限',
dataIndex: 'businessTerm',
key: 'businessTerm',
ellipsis: true,
width: 120
},
{
title: '国标行业门类',
dataIndex: 'nationalStandardIndustryCategories',
key: 'nationalStandardIndustryCategories',
ellipsis: true,
width: 120
},
{
title: '国标行业大类',
dataIndex: 'nationalStandardIndustryCategories2',
key: 'nationalStandardIndustryCategories2',
ellipsis: true,
width: 120
},
{
title: '国标行业中类',
dataIndex: 'nationalStandardIndustryCategories3',
key: 'nationalStandardIndustryCategories3',
ellipsis: true,
width: 120
},
{
title: '国标行业小类',
dataIndex: 'nationalStandardIndustryCategories4',
key: 'nationalStandardIndustryCategories4',
ellipsis: true,
width: 120
},
{
title: '企查查行业门类',
dataIndex: 'nationalStandardIndustryCategories5',
key: 'nationalStandardIndustryCategories5',
ellipsis: true,
width: 120
},
{
title: '企查查行业大类',
dataIndex: 'nationalStandardIndustryCategories6',
key: 'nationalStandardIndustryCategories6',
ellipsis: true,
width: 120
},
{
title: '企查查行业中类',
dataIndex: 'nationalStandardIndustryCategories7',
key: 'nationalStandardIndustryCategories7',
ellipsis: true,
width: 120
},
{
title: '企查查行业小类',
dataIndex: 'nationalStandardIndustryCategories8',
key: 'nationalStandardIndustryCategories8',
ellipsis: true,
width: 120
},
{
title: '企业规模',
dataIndex: 'companySize',
key: 'companySize',
ellipsis: true,
width: 120
},
{
title: '曾用名',
dataIndex: 'formerName',
key: 'formerName',
ellipsis: true,
width: 120
},
{
title: '英文名',
dataIndex: 'englishName',
key: 'englishName',
ellipsis: true,
width: 120
},
{
title: '官网',
dataIndex: 'domain',
key: 'domain',
ellipsis: true,
width: 240
},
{
title: '通信地址',
dataIndex: 'mailingAddress',
key: 'mailingAddress',
ellipsis: true,
width: 120
},
{
title: '企业简介',
dataIndex: 'companyProfile',
key: 'companyProfile',
ellipsis: true,
width: 120
},
{
title: '经营范围',
dataIndex: 'natureOfBusiness',
key: 'natureOfBusiness',
ellipsis: true,
width: 120
},
{
title: '登记机关',
dataIndex: 'registrationAuthority',
key: 'registrationAuthority',
ellipsis: true,
width: 120
},
{
title: '纳税人资质',
dataIndex: 'taxpayerQualification',
key: 'taxpayerQualification',
ellipsis: true,
width: 120
},
{
title: '最新年报年份',
dataIndex: 'latestAnnualReportYear',
key: 'latestAnnualReportYear',
ellipsis: true,
width: 120
},
{
title: '最新年报营业收入',
dataIndex: 'latestAnnualReportOnOperatingRevenue',
key: 'latestAnnualReportOnOperatingRevenue',
ellipsis: true,
width: 150
},
{
title: '企查分',
dataIndex: 'enterpriseScoreCheck',
@@ -484,26 +251,21 @@
ellipsis: true,
width: 120
},
{
title: '科创分',
dataIndex: 'cechnologyScore',
key: 'cechnologyScore',
ellipsis: true,
width: 120
},
{
title: '科创等级',
dataIndex: 'cechnologyLevel',
key: 'cechnologyLevel',
ellipsis: true,
width: 120
},
{
title: '是否小微企业',
dataIndex: 'smallEnterprise',
key: 'smallEnterprise',
ellipsis: true,
width: 120
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 180,
align: 'center',
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}
// {
// title: '备注',
@@ -543,8 +305,12 @@
/* 搜索 */
const reload = (where?: CreditCompanyParam) => {
if (where && Object.prototype.hasOwnProperty.call(where, 'keywords')) {
searchText.value = where.keywords ?? '';
}
const targetWhere = where ?? { keywords: searchText.value || undefined };
selection.value = [];
tableRef?.value?.reload({ where: where });
tableRef?.value?.reload({ where: targetWhere });
};
/* 打开编辑弹窗 */
@@ -562,6 +328,38 @@
const openImport = () => {
showImport.value = true;
};
/* 导出 */
const exportData = () => {
exportCreditData<CreditCompany>({
filename: '企业',
columns: [
{ title: '原文件导入名称', dataIndex: 'name' },
{ title: '系统匹配企业名称', dataIndex: 'matchName' },
{ title: '统一社会信用代码', dataIndex: 'code' },
{ title: '登记状态', dataIndex: 'registrationStatus' },
{ title: '法定代表人', dataIndex: 'legalPerson' },
{ title: '注册资本', dataIndex: 'registeredCapital' },
{ title: '成立日期', dataIndex: 'establishDate' },
{ title: '所属省份', dataIndex: 'province' },
{ title: '所属城市', dataIndex: 'city' },
{ title: '企查分', dataIndex: 'enterpriseScoreCheck' },
{ title: '信用等级', dataIndex: 'creditRating' },
{
title: '创建时间',
dataIndex: 'createTime',
formatter: (record: CreditCompany) =>
record.createTime
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
: ''
}
],
fetchData: () =>
listCreditCompany({
keywords: searchText.value || undefined
})
});
};
/* 打开企业详情 */
const openInfo = (row?: CreditCompany) => {
current.value = row ?? null;