From 6c4e588f920708f63025549f92e379ebfd89baba Mon Sep 17 00:00:00 2001 From: lijiahang Date: Thu, 26 Oct 2023 14:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20json=20view.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orion-ops-ui/src/components/index.ts | 2 + .../src/components/view/editor/core.ts | 13 +++- .../src/components/view/editor/index.vue | 5 +- .../components/host-identity-card-list.vue | 4 +- .../components/host-identity-table.vue | 2 +- .../asset/host/components/host-card-list.vue | 2 +- .../asset/host/components/host-table.vue | 2 +- .../dict-key/components/dict-key-table.vue | 18 +++-- .../components/dict-key-view-modal.vue | 72 +++++++++++++++++++ .../src/views/system/dict-key/index.vue | 7 +- .../system/dict-key/types/table.columns.ts | 4 +- 11 files changed, 110 insertions(+), 21 deletions(-) create mode 100644 orion-ops-ui/src/views/system/dict-key/components/dict-key-view-modal.vue diff --git a/orion-ops-ui/src/components/index.ts b/orion-ops-ui/src/components/index.ts index 511964c0..f671547b 100644 --- a/orion-ops-ui/src/components/index.ts +++ b/orion-ops-ui/src/components/index.ts @@ -13,6 +13,7 @@ import { import Breadcrumb from './app/breadcrumb/index.vue'; import Chart from './view/chart/index.vue'; import CardList from './view/card-list/index.vue'; +import Editor from './view/editor/index.vue'; use([ CanvasRenderer, @@ -33,5 +34,6 @@ export default { Vue.component('Breadcrumb', Breadcrumb); Vue.component('a-query-header', AQueryHeader); Vue.component('card-list', CardList); + Vue.component('Editor', Editor); }, }; diff --git a/orion-ops-ui/src/components/view/editor/core.ts b/orion-ops-ui/src/components/view/editor/core.ts index 44f59685..65c8f20a 100644 --- a/orion-ops-ui/src/components/view/editor/core.ts +++ b/orion-ops-ui/src/components/view/editor/core.ts @@ -27,6 +27,12 @@ export type RenderLineHighlight = 'all' | 'line' | 'none' | 'gutter' export interface Options { // 自适应布局 automaticLayout?: boolean; + // 只读提示 + readOnlyMessage?: { + value?: string, + + [key: string]: unknown; + }; // 是否折叠 folding?: boolean; // 折叠方式 @@ -44,7 +50,9 @@ export interface Options { placeholder?: string; minimap?: { // 关闭小地图 - enabled?: boolean + enabled?: boolean; + + [key: string]: unknown; }; fontSize?: number; // 取消代码后面一大段空白 @@ -63,6 +71,9 @@ export interface Options { export const createDefaultOptions = (): Options => { return { automaticLayout: true, + readOnlyMessage: { + value: '当前为只读状态' + }, folding: true, foldingHighlight: true, foldingStrategy: 'indentation', diff --git a/orion-ops-ui/src/components/view/editor/index.vue b/orion-ops-ui/src/components/view/editor/index.vue index a4cfdce9..1a38616d 100644 --- a/orion-ops-ui/src/components/view/editor/index.vue +++ b/orion-ops-ui/src/components/view/editor/index.vue @@ -71,7 +71,8 @@ language: props.language, readOnly: props.readonly, theme: props.theme === true ? (appStore.theme === 'dark' ? 'vs-dark' : 'vs') : props.theme, - options: { ...createDefaultOptions(), ...props.options }, + ...createDefaultOptions(), + ...props.options, }; // 创建编辑器 editor = monaco.editor.create(editorContainer.value, options); @@ -101,7 +102,7 @@ } }); - // 监听配置 + // 监听配置变更 watch(() => props.options, (v) => { if (editor) { editor.updateOptions(v); 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 28b1def8..6fdb9f16 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 @@ -21,7 +21,7 @@ @@ -226,6 +226,6 @@ - diff --git a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue index 0de69365..a369f750 100644 --- a/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue +++ b/orion-ops-ui/src/views/asset/host-identity/components/host-identity-table.vue @@ -68,7 +68,7 @@ diff --git a/orion-ops-ui/src/views/asset/host/components/host-card-list.vue b/orion-ops-ui/src/views/asset/host/components/host-card-list.vue index 09927941..bd15fef6 100644 --- a/orion-ops-ui/src/views/asset/host/components/host-card-list.vue +++ b/orion-ops-ui/src/views/asset/host/components/host-card-list.vue @@ -25,7 +25,7 @@ diff --git a/orion-ops-ui/src/views/asset/host/components/host-table.vue b/orion-ops-ui/src/views/asset/host/components/host-table.vue index a25ebe0d..30d2eddb 100644 --- a/orion-ops-ui/src/views/asset/host/components/host-table.vue +++ b/orion-ops-ui/src/views/asset/host/components/host-table.vue @@ -94,7 +94,7 @@ diff --git a/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue b/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue index f4c069e1..dfd96501 100644 --- a/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue +++ b/orion-ops-ui/src/views/system/dict-key/components/dict-key-table.vue @@ -53,6 +53,12 @@ @page-change="(page) => fetchTableData(page, pagination.pageSize)" @page-size-change="(size) => fetchTableData(1, size)" :bordered="false"> + + @@ -21,9 +24,11 @@ import { ref } from 'vue'; import DictKeyTable from './components/dict-key-table.vue'; import DictKeyFormModal from './components/dict-key-form-modal.vue'; + import DictKeyViewModal from './components/dict-key-view-modal.vue'; const table = ref(); const modal = ref(); + const view = ref(); // 添加回调 const modalAddCallback = () => { diff --git a/orion-ops-ui/src/views/system/dict-key/types/table.columns.ts b/orion-ops-ui/src/views/system/dict-key/types/table.columns.ts index 36d73a54..b785284f 100644 --- a/orion-ops-ui/src/views/system/dict-key/types/table.columns.ts +++ b/orion-ops-ui/src/views/system/dict-key/types/table.columns.ts @@ -16,7 +16,7 @@ const columns = [ ellipsis: true, tooltip: true, }, { - title: '配置值类型', + title: '类型', dataIndex: 'valueType', slotName: 'valueType', align: 'left', @@ -29,7 +29,7 @@ const columns = [ ellipsis: true, tooltip: true, }, { - title: '额外配置类型', + title: '额外配置', dataIndex: 'extraSchema', slotName: 'extraSchema', align: 'left',