This commit is contained in:
2025-05-22 10:27:07 +08:00
parent 963b239333
commit 95d43746f6
606 changed files with 19207 additions and 102770 deletions
+20
View File
@@ -0,0 +1,20 @@
import request from "@/utils/request";
import type { ApiResult } from "@/api";
import { Area, AreaParam } from "@/api/system/area/model";
export async function listArea(areaParam?: AreaParam) {
const res = await request.post<ApiResult<Area[]>>("/common/area/list-by-level", areaParam);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
export async function listAreaByParent(areaParam?: AreaParam) {
const res = await request.post<ApiResult<Area[]>>("/common/area/city-by-parent", { ...areaParam, parentId: 450000 });
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+14
View File
@@ -0,0 +1,14 @@
import { PageParam } from "@/api";
export interface Area {
id: number,
name: string,
fid: number,
levelId: number,
children?: Area[],
}
export interface AreaParam extends PageParam{
level?: number,
parentId?: number,
}
+61 -62
View File
@@ -1,22 +1,21 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { FileRecord, FileRecordParam } from './model';
import { FILE_SERVER } from '@/config/setting';
import request from "@/utils/request";
import type { ApiResult, PageResult } from "@/api";
import type { FileRecord, FileRecordParam } from "./model";
/**
* 上传文件
*/
export async function uploadFile(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<FileRecord>>(
FILE_SERVER + '/api/file/upload',
formData
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const formData = new FormData();
formData.append("file", file);
const res = await request.post<ApiResult<FileRecord>>(
"/file/upload",
formData
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
@@ -25,88 +24,88 @@ export async function uploadFile(file: File) {
* @param fileName 文件名称
*/
export async function uploadBase64File(base64: string, fileName?: string) {
const formData = new FormData();
formData.append('base64', base64);
if (fileName) {
formData.append('fileName', fileName);
}
const res = await request.post<ApiResult<FileRecord>>(
'/file/upload/base64',
formData
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const formData = new FormData();
formData.append("base64", base64);
if (fileName) {
formData.append("fileName", fileName);
}
const res = await request.post<ApiResult<FileRecord>>(
"/file/upload/base64",
formData
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 分页查询文件上传记录
*/
export async function pageFiles(params: FileRecordParam) {
const res = await request.get<ApiResult<PageResult<FileRecord>>>(
'/file/page',
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<PageResult<FileRecord>>>(
"/file/page",
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询文件
*/
export async function getFile(id: number) {
const res = await request.get<ApiResult<FileRecord>>('/file/' + id);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<FileRecord>>("/file/" + id);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除文件
*/
export async function removeFile(id?: number) {
const res = await request.delete<ApiResult<unknown>>('/file/remove/' + id);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.delete<ApiResult<unknown>>("/file/remove/" + id);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除文件
*/
export async function removeFiles(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>('/file/remove/batch', {
data
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.delete<ApiResult<unknown>>("/file/remove/batch", {
data
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加文件
*/
export async function addFiles(data: FileRecord) {
const res = await request.post<ApiResult<unknown>>('/file', data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.post<ApiResult<unknown>>("/file", data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改文件
*/
export async function updateFiles(data: FileRecord) {
const res = await request.put<ApiResult<unknown>>('/file', data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.put<ApiResult<unknown>>("/file", data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
+33 -31
View File
@@ -1,43 +1,45 @@
import { PageParam } from '@/api';
import { PageParam } from "@/api";
/**
* 机构
*/
export interface Organization {
// 机构id
organizationId?: number;
// 上级id, 0是顶级
parentId?: number;
// 机构名称
organizationName?: string;
// 机构全称
organizationFullName?: string;
// 机构代码
organizationCode?: string;
// 机构类型(字典)
organizationType?: string;
// 排序号
sortNumber?: number;
// 备注
comments?: string;
// 创建时间
createTime?: string;
// 机构类型名称
organizationTypeName?: string;
//
key?: number;
//
value?: number;
//
title?: string;
children?: Organization[];
// 机构id
organizationId?: number;
// 上级id, 0是顶级
parentId?: number;
// 机构名称
organizationName?: string;
// 机构全称
organizationFullName?: string;
// 机构代码
organizationCode?: string;
// 机构类型(字典)
organizationType?: string;
// 排序号
sortNumber?: number;
// 备注
comments?: string;
// 创建时间
createTime?: string;
// 机构类型名称
organizationTypeName?: string;
//
key?: number;
//
value?: number;
//
title?: string;
children?: Organization[];
province?: string;
city?: string;
}
/**
* 机构搜索条件
*/
export interface OrganizationParam extends PageParam {
organizationName?: string;
// 商户编号
merchantCode?: string;
organizationName?: string;
// 商户编号
merchantCode?: string;
}
+106 -106
View File
@@ -1,190 +1,190 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { User, UserParam } from './model';
import request from "@/utils/request";
import type { ApiResult, PageResult } from "@/api";
import type { User, UserParam } from "./model";
/**
* 分页查询用户
*/
export async function pageUsers(params: UserParam) {
const res = await request.get<ApiResult<PageResult<User>>>(
'/system/user/page',
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<PageResult<User>>>(
"/system/user/page",
{ params }
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询用户列表
*/
export async function listUsers(params?: UserParam) {
const res = await request.get<ApiResult<User[]>>('/system/user', {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<User[]>>("/system/user", {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询用户列表
*/
export async function getStaffs(params?: UserParam) {
const res = await request.get<ApiResult<User[]>>('/system/user', {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<User[]>>("/system/user", {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询用户列表
*/
export async function getCompanyList(params?: UserParam) {
const res = await request.get<ApiResult<User[]>>('/system/user', {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<User[]>>("/system/user", {
params
});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询用户
*/
export async function getUser(id: number) {
const res = await request.get<ApiResult<User>>('/system/user/' + id);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<User>>("/system/user/" + id);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加用户
*/
export async function addUser(data: User) {
const res = await request.post<ApiResult<unknown>>('/system/user', data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.post<ApiResult<unknown>>("/system/user", data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改用户
*/
export async function updateUser(data: User) {
const res = await request.put<ApiResult<unknown>>('/system/user', data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.put<ApiResult<unknown>>("/system/user", data);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除用户
*/
export async function removeUser(id?: number) {
const res = await request.delete<ApiResult<unknown>>('/system/user/' + id);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.delete<ApiResult<unknown>>("/system/user/" + id);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除用户
*/
export async function removeUsers(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>('/system/user/batch', {
data
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.delete<ApiResult<unknown>>("/system/user/batch", {
data
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改用户状态
*/
export async function updateUserStatus(userId?: number, status?: number) {
const res = await request.put<ApiResult<unknown>>('/system/user/status', {
userId,
status
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.put<ApiResult<unknown>>("/system/user/status", {
userId,
status
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 重置用户密码
*/
export async function updateUserPassword(userId?: number, password = '123456') {
const res = await request.put<ApiResult<unknown>>('/system/user/password', {
userId,
password
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
export async function updateUserPassword(userId?: number, password = "123456") {
const res = await request.put<ApiResult<unknown>>("/system/user/password", {
userId,
password
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 导入用户
*/
export async function importUsers(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>(
'/system/user/import',
formData
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
export async function importUsers(file: File, userLevel: number) {
const formData = new FormData();
formData.append("file", file);
const res = await request.post<ApiResult<unknown>>(
`/system/user/import/${userLevel}`,
formData
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 检查用户是否存在
*/
export async function checkExistence(
field: string,
value: string,
id?: number
field: string,
value: string,
id?: number
) {
const res = await request.get<ApiResult<unknown>>('/system/user/existence', {
params: { field, value, id }
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
const res = await request.get<ApiResult<unknown>>("/system/user/existence", {
params: { field, value, id }
});
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 统计用户余额
*/
export async function countUserBalance(params?: UserParam) {
const res = await request.get<ApiResult<unknown>>(
'/system/user/countUserBalance',
{
params
const res = await request.get<ApiResult<unknown>>(
"/system/user/countUserBalance",
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
return Promise.reject(new Error(res.data.message));
}
+98 -87
View File
@@ -2,103 +2,114 @@ import type { PageParam } from "@/api";
import type { Role } from "../../role/model";
import type { Menu } from "../../menu/model";
import { Company } from "@/api/system/company/model";
import { VivoBindStoreList } from "@/api/vivo/bindStoreList/model";
/**
* 用户
*/
export interface User {
// 账号类型
type?: number;
// 用户id
userId?: number;
// 账号
username?: string;
// 密码
password?: string;
// 昵称
nickname?: string;
// 别名
alias?: string;
// 头像
avatar?: string;
// 性别(字典)
sex?: string;
// 手机号
phone?: string;
// 邮箱
email?: string;
// 出生日期
birthday?: string;
// 详细地址
address?: string;
// 会员等级ID
gradeId?: number;
// 个人简介
introduction?: string;
// 机构id
organizationId?: number;
// 用户等级
userLevel?: number;
// 状态, 0正常, 1冻结
status?: number;
// 性别名称
sexName?: string;
province?: string;
city?: string;
region?: string;
// 机构名称
organizationName?: string;
// 角色列表
roles?: Role[];
// 权限列表
authorities?: Menu[];
payTime?: string;
deliveryTime?: string;
receiptTime?: string;
// 创建时间
createTime?: string;
// 租户ID
tenantId?: number;
// 租户名称
tenantName?: string;
logo?: string;
companyInfo?: Company;
// 商户名称
merchantName?: string;
// 商户编号
merchantCode?: string;
code?: string;
//
remember?: boolean;
balance?: number;
points?: number;
payMoney?: number;
setting?: string;
realName?: string;
companyName?: string;
idCard?: string;
comments?: string;
// 账号类型
type?: number;
// 用户id
userId?: number;
// 账号
username?: string;
// 密码
password?: string;
// 昵称
nickname?: string;
// 别名
alias?: string;
// 头像
avatar?: string;
// 性别(字典)
sex?: string;
// 手机号
phone?: string;
// 邮箱
email?: string;
// 出生日期
birthday?: string;
// 详细地址
address?: string;
// 会员等级ID
gradeId?: number;
// 个人简介
introduction?: string;
// 机构id
organizationId?: number;
// 用户等级
userLevel: number;
// 状态, 0正常, 1冻结
status?: number;
// 性别名称
sexName?: string;
province?: string;
city?: string;
region?: string;
// 机构名称
organizationName?: string;
// 角色列表
roles?: Role[];
// 权限列表
authorities?: Menu[];
payTime?: string;
deliveryTime?: string;
receiptTime?: string;
// 创建时间
createTime?: string;
// 租户ID
tenantId?: number;
// 租户名称
tenantName?: string;
logo?: string;
companyInfo?: Company;
// 商户名称
merchantName?: string;
// 商户编号
merchantCode?: string;
code?: string;
//
remember?: boolean;
balance?: number;
points?: number;
payMoney?: number;
setting?: string;
realName?: string;
companyName?: string;
idCard?: string;
comments?: string;
vkAccount?: string;
storeId?: number;
storeName?: string;
fixStoreId?: number;
fixStoreName?: string;
secondAreaName?: string;
cityId?: number;
retailerName?: string;
bindStoreList: VivoBindStoreList[];
}
/**
* 用户搜索条件
*/
export interface UserParam extends PageParam {
type?: any;
userId?: number;
username?: string;
nickname?: string;
realName?: string;
companyName?: string;
sex?: string;
phone?: string;
status?: number;
organizationId?: number;
parentId?: number;
sexName?: string;
merchantCode?: string;
roleId?: string;
isStaff?: boolean;
type?: any;
userId?: number;
username?: string;
nickname?: string;
realName?: string;
companyName?: string;
sex?: string;
phone?: string;
status?: number;
organizationId?: number;
parentId?: number;
sexName?: string;
merchantCode?: string;
roleId?: string;
isStaff?: boolean;
userLevel?: number;
}
export const USER_LEVEL_LIST = ["无权限", "场地主管", "资料员", "经营人员", "生产主管", "审核人", "资产员", "车辆调度员", "维保人员", "财务"];
export const USER_LEVEL_LIST = ['', '区域代理', '总售后', '零售商店长', '导购', '售后', '散户', '编外合作伙伴', '售后店长']