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

@@ -103,3 +103,24 @@ export async function getCreditCustomer(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
/**
* 导入客户
*/
export async function importCreditCustomer(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>(
'/credit/credit-customer/import',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -13,6 +13,12 @@
</template> </template>
<span>导入</span> <span>导入</span>
</a-button> </a-button>
<a-button class="ele-btn-icon" @click="exportData">
<template #icon>
<CloudDownloadOutlined />
</template>
<span>导出</span>
</a-button>
<a-button <a-button
danger danger
class="ele-btn-icon" class="ele-btn-icon"
@@ -40,6 +46,7 @@
import { import {
PlusOutlined, PlusOutlined,
CloudUploadOutlined, CloudUploadOutlined,
CloudDownloadOutlined,
DeleteOutlined DeleteOutlined
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import type { import type {
@@ -63,6 +70,7 @@
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
(e: 'importData'): void; (e: 'importData'): void;
(e: 'exportData'): void;
}>(); }>();
const keywords = ref(''); const keywords = ref('');
@@ -83,6 +91,11 @@
emit('importData'); emit('importData');
}; };
// 导出
const exportData = () => {
emit('exportData');
};
// 批量删除 // 批量删除
const remove = () => { const remove = () => {
emit('remove'); emit('remove');

View File

@@ -19,6 +19,7 @@
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport" @importData="openImport"
@exportData="exportData"
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@@ -88,7 +89,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref, computed } from 'vue'; import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
@@ -102,6 +103,7 @@
import CreditCompanyEdit from './components/creditCompanyEdit.vue'; import CreditCompanyEdit from './components/creditCompanyEdit.vue';
import { import {
pageCreditCompany, pageCreditCompany,
listCreditCompany,
removeCreditCompany, removeCreditCompany,
removeBatchCreditCompany removeBatchCreditCompany
} from '@/api/credit/creditCompany'; } from '@/api/credit/creditCompany';
@@ -111,6 +113,7 @@
} from '@/api/credit/creditCompany/model'; } from '@/api/credit/creditCompany/model';
import CreditCompanyImport from './components/credit-company-import.vue'; import CreditCompanyImport from './components/credit-company-import.vue';
import CreditCompanyInfo from './components/creditCompanyInfo.vue'; import CreditCompanyInfo from './components/creditCompanyInfo.vue';
import { exportCreditData } from '../utils/export';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -129,27 +132,33 @@
const showInfo = ref(false); const showInfo = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 搜索关键词
const searchText = ref('');
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page, page,
limit, limit,
where, where = {},
orders, orders,
filters filters
}) => { }) => {
const params: CreditCompanyParam = { ...where };
if (filters) { if (filters) {
where.status = filters.status; (params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
} }
return pageCreditCompany({ return pageCreditCompany({
...where, ...params,
...orders, ...orders,
page, page,
limit limit
}); });
}; };
// 完整的列配置(包含所有字段) // 关键信息列
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: '操作', title: '操作',
@@ -158,12 +167,6 @@
fixed: 'left', fixed: 'left',
align: 'center' align: 'center'
}, },
// {
// title: 'ID',
// dataIndex: 'id',
// key: 'id',
// width: 90
// },
{ {
title: '原文件导入名称', title: '原文件导入名称',
dataIndex: 'name', dataIndex: 'name',
@@ -185,18 +188,6 @@
ellipsis: true, ellipsis: true,
width: 200 width: 200
}, },
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// width: 120
// },
// {
// title: '上级id, 0是顶级',
// dataIndex: 'parentId',
// key: 'parentId',
// width: 120
// },
{ {
title: '登记状态', title: '登记状态',
dataIndex: 'registrationStatus', dataIndex: 'registrationStatus',
@@ -218,13 +209,6 @@
ellipsis: true, ellipsis: true,
width: 120 width: 120
}, },
{
title: '实缴资本',
dataIndex: 'paidinCapital',
key: 'paidinCapital',
ellipsis: true,
width: 120
},
{ {
title: '成立日期', title: '成立日期',
dataIndex: 'establishDate', dataIndex: 'establishDate',
@@ -232,13 +216,6 @@
ellipsis: true, ellipsis: true,
width: 120 width: 120
}, },
{
title: '企业地址',
dataIndex: 'address',
key: 'address',
ellipsis: true,
width: 120
},
{ {
title: '电话', title: '电话',
dataIndex: 'tel', dataIndex: 'tel',
@@ -246,27 +223,6 @@
ellipsis: true, ellipsis: true,
width: 150 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: '所属省份', title: '所属省份',
dataIndex: 'province', dataIndex: 'province',
@@ -281,195 +237,6 @@
ellipsis: true, ellipsis: true,
width: 120 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: '企查分', title: '企查分',
dataIndex: 'enterpriseScoreCheck', dataIndex: 'enterpriseScoreCheck',
@@ -484,26 +251,21 @@
ellipsis: true, ellipsis: true,
width: 120 width: 120
}, },
{
title: '科创分',
dataIndex: 'cechnologyScore',
key: 'cechnologyScore',
ellipsis: true,
width: 120
},
{
title: '科创等级',
dataIndex: 'cechnologyLevel',
key: 'cechnologyLevel',
ellipsis: true,
width: 120
},
{ {
title: '是否小微企业', title: '是否小微企业',
dataIndex: 'smallEnterprise', dataIndex: 'smallEnterprise',
key: 'smallEnterprise', key: 'smallEnterprise',
ellipsis: true, ellipsis: true,
width: 120 width: 120
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 180,
align: 'center',
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
} }
// { // {
// title: '备注', // title: '备注',
@@ -543,8 +305,12 @@
/* 搜索 */ /* 搜索 */
const reload = (where?: CreditCompanyParam) => { 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 = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: targetWhere });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
@@ -562,6 +328,38 @@
const openImport = () => { const openImport = () => {
showImport.value = true; 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) => { const openInfo = (row?: CreditCompany) => {
current.value = row ?? null; current.value = row ?? null;

View File

@@ -26,21 +26,21 @@
v-model:value="form.name" v-model:value="form.name"
/> />
</a-form-item> </a-form-item>
<a-form-item label="企业状态(如存续、注销等)" name="statusTxt"> <a-form-item label="状态" name="statusTxt">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入企业状态(如存续、注销等)" placeholder="请输入企业状态(如存续、注销等)"
v-model:value="form.statusTxt" v-model:value="form.statusTxt"
/> />
</a-form-item> </a-form-item>
<a-form-item label="法定代表人姓名" name="legalRepresentative"> <a-form-item label="法定代表人" name="legalRepresentative">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入法定代表人姓名" placeholder="请输入法定代表人姓名"
v-model:value="form.legalRepresentative" v-model:value="form.legalRepresentative"
/> />
</a-form-item> </a-form-item>
<a-form-item label="注册资本(金额)" name="registeredCapital"> <a-form-item label="注册资本" name="registeredCapital">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入注册资本(金额)" placeholder="请输入注册资本(金额)"
@@ -125,49 +125,12 @@
v-model:value="form.comments" v-model:value="form.comments"
/> />
</a-form-item> </a-form-item>
<a-form-item label="是否推荐" name="recommend"> <!-- <a-form-item label="状态, 0正常, 1冻结" name="status">-->
<a-input <!-- <a-radio-group v-model:value="form.status">-->
allow-clear <!-- <a-radio :value="0">显示</a-radio>-->
placeholder="请输入是否推荐" <!-- <a-radio :value="1">隐藏</a-radio>-->
v-model:value="form.recommend" <!-- </a-radio-group>-->
/> <!-- </a-form-item>-->
</a-form-item>
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
<a-input-number
:min="0"
:max="9999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
/>
</a-form-item>
<a-form-item label="状态, 0正常, 1冻结" name="status">
<a-radio-group v-model:value="form.status">
<a-radio :value="0">显示</a-radio>
<a-radio :value="1">隐藏</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="是否删除, 0否, 1是" name="deleted">
<a-input
allow-clear
placeholder="请输入是否删除, 0否, 1是"
v-model:value="form.deleted"
/>
</a-form-item>
<a-form-item label="用户ID" name="userId">
<a-input
allow-clear
placeholder="请输入用户ID"
v-model:value="form.userId"
/>
</a-form-item>
<a-form-item label="修改时间" name="updateTime">
<a-input
allow-clear
placeholder="请输入修改时间"
v-model:value="form.updateTime"
/>
</a-form-item>
</a-form> </a-form>
</ele-modal> </ele-modal>
</template> </template>
@@ -176,7 +139,10 @@
import { ref, reactive, watch } from 'vue'; import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue'; import { Form, message } from 'ant-design-vue';
import { assignObject, uuid } from 'ele-admin-pro'; import { assignObject, uuid } from 'ele-admin-pro';
import { addCreditExternal, updateCreditExternal } from '@/api/credit/creditExternal'; import {
addCreditExternal,
updateCreditExternal
} from '@/api/credit/creditExternal';
import { CreditExternal } from '@/api/credit/creditExternal/model'; import { CreditExternal } from '@/api/credit/creditExternal/model';
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
@@ -289,7 +255,9 @@
const formData = { const formData = {
...form ...form
}; };
const saveOrUpdate = isUpdate.value ? updateCreditExternal : addCreditExternal; const saveOrUpdate = isUpdate.value
? updateCreditExternal
: addCreditExternal;
saveOrUpdate(formData) saveOrUpdate(formData)
.then((msg) => { .then((msg) => {
loading.value = false; loading.value = false;
@@ -312,12 +280,12 @@
images.value = []; images.value = [];
if (props.data) { if (props.data) {
assignObject(form, props.data); assignObject(form, props.data);
if(props.data.image){ if (props.data.image) {
images.value.push({ images.value.push({
uid: uuid(), uid: uuid(),
url: props.data.image, url: props.data.image,
status: 'done' status: 'done'
}) });
} }
isUpdate.value = true; isUpdate.value = true;
} else { } else {

View File

@@ -1,54 +1,58 @@
<template> <template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)"> <a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<a-card :bordered="false" :body-style="{ padding: '16px' }"> <a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table <ele-pro-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:columns="columns" :columns="columns"
:datasource="datasource" :datasource="datasource"
:customRow="customRow" :customRow="customRow"
tool-class="ele-toolbar-form" tool-class="ele-toolbar-form"
class="sys-org-table" class="sys-org-table"
> >
<template #toolbar> <template #toolbar>
<search <search
@search="reload" @search="reload"
:selection="selection" :selection="selection"
@add="openEdit" @add="openEdit"
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport" @importData="openImport"
@exportData="exportData" @exportData="exportData"
/> />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
</template> </template>
<template #bodyCell="{ column, record }"> <template v-if="column.key === 'status'">
<template v-if="column.key === 'image'"> <a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-image :src="record.image" :width="50" /> <a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</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>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template> </template>
</ele-pro-table> <template v-if="column.key === 'action'">
</a-card> <a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<CreditExternalEdit v-model:visible="showEdit" :data="current" @done="reload" /> <CreditExternalEdit
<!-- 导入弹窗 --> v-model:visible="showEdit"
<CreditExternalImport v-model:visible="showImport" @done="reload" /> :data="current"
@done="reload"
/>
<!-- 导入弹窗 -->
<CreditExternalImport v-model:visible="showImport" @done="reload" />
</a-page-header> </a-page-header>
</template> </template>
@@ -134,20 +138,20 @@
ellipsis: true ellipsis: true
}, },
{ {
title: '企业状态(如存续、注销等)', title: '状态',
dataIndex: 'statusTxt', dataIndex: 'statusTxt',
key: 'statusTxt', key: 'statusTxt',
ellipsis: true ellipsis: true
}, },
{ {
title: '法定代表人姓名', title: '法定代表人',
dataIndex: 'legalRepresentative', dataIndex: 'legalRepresentative',
key: 'legalRepresentative', key: 'legalRepresentative',
ellipsis: true, ellipsis: true,
width: 120 width: 120
}, },
{ {
title: '注册资本(金额)', title: '注册资本',
dataIndex: 'registeredCapital', dataIndex: 'registeredCapital',
key: 'registeredCapital', key: 'registeredCapital',
width: 120 width: 120

View File

@@ -13,6 +13,12 @@
</template> </template>
<span>导入</span> <span>导入</span>
</a-button> </a-button>
<a-button class="ele-btn-icon" @click="exportData">
<template #icon>
<CloudDownloadOutlined />
</template>
<span>导出</span>
</a-button>
<a-button <a-button
danger danger
class="ele-btn-icon" class="ele-btn-icon"
@@ -40,6 +46,7 @@
import { import {
PlusOutlined, PlusOutlined,
CloudUploadOutlined, CloudUploadOutlined,
CloudDownloadOutlined,
DeleteOutlined DeleteOutlined
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import type { import type {
@@ -63,6 +70,7 @@
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
(e: 'importData'): void; (e: 'importData'): void;
(e: 'exportData'): void;
}>(); }>();
const keywords = ref(''); const keywords = ref('');
@@ -83,6 +91,11 @@
emit('importData'); emit('importData');
}; };
// 导出
const exportData = () => {
emit('exportData');
};
// 批量删除 // 批量删除
const remove = () => { const remove = () => {
emit('remove'); emit('remove');

View File

@@ -19,6 +19,7 @@
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport" @importData="openImport"
@exportData="exportData"
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@@ -72,10 +73,12 @@
import CreditJudiciaryImport from './components/credit-judiciary-import.vue'; import CreditJudiciaryImport from './components/credit-judiciary-import.vue';
import { import {
pageCreditJudiciary, pageCreditJudiciary,
listCreditJudiciary,
removeCreditJudiciary, removeCreditJudiciary,
removeBatchCreditJudiciary removeBatchCreditJudiciary
} from '@/api/credit/creditJudiciary'; } from '@/api/credit/creditJudiciary';
import type { CreditJudiciary, CreditJudiciaryParam } from '@/api/credit/creditJudiciary/model'; import type { CreditJudiciary, CreditJudiciaryParam } from '@/api/credit/creditJudiciary/model';
import { exportCreditData } from '../utils/export';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -318,6 +321,29 @@
showImport.value = true; showImport.value = true;
}; };
/* 导出 */
const exportData = () => {
exportCreditData<CreditJudiciary>({
filename: '司法案件',
columns: [
{ title: 'ID', dataIndex: 'id' },
{ title: '案件名称', dataIndex: 'name' },
{ title: '案件类型', dataIndex: 'infoType' },
{ title: '案由', dataIndex: 'reason' },
{ title: '进程日期', dataIndex: 'processDate' },
{ title: '案件进程', dataIndex: 'caseProgress' },
{ title: '案件身份', dataIndex: 'caseIdentity' },
{ title: '案号', dataIndex: 'code' },
{ title: '法院', dataIndex: 'court' },
{ title: '案件金额(元)', dataIndex: 'caseAmount' }
],
fetchData: () =>
listCreditJudiciary({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */ /* 删除单个 */
const remove = (row: CreditJudiciary) => { const remove = (row: CreditJudiciary) => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);

View File

@@ -17,6 +17,8 @@
@add="openEdit" @add="openEdit"
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport"
@exportData="exportData"
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@@ -45,11 +47,16 @@
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<CreditRiskRelationEdit v-model:visible="showEdit" :data="current" @done="reload" /> <CreditRiskRelationEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 导入弹窗 -->
<CreditRiskRelationImport
v-model:visible="showImport"
@done="reload"
/>
</a-page-header> </a-page-header>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref, computed } from 'vue'; import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
@@ -58,11 +65,21 @@
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types'; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue'; import Search from '@/views/credit/components/CreditSearchToolbar.vue';
import {getPageTitle} from '@/utils/common'; import { exportCreditData } from '../utils/export';
import { getPageTitle } from '@/utils/common';
import CreditRiskRelationEdit from './components/creditRiskRelationEdit.vue'; import CreditRiskRelationEdit from './components/creditRiskRelationEdit.vue';
import { pageCreditRiskRelation, removeCreditRiskRelation, removeBatchCreditRiskRelation } from '@/api/credit/creditRiskRelation'; import CreditRiskRelationImport from './components/credit-risk-relation-import.vue';
import type { CreditRiskRelation, CreditRiskRelationParam } from '@/api/credit/creditRiskRelation/model'; import {
pageCreditRiskRelation,
listCreditRiskRelation,
removeCreditRiskRelation,
removeBatchCreditRiskRelation
} from '@/api/credit/creditRiskRelation';
import type {
CreditRiskRelation,
CreditRiskRelationParam
} from '@/api/credit/creditRiskRelation/model';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -73,37 +90,45 @@
const current = ref<CreditRiskRelation | null>(null); const current = ref<CreditRiskRelation | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示导入弹窗
const showImport = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 搜索关键词
const searchText = ref('');
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page, page,
limit, limit,
where, where = {},
orders, orders,
filters filters
}) => { }) => {
const params: CreditRiskRelationParam = { ...where };
if (filters) { if (filters) {
where.status = filters.status; (params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
} }
return pageCreditRiskRelation({ return pageCreditRiskRelation({
...where, ...params,
...orders, ...orders,
page, page,
limit limit
}); });
}; };
// 完整的列配置(包含所有字段) // 关键信息列
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: '序号', title: '序号',
dataIndex: 'id', dataIndex: 'id',
key: 'id', key: 'id',
width: 90, width: 80
}, },
{ {
title: '主体名称', title: '主体名称',
@@ -141,49 +166,12 @@
key: 'riskRelation', key: 'riskRelation',
ellipsis: true 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: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
width: 200, width: 180,
align: 'center', align: 'center',
sorter: true,
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
@@ -191,16 +179,15 @@
title: '修改时间', title: '修改时间',
dataIndex: 'updateTime', dataIndex: 'updateTime',
key: 'updateTime', key: 'updateTime',
width: 200, width: 180,
align: 'center', align: 'center',
sorter: true,
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 180, width: 160,
fixed: 'right', fixed: 'right',
align: 'center', align: 'center',
hideInSetting: true hideInSetting: true
@@ -209,8 +196,12 @@
/* 搜索 */ /* 搜索 */
const reload = (where?: CreditRiskRelationParam) => { const reload = (where?: CreditRiskRelationParam) => {
if (where && Object.prototype.hasOwnProperty.call(where, 'keywords')) {
searchText.value = where.keywords ?? '';
}
const targetWhere = where ?? { keywords: searchText.value || undefined };
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: targetWhere });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
@@ -224,6 +215,39 @@
showMove.value = true; showMove.value = true;
}; };
/* 打开导入弹窗 */
const openImport = () => {
showImport.value = true;
};
/* 导出 */
const exportData = () => {
exportCreditData<CreditRiskRelation>({
filename: '风险关系',
columns: [
{ title: '序号', dataIndex: 'id' },
{ title: '主体名称', dataIndex: 'mainBodyName' },
{ title: '登记状态', dataIndex: 'registrationStatus' },
{ title: '注册资本', dataIndex: 'registeredCapital' },
{ title: '省份地区', dataIndex: 'provinceRegion' },
{ title: '关联关系', dataIndex: 'associatedRelation' },
{ title: '风险关系', dataIndex: 'riskRelation' },
{
title: '创建时间',
dataIndex: 'createTime',
formatter: (record: CreditRiskRelation) =>
record.createTime
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
: ''
}
],
fetchData: () =>
listCreditRiskRelation({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */ /* 删除单个 */
const remove = (row: CreditRiskRelation) => { const remove = (row: CreditRiskRelation) => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);

View File

@@ -17,6 +17,8 @@
@add="openEdit" @add="openEdit"
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport"
@exportData="exportData"
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@@ -45,11 +47,13 @@
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<CreditSupplierEdit v-model:visible="showEdit" :data="current" @done="reload" /> <CreditSupplierEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 导入弹窗 -->
<CreditSupplierImport v-model:visible="showImport" @done="reload" />
</a-page-header> </a-page-header>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref, computed } from 'vue'; import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro'; import type { EleProTable } from 'ele-admin-pro';
@@ -58,11 +62,21 @@
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types'; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue'; import Search from '@/views/credit/components/CreditSearchToolbar.vue';
import {getPageTitle} from '@/utils/common'; import { exportCreditData } from '../utils/export';
import { getPageTitle } from '@/utils/common';
import CreditSupplierEdit from './components/creditSupplierEdit.vue'; import CreditSupplierEdit from './components/creditSupplierEdit.vue';
import { pageCreditSupplier, removeCreditSupplier, removeBatchCreditSupplier } from '@/api/credit/creditSupplier'; import CreditSupplierImport from './components/credit-supplier-import.vue';
import type { CreditSupplier, CreditSupplierParam } from '@/api/credit/creditSupplier/model'; import {
pageCreditSupplier,
listCreditSupplier,
removeCreditSupplier,
removeBatchCreditSupplier
} from '@/api/credit/creditSupplier';
import type {
CreditSupplier,
CreditSupplierParam
} from '@/api/credit/creditSupplier/model';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -73,37 +87,45 @@
const current = ref<CreditSupplier | null>(null); const current = ref<CreditSupplier | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示导入弹窗
const showImport = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 搜索关键词
const searchText = ref('');
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page, page,
limit, limit,
where, where = {},
orders, orders,
filters filters
}) => { }) => {
const params: CreditSupplierParam = { ...where };
if (filters) { if (filters) {
where.status = filters.status; (params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
} }
return pageCreditSupplier({ return pageCreditSupplier({
...where, ...params,
...orders, ...orders,
page, page,
limit limit
}); });
}; };
// 完整的列配置(包含所有字段) // 关键信息列
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: 'ID', title: 'ID',
dataIndex: 'id', dataIndex: 'id',
key: 'id', key: 'id',
width: 90, width: 80
}, },
{ {
title: '供应商', title: '供应商',
@@ -135,66 +157,19 @@
key: 'dataSource', key: 'dataSource',
ellipsis: true 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: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
width: 200, width: 180,
align: 'center', align: 'center',
sorter: true,
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, ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss') customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 180, width: 160,
fixed: 'right', fixed: 'right',
align: 'center', align: 'center',
hideInSetting: true hideInSetting: true
@@ -203,8 +178,12 @@
/* 搜索 */ /* 搜索 */
const reload = (where?: CreditSupplierParam) => { const reload = (where?: CreditSupplierParam) => {
if (where && Object.prototype.hasOwnProperty.call(where, 'keywords')) {
searchText.value = where.keywords ?? '';
}
const targetWhere = where ?? { keywords: searchText.value || undefined };
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: targetWhere });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
@@ -218,6 +197,38 @@
showMove.value = true; showMove.value = true;
}; };
/* 打开导入弹窗 */
const openImport = () => {
showImport.value = true;
};
/* 导出 */
const exportData = () => {
exportCreditData<CreditSupplier>({
filename: '供应商',
columns: [
{ title: 'ID', dataIndex: 'id' },
{ title: '供应商', dataIndex: 'supplier' },
{ title: '状态', dataIndex: 'statusTxt' },
{ title: '采购金额(万元)', dataIndex: 'purchaseAmount' },
{ title: '公开日期', dataIndex: 'publicDate' },
{ title: '数据来源', dataIndex: 'dataSource' },
{
title: '创建时间',
dataIndex: 'createTime',
formatter: (record: CreditSupplier) =>
record.createTime
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
: ''
}
],
fetchData: () =>
listCreditSupplier({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */ /* 删除单个 */
const remove = (row: CreditSupplier) => { const remove = (row: CreditSupplier) => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);

View File

@@ -13,6 +13,12 @@
</template> </template>
<span>导入</span> <span>导入</span>
</a-button> </a-button>
<a-button class="ele-btn-icon" @click="exportData">
<template #icon>
<CloudDownloadOutlined />
</template>
<span>导出</span>
</a-button>
<a-button <a-button
danger danger
class="ele-btn-icon" class="ele-btn-icon"
@@ -40,6 +46,7 @@
import { import {
PlusOutlined, PlusOutlined,
CloudUploadOutlined, CloudUploadOutlined,
CloudDownloadOutlined,
DeleteOutlined DeleteOutlined
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import type { CreditUser, CreditUserParam } from '@/api/credit/creditUser/model'; import type { CreditUser, CreditUserParam } from '@/api/credit/creditUser/model';
@@ -60,6 +67,7 @@
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
(e: 'importData'): void; (e: 'importData'): void;
(e: 'exportData'): void;
}>(); }>();
const keywords = ref(''); const keywords = ref('');
@@ -80,6 +88,11 @@
emit('importData'); emit('importData');
}; };
// 导出
const exportData = () => {
emit('exportData');
};
// 批量删除 // 批量删除
const remove = () => { const remove = () => {
emit('remove'); emit('remove');

View File

@@ -19,6 +19,7 @@
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@importData="openImport" @importData="openImport"
@exportData="exportData"
/> />
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@@ -67,6 +68,7 @@
import CreditUserImport from './components/credit-user-import.vue'; import CreditUserImport from './components/credit-user-import.vue';
import { import {
pageCreditUser, pageCreditUser,
listCreditUser,
removeCreditUser, removeCreditUser,
removeBatchCreditUser removeBatchCreditUser
} from '@/api/credit/creditUser'; } from '@/api/credit/creditUser';
@@ -74,6 +76,7 @@
CreditUser, CreditUser,
CreditUserParam CreditUserParam
} from '@/api/credit/creditUser/model'; } from '@/api/credit/creditUser/model';
import { exportCreditData } from '../utils/export';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -258,6 +261,28 @@
showMove.value = true; showMove.value = true;
}; };
/* 导出 */
const exportData = () => {
exportCreditData<CreditUser>({
filename: '招投标结果',
columns: [
{ title: 'ID', dataIndex: 'id' },
{ title: '项目名称', dataIndex: 'name' },
{ title: '发布日期', dataIndex: 'releaseDate' },
{ title: '企业角色', dataIndex: 'role' },
{ title: '信息类型', dataIndex: 'infoType' },
{ title: '省份地区', dataIndex: 'province' },
{ title: '招采单位', dataIndex: 'procurementName' },
{ title: '中标单位', dataIndex: 'winningName' },
{ title: '中标金额', dataIndex: 'winningPrice' }
],
fetchData: () =>
listCreditUser({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */ /* 删除单个 */
const remove = (row: CreditUser) => { const remove = (row: CreditUser) => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);