feat(credit): 添加信用模块数据导入导出功能
- 为行政许可、破产重整、分支机构、历史法定代表人、附近企业、专利、疑似关系模块添加导入功能 - 在工具栏中将导入按钮文本更新为导入(多)以区分单个导入和批量导入 - 为各信用模块表格添加导入弹窗组件和相应的导入导出事件处理 - 实现各信用模块的导出功能,支持按搜索条件导出数据 - 优化表格数据源处理,支持关键词搜索和状态筛选 - 添加链接字段的点击跳转功能,提升用户体验 - 移除冗余的表格列字段,精简表格展示内容
This commit is contained in:
@@ -103,3 +103,27 @@ export async function getCreditAdministrativeLicense(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入行政许可
|
||||
*/
|
||||
export async function importCreditAdministrativeLicense(file: File, companyId?: number) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-administrative-license/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,27 @@ export async function getCreditBankruptcy(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入破产重整
|
||||
*/
|
||||
export async function importCreditBankruptcy(file: File, companyId?: number) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-bankruptcy/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,27 @@ export async function getCreditBranch(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入分支机构
|
||||
*/
|
||||
export async function importCreditBranch(file: File, companyId?: number) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-branch/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,30 @@ export async function getCreditHistoricalLegalPerson(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入历史法定代表人
|
||||
*/
|
||||
export async function importCreditHistoricalLegalPerson(
|
||||
file: File,
|
||||
companyId?: number
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-historical-legal-person/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,27 @@ export async function getCreditNearbyCompany(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入附近企业
|
||||
*/
|
||||
export async function importCreditNearbyCompany(file: File, companyId?: number) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-nearby-company/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,27 @@ export async function getCreditPatent(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入专利
|
||||
*/
|
||||
export async function importCreditPatent(file: File, companyId?: number) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-patent/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));
|
||||
}
|
||||
|
||||
@@ -103,3 +103,30 @@ export async function getCreditSuspectedRelationship(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入疑似关系
|
||||
*/
|
||||
export async function importCreditSuspectedRelationship(
|
||||
file: File,
|
||||
companyId?: number
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
if (companyId != null) {
|
||||
formData.append('companyId', String(companyId));
|
||||
}
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-suspected-relationship/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));
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
<span>导入</span>
|
||||
<span>导入(多)</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="exportData">
|
||||
<template #icon>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 行政许可导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="行政许可批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="行政许可导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditAdministrativeLicense } from '@/api/credit/creditAdministrativeLicense';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-administrative-license/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditAdministrativeLicense(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditAdministrativeLicenseEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditAdministrativeLicenseImport 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 +70,21 @@
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import Search from '@/views/credit/components/CreditSearchToolbar.vue';
|
||||
import { exportCreditData } from '../utils/export';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import CreditAdministrativeLicenseEdit from './components/creditAdministrativeLicenseEdit.vue';
|
||||
import { pageCreditAdministrativeLicense, removeCreditAdministrativeLicense, removeBatchCreditAdministrativeLicense } from '@/api/credit/creditAdministrativeLicense';
|
||||
import type { CreditAdministrativeLicense, CreditAdministrativeLicenseParam } from '@/api/credit/creditAdministrativeLicense/model';
|
||||
import CreditAdministrativeLicenseImport from './components/credit-administrative-license-import.vue';
|
||||
import {
|
||||
pageCreditAdministrativeLicense,
|
||||
listCreditAdministrativeLicense,
|
||||
removeCreditAdministrativeLicense,
|
||||
removeBatchCreditAdministrativeLicense
|
||||
} from '@/api/credit/creditAdministrativeLicense';
|
||||
import type {
|
||||
CreditAdministrativeLicense,
|
||||
CreditAdministrativeLicenseParam
|
||||
} from '@/api/credit/creditAdministrativeLicense/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -73,24 +95,32 @@
|
||||
const current = ref<CreditAdministrativeLicense | 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: CreditAdministrativeLicenseParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditAdministrativeLicense({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -129,12 +159,6 @@
|
||||
key: 'type',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '链接',
|
||||
dataIndex: 'url',
|
||||
key: 'url',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '有效期自',
|
||||
dataIndex: 'validityStart',
|
||||
@@ -165,48 +189,6 @@
|
||||
key: 'dataSourceUnit',
|
||||
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',
|
||||
@@ -217,16 +199,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',
|
||||
@@ -239,8 +211,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditAdministrativeLicenseParam) => {
|
||||
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 });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
@@ -254,6 +230,43 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditAdministrativeLicense>({
|
||||
filename: '行政许可',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '决定文书/许可编号', dataIndex: 'code' },
|
||||
{ title: '决定文书/许可证名称', dataIndex: 'name' },
|
||||
{ title: '许可状态', dataIndex: 'statusText' },
|
||||
{ title: '许可类型', dataIndex: 'type' },
|
||||
{ title: '有效期自', dataIndex: 'validityStart' },
|
||||
{ title: '有效期至', dataIndex: 'validityEnd' },
|
||||
{ title: '许可机关', dataIndex: 'licensingAuthority' },
|
||||
{ title: '许可内容', dataIndex: 'licenseContent' },
|
||||
{ title: '数据来源单位', dataIndex: 'dataSourceUnit' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditAdministrativeLicense) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditAdministrativeLicense({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditAdministrativeLicense) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 破产重整导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="破产重整批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="破产重整导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditBankruptcy } from '@/api/credit/creditBankruptcy';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-bankruptcy/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditBankruptcy(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 === 'code'">
|
||||
<template v-if="record.url">
|
||||
<a :href="record.url" target="_blank">{{ record.code }}</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ record.code }}
|
||||
</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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditBankruptcyEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditBankruptcyImport 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 Search from '@/views/credit/components/CreditSearchToolbar.vue';
|
||||
import { exportCreditData } from '../utils/export';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import CreditBankruptcyEdit from './components/creditBankruptcyEdit.vue';
|
||||
import { pageCreditBankruptcy, removeCreditBankruptcy, removeBatchCreditBankruptcy } from '@/api/credit/creditBankruptcy';
|
||||
import CreditBankruptcyImport from './components/credit-bankruptcy-import.vue';
|
||||
import {
|
||||
pageCreditBankruptcy,
|
||||
listCreditBankruptcy,
|
||||
removeCreditBankruptcy,
|
||||
removeBatchCreditBankruptcy
|
||||
} from '@/api/credit/creditBankruptcy';
|
||||
import type { CreditBankruptcy, CreditBankruptcyParam } from '@/api/credit/creditBankruptcy/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -73,24 +92,32 @@
|
||||
const current = ref<CreditBankruptcy | 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: CreditBankruptcyParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditBankruptcy({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -123,12 +150,6 @@
|
||||
key: 'party',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '链接',
|
||||
dataIndex: 'url',
|
||||
key: 'url',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '经办法院',
|
||||
dataIndex: 'court',
|
||||
@@ -141,48 +162,6 @@
|
||||
key: 'publicDate',
|
||||
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?: CreditBankruptcyParam) => {
|
||||
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<CreditBankruptcy>({
|
||||
filename: '破产重整',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '案号', dataIndex: 'code' },
|
||||
{ title: '案件类型', dataIndex: 'type' },
|
||||
{ title: '当事人', dataIndex: 'party' },
|
||||
{ title: '经办法院', dataIndex: 'court' },
|
||||
{ title: '公开日期', dataIndex: 'publicDate' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditBankruptcy) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditBankruptcy({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditBankruptcy) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 分支机构导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="分支机构批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="分支机构导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditBranch } from '@/api/credit/creditBranch';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-branch/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditBranch(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 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);
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
:disabled="!form.id"
|
||||
@click="openRelatedImport(tab.key)"
|
||||
>
|
||||
导入
|
||||
导入(多)
|
||||
</a-button>
|
||||
<a-button
|
||||
:loading="tabState[tab.key].loading"
|
||||
@@ -86,13 +86,32 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { computed, h, reactive, ref, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { CreditCompany } from '@/api/credit/creditCompany/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import CreditCompanyRelatedImport from './credit-company-related-import.vue';
|
||||
import {
|
||||
pageCreditAdministrativeLicense,
|
||||
importCreditAdministrativeLicense
|
||||
} from '@/api/credit/creditAdministrativeLicense';
|
||||
import { pageCreditBankruptcy, importCreditBankruptcy } from '@/api/credit/creditBankruptcy';
|
||||
import { pageCreditBranch, importCreditBranch } from '@/api/credit/creditBranch';
|
||||
import {
|
||||
pageCreditHistoricalLegalPerson,
|
||||
importCreditHistoricalLegalPerson
|
||||
} from '@/api/credit/creditHistoricalLegalPerson';
|
||||
import {
|
||||
pageCreditNearbyCompany,
|
||||
importCreditNearbyCompany
|
||||
} from '@/api/credit/creditNearbyCompany';
|
||||
import { pageCreditPatent, importCreditPatent } from '@/api/credit/creditPatent';
|
||||
import {
|
||||
pageCreditSuspectedRelationship,
|
||||
importCreditSuspectedRelationship
|
||||
} from '@/api/credit/creditSuspectedRelationship';
|
||||
import { pageCreditUser, importCreditUsers } from '@/api/credit/creditUser';
|
||||
import {
|
||||
pageCreditExternal,
|
||||
@@ -195,7 +214,14 @@
|
||||
{ key: '终本案件', label: '终本案件' },
|
||||
{ key: '限制高消费', label: '限制高消费' },
|
||||
{ key: '股权冻结', label: '股权冻结' },
|
||||
{ key: '司法案件', label: '司法案件' }
|
||||
{ key: '司法案件', label: '司法案件' },
|
||||
{ key: '附近企业', label: '附近企业' },
|
||||
{ key: '分支机构', label: '分支机构' },
|
||||
{ key: '破产重整', label: '破产重整' },
|
||||
{ key: '行政许可', label: '行政许可' },
|
||||
{ key: '疑似关系', label: '疑似关系' },
|
||||
{ key: '专利', label: '专利' },
|
||||
{ key: '历史法定代表人', label: '历史法定代表人' }
|
||||
];
|
||||
|
||||
type TabApiConfig = {
|
||||
@@ -294,6 +320,41 @@
|
||||
page: pageCreditJudiciary as any,
|
||||
importFn: importCreditJudiciaries as any,
|
||||
templatePath: '/credit/credit-judiciary/import/template'
|
||||
},
|
||||
附近企业: {
|
||||
page: pageCreditNearbyCompany as any,
|
||||
importFn: importCreditNearbyCompany as any,
|
||||
templatePath: '/credit/credit-nearby-company/import/template'
|
||||
},
|
||||
分支机构: {
|
||||
page: pageCreditBranch as any,
|
||||
importFn: importCreditBranch as any,
|
||||
templatePath: '/credit/credit-branch/import/template'
|
||||
},
|
||||
破产重整: {
|
||||
page: pageCreditBankruptcy as any,
|
||||
importFn: importCreditBankruptcy as any,
|
||||
templatePath: '/credit/credit-bankruptcy/import/template'
|
||||
},
|
||||
行政许可: {
|
||||
page: pageCreditAdministrativeLicense as any,
|
||||
importFn: importCreditAdministrativeLicense as any,
|
||||
templatePath: '/credit/credit-administrative-license/import/template'
|
||||
},
|
||||
疑似关系: {
|
||||
page: pageCreditSuspectedRelationship as any,
|
||||
importFn: importCreditSuspectedRelationship as any,
|
||||
templatePath: '/credit/credit-suspected-relationship/import/template'
|
||||
},
|
||||
专利: {
|
||||
page: pageCreditPatent as any,
|
||||
importFn: importCreditPatent as any,
|
||||
templatePath: '/credit/credit-patent/import/template'
|
||||
},
|
||||
历史法定代表人: {
|
||||
page: pageCreditHistoricalLegalPerson as any,
|
||||
importFn: importCreditHistoricalLegalPerson as any,
|
||||
templatePath: '/credit/credit-historical-legal-person/import/template'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -302,6 +363,7 @@
|
||||
dataIndex: string;
|
||||
key: string;
|
||||
ellipsis?: boolean;
|
||||
customRender?: (opt: { text: any; record: Record<string, any> }) => any;
|
||||
};
|
||||
|
||||
type TabColumnConfig = {
|
||||
@@ -376,6 +438,144 @@
|
||||
createTime: '创建时间',
|
||||
updateTime: '修改时间'
|
||||
}
|
||||
},
|
||||
附近企业: {
|
||||
order: [
|
||||
'name',
|
||||
'registrationStatus',
|
||||
'legalPerson',
|
||||
'registeredCapital',
|
||||
'establishDate',
|
||||
'code',
|
||||
'address',
|
||||
'phone',
|
||||
'email',
|
||||
'domain',
|
||||
'createTime'
|
||||
],
|
||||
titleMap: {
|
||||
name: '企业名称',
|
||||
registrationStatus: '登记状态',
|
||||
legalPerson: '法定代表人',
|
||||
registeredCapital: '注册资本',
|
||||
establishDate: '成立日期',
|
||||
code: '统一社会信用代码',
|
||||
address: '注册地址',
|
||||
phone: '有效手机号',
|
||||
email: '邮箱',
|
||||
domain: '官网网址',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
分支机构: {
|
||||
order: [
|
||||
'name',
|
||||
'curator',
|
||||
'region',
|
||||
'establishDate',
|
||||
'statusText',
|
||||
'createTime'
|
||||
],
|
||||
titleMap: {
|
||||
name: '分支机构名称',
|
||||
curator: '负责人',
|
||||
region: '地区',
|
||||
establishDate: '成立日期',
|
||||
statusText: '状态',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
破产重整: {
|
||||
order: ['code', 'type', 'party', 'court', 'publicDate', 'createTime'],
|
||||
titleMap: {
|
||||
code: '案号',
|
||||
type: '案件类型',
|
||||
party: '当事人',
|
||||
court: '经办法院',
|
||||
publicDate: '公开日期',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
行政许可: {
|
||||
order: [
|
||||
'code',
|
||||
'name',
|
||||
'statusText',
|
||||
'type',
|
||||
'validityStart',
|
||||
'validityEnd',
|
||||
'licensingAuthority',
|
||||
'createTime'
|
||||
],
|
||||
titleMap: {
|
||||
code: '许可编号',
|
||||
name: '许可证名称',
|
||||
statusText: '许可状态',
|
||||
type: '许可类型',
|
||||
validityStart: '有效期自',
|
||||
validityEnd: '有效期至',
|
||||
licensingAuthority: '许可机关',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
疑似关系: {
|
||||
order: [
|
||||
'name',
|
||||
'statusText',
|
||||
'legalPerson',
|
||||
'registeredCapital',
|
||||
'createDate',
|
||||
'relatedParty',
|
||||
'type',
|
||||
'detail',
|
||||
'createTime'
|
||||
],
|
||||
titleMap: {
|
||||
name: '企业名称',
|
||||
statusText: '状态',
|
||||
legalPerson: '法定代表人',
|
||||
registeredCapital: '注册资本',
|
||||
createDate: '成立日期',
|
||||
relatedParty: '关联方',
|
||||
type: '疑似关系类型',
|
||||
detail: '疑似关系详情',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
专利: {
|
||||
order: [
|
||||
'name',
|
||||
'type',
|
||||
'statusText',
|
||||
'registerNo',
|
||||
'registerDate',
|
||||
'publicNo',
|
||||
'publicDate',
|
||||
'inventor',
|
||||
'patentApplicant',
|
||||
'createTime'
|
||||
],
|
||||
titleMap: {
|
||||
name: '发明名称',
|
||||
type: '专利类型',
|
||||
statusText: '法律状态',
|
||||
registerNo: '申请号',
|
||||
registerDate: '申请日',
|
||||
publicNo: '公开(公告)号',
|
||||
publicDate: '公开(公告)日期',
|
||||
inventor: '发明人',
|
||||
patentApplicant: '申请(专利权)人',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
},
|
||||
历史法定代表人: {
|
||||
order: ['name', 'registerDate', 'publicDate', 'createTime'],
|
||||
titleMap: {
|
||||
name: '名称',
|
||||
registerDate: '任职日期',
|
||||
publicDate: '卸任日期',
|
||||
createTime: '创建时间'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -541,15 +741,28 @@
|
||||
const titleMap = { ...commonTitleMap, ...(config?.titleMap ?? {}) };
|
||||
|
||||
const keysFromData = Object.keys(rows[0]);
|
||||
const keysSet = new Set(keysFromData);
|
||||
const keys = config?.order?.length ? config.order : keysFromData;
|
||||
const finalKeys = keys.filter((k) => !hidden.has(k));
|
||||
const finalKeys = keys.filter((k) => keysSet.has(k) && !hidden.has(k));
|
||||
|
||||
return finalKeys.map((key) => ({
|
||||
const linkTextKeys = new Set(['name', 'code', 'caseNumber', 'registerNo']);
|
||||
return finalKeys.map((key) => {
|
||||
const column: TableColumn = {
|
||||
title: titleMap[key] ?? key,
|
||||
dataIndex: key,
|
||||
key,
|
||||
ellipsis: true
|
||||
}));
|
||||
};
|
||||
if (linkTextKeys.has(key)) {
|
||||
column.customRender = ({ text, record }) => {
|
||||
if (record?.url && text) {
|
||||
return h('a', { href: record.url, target: '_blank' }, text);
|
||||
}
|
||||
return text;
|
||||
};
|
||||
}
|
||||
return column;
|
||||
});
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
<span>导入</span>
|
||||
<span>导入(多)</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="exportData">
|
||||
<template #icon>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<!-- 历史法定代表人导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="历史法定代表人批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="历史法定代表人导入模板.xlsx">
|
||||
下载导入模板
|
||||
</a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditHistoricalLegalPerson } from '@/api/credit/creditHistoricalLegalPerson';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-historical-legal-person/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditHistoricalLegalPerson(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 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);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
<span>导入</span>
|
||||
<span>导入(多)</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="exportData">
|
||||
<template #icon>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 附近企业导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="附近企业批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="附近企业导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditNearbyCompany } from '@/api/credit/creditNearbyCompany';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-nearby-company/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditNearbyCompany(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 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);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 专利导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="专利批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="专利导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditPatent } from '@/api/credit/creditPatent';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-patent/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditPatent(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditPatentEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditPatentImport 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 Search from '@/views/credit/components/CreditSearchToolbar.vue';
|
||||
import { exportCreditData } from '../utils/export';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import CreditPatentEdit from './components/creditPatentEdit.vue';
|
||||
import { pageCreditPatent, removeCreditPatent, removeBatchCreditPatent } from '@/api/credit/creditPatent';
|
||||
import CreditPatentImport from './components/credit-patent-import.vue';
|
||||
import {
|
||||
pageCreditPatent,
|
||||
listCreditPatent,
|
||||
removeCreditPatent,
|
||||
removeBatchCreditPatent
|
||||
} from '@/api/credit/creditPatent';
|
||||
import type { CreditPatent, CreditPatentParam } from '@/api/credit/creditPatent/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -73,24 +92,32 @@
|
||||
const current = ref<CreditPatent | 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: CreditPatentParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditPatent({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -159,54 +186,6 @@
|
||||
key: 'patentApplicant',
|
||||
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',
|
||||
@@ -217,16 +196,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',
|
||||
@@ -239,8 +208,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditPatentParam) => {
|
||||
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 });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
@@ -254,6 +227,43 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditPatent>({
|
||||
filename: '专利',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '发明名称', dataIndex: 'name' },
|
||||
{ title: '专利类型', dataIndex: 'type' },
|
||||
{ title: '法律状态', dataIndex: 'statusText' },
|
||||
{ title: '申请号', dataIndex: 'registerNo' },
|
||||
{ title: '申请日', dataIndex: 'registerDate' },
|
||||
{ title: '公开(公告)号', dataIndex: 'publicNo' },
|
||||
{ title: '公开(公告)日期', dataIndex: 'publicDate' },
|
||||
{ title: '发明人', dataIndex: 'inventor' },
|
||||
{ title: '申请(专利权)人', dataIndex: 'patentApplicant' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditPatent) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditPatent({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditPatent) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 疑似关系导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="疑似关系批量导入"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
<div class="ele-text-center">
|
||||
<span>只能上传xls、xlsx文件,</span>
|
||||
<a :href="templateUrl" download="疑似关系导入模板.xlsx"> 下载导入模板 </a>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCreditSuspectedRelationship } from '@/api/credit/creditSuspectedRelationship';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 模板下载地址,保持与当前接口域名一致
|
||||
const templateUrl = computed(() => {
|
||||
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
|
||||
/\/$/,
|
||||
''
|
||||
);
|
||||
return `${base}/credit/credit-suspected-relationship/import/template`;
|
||||
});
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCreditSuspectedRelationship(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditSuspectedRelationshipEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditSuspectedRelationshipImport 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 Search from '@/views/credit/components/CreditSearchToolbar.vue';
|
||||
import { exportCreditData } from '../utils/export';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import CreditSuspectedRelationshipEdit from './components/creditSuspectedRelationshipEdit.vue';
|
||||
import { pageCreditSuspectedRelationship, removeCreditSuspectedRelationship, removeBatchCreditSuspectedRelationship } from '@/api/credit/creditSuspectedRelationship';
|
||||
import CreditSuspectedRelationshipImport from './components/credit-suspected-relationship-import.vue';
|
||||
import {
|
||||
pageCreditSuspectedRelationship,
|
||||
listCreditSuspectedRelationship,
|
||||
removeCreditSuspectedRelationship,
|
||||
removeBatchCreditSuspectedRelationship
|
||||
} from '@/api/credit/creditSuspectedRelationship';
|
||||
import type { CreditSuspectedRelationship, CreditSuspectedRelationshipParam } from '@/api/credit/creditSuspectedRelationship/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -73,24 +92,32 @@
|
||||
const current = ref<CreditSuspectedRelationship | 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: CreditSuspectedRelationshipParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditSuspectedRelationship({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
@@ -153,54 +180,6 @@
|
||||
key: 'detail',
|
||||
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',
|
||||
@@ -211,16 +190,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',
|
||||
@@ -233,8 +202,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditSuspectedRelationshipParam) => {
|
||||
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 });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
@@ -248,6 +221,42 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditSuspectedRelationship>({
|
||||
filename: '疑似关系',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '企业名称', dataIndex: 'name' },
|
||||
{ title: '状态', dataIndex: 'statusText' },
|
||||
{ title: '法定代表人', dataIndex: 'legalPerson' },
|
||||
{ title: '注册资本', dataIndex: 'registeredCapital' },
|
||||
{ title: '成立日期', dataIndex: 'createDate' },
|
||||
{ title: '关联方', dataIndex: 'relatedParty' },
|
||||
{ title: '疑似关系类型', dataIndex: 'type' },
|
||||
{ title: '疑似关系详情', dataIndex: 'detail' },
|
||||
{ title: '备注', dataIndex: 'comments' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditSuspectedRelationship) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditSuspectedRelationship({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditSuspectedRelationship) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<template #icon>
|
||||
<CloudUploadOutlined />
|
||||
</template>
|
||||
<span>导入</span>
|
||||
<span>导入(多)</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="exportData">
|
||||
<template #icon>
|
||||
|
||||
Reference in New Issue
Block a user