feat(credit): 添加客户管理模块
- 新增客户数据模型定义 - 实现客户分页查询、列表查询、新增、修改、删除等API接口 - 创建客户管理页面,包含表格展示、编辑弹窗、搜索功能 - 添加客户编辑表单,支持客户信息的录入与修改 - 实现客户数据的状态管理与操作功能 - 优化开庭公告等模块的字段命名与代码结构 - 统一导入导出功能组件的使用方式 - 修复被告/被上诉人字段绑定错误的问题
This commit is contained in:
@@ -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 { importCreditFinalVersion } from '@/api/credit/creditFinalVersion';
|
||||
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-final-version/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;
|
||||
importCreditFinalVersion(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>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入被告/被上诉人"
|
||||
v-model:value="form.defendant appellee"
|
||||
v-model:value="form.appellee"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="其他当事人/第三人" name="otherPartiesThirdParty">
|
||||
@@ -188,7 +188,7 @@
|
||||
id: undefined,
|
||||
dataType: undefined,
|
||||
plaintiffAppellant: undefined,
|
||||
defendant appellee: undefined,
|
||||
appellee: undefined,
|
||||
otherPartiesThirdParty: undefined,
|
||||
occurrenceTime: undefined,
|
||||
caseNumber: undefined,
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
@importData="openImport"
|
||||
@exportData="exportData"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
@@ -45,11 +47,16 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<CreditFinalVersionEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 导入弹窗 -->
|
||||
<CreditFinalVersionImport
|
||||
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 +65,21 @@
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import {getPageTitle} from '@/utils/common';
|
||||
import Search from '@/views/credit/components/CreditSearchToolbar.vue';
|
||||
import { exportCreditData } from '../utils/export';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
import CreditFinalVersionEdit from './components/creditFinalVersionEdit.vue';
|
||||
import { pageCreditFinalVersion, removeCreditFinalVersion, removeBatchCreditFinalVersion } from '@/api/credit/creditFinalVersion';
|
||||
import type { CreditFinalVersion, CreditFinalVersionParam } from '@/api/credit/creditFinalVersion/model';
|
||||
import CreditFinalVersionImport from './components/credit-final-version-import.vue';
|
||||
import {
|
||||
pageCreditFinalVersion,
|
||||
listCreditFinalVersion,
|
||||
removeCreditFinalVersion,
|
||||
removeBatchCreditFinalVersion
|
||||
} from '@/api/credit/creditFinalVersion';
|
||||
import type {
|
||||
CreditFinalVersion,
|
||||
CreditFinalVersionParam
|
||||
} from '@/api/credit/creditFinalVersion/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -73,31 +90,39 @@
|
||||
const current = ref<CreditFinalVersion | 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: CreditFinalVersionParam = { ...where };
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
(params as any).status = filters.status;
|
||||
}
|
||||
if (!params.keywords && searchText.value) {
|
||||
params.keywords = searchText.value;
|
||||
}
|
||||
return pageCreditFinalVersion({
|
||||
...where,
|
||||
...params,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 完整的列配置(包含所有字段)
|
||||
// 关键信息列
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
@@ -117,18 +142,6 @@
|
||||
key: 'plaintiffAppellant',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '被告/被上诉人',
|
||||
dataIndex: 'defendant appellee',
|
||||
key: 'defendant appellee',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '其他当事人/第三人',
|
||||
dataIndex: 'otherPartiesThirdParty',
|
||||
key: 'otherPartiesThirdParty',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '发生时间',
|
||||
dataIndex: 'occurrenceTime',
|
||||
@@ -165,66 +178,19 @@
|
||||
key: 'dataStatus',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '是否推荐',
|
||||
dataIndex: 'recommend',
|
||||
key: 'recommend',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '排序(数字越小越靠前)',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '状态, 0正常, 1冻结',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '是否删除, 0否, 1是',
|
||||
dataIndex: 'deleted',
|
||||
key: 'deleted',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
@@ -233,8 +199,12 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CreditFinalVersionParam) => {
|
||||
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 +218,41 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出 */
|
||||
const exportData = () => {
|
||||
exportCreditData<CreditFinalVersion>({
|
||||
filename: '终本案件',
|
||||
columns: [
|
||||
{ title: 'ID', dataIndex: 'id' },
|
||||
{ title: '数据类型', dataIndex: 'dataType' },
|
||||
{ title: '原告/上诉人', dataIndex: 'plaintiffAppellant' },
|
||||
{ title: '发生时间', dataIndex: 'occurrenceTime' },
|
||||
{ title: '案号', dataIndex: 'caseNumber' },
|
||||
{ title: '案由', dataIndex: 'causeOfAction' },
|
||||
{ title: '涉案金额', dataIndex: 'involvedAmount' },
|
||||
{ title: '法院', dataIndex: 'courtName' },
|
||||
{ title: '数据状态', dataIndex: 'dataStatus' },
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
formatter: (record: CreditFinalVersion) =>
|
||||
record.createTime
|
||||
? toDateString(record.createTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
: ''
|
||||
}
|
||||
],
|
||||
fetchData: () =>
|
||||
listCreditFinalVersion({
|
||||
keywords: searchText.value || undefined
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CreditFinalVersion) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
|
||||
Reference in New Issue
Block a user