新增:批量删除菜单功能和复制菜单功能

This commit is contained in:
2024-09-01 01:59:07 +08:00
parent 41ad9a474e
commit bf43bdbab4
22 changed files with 1314 additions and 87 deletions

View File

@@ -6,6 +6,8 @@ import type { PageParam } from '@/api';
export interface Domain {
// 自增ID
id?: number;
// 类型
type?: number;
// 域名
domain?: string;
// 主机记录

View File

@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { Website, WebsiteParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询网站信息记录表
*/
export async function pageWebsite(params: WebsiteParam) {
const res = await request.get<ApiResult<PageResult<Website>>>(
MODULES_API_URL + '/common.system/website/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询网站信息记录表列表
*/
export async function listWebsite(params?: WebsiteParam) {
const res = await request.get<ApiResult<Website[]>>(
MODULES_API_URL + '/common.system/website',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加网站信息记录表
*/
export async function addWebsite(data: Website) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/common.system/website',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改网站信息记录表
*/
export async function updateWebsite(data: Website) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/common.system/website',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除网站信息记录表
*/
export async function removeWebsite(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/common.system/website/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除网站信息记录表
*/
export async function removeBatchWebsite(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/common.system/website/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询网站信息记录表
*/
export async function getWebsite(id: number) {
const res = await request.get<ApiResult<Website>>(
MODULES_API_URL + '/common.system/website/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}

View File

@@ -0,0 +1,97 @@
import type { PageParam } from '@/api';
/**
* 网站信息记录表
*/
export interface Website {
// 站点ID
websiteId?: number;
// 网站名称
websiteName?: string;
// 网站标识
websiteCode?: string;
// 网站LOGO
websiteIcon?: string;
// 网站LOGO
websiteLogo?: string;
// 网站LOGO(深色模式)
websiteDarkLogo?: string;
// 网站类型
websiteType?: string;
// 网站关键词
keywords?: string;
// 域名前缀
prefix?: string;
// 绑定域名
domain?: string;
// 全局样式
style?: string;
// 后台管理地址
adminUrl?: string;
// 应用版本 10免费版 20授权版 30永久授权
version?: number;
// 服务到期时间
expirationTime?: string;
// 模版ID
templateId?: number;
// 行业类型(父级)
industryParent?: string;
// 行业类型(子级)
industryChild?: string;
// 企业ID
companyId?: number;
// 所在国家
country?: string;
// 所在省份
province?: string;
// 所在城市
city?: string;
// 所在辖区
region?: string;
// 经度
longitude?: string;
// 纬度
latitude?: string;
// 街道地址
address?: string;
// 联系电话
phone?: string;
// 电子邮箱
email?: string;
// ICP备案号
icpNo?: string;
// 公安备案
policeNo?: string;
// 备注
comments?: string;
// 是否推荐
recommend?: number;
// 状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停
status?: number;
// 维护说明
statusText?: string;
// 关闭说明
statusClose?: string;
// 全局样式
styles?: string;
// 排序号
sortNumber?: number;
// 用户ID
userId?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 租户id
tenantId?: number;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
}
/**
* 网站信息记录表搜索条件
*/
export interface WebsiteParam extends PageParam {
websiteId?: number;
keywords?: string;
}

View File

@@ -61,6 +61,36 @@ export async function removeMenu(id?: number) {
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除菜单
*/
export async function removeBatchMenu(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/menu/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 按顶级目录批量删除菜单
*/
export async function deleteParentMenu(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
SERVER_API_URL + '/system/menu/deleteParentMenu/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 安装应用
*/

View File

@@ -1,58 +1,97 @@
import { WebsiteField } from '@/api/cms/website/field/model';
import { Navigation } from '@/api/cms/navigation/model';
import { Link } from '@/api/cms/link/model';
import { ArrangeCategory } from '@/api/cms/category/model';
import type { PageParam } from '@/api';
/**
* 菜单
* 网站信息记录表
*/
export interface Website {
// 站点ID
websiteId?: number;
// 网站名称
websiteName?: string;
// 网站标识
websiteCode?: string;
// 网站LOGO
websiteIcon?: string;
// 网站LOGO
websiteLogo?: string;
// 网站LOGO(深色模式)
websiteDarkLogo?: string;
keywords?: string;
address?: string;
phone?: string;
email?: string;
// 网站类型
websiteType?: string;
expirationTime?: string;
templateId?: string;
industryParent?: string;
industryChild?: string;
companyId?: number;
// 网站关键词
keywords?: string;
// 域名前缀
prefix?: string;
// 绑定域名
domain?: string;
icpNo?: string;
policeNo?: string;
comments?: string;
sortNumber?: number;
createTime?: string;
disabled?: boolean;
// 全局样式
style?: string;
// 后台管理地址
adminUrl?: string;
// 应用版本 10免费版 20授权版 30永久授权
version?: number;
// 服务到期时间
expirationTime?: string;
// 模版ID
templateId?: number;
// 行业类型(父级)
industryParent?: string;
// 行业类型(子级)
industryChild?: string;
// 企业ID
companyId?: number;
// 所在国家
country?: string;
// 所在省份
province?: string;
recommend?: number;
// 所在城市
city?: string;
// 所在辖区
region?: string;
appId?: number;
fields?: WebsiteField[];
// 经度
longitude?: string;
// 纬度
latitude?: string;
// 街道地址
address?: string;
// 联系电话
phone?: string;
// 电子邮箱
email?: string;
// ICP备案号
icpNo?: string;
// 公安备案
policeNo?: string;
// 备注
comments?: string;
// 是否推荐
recommend?: number;
// 状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停
status?: number;
// 维护说明
statusText?: string;
// 关闭说明
statusClose?: string;
// 全局样式
styles?: string;
// 排序号
sortNumber?: number;
// 用户ID
userId?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 租户id
tenantId?: number;
tenantName?: string;
navigations?: Navigation[];
categoryList?: ArrangeCategory[];
links?: Link[];
// 配置信息
config?: any;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
}
/**
* 菜单搜索参数
* 网站信息记录表搜索条件
*/
export interface WebsiteParam {
title?: string;
path?: string;
authority?: string;
parentId?: number;
export interface WebsiteParam extends PageParam {
websiteId?: number;
keywords?: string;
}