feat(credit): 添加信用模块数据导入导出功能

- 为行政许可、破产重整、分支机构、历史法定代表人、附近企业、专利、疑似关系模块添加导入功能
- 在工具栏中将导入按钮文本更新为导入(多)以区分单个导入和批量导入
- 为各信用模块表格添加导入弹窗组件和相应的导入导出事件处理
- 实现各信用模块的导出功能,支持按搜索条件导出数据
- 优化表格数据源处理,支持关键词搜索和状态筛选
- 添加链接字段的点击跳转功能,提升用户体验
- 移除冗余的表格列字段,精简表格展示内容
This commit is contained in:
2026-01-07 17:43:11 +08:00
parent d32fd4f711
commit cc04fee941
26 changed files with 1617 additions and 482 deletions

View File

@@ -17,12 +17,22 @@
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
@importData="openImport"
@exportData="exportData"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
</template>
<template v-if="column.key === 'name'">
<template v-if="record.url">
<a :href="record.url" target="_blank">{{ record.name }}</a>
</template>
<template v-else>
{{ record.name }}
</template>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
@@ -45,11 +55,13 @@
<!-- 编辑弹窗 -->
<CreditNearbyCompanyEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 导入弹窗 -->
<CreditNearbyCompanyImport v-model:visible="showImport" @done="reload" />
</a-page-header>
</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';
@@ -58,10 +70,17 @@
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import {getPageTitle} from '@/utils/common';
import Search from '@/views/credit/components/CreditSearchToolbar.vue';
import { exportCreditData } from '../utils/export';
import { getPageTitle } from '@/utils/common';
import CreditNearbyCompanyEdit from './components/creditNearbyCompanyEdit.vue';
import { pageCreditNearbyCompany, removeCreditNearbyCompany, removeBatchCreditNearbyCompany } from '@/api/credit/creditNearbyCompany';
import CreditNearbyCompanyImport from './components/credit-nearby-company-import.vue';
import {
pageCreditNearbyCompany,
listCreditNearbyCompany,
removeCreditNearbyCompany,
removeBatchCreditNearbyCompany
} from '@/api/credit/creditNearbyCompany';
import type { CreditNearbyCompany, CreditNearbyCompanyParam } from '@/api/credit/creditNearbyCompany/model';
// 表格实例
@@ -73,24 +92,32 @@
const current = ref<CreditNearbyCompany | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示导入弹窗
const showImport = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 搜索关键词
const searchText = ref('');
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
where = {},
orders,
filters
}) => {
const params: CreditNearbyCompanyParam = { ...where };
if (filters) {
where.status = filters.status;
(params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
}
return pageCreditNearbyCompany({
...where,
...params,
...orders,
page,
limit
@@ -145,13 +172,15 @@
title: '注册地址',
dataIndex: 'address',
key: 'address',
ellipsis: true
ellipsis: true,
hideInTable: true
},
{
title: '注册地址邮编',
dataIndex: 'postalCode',
key: 'postalCode',
ellipsis: true
ellipsis: true,
hideInTable: true
},
{
title: '有效手机号',
@@ -163,7 +192,8 @@
title: '更多电话',
dataIndex: 'moreTel',
key: 'moreTel',
ellipsis: true
ellipsis: true,
hideInTable: true
},
{
title: '邮箱',
@@ -175,13 +205,15 @@
title: '邮箱',
dataIndex: 'moreEmail',
key: 'moreEmail',
ellipsis: true
ellipsis: true,
hideInTable: true
},
{
title: '所在国家',
dataIndex: 'country',
key: 'country',
ellipsis: true
ellipsis: true,
hideInTable: true
},
{
title: '所属省份',
@@ -345,24 +377,12 @@
key: 'nationalStandardIndustryCategories8',
ellipsis: true
},
{
title: '链接',
dataIndex: 'url',
key: 'url',
ellipsis: true
},
{
title: '类型',
dataIndex: 'type',
key: 'type',
width: 120
},
{
title: '上级id, 0是顶级',
dataIndex: 'parentId',
key: 'parentId',
width: 120
},
{
title: '实缴资本',
dataIndex: 'paidinCapital',
@@ -423,42 +443,30 @@
key: 'smallEnterprise',
ellipsis: true
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
ellipsis: true
},
{
title: '是否推荐',
dataIndex: 'recommend',
key: 'recommend',
width: 120
},
{
title: '排序(数字越小越靠前)',
dataIndex: 'sortNumber',
key: 'sortNumber',
width: 120
},
{
title: '状态, 0正常, 1冻结',
dataIndex: 'status',
key: 'status',
width: 120
},
{
title: '是否删除, 0否, 1是',
dataIndex: 'deleted',
key: 'deleted',
width: 120
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
width: 120
},
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// ellipsis: true
// },
// {
// title: '是否推荐',
// dataIndex: 'recommend',
// key: 'recommend',
// width: 120
// },
// {
// title: '排序(数字越小越靠前)',
// dataIndex: 'sortNumber',
// key: 'sortNumber',
// width: 120
// },
// {
// title: '状态, 0正常, 1冻结',
// dataIndex: 'status',
// key: 'status',
// width: 120
// },
{
title: '创建时间',
dataIndex: 'createTime',
@@ -469,16 +477,6 @@
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '修改时间',
dataIndex: 'updateTime',
key: 'updateTime',
width: 200,
align: 'center',
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
@@ -491,8 +489,12 @@
/* 搜索 */
const reload = (where?: CreditNearbyCompanyParam) => {
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 });
};
/* 打开编辑弹窗 */
@@ -506,6 +508,44 @@
showMove.value = true;
};
/* 打开导入弹窗 */
const openImport = () => {
showImport.value = true;
};
/* 导出 */
const exportData = () => {
exportCreditData<CreditNearbyCompany>({
filename: '附近企业',
columns: [
{ title: 'ID', dataIndex: 'id' },
{ title: '企业名称', dataIndex: 'name' },
{ title: '登记状态', dataIndex: 'registrationStatus' },
{ title: '法定代表人', dataIndex: 'legalPerson' },
{ title: '注册资本', dataIndex: 'registeredCapital' },
{ title: '成立日期', dataIndex: 'establishDate' },
{ title: '统一社会信用代码', dataIndex: 'code' },
{ title: '注册地址', dataIndex: 'address' },
{ title: '有效手机号', dataIndex: 'phone' },
{ title: '邮箱', dataIndex: 'email' },
{ title: '网址', dataIndex: 'domain' },
{ title: '备注', dataIndex: 'comments' },
{
title: '创建时间',
dataIndex: 'createTime',
formatter: (record: CreditNearbyCompany) =>
record.createTime
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
: ''
}
],
fetchData: () =>
listCreditNearbyCompany({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */
const remove = (row: CreditNearbyCompany) => {
const hide = message.loading('请求中..', 0);