From 5d86c330fee5b0f34ef5bc8d36d5d985fb4ff2fe Mon Sep 17 00:00:00 2001 From: lijiahangmax Date: Wed, 29 Oct 2025 10:39:19 +0800 Subject: [PATCH] =?UTF-8?q?:hammer:=20tag=20=E7=AE=A1=E7=90=86.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...itional-spring-configuration-metadata.json | 5 + .../TagRelCountPO.java} | 37 ++- orion-visor-ui/src/api/meta/tag.ts | 59 ++++- .../src/router/routes/modules/system.ts | 5 + orion-visor-ui/src/types/const.ts | 15 ++ .../components/notify-template-table.vue | 3 +- .../system/tags/components/tag-form-modal.vue | 129 ++++++++++ .../system/tags/components/tag-table.vue | 231 ++++++++++++++++++ .../src/views/system/tags/index.vue | 46 ++++ .../src/views/system/tags/types/const.ts | 7 + .../src/views/system/tags/types/form.rules.ts | 11 + .../views/system/tags/types/table.columns.ts | 71 ++++++ 12 files changed, 591 insertions(+), 28 deletions(-) rename orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/{dto/LoginTokenIdentityDTO.java => po/TagRelCountPO.java} (65%) create mode 100644 orion-visor-ui/src/views/system/tags/components/tag-form-modal.vue create mode 100644 orion-visor-ui/src/views/system/tags/components/tag-table.vue create mode 100644 orion-visor-ui/src/views/system/tags/index.vue create mode 100644 orion-visor-ui/src/views/system/tags/types/const.ts create mode 100644 orion-visor-ui/src/views/system/tags/types/form.rules.ts create mode 100644 orion-visor-ui/src/views/system/tags/types/table.columns.ts diff --git a/orion-visor-framework/orion-visor-spring-boot-starter-web/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/orion-visor-framework/orion-visor-spring-boot-starter-web/src/main/resources/META-INF/additional-spring-configuration-metadata.json index ec187a88..083938bf 100644 --- a/orion-visor-framework/orion-visor-spring-boot-starter-web/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/orion-visor-framework/orion-visor-spring-boot-starter-web/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -33,6 +33,11 @@ "type": "java.lang.Boolean", "description": "是否开启 cors 过滤器." }, + { + "name": "orion.api.ip-headers", + "type": "java.lang.String", + "description": "获取 IP 的请求头." + }, { "name": "orion.api.expose.header", "type": "java.lang.String", diff --git a/orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/dto/LoginTokenIdentityDTO.java b/orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/po/TagRelCountPO.java similarity index 65% rename from orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/dto/LoginTokenIdentityDTO.java rename to orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/po/TagRelCountPO.java index 989c352d..4cef0368 100644 --- a/orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/dto/LoginTokenIdentityDTO.java +++ b/orion-visor-modules/orion-visor-module-infra/orion-visor-module-infra-service/src/main/java/org/dromara/visor/module/infra/entity/po/TagRelCountPO.java @@ -20,43 +20,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.dromara.visor.module.infra.entity.dto; +package org.dromara.visor.module.infra.entity.po; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.dromara.visor.common.entity.RequestIdentity; + +import java.io.Serializable; /** - * 身份信息 + * 标签关联数量 * * @author Jiahang Li * @version 1.0.0 - * @since 2023/11/1 1:01 + * @since 2024/12/23 16:24 */ @Data +@Builder @NoArgsConstructor @AllArgsConstructor -public class LoginTokenIdentityDTO implements RequestIdentity { +@Schema(name = "TagRelCountPO", description = "标签关联数量") +public class TagRelCountPO implements Serializable { - /** - * 原始登录时间 - */ - private Long loginTime; + private static final long serialVersionUID = 1L; - /** - * 当前设备登录地址 - */ - private String address; + @Schema(description = "tagId") + private Long tagId; - /** - * 当前设备登录地址 - */ - private String location; - - /** - * 当前设备 userAgent - */ - private String userAgent; + @Schema(description = "数量") + private Integer count; } diff --git a/orion-visor-ui/src/api/meta/tag.ts b/orion-visor-ui/src/api/meta/tag.ts index 2ace1b2f..b2c40487 100644 --- a/orion-visor-ui/src/api/meta/tag.ts +++ b/orion-visor-ui/src/api/meta/tag.ts @@ -1,19 +1,47 @@ +import type { TableData } from '@arco-design/web-vue'; +import type { DataGrid, Pagination, OrderDirection } from '@/types/global'; import axios from 'axios'; -export type TagType = 'HOST' | string +export type TagType = 'HOST' | 'MONITOR_DASH' | string /** * tag 创建对象 */ export interface TagCreateRequest { - name: number; - type: TagType; + name?: string; + type?: TagType; +} + +/** + * tag 修改对象 + */ +export interface TagUpdateRequest extends TagCreateRequest { + id?: number; +} + +/** + * tag 查询请求 + */ +export interface TagQueryRequest extends Pagination, OrderDirection { + name?: string; + type?: string; } /** * tag 响应对象 */ -export interface TagQueryResponse { +export interface TagQueryResponse extends TableData, TagItem { + relCount: string; + createTime: number; + updateTime: number; + creator: string; + updater: string; +} + +/** + * tag 元素 + */ +export interface TagItem { id: number; name: string; } @@ -25,9 +53,30 @@ export function createTag(request: TagCreateRequest) { return axios.post('/infra/tag/create', request); } +/** + * 修改标签 + */ +export function updateTag(request: TagUpdateRequest) { + return axios.put('/infra/tag/update', request); +} + +/** + * 分页查询标签 + */ +export function getTagPage(request: TagQueryRequest) { + return axios.post>('/infra/tag/query', request); +} + /** * 查询标签 */ export function getTagList(type: TagType) { - return axios.get>('/infra/tag/list', { params: { type } }); + return axios.get>('/infra/tag/list', { params: { type } }); +} + +/** + * 通过 id 删除标签 + */ +export function deleteTag(id: number) { + return axios.delete('/infra/tag/delete', { params: { id } }); } diff --git a/orion-visor-ui/src/router/routes/modules/system.ts b/orion-visor-ui/src/router/routes/modules/system.ts index a2ca2145..8c4bdc93 100644 --- a/orion-visor-ui/src/router/routes/modules/system.ts +++ b/orion-visor-ui/src/router/routes/modules/system.ts @@ -26,6 +26,11 @@ const SYSTEM: AppRouteRecordRaw = { path: '/system/notify-template', component: () => import('@/views/system/notify-template/index.vue'), }, + { + name: 'systemTags', + path: '/system/tags', + component: () => import('@/views/system/tags/index.vue'), + }, { name: 'systemSetting', path: '/system/setting', diff --git a/orion-visor-ui/src/types/const.ts b/orion-visor-ui/src/types/const.ts index 25d553de..41bf530c 100644 --- a/orion-visor-ui/src/types/const.ts +++ b/orion-visor-ui/src/types/const.ts @@ -12,3 +12,18 @@ export const EnabledStatus = { DISABLED: 0, ENABLED: 1 }; + +// 开关值 +export const SwitchValue = { + OFF: 0, + ON: 1 +}; + +// tag 颜色 +export const TagColors = [ + 'arcoblue', + 'green', + 'purple', + 'pinkpurple', + 'magenta' +]; diff --git a/orion-visor-ui/src/views/system/notify-template/components/notify-template-table.vue b/orion-visor-ui/src/views/system/notify-template/components/notify-template-table.vue index dbf0d835..8edf0eb2 100644 --- a/orion-visor-ui/src/views/system/notify-template/components/notify-template-table.vue +++ b/orion-visor-ui/src/views/system/notify-template/components/notify-template-table.vue @@ -41,7 +41,8 @@ + :hide-content="true" + @change="reload"> diff --git a/orion-visor-ui/src/views/system/tags/components/tag-form-modal.vue b/orion-visor-ui/src/views/system/tags/components/tag-form-modal.vue new file mode 100644 index 00000000..50f5e3fb --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/components/tag-form-modal.vue @@ -0,0 +1,129 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/system/tags/components/tag-table.vue b/orion-visor-ui/src/views/system/tags/components/tag-table.vue new file mode 100644 index 00000000..1cea4a71 --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/components/tag-table.vue @@ -0,0 +1,231 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/system/tags/index.vue b/orion-visor-ui/src/views/system/tags/index.vue new file mode 100644 index 00000000..394e47fe --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/index.vue @@ -0,0 +1,46 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/system/tags/types/const.ts b/orion-visor-ui/src/views/system/tags/types/const.ts new file mode 100644 index 00000000..53e9142b --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/types/const.ts @@ -0,0 +1,7 @@ +export const TableName = 'tag_list'; + +// 标签类型 字典项 +export const TagTypeKey = 'tagType'; + +// 加载的字典值 +export const dictKeys = [TagTypeKey]; diff --git a/orion-visor-ui/src/views/system/tags/types/form.rules.ts b/orion-visor-ui/src/views/system/tags/types/form.rules.ts new file mode 100644 index 00000000..332c03a6 --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/types/form.rules.ts @@ -0,0 +1,11 @@ +import type { FieldRule } from '@arco-design/web-vue'; + +export default { + name: [{ + required: true, + message: '请输入标签名称' + }, { + maxLength: 32, + message: '标签名称长度不能大于32位' + }], +} as Record; diff --git a/orion-visor-ui/src/views/system/tags/types/table.columns.ts b/orion-visor-ui/src/views/system/tags/types/table.columns.ts new file mode 100644 index 00000000..013521d0 --- /dev/null +++ b/orion-visor-ui/src/views/system/tags/types/table.columns.ts @@ -0,0 +1,71 @@ +import type { TableColumnData } from '@arco-design/web-vue'; +import { dateFormat } from '@/utils'; + +const columns = [ + { + title: 'id', + dataIndex: 'id', + slotName: 'id', + width: 68, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '标签名称', + dataIndex: 'name', + slotName: 'name', + align: 'left', + minWidth: 168, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '关联数量', + dataIndex: 'relCount', + slotName: 'relCount', + align: 'left', + minWidth: 168, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '创建时间', + dataIndex: 'createTime', + slotName: 'createTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.createTime)); + }, + default: true, + }, { + title: '修改时间', + dataIndex: 'updateTime', + slotName: 'updateTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.updateTime)); + }, + }, { + title: '创建人', + width: 148, + dataIndex: 'creator', + slotName: 'creator', + default: true, + }, { + title: '修改人', + width: 148, + dataIndex: 'updater', + slotName: 'updater', + }, { + title: '操作', + slotName: 'handle', + width: 138, + align: 'center', + fixed: 'right', + default: true, + }, +] as TableColumnData[]; + +export default columns;