feat(credit): 添加客户管理模块

- 新增客户数据模型定义
- 实现客户分页查询、列表查询、新增、修改、删除等API接口
- 创建客户管理页面,包含表格展示、编辑弹窗、搜索功能
- 添加客户编辑表单,支持客户信息的录入与修改
- 实现客户数据的状态管理与操作功能
- 优化开庭公告等模块的字段命名与代码结构
- 统一导入导出功能组件的使用方式
- 修复被告/被上诉人字段绑定错误的问题
This commit is contained in:
2025-12-21 21:22:11 +08:00
parent f87103119a
commit ebdc9b5933
37 changed files with 2691 additions and 858 deletions

View File

@@ -17,6 +17,8 @@
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
@importData="openImport"
@exportData="exportData"
/>
</template>
<template #bodyCell="{ column, record }">
@@ -45,11 +47,13 @@
<!-- 编辑弹窗 -->
<CreditExternalEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 导入弹窗 -->
<CreditExternalImport 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,11 +62,21 @@
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 CreditExternalEdit from './components/creditExternalEdit.vue';
import { pageCreditExternal, removeCreditExternal, removeBatchCreditExternal } from '@/api/credit/creditExternal';
import type { CreditExternal, CreditExternalParam } from '@/api/credit/creditExternal/model';
import CreditExternalImport from './components/credit-external-import.vue';
import {
pageCreditExternal,
listCreditExternal,
removeCreditExternal,
removeBatchCreditExternal
} from '@/api/credit/creditExternal';
import type {
CreditExternal,
CreditExternalParam
} from '@/api/credit/creditExternal/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -73,37 +87,45 @@
const current = ref<CreditExternal | 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: CreditExternalParam = { ...where };
if (filters) {
where.status = filters.status;
(params as any).status = filters.status;
}
if (!params.keywords && searchText.value) {
params.keywords = searchText.value;
}
return pageCreditExternal({
...where,
...params,
...orders,
page,
limit
});
};
// 完整的列配置(包含所有字段)
// 关键信息列
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'id',
key: 'id',
width: 90,
width: 80
},
{
title: '被投资企业名称',
@@ -121,7 +143,8 @@
title: '法定代表人姓名',
dataIndex: 'legalRepresentative',
key: 'legalRepresentative',
ellipsis: true
ellipsis: true,
width: 120
},
{
title: '注册资本(金额)',
@@ -145,19 +168,7 @@
title: '认缴出资额',
dataIndex: 'subscribedInvestmentAmount',
key: 'subscribedInvestmentAmount',
width: 120
},
{
title: '认缴出资日期',
dataIndex: 'subscribedInvestmentDate',
key: 'subscribedInvestmentDate',
width: 120
},
{
title: '间接持股比例',
dataIndex: 'indirectShareholdingRatio',
key: 'indirectShareholdingRatio',
width: 120
ellipsis: true
},
{
title: '投资日期',
@@ -177,78 +188,19 @@
key: 'industry',
ellipsis: true
},
{
title: '投资数量',
dataIndex: 'investmentCount',
key: 'investmentCount',
width: 120
},
{
title: '关联产品/机构',
dataIndex: 'relatedProductsInstitutions',
key: 'relatedProductsInstitutions',
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: 'createTime',
key: 'createTime',
width: 200,
width: 180,
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,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
width: 160,
fixed: 'right',
align: 'center',
hideInSetting: true
@@ -257,8 +209,12 @@
/* 搜索 */
const reload = (where?: CreditExternalParam) => {
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 });
};
/* 打开编辑弹窗 */
@@ -272,6 +228,43 @@
showMove.value = true;
};
/* 打开导入弹窗 */
const openImport = () => {
showImport.value = true;
};
/* 导出 */
const exportData = () => {
exportCreditData<CreditExternal>({
filename: '对外投资',
columns: [
{ title: 'ID', dataIndex: 'id' },
{ title: '被投资企业名称', dataIndex: 'name' },
{ title: '企业状态', dataIndex: 'statusTxt' },
{ title: '法定代表人姓名', dataIndex: 'legalRepresentative' },
{ title: '注册资本(金额)', dataIndex: 'registeredCapital' },
{ title: '成立日期', dataIndex: 'establishmentDate' },
{ title: '持股比例', dataIndex: 'shareholdingRatio' },
{ title: '认缴出资额', dataIndex: 'subscribedInvestmentAmount' },
{ title: '投资日期', dataIndex: 'investmentDate' },
{ title: '所属地区', dataIndex: 'region' },
{ title: '所属行业', dataIndex: 'industry' },
{
title: '创建时间',
dataIndex: 'createTime',
formatter: (record: CreditExternal) =>
record.createTime
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
: ''
}
],
fetchData: () =>
listCreditExternal({
keywords: searchText.value || undefined
})
});
};
/* 删除单个 */
const remove = (row: CreditExternal) => {
const hide = message.loading('请求中..', 0);