feat(credit): 添加信用模块数据导入导出功能
- 为行政许可、破产重整、分支机构、历史法定代表人、附近企业、专利、疑似关系模块添加导入功能 - 在工具栏中将导入按钮文本更新为导入(多)以区分单个导入和批量导入 - 为各信用模块表格添加导入弹窗组件和相应的导入导出事件处理 - 实现各信用模块的导出功能,支持按搜索条件导出数据 - 优化表格数据源处理,支持关键词搜索和状态筛选 - 添加链接字段的点击跳转功能,提升用户体验 - 移除冗余的表格列字段,精简表格展示内容
This commit is contained in:
@@ -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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditHistoricalLegalPersonEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditHistoricalLegalPersonImport 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 CreditHistoricalLegalPersonEdit from './components/creditHistoricalLegalPersonEdit.vue';
|
||||
import { pageCreditHistoricalLegalPerson, removeCreditHistoricalLegalPerson, removeBatchCreditHistoricalLegalPerson } from '@/api/credit/creditHistoricalLegalPerson';
|
||||
import CreditHistoricalLegalPersonImport from './components/credit-historical-legal-person-import.vue';
|
||||
import {
|
||||
pageCreditHistoricalLegalPerson,
|
||||
listCreditHistoricalLegalPerson,
|
||||
removeCreditHistoricalLegalPerson,
|
||||
removeBatchCreditHistoricalLegalPerson
|
||||
} from '@/api/credit/creditHistoricalLegalPerson';
|
||||
import type { CreditHistoricalLegalPerson, CreditHistoricalLegalPersonParam } from '@/api/credit/creditHistoricalLegalPerson/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -73,24 +92,32 @@
|
||||
const current = ref<CreditHistoricalLegalPerson | 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: CreditHistoricalLegalPersonParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditHistoricalLegalPerson({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -123,54 +150,6 @@
|
||||
key: 'publicDate',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '链接',
|
||||
dataIndex: 'url',
|
||||
key: 'url',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '企业ID',
|
||||
dataIndex: 'companyId',
|
||||
key: 'companyId',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
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',
|
||||
@@ -181,16 +160,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',
|
||||
@@ -203,8 +172,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditHistoricalLegalPersonParam) => {
|
||||
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 });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
@@ -218,6 +191,37 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditHistoricalLegalPerson>({
|
||||
filename: '历史法定代表人',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '名称', dataIndex: 'name' },
|
||||
{ title: '任职日期', dataIndex: 'registerDate' },
|
||||
{ title: '卸任日期', dataIndex: 'publicDate' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditHistoricalLegalPerson) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditHistoricalLegalPerson({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditHistoricalLegalPerson) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
Reference in New Issue
Block a user