diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm index 585c360e..a8414a43 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-card-list.vue.vm @@ -66,7 +66,8 @@ label-align="right" :style="{ width: '320px' }" :label-col-props="{ span: 6 }" - :wrapper-col-props="{ span: 18 }"> + :wrapper-col-props="{ span: 18 }" + @keyup.enter="() => fetchCardData()"> #foreach($field in ${table.fields}) diff --git a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm index 17a27a85..52015389 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-vue-views-components-table.vue.vm @@ -4,7 +4,8 @@ + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> #foreach($field in ${table.fields}) diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/dto/DictKeyExtraSchemaDTO.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/dto/DictKeyExtraSchemaDTO.java new file mode 100644 index 00000000..168221b1 --- /dev/null +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/dto/DictKeyExtraSchemaDTO.java @@ -0,0 +1,29 @@ +package com.orion.ops.module.infra.entity.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 字典配置项额外参数类型 + * + * @author Jiahang Li + * @version 1.0.0 + * @since 2023/10/20 18:06 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DictKeyExtraSchemaDTO { + + /** + * 参数 + */ + private String name; + + /** + * 数据类型 + */ + private String type; + +} diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyCreateRequest.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyCreateRequest.java index 4fbc0208..23cace55 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyCreateRequest.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyCreateRequest.java @@ -40,6 +40,7 @@ public class DictKeyCreateRequest implements Serializable { @Schema(description = "额外配置定义") private String extraSchema; + @NotBlank @Size(max = 64) @Schema(description = "配置描述") private String description; diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyUpdateRequest.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyUpdateRequest.java index 3059e6c6..4072e054 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyUpdateRequest.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictKeyUpdateRequest.java @@ -45,6 +45,7 @@ public class DictKeyUpdateRequest implements Serializable { @Schema(description = "额外配置定义") private String extraSchema; + @NotBlank @Size(max = 64) @Schema(description = "配置描述") private String description; diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictValueQueryRequest.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictValueQueryRequest.java index 5c58f3ce..4b49c64d 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictValueQueryRequest.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/entity/request/dict/DictValueQueryRequest.java @@ -24,6 +24,10 @@ public class DictValueQueryRequest extends PageRequest { @Schema(description = "配置项id") private Long keyId; + @Size(max = 32) + @Schema(description = "配置项名称") + private String keyName; + @Size(max = 32) @Schema(description = "配置名称") private String name; diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictKeyServiceImpl.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictKeyServiceImpl.java index 3ee5b999..7971fab1 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictKeyServiceImpl.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictKeyServiceImpl.java @@ -13,11 +13,13 @@ import com.orion.ops.framework.common.constant.ErrorMessage; import com.orion.ops.framework.common.utils.Valid; import com.orion.ops.framework.redis.core.utils.RedisMaps; import com.orion.ops.framework.redis.core.utils.RedisStrings; +import com.orion.ops.framework.redis.core.utils.RedisUtils; import com.orion.ops.module.infra.convert.DictKeyConvert; import com.orion.ops.module.infra.dao.DictKeyDAO; import com.orion.ops.module.infra.define.cache.DictCacheKeyDefine; import com.orion.ops.module.infra.entity.domain.DictKeyDO; import com.orion.ops.module.infra.entity.dto.DictKeyCacheDTO; +import com.orion.ops.module.infra.entity.dto.DictKeyExtraSchemaDTO; import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest; import com.orion.ops.module.infra.entity.request.dict.DictKeyQueryRequest; import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest; @@ -90,7 +92,7 @@ public class DictKeyServiceImpl implements DictKeyService { dictValueService.updateKeyNameByKeyId(id, record.getKeyName(), request.getKeyName()); } // 删除缓存 - RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, + RedisUtils.delete(DictCacheKeyDefine.DICT_KEY.getKey(), DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName())); log.info("DictKeyService-updateDictKeyById effect: {}", effect); return effect; @@ -147,7 +149,10 @@ public class DictKeyServiceImpl implements DictKeyService { cacheResult.put(Const.VALUE, dictKey.getValueType()); String extraSchema = dictKey.getExtraSchema(); if (extraSchema != null) { - cacheResult.putAll(JSON.parseObject(extraSchema)); + List schemas = JSON.parseArray(extraSchema, DictKeyExtraSchemaDTO.class); + for (DictKeyExtraSchemaDTO schema : schemas) { + cacheResult.put(schema.getName(), schema.getType()); + } } // 设置缓存 RedisStrings.setJson(cacheKey, DictCacheKeyDefine.DICT_SCHEMA, cacheResult); @@ -173,8 +178,8 @@ public class DictKeyServiceImpl implements DictKeyService { // 删除配置值 dictValueService.deleteDictValueByKeyId(id); // 删除缓存 - RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, id); - RedisMaps.delete(DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName())); + RedisUtils.delete(DictCacheKeyDefine.DICT_KEY.getKey(), + DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName())); log.info("DictKeyService-deleteDictKeyById id: {}, effect: {}", id, effect); return effect; } @@ -197,7 +202,7 @@ public class DictKeyServiceImpl implements DictKeyService { dictValueService.deleteDictValueByKeyIdList(idList); log.info("DictKeyService-deleteDictKeyByIdList effect: {}", effect); // 删除缓存 - RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, idList); + RedisMaps.delete(DictCacheKeyDefine.DICT_KEY); List schemaKeys = dictKeys.stream() .map(DictKeyDO::getKeyName) .map(DictCacheKeyDefine.DICT_SCHEMA::format) diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictValueServiceImpl.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictValueServiceImpl.java index 725db9c7..5ce65b1b 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictValueServiceImpl.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/service/impl/DictValueServiceImpl.java @@ -345,6 +345,7 @@ public class DictValueServiceImpl implements DictValueService { private LambdaQueryWrapper buildQueryWrapper(DictValueQueryRequest request) { return dictValueDAO.wrapper() .eq(DictValueDO::getKeyId, request.getKeyId()) + .like(DictValueDO::getKeyName, request.getKeyName()) .like(DictValueDO::getName, request.getName()) .eq(DictValueDO::getValue, request.getValue()) .like(DictValueDO::getLabel, request.getLabel()) diff --git a/orion-ops-ui/src/api/system/dict-value.ts b/orion-ops-ui/src/api/system/dict-value.ts index 5a8db8d3..ebd2f806 100644 --- a/orion-ops-ui/src/api/system/dict-value.ts +++ b/orion-ops-ui/src/api/system/dict-value.ts @@ -1,6 +1,6 @@ import axios from 'axios'; import qs from 'query-string'; -import { AnyObject, DataGrid, Options, Pagination } from '@/types/global'; +import { DataGrid, Options, Pagination } from '@/types/global'; import { TableData } from '@arco-design/web-vue/es/table/interface'; /** diff --git a/orion-ops-ui/src/assets/style/layout.less b/orion-ops-ui/src/assets/style/layout.less index bfcabe61..3b3782cd 100644 --- a/orion-ops-ui/src/assets/style/layout.less +++ b/orion-ops-ui/src/assets/style/layout.less @@ -110,6 +110,27 @@ padding: 18px 24px 14px 24px; } +.click-icon-wrapper { + display: flex; + justify-content: center; + align-items: center; + color: var(--color-text-2); + background: var(--color-fill-2); + border-radius: 2px; + cursor: pointer; + border: 1px solid transparent; + transition: background-color 0.1s cubic-bezier(0, 0, 1, 1); +} + +.click-icon-wrapper:hover { + background: var(--color-fill-3); +} + +.arco-table-td-content { + color: rgba(var(--gray-9), .95); + font-size: 13px; +} + .usn { user-select: none; } diff --git a/orion-ops-ui/src/components/system/dict-key/dict-key-selector.vue b/orion-ops-ui/src/components/system/dict-key/dict-key-selector.vue new file mode 100644 index 00000000..1aae37ec --- /dev/null +++ b/orion-ops-ui/src/components/system/dict-key/dict-key-selector.vue @@ -0,0 +1,60 @@ + + + + + + + diff --git a/orion-ops-ui/src/components/user/role/user-role-selector.vue b/orion-ops-ui/src/components/user/role/user-role-selector.vue index b248144b..ecdb7cb2 100644 --- a/orion-ops-ui/src/components/user/role/user-role-selector.vue +++ b/orion-ops-ui/src/components/user/role/user-role-selector.vue @@ -22,7 +22,8 @@ import { RoleStatusEnum } from '@/views/user/role/types/enum.types'; const props = defineProps({ - modelValue: Object, + // FIXME 拆出来单选多选 + modelValue: Array, loading: Boolean, multiple: Boolean, }); diff --git a/orion-ops-ui/src/components/view/card-list/index.vue b/orion-ops-ui/src/components/view/card-list/index.vue index 3b0f48ae..267c263c 100644 --- a/orion-ops-ui/src/components/view/card-list/index.vue +++ b/orion-ops-ui/src/components/view/card-list/index.vue @@ -27,7 +27,7 @@
@@ -51,13 +51,13 @@ allow-clear @input="e => emits('update:searchValue', e)" @change="e => emits('update:searchValue', e)" - @keydown.enter="emits('search')" /> + @keyup.enter="emits('search')" />
@@ -77,14 +77,14 @@
@@ -358,7 +358,6 @@ // 重置过滤 const filterReset = () => { emits('reset'); - triggerMouseEvent(filterRef); }; // 搜索 @@ -435,21 +434,8 @@ } .header-icon-wrapper { - display: flex; - justify-content: center; - align-items: center; height: 27px; padding: 6px; - color: var(--color-text-2); - background: var(--color-fill-2); - border-radius: 2px; - cursor: pointer; - border: 1px solid transparent; - transition: background-color 0.1s cubic-bezier(0, 0, 1, 1); - } - - .header-icon-wrapper:hover { - background: var(--color-fill-3); } .filter-bottom-container { diff --git a/orion-ops-ui/src/store/modules/cache/index.ts b/orion-ops-ui/src/store/modules/cache/index.ts index f45d5ca6..412472ee 100644 --- a/orion-ops-ui/src/store/modules/cache/index.ts +++ b/orion-ops-ui/src/store/modules/cache/index.ts @@ -1,7 +1,7 @@ import { defineStore } from 'pinia'; import { CacheState } from './types'; -export type CacheType = 'menus' | 'roles' | 'hostTags' | 'hostKeys' | 'hostIdentities' +export type CacheType = 'menus' | 'roles' | 'hostTags' | 'hostKeys' | 'hostIdentities' | 'dictKeys' | string export default defineStore('cache', { state: (): CacheState => ({ @@ -10,6 +10,7 @@ export default defineStore('cache', { hostTags: [], hostKeys: [], hostIdentities: [], + dictKeys: [], }), getters: {}, diff --git a/orion-ops-ui/src/store/modules/cache/types.ts b/orion-ops-ui/src/store/modules/cache/types.ts index e00ecd58..a07142d3 100644 --- a/orion-ops-ui/src/store/modules/cache/types.ts +++ b/orion-ops-ui/src/store/modules/cache/types.ts @@ -3,6 +3,7 @@ import { RoleQueryResponse } from '@/api/user/role'; import { TagQueryResponse } from '@/api/meta/tag'; import { HostKeyQueryResponse } from '@/api/asset/host-key'; import { HostIdentityQueryResponse } from '@/api/asset/host-identity'; +import { DictKeyQueryResponse } from '@/api/system/dict-key'; export interface CacheState { menus: MenuQueryResponse[]; @@ -10,6 +11,7 @@ export interface CacheState { hostTags: TagQueryResponse[]; hostKeys: HostKeyQueryResponse[]; hostIdentities: HostIdentityQueryResponse[]; + dictKeys: DictKeyQueryResponse[]; [key: string]: unknown; } diff --git a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-card-list.vue b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-card-list.vue index c8a4fe86..76fde006 100644 --- a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-card-list.vue +++ b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-card-list.vue @@ -92,7 +92,8 @@ label-align="right" :style="{ width: '320px' }" :label-col-props="{ span: 6 }" - :wrapper-col-props="{ span: 18 }"> + :wrapper-col-props="{ span: 18 }" + @keyup.enter="() => fetchCardData()"> + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> + :wrapper-col-props="{ span: 18 }" + @keyup.enter="() => fetchCardData()"> + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> - 额外参数定义 + 额外参数定义 + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> @@ -54,7 +55,7 @@ :bordered="false"> @@ -63,7 +64,9 @@ @@ -126,8 +129,6 @@ const formModel = reactive({ id: undefined, keyName: undefined, - valueType: undefined, - extraSchema: undefined, description: undefined, }); diff --git a/orion-ops-ui/src/views/system/dict-key/types/form.rules.ts b/orion-ops-ui/src/views/system/dict-key/types/form.rules.ts index 880ac041..8e1328ca 100644 --- a/orion-ops-ui/src/views/system/dict-key/types/form.rules.ts +++ b/orion-ops-ui/src/views/system/dict-key/types/form.rules.ts @@ -17,6 +17,9 @@ export const valueType = [{ }] as FieldRule[]; export const description = [{ + required: true, + message: '请输入配置描述' +}, { maxLength: 64, message: '配置描述长度不能大于64位' }] as FieldRule[]; diff --git a/orion-ops-ui/src/views/system/dict-value/components/dict-value-card-list.vue b/orion-ops-ui/src/views/system/dict-value/components/dict-value-card-list.vue deleted file mode 100644 index 26f55e3e..00000000 --- a/orion-ops-ui/src/views/system/dict-value/components/dict-value-card-list.vue +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - diff --git a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-drawer.vue b/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-drawer.vue deleted file mode 100644 index cd95b96a..00000000 --- a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-drawer.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - diff --git a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue b/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue index 979f4fe8..71ed3736 100644 --- a/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue +++ b/orion-ops-ui/src/views/system/dict-value/components/dict-value-form-modal.vue @@ -20,15 +20,9 @@ :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }" :rules="formRules"> - - - - - - + + @@ -42,10 +36,6 @@ - - - - - - - - - - - - + @reset="fetchTableData" + @keyup.enter="() => fetchTableData()"> @@ -35,17 +22,6 @@ - - - - - - - - @@ -102,6 +78,18 @@ @page-change="(page) => fetchTableData(page, pagination.pageSize)" @page-size-change="(size) => fetchTableData(1, size)" :bordered="false"> + + + + @@ -21,10 +21,15 @@ import DictValueTable from './components/dict-value-table.vue'; import DictValueFormModal from './components/dict-value-form-modal.vue'; - import { ref } from 'vue'; + import { onUnmounted, ref } from 'vue'; + import { useCacheStore } from '@/store'; + import { getDictKeyList } from '@/api/system/dict-key'; + import { getTagList } from '@/api/meta/tag'; + import { Message } from '@arco-design/web-vue'; const table = ref(); const modal = ref(); + const cacheStore = useCacheStore(); // 添加回调 const modalAddCallback = () => { @@ -36,6 +41,23 @@ table.value.updatedCallback(); }; + // 加载字典配置项 + const loadDictKeys = async () => { + try { + const { data } = await getDictKeyList(); + // 设置到缓存 + cacheStore.set('dictKeys', data); + } catch { + Message.error('配置项加载失败'); + } + }; + loadDictKeys(); + + // 卸载时清除 cache + onUnmounted(() => { + cacheStore.set('dictKeys', []); + }); +