diff --git a/src/views/ops/pages/dc/server/components/ServerDetail.vue b/src/views/ops/pages/dc/server/components/ServerDetail.vue index d035490..a8433e7 100644 --- a/src/views/ops/pages/dc/server/components/ServerDetail.vue +++ b/src/views/ops/pages/dc/server/components/ServerDetail.vue @@ -28,22 +28,29 @@ - {{ record.unique_id || '-' }} + {{ record.server_identity || '-' }} {{ record.name || '-' }} {{ getServerTypeText(record.server_type) }} - {{ record.os || '-' }} + {{ formatOSInfo(record.os, record.os_version) }} + {{ record.kernel || '-' }} {{ record.location || '-' }} {{ record.tags || '-' }} - {{ record.ip || '-' }} - {{ record.remote_port || '-' }} - {{ record.agent_url || '-' }} - - - {{ record.data_collection ? '已开启' : '未开启' }} + {{ record.ip_address || '-' }} + {{ record.remote_access || '-' }} + {{ record.agent_config || '-' }} + {{ getStatusText(record.status) }} + {{ formatTime(record.last_check_time) }} + + + {{ record.collect_on ? '已启用' : '未启用' }} - {{ record.collection_interval ? `${record.collection_interval}分钟` : '-' }} - {{ record.remark || '-' }} + {{ record.collect_interval ? `${record.collect_interval}秒` : '-' }} + {{ record.collect_args || '-' }} + {{ record.collect_last_result || '-' }} + {{ record.description || '-' }} + {{ formatTime(record.created_at) }} + {{ formatTime(record.updated_at) }} @@ -555,10 +562,35 @@ const getStatusText = (status?: string) => { offline: '离线', maintenance: '维护中', retired: '已退役', + unknown: '未知', } return textMap[status || ''] || '-' } +const formatOSInfo = (os?: string, osVersion?: string) => { + const parts = [] + if (os) parts.push(os) + if (osVersion) parts.push(osVersion) + return parts.length > 0 ? parts.join(' ') : '-' +} + +const formatTime = (time?: string | Date) => { + if (!time) return '-' + try { + const date = new Date(time) + return date.toLocaleString('zh-CN', { + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }) + } catch (e) { + return '-' + } +} + const getServerTypeText = (type?: string) => { const typeMap: Record = { physical: '物理服务器', @@ -567,7 +599,6 @@ const getServerTypeText = (type?: string) => { } return typeMap[type || ''] || '-' } - const handleRemoteControl = () => { emit('remote-control') } diff --git a/src/views/ops/pages/dc/server/components/ServerFormDialog.vue b/src/views/ops/pages/dc/server/components/ServerFormDialog.vue index 648b19f..d767cc2 100644 --- a/src/views/ops/pages/dc/server/components/ServerFormDialog.vue +++ b/src/views/ops/pages/dc/server/components/ServerFormDialog.vue @@ -27,7 +27,7 @@ - + 物理服务器 @@ -36,7 +36,7 @@ - + Windows @@ -45,6 +45,15 @@ + + + + X86 + ARM + 其它 + + + @@ -67,14 +76,14 @@ - - + + - - + + @@ -135,13 +144,14 @@ const formData = reactive({ name: '', server_type: '', os: '', + kernel: '', datacenter_id: undefined as number | undefined, floor_id: undefined as number | undefined, rack_id: undefined as number | undefined, tags: '', ip: '', - remote_port: '', - agent_url: '', + remote_access: '', + agent_config: '', data_collection: false, collection_interval: 5, remark: '', @@ -168,8 +178,8 @@ watch( rack_id: props.record.rack_id, tags: props.record.tags || '', ip: props.record.ip || '', - remote_port: props.record.remote_port || '', - agent_url: props.record.agent_url || '', + remote_access: props.record.remote_access || '', + agent_config: props.record.agent_config || '', data_collection: props.record.data_collection || false, collection_interval: props.record.collection_interval || 5, remark: props.record.remark || '', @@ -190,8 +200,8 @@ watch( rack_id: undefined, tags: '', ip: '', - remote_port: '', - agent_url: '', + remote_access: '', + agent_config: '', data_collection: false, collection_interval: 5, remark: '', diff --git a/src/views/ops/pages/dc/server/config/columns.ts b/src/views/ops/pages/dc/server/config/columns.ts index e835509..e2c82e1 100644 --- a/src/views/ops/pages/dc/server/config/columns.ts +++ b/src/views/ops/pages/dc/server/config/columns.ts @@ -6,7 +6,7 @@ export const columns = [ slotName: 'id', }, { - dataIndex: 'unique_id', + dataIndex: 'service_identity', title: '唯一标识', width: 150, }, @@ -16,7 +16,7 @@ export const columns = [ width: 150, }, { - dataIndex: 'type', + dataIndex: 'server_type', title: '类型', width: 120, }, @@ -25,6 +25,11 @@ export const columns = [ title: '操作系统', width: 150, }, + { + dataIndex: 'kernel', + title: '内核类型', + width: 150, + }, { dataIndex: 'location', title: '位置信息', diff --git a/src/views/ops/pages/dc/server/model.txt b/src/views/ops/pages/dc/server/model.txt new file mode 100644 index 0000000..6b2b934 --- /dev/null +++ b/src/views/ops/pages/dc/server/model.txt @@ -0,0 +1,38 @@ + +// ControlServer 服务器管理表 +type ControlServer struct { + ID uint `gorm:"primarykey" json:"id"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` + + // 服务器唯一标识 + ServerIdentity string `gorm:"type:varchar(255);not null;uniqueIndex" json:"server_identity"` // 服务器唯一标识 + + // 服务器基本信息 + Name string `gorm:"type:varchar(100);not null" json:"name"` // 服务器名称 + IPAddress string `gorm:"type:varchar(50)" json:"ip_address"` // IP地址 + Description string `gorm:"type:text" json:"description"` // 描述信息 + + // 服务器类型和标签 + OS string `gorm:"type:varchar(50)" json:"os"` // 操作系统: Windows/Linux/Mac/Other + OSVersion string `gorm:"type:varchar(50)" json:"os_version"` // 操作系统版本: 10.0.19041.1/18.04.5/14.1.0/Other + Kernel string `gorm:"type:varchar(50)" json:"kernel"` // 内核类型:x86/arm + ServerType string `gorm:"type:varchar(50)" json:"server_type"` // 服务器类型: physical/virtual/cloud + Tags string `gorm:"type:varchar(500)" json:"tags"` // 标签:PC/Server + Location string `gorm:"type:varchar(200)" json:"location"` // 位置/机房信息 + + // 远程访问 + RemoteAccess string `gorm:"type:varchar(255)" json:"remote_access"` // 远程访问 + AgentConfig string `gorm:"type:varchar(255)" json:"agent_config"` // Agent配置 + + // 状态信息 + Status string `gorm:"type:varchar(20);not null;default:unknown" json:"status"` // 状态: online/offline/unknown + LastCheckTime time.Time `json:"last_check_time"` // 最后检查时间 + + // 采集器配置 + CollectOn bool `gorm:"default:true" json:"collect_on"` // 是否启用采集 + CollectArgs string `gorm:"type:varchar(255)" json:"collect_args"` // 采集参数 + CollectInterval int `gorm:"default:60" json:"collect_interval"` // 采集间隔(秒) + CollectLastResult string `gorm:"type:varchar(2000)" json:"collect_last_result"` // 采集最后结果 +} \ No newline at end of file