From 34082c57dbda140f45c4481a01070ecc7d412a33 Mon Sep 17 00:00:00 2001 From: hzyuan <562447916@qq.com> Date: Sun, 7 Jun 2026 22:42:04 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD-=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E6=8F=90=E4=BA=A4]1=E3=80=81=E6=96=B0=E5=A2=9Elinkflo?= =?UTF-8?q?w=E6=96=B0=E7=A7=9F=E6=88=B7=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=202=E3=80=81=E9=85=8D=E9=A2=9D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/linkflow/org/index.ts | 102 +++++++++++++++++++++++++++++++ src/api/linkflow/org/types.ts | 64 +++++++++++++++++++ src/api/linkflow/quota/index.ts | 39 ++++++++++++ src/api/linkflow/quota/types.ts | 2 + src/layout/components/Navbar.vue | 3 + 5 files changed, 210 insertions(+) create mode 100644 src/api/linkflow/org/index.ts create mode 100644 src/api/linkflow/org/types.ts create mode 100644 src/api/linkflow/quota/index.ts create mode 100644 src/api/linkflow/quota/types.ts diff --git a/src/api/linkflow/org/index.ts b/src/api/linkflow/org/index.ts new file mode 100644 index 00000000..d2d5a5c9 --- /dev/null +++ b/src/api/linkflow/org/index.ts @@ -0,0 +1,102 @@ +import request from '@/utils/request'; +import { TenantDetailVO, TenantDetailQuery, TenantDetailForm } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询LinkFlow租户列表 +export function listLinkflowTenant(query: TenantDetailQuery): AxiosPromise { + return request({ + url: '/linkflow/tenant/list', + method: 'get', + params: query + }); +} + +// 查询租户详情 +export function getLinkflowTenant(tenantId: string | number): AxiosPromise { + return request({ + url: '/linkflow/tenant/' + tenantId, + method: 'get' + }); +} + +// 新增租户 +export function addLinkflowTenant(data: TenantDetailForm) { + return request({ + url: '/linkflow/tenant', + method: 'post', + data: data + }); +} + +// 修改租户 +export function updateLinkflowTenant(data: TenantDetailForm) { + return request({ + url: '/linkflow/tenant', + method: 'put', + data: data + }); +} + +// 切换业务状态 +export function changeOrgStatus(tenantId: string, orgStatus: string) { + return request({ + url: '/linkflow/tenant/changeOrgStatus', + method: 'put', + data: { tenantId, orgStatus } + }); +} + +// 删除租户 +export function delLinkflowTenant(ids: string | number | Array) { + return request({ + url: '/linkflow/tenant/' + ids, + method: 'delete' + }); +} + +// 导出租户 +export function exportLinkflowTenant(data: any) { + return request({ + url: '/linkflow/tenant/export', + method: 'post', + data: data, + responseType: 'blob' + }); +} + +// ========== 通知相关 ========== + +// 查询通知列表(tenantId 可选,后端自动兜底) +export function listNotifications(tenantId?: string) { + return request({ + url: '/linkflow/tenant/notifications', + method: 'get', + params: tenantId ? { tenantId } : {} + }); +} + +// 标记已读 +export function markNotificationRead(id: number | string) { + return request({ + url: '/linkflow/tenant/notifications/' + id + '/read', + method: 'put' + }); +} + +// 全部已读 +export function markAllNotificationsRead(tenantId?: string) { + return request({ + url: '/linkflow/tenant/notifications/readAll', + method: 'put', + params: tenantId ? { tenantId } : {} + }); +} + +// 未读数量 +export function getUnreadCount(tenantId?: string) { + return request({ + url: '/linkflow/tenant/notifications/unreadCount', + method: 'get', + params: tenantId ? { tenantId } : {} + }); +} diff --git a/src/api/linkflow/org/types.ts b/src/api/linkflow/org/types.ts new file mode 100644 index 00000000..eb864dc3 --- /dev/null +++ b/src/api/linkflow/org/types.ts @@ -0,0 +1,64 @@ +export interface TenantDetailVO extends BaseEntity { + id: number | string; + tenantId: string; + companyName: string; + contactUserName: string; + contactPhone: string; + domain: string; + packageId: number | string; + packageName: string; + expireTime: string; + accountCount: number; + status: string; + // lf_tenant_ext 字段 + extId: number | string; + monthlyQuota: number; + usedQuota: number; + platformCount: number; + orgStatus: string; + remark: string; + // 管理员信息 + phonenumber: string; + // 计算字段 + quotaUsageRate: number; + daysToExpire: number; +} + +export interface TenantDetailQuery extends PageQuery { + companyName?: string; + contactUserName?: string; + orgStatus?: string; + packageId?: number | string; +} + +export interface TenantDetailForm { + id?: number | string | undefined; + tenantId?: string | undefined; + companyName: string; + contactUserName: string; + contactPhone: string; + domain?: string; + packageId: number | string; + expireTime: string; + accountCount: number; + // 新增租户时需要(RuoYi 创建租户同时创建管理员用户) + username?: string; + password?: string; + phonenumber?: string; + // lf_tenant_ext + extId?: number | string | undefined; + monthlyQuota: number; + platformCount: number; + remark?: string; + orgStatus?: string; +} + +export interface NotificationVO { + id: number | string; + tenantId: string; + type: string; + title: string; + content: string; + isRead: string; + createTime: string; +} diff --git a/src/api/linkflow/quota/index.ts b/src/api/linkflow/quota/index.ts new file mode 100644 index 00000000..571b1f08 --- /dev/null +++ b/src/api/linkflow/quota/index.ts @@ -0,0 +1,39 @@ +import request from '@/utils/request'; +import { QuotaVO, QuotaQuery } from './types'; +import { AxiosPromise } from 'axios'; + +// 查询配额列表 +export function listQuota(query: QuotaQuery): AxiosPromise { + return request({ + url: '/linkflow/quota/list', + method: 'get', + params: query + }); +} + +// 查询单个租户配额 +export function getQuota(tenantId: string | number): AxiosPromise { + return request({ + url: '/linkflow/quota/' + tenantId, + method: 'get' + }); +} + +// 调整配额 +export function adjustQuota(tenantId: string, newMonthlyQuota: number) { + return request({ + url: '/linkflow/quota/adjust', + method: 'put', + params: { tenantId, newMonthlyQuota } + }); +} + +// 导出配额 +export function exportQuota(data: any) { + return request({ + url: '/linkflow/quota/export', + method: 'post', + data: data, + responseType: 'blob' + }); +} diff --git a/src/api/linkflow/quota/types.ts b/src/api/linkflow/quota/types.ts new file mode 100644 index 00000000..4956505a --- /dev/null +++ b/src/api/linkflow/quota/types.ts @@ -0,0 +1,2 @@ +// 配额 VO 复用 TenantDetailVO(包含配额使用率等计算字段) +export type { TenantDetailVO as QuotaVO, TenantDetailQuery as QuotaQuery } from '../org/types'; diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 906ed6f3..b4374cd1 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -47,6 +47,8 @@ + + @@ -102,6 +104,7 @@ import { getTenantList } from '@/api/login'; import { dynamicClear, dynamicTenant } from '@/api/system/tenant'; import { TenantVO } from '@/api/types'; import notice from './notice/index.vue'; +import LfNotification from '@/components/LfNotification/index.vue'; import router from '@/router'; import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type'; import { NavTypeEnum } from '@/enums/NavTypeEnum';