mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
refact: 重构目录架构
This commit is contained in:
@@ -1,2 +1 @@
|
||||
export * from './core';
|
||||
export * from './shop';
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 店铺管理模块API导出
|
||||
*/
|
||||
|
||||
// 店铺相关API
|
||||
export * from './shop.apis';
|
||||
|
||||
// 商品相关API
|
||||
export * from './product.apis';
|
||||
|
||||
// 推广费相关API
|
||||
export * from './promotion-fee.apis';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './apis';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './apis';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './apis';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 店铺管理模块类型定义导出
|
||||
*/
|
||||
|
||||
// DTO类型导出
|
||||
export * from './dto.shop';
|
||||
export * from './dto.product';
|
||||
export * from './dto.promotion-fee';
|
||||
|
||||
// VO类型导出
|
||||
export * from './vo.shop';
|
||||
export * from './vo.product';
|
||||
export * from './vo.promotion-fee';
|
||||
@@ -0,0 +1,21 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { MenuPermissionDTO, MenuPermissionVO } from './types';
|
||||
|
||||
/**
|
||||
* 菜单权限映射API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 添加菜单权限映射
|
||||
*/
|
||||
export async function addMenuPermissionApi(data: MenuPermissionDTO.AddMenuPermissionDTO) {
|
||||
return requestClient.post<MenuPermissionVO.MenuPermissionInfoVO>('/menu-permission/add', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单权限映射
|
||||
*/
|
||||
export async function removeMenuPermissionApi(data: MenuPermissionDTO.RemoveMenuPermissionDTO) {
|
||||
return requestClient.post<void>('/menu-permission/remove', data);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 菜单权限映射模块API导出
|
||||
*/
|
||||
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 菜单权限映射模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 菜单权限映射模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace MenuPermissionDTO {
|
||||
/** 添加菜单权限映射参数 */
|
||||
export interface AddMenuPermissionDTO {
|
||||
/** 菜单ID */
|
||||
menuId: number;
|
||||
/** 权限ID */
|
||||
permissionId: number;
|
||||
}
|
||||
|
||||
/** 删除菜单权限映射参数 */
|
||||
export interface RemoveMenuPermissionDTO {
|
||||
/** 菜单ID */
|
||||
menuId: number;
|
||||
/** 权限ID */
|
||||
permissionId: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 菜单权限映射模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace MenuPermissionVO {
|
||||
/** 菜单权限映射信息 */
|
||||
export interface MenuPermissionInfoVO {
|
||||
/** 主键ID */
|
||||
id: number;
|
||||
/** 菜单ID */
|
||||
menuId: number;
|
||||
/** 权限ID */
|
||||
permissionId: number;
|
||||
/** 菜单名称 */
|
||||
menuName: string;
|
||||
/** 菜单标题 */
|
||||
menuTitle: string;
|
||||
/** 权限码 */
|
||||
permissionCode: string;
|
||||
/** 权限名称 */
|
||||
permissionName: string;
|
||||
/** 权限类型 */
|
||||
permissionType: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 创建人ID */
|
||||
createBy: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 菜单模块API导出
|
||||
*/
|
||||
|
||||
export * from './menu';
|
||||
export * from './types';
|
||||
@@ -1,95 +1,44 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MenuApi {
|
||||
/** 菜单信息 */
|
||||
export interface MenuInfo {
|
||||
id: number;
|
||||
parentId?: number;
|
||||
superMenu?: number;
|
||||
name: string;
|
||||
title?: string;
|
||||
path?: string;
|
||||
component?: string;
|
||||
redirect?: string;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
type: string;
|
||||
visible?: number;
|
||||
status?: number;
|
||||
keepAlive?: number;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
children?: MenuInfo[];
|
||||
}
|
||||
import type { MenuDTO, MenuVO } from './types';
|
||||
|
||||
/** 创建菜单参数 */
|
||||
export interface CreateMenuParams {
|
||||
parentId?: number;
|
||||
superMenu?: number;
|
||||
name: string;
|
||||
title?: string;
|
||||
path?: string;
|
||||
component?: string;
|
||||
redirect?: string;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
type: string;
|
||||
visible?: number;
|
||||
status?: number;
|
||||
keepAlive?: number;
|
||||
}
|
||||
|
||||
/** 更新菜单参数 */
|
||||
export interface UpdateMenuParams {
|
||||
parentId?: number;
|
||||
superMenu?: number;
|
||||
name: string;
|
||||
title?: string;
|
||||
path?: string;
|
||||
component?: string;
|
||||
redirect?: string;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
type: string;
|
||||
visible?: number;
|
||||
status?: number;
|
||||
keepAlive?: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 菜单API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取菜单树
|
||||
*/
|
||||
export async function getMenuTreeApi() {
|
||||
return requestClient.get<MenuApi.MenuInfo[]>('/menu/tree');
|
||||
return requestClient.get<MenuVO.MenuInfoVO[]>('/menu/tree');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有菜单
|
||||
*/
|
||||
export async function getAllMenusApi() {
|
||||
return requestClient.get<MenuApi.MenuInfo[]>('/menu/list');
|
||||
return requestClient.get<MenuVO.MenuInfoVO[]>('/menu/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单详情
|
||||
*/
|
||||
export async function getMenuDetailApi(id: number) {
|
||||
return requestClient.get<MenuApi.MenuInfo>(`/menu/detail/${id}`);
|
||||
return requestClient.get<MenuVO.MenuInfoVO>(`/menu/detail/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建菜单
|
||||
*/
|
||||
export async function createMenuApi(data: MenuApi.CreateMenuParams) {
|
||||
return requestClient.post<MenuApi.MenuInfo>('/menu/create', data);
|
||||
export async function createMenuApi(data: MenuDTO.CreateMenuDTO) {
|
||||
return requestClient.post<MenuVO.MenuInfoVO>('/menu/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
*/
|
||||
export async function updateMenuApi(id: number, data: MenuApi.UpdateMenuParams) {
|
||||
return requestClient.put<MenuApi.MenuInfo>(`/menu/update/${id}`, data);
|
||||
export async function updateMenuApi(id: number, data: MenuDTO.UpdateMenuDTO) {
|
||||
return requestClient.put<MenuVO.MenuInfoVO>(`/menu/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,4 +46,4 @@ export async function updateMenuApi(id: number, data: MenuApi.UpdateMenuParams)
|
||||
*/
|
||||
export async function deleteMenuApi(id: number) {
|
||||
return requestClient.delete<void>(`/menu/delete/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 菜单模块类型定义导出
|
||||
*/
|
||||
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 菜单模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace MenuDTO {
|
||||
/** 创建菜单参数 */
|
||||
export interface CreateMenuDTO {
|
||||
/** 父级菜单ID */
|
||||
parentId?: number;
|
||||
/** 超级菜单标识 */
|
||||
superMenu?: number;
|
||||
/** 菜单名称 */
|
||||
name: string;
|
||||
/** 菜单标题 */
|
||||
title?: string;
|
||||
/** 路由路径 */
|
||||
path?: string;
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** 重定向路径 */
|
||||
redirect?: string;
|
||||
/** 菜单图标 */
|
||||
icon?: string;
|
||||
/** 排序 */
|
||||
order?: number;
|
||||
/** 菜单类型 */
|
||||
type: string;
|
||||
/** 是否可见 */
|
||||
visible?: number;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
/** 是否缓存 */
|
||||
keepAlive?: number;
|
||||
}
|
||||
|
||||
/** 更新菜单参数 */
|
||||
export interface UpdateMenuDTO {
|
||||
/** 父级菜单ID */
|
||||
parentId?: number;
|
||||
/** 超级菜单标识 */
|
||||
superMenu?: number;
|
||||
/** 菜单名称 */
|
||||
name: string;
|
||||
/** 菜单标题 */
|
||||
title?: string;
|
||||
/** 路由路径 */
|
||||
path?: string;
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** 重定向路径 */
|
||||
redirect?: string;
|
||||
/** 菜单图标 */
|
||||
icon?: string;
|
||||
/** 排序 */
|
||||
order?: number;
|
||||
/** 菜单类型 */
|
||||
type: string;
|
||||
/** 是否可见 */
|
||||
visible?: number;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
/** 是否缓存 */
|
||||
keepAlive?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 菜单模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace MenuVO {
|
||||
/** 菜单信息 */
|
||||
export interface MenuInfoVO {
|
||||
/** 主键ID */
|
||||
id: number;
|
||||
/** 父级菜单ID */
|
||||
parentId?: number;
|
||||
/** 超级菜单标识 */
|
||||
superMenu?: number;
|
||||
/** 菜单名称 */
|
||||
name: string;
|
||||
/** 菜单标题 */
|
||||
title?: string;
|
||||
/** 路由路径 */
|
||||
path?: string;
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** 重定向路径 */
|
||||
redirect?: string;
|
||||
/** 菜单图标 */
|
||||
icon?: string;
|
||||
/** 排序 */
|
||||
order?: number;
|
||||
/** 菜单类型 */
|
||||
type: string;
|
||||
/** 是否可见 */
|
||||
visible?: number;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
/** 是否缓存 */
|
||||
keepAlive?: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 子菜单列表 */
|
||||
children?: MenuInfoVO[];
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -3,13 +3,11 @@
|
||||
* 用于匹配CSV数据中的实体(店铺、商品、规格、订单状态)到数据库中的ID
|
||||
*/
|
||||
|
||||
import {
|
||||
getShopsByNamesApi,
|
||||
getProductsByNamesApi,
|
||||
getProductSpecsByProductAndSpecsApi
|
||||
} from '#/api/shop';
|
||||
import { getShopsByNamesApi } from '#/api/shop/shop';
|
||||
import { getProductsByNamesApi, getProductSpecsByProductAndSpecsApi } from '#/api/shop/product';
|
||||
import type { OrderDTO} from '#/api/ecommerce/types';
|
||||
import type { ShopVO, ProductVO } from '#/api/shop/types';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
import type { ProductVO } from '#/api/shop/product/types';
|
||||
|
||||
export interface EntityMatchingResult {
|
||||
/** 匹配成功的订单数据 */
|
||||
|
||||
-11
@@ -38,7 +38,6 @@ defineOptions({ name: 'FileRepository' });
|
||||
const loading = ref(false);
|
||||
const fileList = ref<FileVO.Info[]>([]);
|
||||
const total = ref(0);
|
||||
const current = ref(1);
|
||||
const editModalVisible = ref(false);
|
||||
const currentFileData = ref<FileVO.Info | null>(null);
|
||||
const uploadLoading = ref(false);
|
||||
@@ -190,16 +189,6 @@ function refreshTable() {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理重置
|
||||
function handleReset() {
|
||||
searchForm.value = {
|
||||
filename: '',
|
||||
fileFormat: undefined,
|
||||
};
|
||||
current.value = 1;
|
||||
refreshTable();
|
||||
}
|
||||
|
||||
const handleUpload = async (file: File) => {
|
||||
uploadLoading.value = true;
|
||||
try {
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
super_updateAccountApi,
|
||||
type SuperAccountVO,
|
||||
type SuperAccountDTO
|
||||
} from '#/api/org/superAccount';
|
||||
} from '#/api/organization/account-super';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
super_getAccountPageApi,
|
||||
type SuperAccountVO,
|
||||
type SuperAccountDTO
|
||||
} from '#/api/org/superAccount';
|
||||
} from '#/api/organization/account-super';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import SuperAccountFormModal from './components/SuperAccountFormModal.vue';
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
admin_updateAccountApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
} from '#/api/organization/account';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
admin_getAccountPageApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
} from '#/api/organization/account';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import AccountFormModal from './components/AccountFormModal.vue';
|
||||
|
||||
-256
@@ -1,256 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Modal, Form, FormItem, Input, Select, SelectOption, Button, message } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
createAccountForCompanyApi,
|
||||
updateAccountApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
|
||||
// 创建图标组件
|
||||
const SaveIcon = createIconifyIcon('lucide:save');
|
||||
const CloseIcon = createIconifyIcon('lucide:x');
|
||||
|
||||
defineOptions({ name: 'CompanyAccountFormModal' });
|
||||
|
||||
// 响应式数据
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const formRef = ref();
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive<AccountDTO.CreateAccountDTO>({
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
// 表单规则
|
||||
const formRules = {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||
{ min: 3, max: 20, message: '用户名长度为3-20个字符', trigger: 'blur' },
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '密码长度为6-20个字符', trigger: 'blur' },
|
||||
],
|
||||
realName: [
|
||||
{ required: true, message: '请输入真实姓名', trigger: 'blur' },
|
||||
],
|
||||
email: [
|
||||
{ type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' },
|
||||
],
|
||||
phone: [
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' },
|
||||
],
|
||||
};
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '禁用', value: 0 },
|
||||
{ label: '正常', value: 1 },
|
||||
];
|
||||
|
||||
// 方法
|
||||
const open = (record?: AccountVO.AccountInfoVO) => {
|
||||
visible.value = true;
|
||||
isEdit.value = !!record;
|
||||
|
||||
if (record) {
|
||||
Object.assign(formData, {
|
||||
username: record.username,
|
||||
realName: record.realName,
|
||||
email: record.email,
|
||||
phone: record.phone,
|
||||
companyId: record.companyId,
|
||||
departmentId: record.departmentId,
|
||||
positionId: record.positionId,
|
||||
roleId: record.roleId,
|
||||
status: record.status,
|
||||
});
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
visible.value = false;
|
||||
resetForm();
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(formData, {
|
||||
username: '',
|
||||
password: '',
|
||||
realName: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
companyId: undefined,
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
roleId: undefined,
|
||||
status: 1,
|
||||
});
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
loading.value = true;
|
||||
|
||||
if (isEdit.value) {
|
||||
const { password, ...updateData } = formData;
|
||||
await updateAccountApi(formData.id!, updateData);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
await createAccountForCompanyApi(formData);
|
||||
message.success('创建成功');
|
||||
}
|
||||
|
||||
close();
|
||||
emit('success');
|
||||
} catch (error) {
|
||||
console.error('提交失败:', error);
|
||||
message.error(isEdit.value ? '更新失败' : '创建失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 事件
|
||||
const emit = defineEmits<{
|
||||
success: [];
|
||||
}>();
|
||||
|
||||
// 监听弹窗关闭
|
||||
watch(visible, (val) => {
|
||||
if (!val) {
|
||||
resetForm();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
v-model:open="visible"
|
||||
:title="isEdit ? '编辑账户' : '新增账户'"
|
||||
width="600px"
|
||||
:confirm-loading="loading"
|
||||
@cancel="close"
|
||||
>
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
layout="vertical"
|
||||
class="mt-4"
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<FormItem label="用户名" name="username">
|
||||
<Input
|
||||
v-model:value="formData.username"
|
||||
placeholder="请输入用户名"
|
||||
:disabled="isEdit"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="密码" name="password" v-if="!isEdit">
|
||||
<Input
|
||||
v-model:value="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="真实姓名" name="realName">
|
||||
<Input
|
||||
v-model:value="formData.realName"
|
||||
placeholder="请输入真实姓名"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="邮箱" name="email">
|
||||
<Input
|
||||
v-model:value="formData.email"
|
||||
placeholder="请输入邮箱"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="手机号" name="phone">
|
||||
<Input
|
||||
v-model:value="formData.phone"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="部门ID" name="departmentId">
|
||||
<Input
|
||||
v-model:value="formData.departmentId"
|
||||
type="number"
|
||||
placeholder="请输入部门ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="职位ID" name="positionId">
|
||||
<Input
|
||||
v-model:value="formData.positionId"
|
||||
type="number"
|
||||
placeholder="请输入职位ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="角色ID" name="roleId">
|
||||
<Input
|
||||
v-model:value="formData.roleId"
|
||||
type="number"
|
||||
placeholder="请输入角色ID"
|
||||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="状态" name="status">
|
||||
<Select
|
||||
v-model:value="formData.status"
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="option in statusOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end space-x-2">
|
||||
<Button @click="close" :icon="CloseIcon">
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:icon="SaveIcon"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
{{ isEdit ? '更新' : '创建' }}
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
-339
@@ -1,339 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, h, onMounted } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
deleteAccountApi,
|
||||
getAccountPageForCompanyApi,
|
||||
type AccountVO,
|
||||
type AccountDTO
|
||||
} from '#/api/org/account';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import AccountFormModal from './components/AccountFormModal.vue';
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const EditIcon = createIconifyIcon('lucide:edit');
|
||||
const TrashIcon = createIconifyIcon('lucide:trash-2');
|
||||
|
||||
defineOptions({ name: 'CompanyAccountManagement' });
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const accountFormModalRef = ref();
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
loginCode: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
departmentId: undefined as number | undefined,
|
||||
positionId: undefined as number | undefined,
|
||||
role: '',
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ label: '正常', value: 0 },
|
||||
{ label: '删除', value: 1 },
|
||||
{ label: '停用', value: 2 },
|
||||
{ label: '冻结', value: 3 },
|
||||
];
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'username',
|
||||
title: '用户名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realName',
|
||||
title: '真实姓名',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'email',
|
||||
title: '邮箱',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '手机号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'departmentName',
|
||||
title: '部门',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'positionName',
|
||||
title: '职位',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'roleName',
|
||||
title: '角色',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 80,
|
||||
cellRender: ({ row }) => {
|
||||
const statusMap = {
|
||||
0: { text: '正常', color: 'green' },
|
||||
1: { text: '删除', color: 'red' },
|
||||
2: { text: '停用', color: 'orange' },
|
||||
3: { text: '冻结', color: 'purple' },
|
||||
};
|
||||
const status = statusMap[row.status as keyof typeof statusMap];
|
||||
return h(Tag, { color: status.color }, () => status.text);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
cellRender: ({ row }) => {
|
||||
return h(Space, {}, () => [
|
||||
h(Button, {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
icon: h(EditIcon),
|
||||
onClick: () => handleEdit(row),
|
||||
}, () => '编辑'),
|
||||
h(Button, {
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
danger: true,
|
||||
icon: h(TrashIcon),
|
||||
onClick: () => handleDelete(row),
|
||||
}, () => '删除'),
|
||||
]);
|
||||
},
|
||||
},
|
||||
],
|
||||
data: [],
|
||||
loading: false,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
showOverflow: 'tooltip',
|
||||
showHeaderOverflow: 'tooltip',
|
||||
resizable: true,
|
||||
keepSource: true,
|
||||
id: 'company-account-grid',
|
||||
};
|
||||
|
||||
// 表格实例
|
||||
const { gridRef, getVxeGridInstance } = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
const instance = getVxeGridInstance();
|
||||
return instance?.getCheckboxRecords().length > 0;
|
||||
});
|
||||
|
||||
// 方法
|
||||
const handleSearch = async () => {
|
||||
await loadData();
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
searchForm.value = {
|
||||
loginCode: '',
|
||||
realName: '',
|
||||
phone: '',
|
||||
departmentId: undefined,
|
||||
positionId: undefined,
|
||||
role: '',
|
||||
status: undefined,
|
||||
};
|
||||
loadData();
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const instance = getVxeGridInstance();
|
||||
instance?.commitProxy('query');
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
accountFormModalRef.value?.open();
|
||||
};
|
||||
|
||||
const handleEdit = (row: AccountVO.AccountInfoVO) => {
|
||||
accountFormModalRef.value?.open(row);
|
||||
};
|
||||
|
||||
const handleDelete = async (row: AccountVO.AccountInfoVO) => {
|
||||
try {
|
||||
await deleteAccountApi(row.id);
|
||||
message.success('删除成功');
|
||||
await loadData();
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error);
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchDelete = async () => {
|
||||
const instance = getVxeGridInstance();
|
||||
const selectedRows = instance?.getCheckboxRecords();
|
||||
if (!selectedRows?.length) {
|
||||
message.warning('请选择要删除的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const deletePromises = selectedRows.map((row: AccountVO.AccountInfoVO) =>
|
||||
deleteAccountApi(row.id)
|
||||
);
|
||||
await Promise.all(deletePromises);
|
||||
message.success('批量删除成功');
|
||||
await loadData();
|
||||
} catch (error) {
|
||||
console.error('批量删除失败:', error);
|
||||
message.error('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 表格代理配置
|
||||
const gridProxyConfig = {
|
||||
ajax: {
|
||||
query: async ({ page, sorts, filters }: any) => {
|
||||
const params: PageQueryDTO<AccountDTO.AccountFilterDTO> = {
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...searchForm.value,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await getAccountPageForCompanyApi(params);
|
||||
return {
|
||||
result: response.data.records,
|
||||
page: {
|
||||
total: response.data.total,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('查询数据失败:', error);
|
||||
return {
|
||||
result: [],
|
||||
page: {
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
const instance = getVxeGridInstance();
|
||||
instance?.setProxyConfig(gridProxyConfig);
|
||||
loadData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page>
|
||||
<template #title>
|
||||
<div class="flex items-center justify-between">
|
||||
<h1 class="text-xl font-semibold">公司账户管理</h1>
|
||||
<Space>
|
||||
<Button @click="handleAdd" type="primary" :icon="PlusIcon">
|
||||
新增账户
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasSelected"
|
||||
danger
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 搜索表单 -->
|
||||
<div class="mb-4 p-4 bg-gray-50 rounded-lg">
|
||||
<div class="grid grid-cols-4 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">用户名</label>
|
||||
<input
|
||||
v-model="searchForm.loginCode"
|
||||
placeholder="请输入用户名"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">真实姓名</label>
|
||||
<input
|
||||
v-model="searchForm.realName"
|
||||
placeholder="请输入真实姓名"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">手机号</label>
|
||||
<input
|
||||
v-model="searchForm.phone"
|
||||
placeholder="请输入手机号"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">状态</label>
|
||||
<select
|
||||
v-model="searchForm.status"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">全部</option>
|
||||
<option v-for="option in statusOptions" :key="option.value" :value="option.value">
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex justify-end space-x-2">
|
||||
<Button @click="handleReset">重置</Button>
|
||||
<Button type="primary" @click="handleSearch">搜索</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
<VbenVxeGrid ref="gridRef" v-bind="gridOptions" />
|
||||
|
||||
<!-- 账户表单弹窗 -->
|
||||
<AccountFormModal ref="accountFormModalRef" @success="loadData" />
|
||||
</Page>
|
||||
</template>
|
||||
+1
-1
@@ -108,7 +108,7 @@ import {
|
||||
updateCompanyApi,
|
||||
type CompanyVO,
|
||||
type CompanyDTO
|
||||
} from '#/api/org/company';
|
||||
} from '#/api/organization/company';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
getCompanyPageApi,
|
||||
type CompanyVO,
|
||||
type CompanyDTO
|
||||
} from '#/api/org/company';
|
||||
} from '#/api/organization/company';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import CompanyFormModal from './components/CompanyFormModal.vue';
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
createDepartmentApi,
|
||||
updateDepartmentApi,
|
||||
type DepartmentVO
|
||||
} from '#/api/org/department';
|
||||
} from '#/api/organization/department';
|
||||
|
||||
interface Props {
|
||||
departmentList: DepartmentVO.DepartmentInfoVO[];
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
getDepartmentPageApi,
|
||||
type DepartmentVO,
|
||||
type DepartmentDTO
|
||||
} from '#/api/org/department';
|
||||
} from '#/api/organization/department';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import DepartmentModal from './components/DepartmentModal.vue';
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
createPositionApi,
|
||||
updatePositionApi,
|
||||
type PositionVO
|
||||
} from '#/api/org/position';
|
||||
} from '#/api/organization/position';
|
||||
|
||||
interface Props {
|
||||
departmentOptions: Array<{ label: string; value: number }>;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
getPositionPageApi,
|
||||
type PositionVO,
|
||||
type PositionDTO
|
||||
} from '#/api/org/position';
|
||||
} from '#/api/organization/position';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import PositionModal from './components/PositionModal.vue';
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import {
|
||||
getActiveOrderStatusListApi,
|
||||
} from '#/api/ecommerce';
|
||||
import type { OrderDTO, OrderVO, OrderStatusVO } from '#/api/ecommerce/types';
|
||||
import { getShopPageApi } from '#/api/shop';
|
||||
import type { ShopVO } from '#/api/shop/types';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
|
||||
defineProps<{
|
||||
visible?: boolean;
|
||||
+2
-2
@@ -13,8 +13,8 @@ import {
|
||||
getActiveOrderStatusListApi
|
||||
} from '#/api/ecommerce';
|
||||
import type { OrderVO, OrderDTO, OrderStatusVO } from '#/api/ecommerce/types';
|
||||
import { getShopPageApi } from '#/api/shop';
|
||||
import type { ShopVO } from '#/api/shop/types';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import OrderFormModal from './components/OrderFormModal.vue';
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { Card, Image, Tag, Button, Space, Popconfirm, Tooltip } from 'ant-design-vue';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import type { ProductVO } from '#/api/shop/types';
|
||||
import type { ProductVO } from '#/api/shop/product/types';
|
||||
|
||||
// 创建图标组件
|
||||
const EditIcon = createIconifyIcon('lucide:edit');
|
||||
+2
-2
@@ -150,8 +150,8 @@ import {
|
||||
createProductApi,
|
||||
updateProductApi,
|
||||
createProductWithSpecsApi
|
||||
} from '#/api/shop';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/product';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/product/types';
|
||||
import { uploadImageApi } from '#/api/media/image';
|
||||
|
||||
interface Emits {
|
||||
+2
-2
@@ -95,8 +95,8 @@ import {
|
||||
createProductSpecApi,
|
||||
updateProductSpecApi,
|
||||
deleteProductSpecApi
|
||||
} from '#/api/shop';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/product';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/product/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
interface Emits {
|
||||
+2
-2
@@ -206,8 +206,8 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProductApi,
|
||||
getProductPageApi
|
||||
} from '#/api/shop';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/product';
|
||||
import type { ProductVO, ProductDTO } from '#/api/shop/product/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import ProductFormModal from './components/ProductFormModal.vue';
|
||||
// @ts-ignore
|
||||
+4
-3
@@ -155,10 +155,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { Modal, Form, Input, Select, InputNumber, DatePicker, message } from 'ant-design-vue';
|
||||
import { createPromotionFeeApi, updatePromotionFeeApi } from '#/api/shop';
|
||||
import { getShopPageApi } from '#/api/shop';
|
||||
import { createPromotionFeeApi, updatePromotionFeeApi } from '#/api/shop/promotion-fee';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
import { getActivePromotionFeeTypeListApi } from '#/api/ecommerce';
|
||||
import type { PromotionFeeDTO, PromotionFeeVO, ShopVO } from '#/api/shop/types';
|
||||
import type { PromotionFeeDTO, PromotionFeeVO } from '#/api/shop/promotion-fee/types';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
import type { PromotionFeeTypeVO } from '#/api/ecommerce/types';
|
||||
|
||||
defineOptions({ name: 'PromotionFeeFormModal' });
|
||||
+2
-2
@@ -10,8 +10,8 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
getPromotionFeePageApi,
|
||||
deletePromotionFeeApi,
|
||||
} from '#/api/shop';
|
||||
import type { PromotionFeeVO, PromotionFeeDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/promotion-fee';
|
||||
import type { PromotionFeeVO, PromotionFeeDTO } from '#/api/shop/promotion-fee/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import PromotionFeeFormModal from './components/PromotionFeeFormModal.vue';
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import {
|
||||
uploadShopLogoApi,
|
||||
createShopApi,
|
||||
updateShopApi,
|
||||
} from '#/api/shop';
|
||||
import type { ShopVO, ShopDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/shop';
|
||||
import type { ShopVO, ShopDTO } from '#/api/shop/shop/types';
|
||||
|
||||
interface Emits {
|
||||
(e: 'success'): void;
|
||||
+2
-2
@@ -10,8 +10,8 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteShopApi,
|
||||
getShopPageApi,
|
||||
} from '#/api/shop';
|
||||
import type { ShopVO, ShopDTO } from '#/api/shop/types';
|
||||
} from '#/api/shop/shop';
|
||||
import type { ShopVO, ShopDTO } from '#/api/shop/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
import ShopFormModal from './components/ShopFormModal.vue';
|
||||
|
||||
Reference in New Issue
Block a user