feat(credit): 赊账客户模块更名为招投标信息模块

- 修改.env.development中的API地址注释为启用状态
- 将赊账客户相关组件及接口重命名为招投标信息相关
- 更新导入模板文件名为"招投标导入模板.xlsx"
- 调整编辑表单字段,将"唯一标识"改为"发布日期"
- 移除部分冗余表单项如类型、上级ID、国家省市等字段
- 修改列表展示字段,优化列标题如"客户名称"改为"项目名称"
- 更新API模型定义文件,调整字段描述和部分字段类型
- 删除部分无用的搜索条件和表格列配置项
- 调整表单校验提示信息与新业务场景匹配
- 清理废弃代码及注释内容,统一命名规范
This commit is contained in:
2025-12-16 14:59:30 +08:00
parent 0e489ec35f
commit 424e5641bb
10 changed files with 156 additions and 1128 deletions

View File

@@ -1,5 +1,5 @@
VITE_APP_NAME=后台管理(开发环境) VITE_APP_NAME=后台管理(开发环境)
#VITE_API_URL=http://127.0.0.1:9200/api VITE_API_URL=http://127.0.0.1:9200/api
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api #VITE_SERVER_API_URL=http://127.0.0.1:8000/api

View File

@@ -3,7 +3,7 @@ import type { ApiResult, PageResult } from '@/api';
import type { CreditUser, CreditUserParam } from './model'; import type { CreditUser, CreditUserParam } from './model';
/** /**
* 分页查询赊账客户 * 分页查询招投标信息
*/ */
export async function pageCreditUser(params: CreditUserParam) { export async function pageCreditUser(params: CreditUserParam) {
const res = await request.get<ApiResult<PageResult<CreditUser>>>( const res = await request.get<ApiResult<PageResult<CreditUser>>>(
@@ -19,7 +19,7 @@ export async function pageCreditUser(params: CreditUserParam) {
} }
/** /**
* 查询赊账客户表列表 * 查询招投标信息表列表
*/ */
export async function listCreditUser(params?: CreditUserParam) { export async function listCreditUser(params?: CreditUserParam) {
const res = await request.get<ApiResult<CreditUser[]>>( const res = await request.get<ApiResult<CreditUser[]>>(
@@ -35,7 +35,7 @@ export async function listCreditUser(params?: CreditUserParam) {
} }
/** /**
* 添加赊账客户 * 添加招投标信息
*/ */
export async function addCreditUser(data: CreditUser) { export async function addCreditUser(data: CreditUser) {
const res = await request.post<ApiResult<unknown>>( const res = await request.post<ApiResult<unknown>>(
@@ -49,7 +49,7 @@ export async function addCreditUser(data: CreditUser) {
} }
/** /**
* 修改赊账客户 * 修改招投标信息
*/ */
export async function updateCreditUser(data: CreditUser) { export async function updateCreditUser(data: CreditUser) {
const res = await request.put<ApiResult<unknown>>( const res = await request.put<ApiResult<unknown>>(
@@ -63,7 +63,7 @@ export async function updateCreditUser(data: CreditUser) {
} }
/** /**
* 删除赊账客户 * 删除招投标信息
*/ */
export async function removeCreditUser(id?: number) { export async function removeCreditUser(id?: number) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
@@ -76,7 +76,7 @@ export async function removeCreditUser(id?: number) {
} }
/** /**
* 批量删除赊账客户 * 批量删除招投标信息
*/ */
export async function removeBatchCreditUser(data: (number | undefined)[]) { export async function removeBatchCreditUser(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
@@ -92,7 +92,7 @@ export async function removeBatchCreditUser(data: (number | undefined)[]) {
} }
/** /**
* 根据id查询赊账客户 * 根据id查询招投标信息
*/ */
export async function getCreditUser(id: number) { export async function getCreditUser(id: number) {
const res = await request.get<ApiResult<CreditUser>>( const res = await request.get<ApiResult<CreditUser>>(
@@ -105,7 +105,7 @@ export async function getCreditUser(id: number) {
} }
/** /**
* 导入赊账客户 * 导入招投标
*/ */
export async function importCreditUsers(file: File) { export async function importCreditUsers(file: File) {
const formData = new FormData(); const formData = new FormData();

View File

@@ -1,11 +1,11 @@
import type { PageParam } from '@/api'; import type { PageParam } from '@/api';
/** /**
* 赊账客户 * 招投标信息
*/ */
export interface CreditUser { export interface CreditUser {
// ID // ID
id?: string; id?: number;
// 客户名称 // 客户名称
name?: string; name?: string;
// 唯一标识 // 唯一标识
@@ -34,6 +34,8 @@ export interface CreditUser {
winningName?: string; winningName?: string;
// 中标单位名称 // 中标单位名称
winningPrice?: string; winningPrice?: string;
// 发布日期
releaseDate?: string;
// 备注 // 备注
comments?: string; comments?: string;
// 是否推荐 // 是否推荐
@@ -57,7 +59,7 @@ export interface CreditUser {
} }
/** /**
* 赊账客户表搜索条件 * 招投标信息表搜索条件
*/ */
export interface CreditUserParam extends PageParam { export interface CreditUserParam extends PageParam {
id?: number; id?: number;

View File

@@ -1,9 +1,9 @@
<!-- 赊账客户导入弹窗 --> <!-- 招投标导入弹窗 -->
<template> <template>
<ele-modal <ele-modal
:width="520" :width="520"
:footer="null" :footer="null"
title="赊账客户批量导入" title="招投标批量导入"
:visible="visible" :visible="visible"
@update:visible="updateVisible" @update:visible="updateVisible"
> >
@@ -22,7 +22,7 @@
</a-spin> </a-spin>
<div class="ele-text-center"> <div class="ele-text-center">
<span>只能上传xlsxlsx文件</span> <span>只能上传xlsxlsx文件</span>
<a :href="templateUrl" download="赊账客户导入模板.xlsx"> <a :href="templateUrl" download="招投标导入模板.xlsx">
下载导入模板 下载导入模板
</a> </a>
</div> </div>

View File

@@ -5,7 +5,7 @@
:visible="visible" :visible="visible"
:maskClosable="false" :maskClosable="false"
:maxable="maxable" :maxable="maxable"
:title="isUpdate ? '编辑赊账客户表' : '添加赊账客户表'" :title="isUpdate ? '编辑招投标信息表' : '添加招投标信息表'"
:body-style="{ paddingBottom: '28px' }" :body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible" @update:visible="updateVisible"
@ok="save" @ok="save"
@@ -26,20 +26,20 @@
v-model:value="form.name" v-model:value="form.name"
/> />
</a-form-item> </a-form-item>
<a-form-item label="唯一标识" name="code"> <a-form-item label="发布日期" name="releaseDate">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入唯一标识" placeholder="请输入发布日期"
v-model:value="form.code" v-model:value="form.releaseDate"
/>
</a-form-item>
<a-form-item label="类型, 0普通用户, 1招投标" name="type">
<a-input
allow-clear
placeholder="请输入类型, 0普通用户, 1招投标"
v-model:value="form.type"
/> />
</a-form-item> </a-form-item>
<!-- <a-form-item label="类型, 0普通用户, 1招投标" name="type">-->
<!-- <a-input-->
<!-- allow-clear-->
<!-- placeholder="请输入类型, 0普通用户, 1招投标"-->
<!-- v-model:value="form.type"-->
<!-- />-->
<!-- </a-form-item>-->
<a-form-item label="企业角色" name="role"> <a-form-item label="企业角色" name="role">
<a-input <a-input
allow-clear allow-clear
@@ -47,13 +47,13 @@
v-model:value="form.role" v-model:value="form.role"
/> />
</a-form-item> </a-form-item>
<a-form-item label="上级id, 0是顶级" name="parentId"> <!-- <a-form-item label="上级id, 0是顶级" name="parentId">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入上级id, 0是顶级" <!-- placeholder="请输入上级id, 0是顶级"-->
v-model:value="form.parentId" <!-- v-model:value="form.parentId"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="信息类型" name="infoType"> <a-form-item label="信息类型" name="infoType">
<a-input <a-input
allow-clear allow-clear
@@ -61,59 +61,59 @@
v-model:value="form.infoType" v-model:value="form.infoType"
/> />
</a-form-item> </a-form-item>
<a-form-item label="所在国家" name="country"> <!-- <a-form-item label="所在国家" name="country">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入所在国家" <!-- placeholder="请输入所在国家"-->
v-model:value="form.country" <!-- v-model:value="form.country"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="所在省份" name="province"> <!-- <a-form-item label="所在省份" name="province">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入所在省份" <!-- placeholder="请输入所在省份"-->
v-model:value="form.province" <!-- v-model:value="form.province"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="所在城市" name="city"> <!-- <a-form-item label="所在城市" name="city">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入所在城市" <!-- placeholder="请输入所在城市"-->
v-model:value="form.city" <!-- v-model:value="form.city"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="所在辖区" name="region"> <!-- <a-form-item label="所在辖区" name="region">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入所在辖区" <!-- placeholder="请输入所在辖区"-->
v-model:value="form.region" <!-- v-model:value="form.region"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="街道地址" name="address"> <a-form-item label="省份地区" name="address">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入街道地址" placeholder="请输入街道地址"
v-model:value="form.address" v-model:value="form.address"
/> />
</a-form-item> </a-form-item>
<a-form-item label="招采单位名称" name="procurementName"> <a-form-item label="招采单位" name="procurementName">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入招采单位名称" placeholder="请输入招采单位名称"
v-model:value="form.procurementName" v-model:value="form.procurementName"
/> />
</a-form-item> </a-form-item>
<a-form-item label="中标单位名称" name="winningName"> <a-form-item label="中标单位" name="winningName">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入中标单位名称" placeholder="请输入中标单位名称"
v-model:value="form.winningName" v-model:value="form.winningName"
/> />
</a-form-item> </a-form-item>
<a-form-item label="中标单位名称" name="winningPrice"> <a-form-item label="中标金额" name="winningPrice">
<a-input <a-input
allow-clear allow-clear
placeholder="请输入中标单位名称" placeholder="请输入中标金额"
v-model:value="form.winningPrice" v-model:value="form.winningPrice"
/> />
</a-form-item> </a-form-item>
@@ -125,21 +125,21 @@
v-model:value="form.comments" v-model:value="form.comments"
/> />
</a-form-item> </a-form-item>
<a-form-item label="是否推荐" name="recommend"> <!-- <a-form-item label="是否推荐" name="recommend">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入是否推荐" <!-- placeholder="请输入是否推荐"-->
v-model:value="form.recommend" <!-- v-model:value="form.recommend"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="到期时间" name="expirationTime"> <!-- <a-form-item label="到期时间" name="expirationTime">-->
<a-input <!-- <a-input-->
allow-clear <!-- allow-clear-->
placeholder="请输入到期时间" <!-- placeholder="请输入到期时间"-->
v-model:value="form.expirationTime" <!-- v-model:value="form.expirationTime"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="排序(数字越小越靠前)" name="sortNumber"> <a-form-item label="排序" name="sortNumber">
<a-input-number <a-input-number
:min="0" :min="0"
:max="9999" :max="9999"
@@ -148,33 +148,6 @@
v-model:value="form.sortNumber" v-model:value="form.sortNumber"
/> />
</a-form-item> </a-form-item>
<a-form-item label="状态, 0正常, 1冻结" name="status">
<a-radio-group v-model:value="form.status">
<a-radio :value="0">显示</a-radio>
<a-radio :value="1">隐藏</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="是否删除, 0否, 1是" name="deleted">
<a-input
allow-clear
placeholder="请输入是否删除, 0否, 1是"
v-model:value="form.deleted"
/>
</a-form-item>
<a-form-item label="用户ID" name="userId">
<a-input
allow-clear
placeholder="请输入用户ID"
v-model:value="form.userId"
/>
</a-form-item>
<a-form-item label="修改时间" name="updateTime">
<a-input
allow-clear
placeholder="请输入修改时间"
v-model:value="form.updateTime"
/>
</a-form-item>
</a-form> </a-form>
</ele-modal> </ele-modal>
</template> </template>
@@ -235,21 +208,17 @@
procurementName: undefined, procurementName: undefined,
winningName: undefined, winningName: undefined,
winningPrice: undefined, winningPrice: undefined,
releaseDate: undefined,
comments: undefined, comments: undefined,
recommend: undefined, recommend: undefined,
expirationTime: undefined, expirationTime: undefined,
sortNumber: undefined, sortNumber: undefined,
status: undefined,
deleted: undefined, deleted: undefined,
userId: undefined, userId: undefined,
tenantId: undefined, tenantId: undefined,
createTime: undefined, createTime: undefined,
updateTime: undefined, updateTime: undefined,
creditUserId: undefined,
creditUserName: '',
status: 0, status: 0,
comments: '',
sortNumber: 100
}); });
/* 更新visible */ /* 更新visible */
@@ -263,7 +232,7 @@
{ {
required: true, required: true,
type: 'string', type: 'string',
message: '请填写赊账客户表名称', message: '请填写招投标信息表名称',
trigger: 'blur' trigger: 'blur'
} }
] ]

View File

@@ -117,35 +117,33 @@
width: 90, width: 90,
}, },
{ {
title: '客户名称', title: '项目名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name'
ellipsis: true
}, },
{ {
title: '唯一标识', title: '发布日期',
dataIndex: 'code', dataIndex: 'releaseDate',
key: 'code', key: 'releaseDate',
ellipsis: true
},
{
title: '类型, 0普通用户, 1招投标',
dataIndex: 'type',
key: 'type',
width: 120
}, },
// {
// title: '唯一标识',
// dataIndex: 'code',
// key: 'code',
// ellipsis: true
// },
// {
// title: '类型, 0普通用户, 1招投标',
// dataIndex: 'type',
// key: 'type',
// width: 120
// },
{ {
title: '企业角色', title: '企业角色',
dataIndex: 'role', dataIndex: 'role',
key: 'role', key: 'role',
ellipsis: true ellipsis: true
}, },
{
title: '上级id, 0是顶级',
dataIndex: 'parentId',
key: 'parentId',
width: 120
},
{ {
title: '信息类型', title: '信息类型',
dataIndex: 'infoType', dataIndex: 'infoType',
@@ -153,123 +151,79 @@
ellipsis: true ellipsis: true
}, },
{ {
title: '所在国家', title: '省份地区',
dataIndex: 'country',
key: 'country',
ellipsis: true
},
{
title: '所在省份',
dataIndex: 'province', dataIndex: 'province',
key: 'province', key: 'province',
ellipsis: true ellipsis: true
}, },
// {
// title: '所在城市',
// dataIndex: 'city',
// key: 'city',
// ellipsis: true
// },
// {
// title: '所在辖区',
// dataIndex: 'region',
// key: 'region',
// ellipsis: true
// },
// {
// title: '街道地址',
// dataIndex: 'address',
// key: 'address',
// ellipsis: true
// },
{ {
title: '所在城市', title: '招采单位',
dataIndex: 'city',
key: 'city',
ellipsis: true
},
{
title: '所在辖区',
dataIndex: 'region',
key: 'region',
ellipsis: true
},
{
title: '街道地址',
dataIndex: 'address',
key: 'address',
ellipsis: true
},
{
title: '招采单位名称',
dataIndex: 'procurementName', dataIndex: 'procurementName',
key: 'procurementName', key: 'procurementName',
ellipsis: true ellipsis: true
}, },
{ {
title: '中标单位名称', title: '中标单位',
dataIndex: 'winningName', dataIndex: 'winningName',
key: 'winningName', key: 'winningName',
ellipsis: true ellipsis: true
}, },
{ {
title: '中标单位名称', title: '中标金额',
dataIndex: 'winningPrice', dataIndex: 'winningPrice',
key: 'winningPrice', key: 'winningPrice',
ellipsis: true ellipsis: true
}, },
{ // {
title: '备注', // title: '排序',
dataIndex: 'comments', // dataIndex: 'sortNumber',
key: 'comments', // key: 'sortNumber',
ellipsis: true // width: 90,
}, // align: 'center',
{ // },
title: '是否推荐', // {
dataIndex: 'recommend', // title: '状态',
key: 'recommend', // dataIndex: 'status',
width: 120 // key: 'status',
}, // width: 120,
{ // align: 'center'
title: '到期时间', // },
dataIndex: 'expirationTime', // {
key: 'expirationTime', // title: '创建时间',
width: 120 // dataIndex: 'createTime',
}, // key: 'createTime',
{ // width: 200,
title: '排序(数字越小越靠前)', // align: 'center',
dataIndex: 'sortNumber', // sorter: true,
key: 'sortNumber', // ellipsis: true,
width: 120 // customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, // },
{ // {
title: '状态, 0正常, 1冻结', // title: '操作',
dataIndex: 'status', // key: 'action',
key: 'status', // width: 120,
width: 120 // fixed: 'right',
}, // align: 'center',
{ // hideInSetting: true
title: '是否删除, 0否, 1是', // }
dataIndex: 'deleted',
key: 'deleted',
width: 120
},
{
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
width: 120
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 200,
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,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]); ]);
/* 搜索 */ /* 搜索 */

View File

@@ -1,219 +0,0 @@
<!-- 搜索表单 -->
<template>
<div class="search-container">
<!-- 搜索表单 -->
<a-form
:model="searchForm"
layout="inline"
class="search-form"
@finish="handleSearch"
>
<a-form-item label="申请人姓名">
<a-input
v-model:value="searchForm.realName"
placeholder="请输入申请人姓名"
allow-clear
style="width: 160px"
/>
</a-form-item>
<a-form-item label="手机号码">
<a-input
v-model:value="searchForm.mobile"
placeholder="请输入手机号码"
allow-clear
style="width: 160px"
/>
</a-form-item>
<a-form-item label="申请方式">
<a-select
v-model:value="searchForm.applyType"
placeholder="全部方式"
allow-clear
style="width: 120px"
>
<a-select-option :value="10">需要审核</a-select-option>
<a-select-option :value="20">免审核</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="审核状态">
<a-select
v-model:value="searchForm.applyStatus"
placeholder="全部状态"
allow-clear
style="width: 120px"
>
<a-select-option :value="10">待审核</a-select-option>
<a-select-option :value="20">审核通过</a-select-option>
<a-select-option :value="30">审核驳回</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="申请时间">
<a-range-picker
v-model:value="searchForm.dateRange"
style="width: 240px"
/>
</a-form-item>
<a-form-item>
<a-space>
<a-button type="primary" html-type="submit" class="ele-btn-icon">
<template #icon>
<SearchOutlined />
</template>
搜索
</a-button>
<a-button @click="resetSearch">
重置
</a-button>
</a-space>
</a-form-item>
</a-form>
<!-- 操作按钮 -->
<div class="action-buttons">
<a-space>
<!-- <a-button type="primary" @click="add" class="ele-btn-icon">-->
<!-- <template #icon>-->
<!-- <PlusOutlined />-->
<!-- </template>-->
<!-- 新增申请-->
<!-- </a-button>-->
<a-button
type="primary"
ghost
:disabled="!selection?.length"
@click="batchApprove"
class="ele-btn-icon"
>
<template #icon>
<CheckOutlined />
</template>
批量通过
</a-button>
<a-button
:disabled="!selection?.length"
@click="exportData"
class="ele-btn-icon"
>
<template #icon>
<ExportOutlined />
</template>
导出数据
</a-button>
</a-space>
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive } from 'vue';
import {
PlusOutlined,
SearchOutlined,
CheckOutlined,
ExportOutlined
} from '@ant-design/icons-vue';
import type { ShopDealerApplyParam } from '@/api/shop/shopDealerApply/model';
import dayjs from 'dayjs';
const props = withDefaults(
defineProps<{
// 选中的数据
selection?: any[];
}>(),
{
selection: () => []
}
);
const emit = defineEmits<{
(e: 'search', where?: ShopDealerApplyParam): void;
(e: 'add'): void;
(e: 'batchApprove'): void;
(e: 'export'): void;
}>();
// 搜索表单
const searchForm = reactive<any>({
realName: '',
mobile: '',
applyType: undefined,
applyStatus: undefined,
dateRange: undefined
});
// 搜索
const handleSearch = () => {
const searchParams: ShopDealerApplyParam = {};
if (searchForm.realName) {
searchParams.realName = searchForm.realName;
}
if (searchForm.mobile) {
searchParams.mobile = searchForm.mobile;
}
if (searchForm.applyType) {
searchParams.applyType = searchForm.applyType;
}
if (searchForm.applyStatus) {
searchParams.applyStatus = searchForm.applyStatus;
}
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
searchParams.startTime = dayjs(searchForm.dateRange[0]).format('YYYY-MM-DD');
searchParams.endTime = dayjs(searchForm.dateRange[1]).format('YYYY-MM-DD');
}
emit('search', searchParams);
};
// 重置搜索
const resetSearch = () => {
searchForm.realName = '';
searchForm.mobile = '';
searchForm.applyType = undefined;
searchForm.applyStatus = undefined;
searchForm.dateRange = undefined;
emit('search', {});
};
// 新增
const add = () => {
emit('add');
};
// 批量通过
const batchApprove = () => {
emit('batchApprove');
};
// 导出数据
const exportData = () => {
emit('export');
};
</script>
<style lang="less" scoped>
.search-container {
background: #fff;
padding: 16px;
border-radius: 6px;
margin-bottom: 16px;
.search-form {
margin-bottom: 16px;
:deep(.ant-form-item) {
margin-bottom: 8px;
}
}
.action-buttons {
border-top: 1px solid #f0f0f0;
padding-top: 16px;
}
}
</style>

View File

@@ -1,88 +0,0 @@
<!-- 经销商申请批量导入弹窗 -->
<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>只能上传xlsxlsx文件</span>
<a
href="https://cms-api.websoft.top/api/shop/shop-dealer-apply/import/template"
download="经销商申请导入模板.xlsx"
>
下载导入模板
</a>
</div>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { message } from 'ant-design-vue/es';
import { CloudUploadOutlined } from '@ant-design/icons-vue';
import { importShopDealerApplies } from '@/api/shop/shopDealerApply';
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
defineProps<{
// 是否打开弹窗
visible: boolean;
}>();
// 导入请求状态
const loading = ref(false);
/* 上传 */
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;
importShopDealerApplies(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>

View File

@@ -1,280 +0,0 @@
<!-- 编辑弹窗 -->
<template>
<ele-modal
:width="600"
:visible="visible"
:maskClosable="false"
:maxable="maxable"
:title="isUpdate ? '编辑企业' : '新增企业'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<a-form
ref="formRef"
:model="form"
:rules="rules"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 18 }"
>
<a-form-item label="企业名称" name="dealerName">
<a-input
placeholder="请输入企业名称"
v-model:value="form.dealerName"
/>
</a-form-item>
<a-form-item label="入市状态" name="applyStatus">
<a-select v-model:value="form.applyStatus" placeholder="请选择入市状态" @change="handleStatusChange">
<a-select-option :value="10">
<a-tag>未入市</a-tag>
<span style="margin-left: 8px;">未入市</span>
</a-select-option>
<a-select-option :value="20">
<a-tag color="success">已入市</a-tag>
<span style="margin-left: 8px;">已入市</span>
</a-select-option>
</a-select>
</a-form-item>
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { assignObject } from 'ele-admin-pro';
import { addShopDealerApply, updateShopDealerApply } from '@/api/shop/shopDealerApply';
import { ShopDealerApply } from '@/api/shop/shopDealerApply/model';
import { FormInstance } from 'ant-design-vue/es/form';
// 是否是修改
const isUpdate = ref(false);
const useForm = Form.useForm;
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 修改回显的数据
data?: ShopDealerApply | null;
}>();
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
// 表单数据
const form = reactive<ShopDealerApply>({
applyId: undefined,
type: 3,
userId: undefined,
dealerName: '',
realName: '',
mobile: '',
refereeId: undefined,
applyType: 10,
applyTime: undefined,
applyStatus: 10,
auditTime: undefined,
rejectReason: '',
tenantId: undefined,
createTime: undefined,
updateTime: undefined
});
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 表单验证规则
const rules = reactive({
dealerName: [
{
required: true,
message: '请输入经销商名称',
trigger: 'blur'
}
],
realName: [
{
required: true,
message: '请输入企业名称',
trigger: 'blur'
}
],
applyStatus: [
{
required: true,
message: '请选择审核状态',
trigger: 'change'
}
]
});
const { resetFields } = useForm(form, rules);
/* 处理审核状态变化 */
const handleStatusChange = (value: number) => {
// 当状态改为审核通过或驳回时,自动设置审核时间为当前时间
if ((value === 20 || value === 30) && !form.auditTime) {
form.auditTime = dayjs();
}
// 当状态改为待审核时,清空审核时间和驳回原因
if (value === 10) {
form.auditTime = undefined;
form.rejectReason = '';
}
};
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
// 动态验证规则
const validateFields: string[] = ['userId', 'realName', 'mobile', 'applyStatus'];
// 如果是驳回状态,需要验证驳回原因
if (form.applyStatus === 30) {
validateFields.push('rejectReason');
}
// 如果是审核通过或驳回状态,需要验证审核时间
if (form.applyStatus === 20 || form.applyStatus === 30) {
validateFields.push('auditTime');
}
formRef.value
.validate(validateFields)
.then(() => {
loading.value = true;
const formData = {
...form
};
// 处理时间字段转换 - 转换为ISO字符串格式
if (formData.applyTime) {
if (dayjs.isDayjs(formData.applyTime)) {
formData.applyTime = formData.applyTime.format('YYYY-MM-DD HH:mm:ss');
} else if (typeof formData.applyTime === 'number') {
formData.applyTime = dayjs(formData.applyTime).format('YYYY-MM-DD HH:mm:ss');
}
}
if (formData.auditTime) {
if (dayjs.isDayjs(formData.auditTime)) {
formData.auditTime = formData.auditTime.format('YYYY-MM-DD HH:mm:ss');
} else if (typeof formData.auditTime === 'number') {
formData.auditTime = dayjs(formData.auditTime).format('YYYY-MM-DD HH:mm:ss');
}
}
// 当审核状态为通过或驳回时,确保有审核时间
if ((formData.applyStatus === 20 || formData.applyStatus === 30) && !formData.auditTime) {
formData.auditTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
}
// 当状态为待审核时,清空审核时间
if (formData.applyStatus === 10) {
formData.auditTime = undefined;
}
const saveOrUpdate = isUpdate.value ? updateShopDealerApply : addShopDealerApply;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
})
.catch(() => {});
};
watch(
() => props.visible,
(visible) => {
if (visible) {
if (props.data) {
assignObject(form, props.data);
// 处理时间字段 - 确保转换为dayjs对象
if (props.data.applyTime) {
form.applyTime = dayjs(props.data.applyTime);
}
if (props.data.auditTime) {
form.auditTime = dayjs(props.data.auditTime);
}
isUpdate.value = true;
} else {
// 重置为默认值
Object.assign(form, {
applyId: undefined,
userId: undefined,
realName: '',
mobile: '',
refereeId: undefined,
applyType: 10,
applyTime: dayjs(),
applyStatus: 10,
auditTime: undefined,
rejectReason: '',
tenantId: undefined,
createTime: undefined,
updateTime: undefined
});
isUpdate.value = false;
}
} else {
resetFields();
}
},
{ immediate: true }
);
</script>
<style lang="less" scoped>
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
margin: 24px 0 16px 0;
.ant-divider-inner-text {
padding: 0 16px 0 0;
}
}
:deep(.ant-form-item) {
margin-bottom: 16px;
}
:deep(.ant-radio) {
display: flex;
align-items: center;
margin-bottom: 8px;
.ant-radio-inner {
margin-right: 8px;
}
}
:deep(.ant-select-selection-item) {
display: flex;
align-items: center;
}
</style>

View File

@@ -1,310 +0,0 @@
<template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<a-card :bordered="false">
<!-- 表格 -->
<ele-pro-table
ref="tableRef"
row-key="applyId"
:columns="columns"
:datasource="datasource"
class="sys-org-table"
:scroll="{ x: 1300 }"
:where="defaultWhere"
:customRow="customRow"
cache-key="proSystemShopDealerApplyTable"
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined/>
</template>
<span>添加</span>
</a-button>
<a-button class="ele-btn-icon" @click="openImport()">
<template #icon>
<cloud-upload-outlined/>
</template>
<span>导入</span>
</a-button>
<!-- <a-button class="ele-btn-icon" @click="exportData()" :loading="exportLoading">-->
<!-- <template #icon>-->
<!-- <download-outlined/>-->
<!-- </template>-->
<!-- <span>导出</span>-->
<!-- </a-button>-->
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入关键词"
@search="reload"
@pressEnter="reload"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'applyStatus'">
<span class="text-green-500" v-if="record.applyStatus == 20">已入市</span>
<span class="text-gray-300" v-else>未入市</span>
</template>
<template v-if="column.key === 'action'">
<div>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical"/>
<a-popconfirm
placement="topRight"
title="确定要删除此用户吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</div>
</template>
</template>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 -->
<ShopDealerApplyEdit
v-model:visible="showEdit"
:data="current"
:organization-list="data"
@done="reload"
/>
<!-- 导入弹窗 -->
<ShopDealerApplyImport v-model:visible="showImport" @done="reload"/>
</a-page-header>
</template>
<script lang="ts" setup>
import {ref, reactive, watch} from 'vue';
import {message} from 'ant-design-vue/es';
import {
PlusOutlined,
CloudUploadOutlined,
} from '@ant-design/icons-vue';
import type {EleProTable} from 'ele-admin-pro/es';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import {messageLoading} from 'ele-admin-pro/es';
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
import ShopDealerApplyImport from './components/shop-dealer-apply-import.vue';
import {toDateString} from 'ele-admin-pro';
import {utils, writeFile} from 'xlsx';
import dayjs from 'dayjs';
import {Organization} from '@/api/system/organization/model';
import {getPageTitle} from "@/utils/common";
import router from "@/router";
import {listShopDealerApply, pageShopDealerApply, removeShopDealerApply} from "@/api/shop/shopDealerApply";
import {ShopDealerApply, ShopDealerApplyParam} from "@/api/shop/shopDealerApply/model";
// 加载状态
const loading = ref(true);
// 树形数据
const data = ref<Organization[]>([]);
// 树展开的key
const expandedRowKeys = ref<number[]>([]);
// 树选中的key
const selectedRowKeys = ref<number[]>([]);
// 表格选中数据
const selection = ref<ShopDealerApply[]>([]);
// 当前编辑数据
const current = ref<ShopDealerApply | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示用户导入弹窗
const showImport = ref(false);
// 导出加载状态
const exportLoading = ref(false);
const searchText = ref('');
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格列配置
const columns = ref<ColumnItem[]>([
// {
// title: 'ID',
// dataIndex: 'userId',
// width: 90,
// showSorterTooltip: false
// },
{
title: '企业名称',
dataIndex: 'dealerName',
align: 'dealerName',
showSorterTooltip: false
},
{
title: '入市情况',
dataIndex: 'applyStatus',
key: 'applyStatus',
align: 'center',
sorter: true
},
{
title: '创建时间',
dataIndex: 'createTime',
sorter: true,
align: 'center',
showSorterTooltip: false,
ellipsis: true,
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center'
}
]);
// 默认搜索条件
const defaultWhere = reactive({
username: '',
nickname: ''
});
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders
}) => {
where = {};
where.keywords = searchText.value;
where.type = 3;
return pageShopDealerApply({page, limit, ...where, ...orders});
};
/* 搜索 */
const reload = (where?: ShopDealerApplyParam) => {
selection.value = [];
tableRef?.value?.reload({where});
};
/* 打开编辑弹窗 */
const openEdit = (row?: ShopDealerApply) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 打开编辑弹窗 */
const openImport = () => {
showImport.value = true;
};
/* 导出数据 */
const exportData = async () => {
exportLoading.value = true;
try {
// 定义表头
const array: (string | number)[][] = [
[
'ID',
'企业名称',
'联系方式',
'入市状态',
'创建时间'
]
];
// 构建查询参数,使用当前搜索条件
const params = {
keywords: searchText.value,
isAdmin: 0
};
// 获取用户列表数据
const list = await listShopDealerApply(params);
if (!list || list.length === 0) {
message.warning('没有数据可以导出');
exportLoading.value = false;
return;
}
// 将数据转换为Excel行
list.forEach((user: ShopDealerApply) => {
array.push([
`${user.applyId || ''}`,
`${user.realName || ''}`,
`${user.mobile || ''}`,
`${user.applyStatus === 20 ? '通过' : '未通过'}`,
`${user.createTime || ''}`
]);
});
// 生成Excel文件
const sheetName = `导出企业入市${dayjs(new Date()).format('YYYYMMDD')}`;
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
];
message.loading('正在生成Excel文件...', 0);
setTimeout(() => {
writeFile(workbook, `${sheetName}.xlsx`);
exportLoading.value = false;
message.destroy();
message.success(`成功导出 ${list.length} 条记录`);
}, 1000);
} catch (error: any) {
exportLoading.value = false;
message.error(error.message || '导出失败');
}
};
/* 删除单个 */
const remove = (row: ShopDealerApply) => {
const hide = messageLoading('请求中..', 0);
removeShopDealerApply(row.applyId)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 自定义行属性 */
const customRow = (record: ShopDealerApply) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
watch(
() => router.currentRoute.value.query,
() => {},
{immediate: true}
);
</script>
<script lang="ts">
export default {
name: 'ShopDealerApplyRs'
};
</script>