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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditBranchEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditBranchImport 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 CreditBranchEdit from './components/creditBranchEdit.vue';
|
||||
import { pageCreditBranch, removeCreditBranch, removeBatchCreditBranch } from '@/api/credit/creditBranch';
|
||||
import CreditBranchImport from './components/credit-branch-import.vue';
|
||||
import {
|
||||
pageCreditBranch,
|
||||
listCreditBranch,
|
||||
removeCreditBranch,
|
||||
removeBatchCreditBranch
|
||||
} from '@/api/credit/creditBranch';
|
||||
import type { CreditBranch, CreditBranchParam } from '@/api/credit/creditBranch/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -73,24 +92,32 @@
|
||||
const current = ref<CreditBranch | 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: CreditBranchParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditBranch({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -123,12 +150,6 @@
|
||||
key: 'region',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '链接',
|
||||
dataIndex: 'url',
|
||||
key: 'url',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '成立日期',
|
||||
dataIndex: 'establishDate',
|
||||
@@ -141,48 +162,6 @@
|
||||
key: 'statusText',
|
||||
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',
|
||||
@@ -193,16 +172,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',
|
||||
@@ -215,8 +184,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditBranchParam) => {
|
||||
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 });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
@@ -230,6 +203,39 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditBranch>({
|
||||
filename: '分支机构',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '分支机构名称', dataIndex: 'name' },
|
||||
{ title: '负责人', dataIndex: 'curator' },
|
||||
{ title: '地区', dataIndex: 'region' },
|
||||
{ title: '成立日期', dataIndex: 'establishDate' },
|
||||
{ title: '状态', dataIndex: 'statusText' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditBranch) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditBranch({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditBranch) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
Reference in New Issue
Block a user