diff --git a/orion-ops-ui/src/assets/style/global.less b/orion-ops-ui/src/assets/style/global.less index b0f3b9fa..5b272bb2 100644 --- a/orion-ops-ui/src/assets/style/global.less +++ b/orion-ops-ui/src/assets/style/global.less @@ -120,6 +120,10 @@ body { color: rgb(var(--arcoblue-6)); } +.span-red { + color: rgb(var(--red-6)); +} + #app { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/orion-ops-ui/src/assets/style/layout.less b/orion-ops-ui/src/assets/style/layout.less index a3154a73..3d160e75 100644 --- a/orion-ops-ui/src/assets/style/layout.less +++ b/orion-ops-ui/src/assets/style/layout.less @@ -75,9 +75,9 @@ box-shadow: 2px 2px 12px rgba(0, 0, 0, .15); } -.card-descriptions { - height: 100%; - overflow-y: auto; +.card-extra-icon { + font-size: 16px; + cursor: pointer; } .usn { diff --git a/orion-ops-ui/src/components/card/list/index.vue b/orion-ops-ui/src/components/card/list/index.vue index 6653a4d8..aab4417a 100644 --- a/orion-ops-ui/src/components/card/list/index.vue +++ b/orion-ops-ui/src/components/card/list/index.vue @@ -25,7 +25,8 @@
-
@@ -83,7 +84,9 @@ - + @@ -112,12 +115,58 @@ - - + + + + - + @@ -128,12 +177,7 @@ - + @@ -150,7 +194,7 @@ import { compile, computed, h, PropType } from 'vue'; import { useAppStore } from '@/store'; import { PaginationProps, ResponsiveValue } from '@arco-design/web-vue'; - import { Position, CardRecord, ColResponsiveValue, HandleVisible } from '@/types/card'; + import { Position, CardRecord, ColResponsiveValue, HandleVisible, CardFieldConfig } from '@/types/card'; const appStore = useAppStore(); const headerWidth = computed(() => { @@ -189,6 +233,10 @@ type: Boolean as PropType, default: () => false }, + fieldConfig: { + type: Object as PropType, + default: () => [] + }, cardHeight: Number, searchInputWidth: { type: String, @@ -206,14 +254,6 @@ type: String as PropType, default: () => '暂无数据 点击此处进行创建' }, - emptyToCreate: { - type: Boolean, - default: () => true - }, - emptyDescription: { - type: String, - default: () => '暂无数据 点击此处进行创建' - }, cardLayoutGutter: { type: [Number, Array] as PropType | PropType | @@ -221,6 +261,10 @@ PropType>, default: () => [16, 16] }, + addPermission: { + type: Array as PropType, + default: () => [] + }, cardLayoutCols: { type: Object as PropType, default: () => { @@ -382,8 +426,34 @@ padding: 0; } - &-body-creatable { - cursor: pointer; + } + + .fields-container { + height: 100%; + overflow-y: auto; + + .field-label { + color: var(--color-text-3); + word-break: break-all; + white-space: pre-wrap; + padding-right: 8px; + font-size: 14px; + font-weight: 500; + } + + .field-value { + color: var(--color-text-1); + word-break: break-all; + white-space: pre-wrap; + padding-right: 8px; + font-size: 14px; + font-weight: 400; + } + + .field-value.field-value-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + word-break: keep-all; } } diff --git a/orion-ops-ui/src/types/card.ts b/orion-ops-ui/src/types/card.ts index 2be009df..8f1ae66e 100644 --- a/orion-ops-ui/src/types/card.ts +++ b/orion-ops-ui/src/types/card.ts @@ -1,21 +1,46 @@ -import { DescData, PaginationProps, ResponsiveValue } from '@arco-design/web-vue'; +import { PaginationProps, ResponsiveValue } from '@arco-design/web-vue'; import { reactive } from 'vue'; /** - * 卡片字段 + * 对齐方式 */ -export interface CardField { - field: string; - label: string; - render: (record: CardRecord) => string; - span?: number; -} +export type Align = 'left' | 'center' | 'right'; /** * 创建卡片位置 */ export type Position = 'head' | 'tail' | false; +/** + * 卡片字段配置 + */ +export interface CardFieldConfig { + rowGap?: string; + bodyClass?: string; + showColon?: boolean; + labelSpan?: number; + labelOffset?: number; + labelAlign?: Align; + valueAlign?: Align; + labelClass?: string; + valueClass?: string; + + fields: CardField[]; +} + +/** + * 卡片字段 + */ +export interface CardField { + label: string; + dataIndex: string; + slotName?: string; + labelClass?: string; + valueClass?: string; + ellipsis?: boolean; + tooltip?: boolean; +} + /** * 卡片实体 */ @@ -72,17 +97,3 @@ export const usePagination = (): PaginationProps => { pageSizeOptions: [12, 18, 36, 48, 96] }); }; - -/** - * 转为卡片描述对象 - */ -export const toCardDesc = (fields: CardField[], record: CardRecord): DescData[] => { - return fields.map(s => { - return { - field: s.field, - label: s.label, - value: s.render(record), - span: s.span || 3 - }; - }); -}; 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 f190f568..6f027a02 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 @@ -1,40 +1,72 @@