|
|
|
|
@ -33,7 +33,7 @@
|
|
|
|
|
<div class="stat-card">
|
|
|
|
|
<div class="stat-label">
|
|
|
|
|
采集服务
|
|
|
|
|
<el-tooltip content="数据采集服务的运行状态。系统根据心跳表判断服务是否存活,心跳超时则显示异常。" placement="top">
|
|
|
|
|
<el-tooltip content="数据采集服务的运行状态。点击暂停可暂停采集引擎,需手动启动/停止Windows服务。" placement="top">
|
|
|
|
|
<span class="info-icon">ⓘ</span>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
@ -42,11 +42,12 @@
|
|
|
|
|
{{ collectorStatusText }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="stat-sub" v-if="collectorStatus.serviceStatus === 'Running' && collectorStatus.status === 'running'">运行 {{ formatUptime(collectorStatus.uptimeSeconds) }}</div>
|
|
|
|
|
<div class="stat-sub" v-if="collectorStatus.status === 'running'">运行 {{ formatUptime(collectorStatus.uptimeSeconds) }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="collector-actions">
|
|
|
|
|
<el-button v-if="collectorStatus.serviceStatus !== 'Running'" size="small" type="success" :loading="startLoading" @click="startCollector">启动采集</el-button>
|
|
|
|
|
<el-button v-if="collectorStatus.status === 'running'" size="small" type="danger" :loading="stopLoading" @click="stopCollector">停止采集</el-button>
|
|
|
|
|
<el-button v-if="collectorStatus.status === 'stopped' || collectorStatus.status === 'not_installed'" size="small" type="success" disabled>需手动启动服务</el-button>
|
|
|
|
|
<el-button v-if="collectorStatus.status === 'paused' || collectorStatus.status === 'timeout'" size="small" type="success" :loading="startLoading" @click="startCollector">恢复采集</el-button>
|
|
|
|
|
<el-button v-if="collectorStatus.status === 'running'" size="small" type="danger" :loading="stopLoading" @click="stopCollector">暂停采集</el-button>
|
|
|
|
|
<el-button size="small" type="warning" :loading="refreshLoading" @click="refreshCollectorConfig">刷新配置</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
@ -402,25 +403,25 @@ function formatNumber(val: number | undefined | null): string {
|
|
|
|
|
return Number(val).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 采集服务状态:综合心跳 + Windows服务状态
|
|
|
|
|
// 采集服务状态:5种精确状态
|
|
|
|
|
const collectorTagType = computed(() => {
|
|
|
|
|
const { serviceStatus, status } = collectorStatus.value
|
|
|
|
|
if (serviceStatus === 'Running' && status === 'running') return 'success'
|
|
|
|
|
if (serviceStatus === 'Running' && status !== 'running') return 'warning' // 进程在但心跳超时
|
|
|
|
|
if (serviceStatus === 'NotInstalled') return 'danger'
|
|
|
|
|
if (serviceStatus === 'StartFailed') return 'danger'
|
|
|
|
|
const { status } = collectorStatus.value
|
|
|
|
|
if (status === 'running') return 'success'
|
|
|
|
|
if (status === 'paused') return 'info'
|
|
|
|
|
if (status === 'timeout') return 'warning'
|
|
|
|
|
if (status === 'stopped') return 'info'
|
|
|
|
|
if (status === 'not_installed') return 'danger'
|
|
|
|
|
return 'warning'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const collectorStatusText = computed(() => {
|
|
|
|
|
const { serviceStatus, status } = collectorStatus.value
|
|
|
|
|
if (serviceStatus === 'Running' && status === 'running') return '运行中'
|
|
|
|
|
if (serviceStatus === 'Running' && status !== 'running') return '心跳超时'
|
|
|
|
|
if (serviceStatus === 'NotInstalled') return '未安装'
|
|
|
|
|
if (serviceStatus === 'Stopped') return '已停止'
|
|
|
|
|
if (serviceStatus === 'Starting') return '启动中'
|
|
|
|
|
if (serviceStatus === 'StartFailed') return '启动失败'
|
|
|
|
|
return serviceStatus || '-'
|
|
|
|
|
const { status } = collectorStatus.value
|
|
|
|
|
if (status === 'running') return '运行中'
|
|
|
|
|
if (status === 'paused') return '已暂停'
|
|
|
|
|
if (status === 'timeout') return '心跳超时'
|
|
|
|
|
if (status === 'stopped') return '已停止'
|
|
|
|
|
if (status === 'not_installed') return '未安装'
|
|
|
|
|
return status || '-'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function alertTypeTag(type: string): string {
|
|
|
|
|
@ -443,7 +444,7 @@ function initWorkshopChart() {
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
formatter: (params: any) => {
|
|
|
|
|
const d = workshopData.value[params[0].dataIndex]
|
|
|
|
|
return `${d.workshopName}<br/>${unitLabel}产量: ${params[0].value} ${unit}<br/>总产量: ${d.quantity} 件<br/>机床数: ${d.machineCount} 台`
|
|
|
|
|
return `${d.workshopName}<br/>${unitLabel}产量: ${Number(params[0].value).toFixed(2)} ${unit}<br/>总产量: ${d.quantity} 件<br/>机床数: ${d.machineCount} 台`
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
grid: { left: 60, right: 20, top: 20, bottom: 30 },
|
|
|
|
|
@ -452,7 +453,7 @@ function initWorkshopChart() {
|
|
|
|
|
series: [{
|
|
|
|
|
type: 'bar', data: workshopData.value.map(i => i.avgQuantity),
|
|
|
|
|
itemStyle: { color: '#67C23A', borderRadius: [4, 4, 0, 0] }, barWidth: '40%',
|
|
|
|
|
label: { show: true, position: 'top', formatter: `{c} ${unit}`, fontSize: 12 },
|
|
|
|
|
label: { show: true, position: 'top', formatter: (p: any) => `${Number(p.value).toFixed(2)} ${unit}`, fontSize: 12 },
|
|
|
|
|
}],
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|