完成页面监控功能
This commit is contained in:
@@ -72,14 +72,17 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
GET_DEVICE_CONFIGURE (id) {
|
GET_DEVICE_CONFIGURE (id) {
|
||||||
return request({ url: '?query=device&id=' + id })
|
return request({ url: '?query=device&id=' + id })
|
||||||
},
|
},
|
||||||
GET_SERVE_DEVICE_MONITORING (url, username, password) {
|
GET_SERVE_DEVICE_MONITORING (url, username, password, deviceName) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: username,
|
||||||
password: password
|
password: password
|
||||||
},
|
},
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: url + '/Edge/DeviceData'
|
url: url + '/Edge/DeviceData?data=' + deviceName
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
GET_ALL_DEVICES () {
|
||||||
|
return request({ url: '?query=all_devices' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,106 +1,121 @@
|
|||||||
<template>
|
<template>
|
||||||
<d2-container>
|
<d2-container>
|
||||||
<el-card class="box-card" v-for="(item, index) in serverData" :key="index">
|
<div :key="key">
|
||||||
<div slot="header" class="device-header">
|
<el-card class="box-card" v-for="(item, index) in serverData" :key="index">
|
||||||
<span>前置服务 {{ item.server_name }} ({{ item.url }} )</span>
|
<div slot="header" class="device-header">
|
||||||
</div>
|
<span>前置服务 {{ item.server_name }} ({{ item.url }}:{{ item.port }} )</span>
|
||||||
<el-row :gutter="12">
|
</div>
|
||||||
<el-col :span="6" v-for="i in item.devices" :key="i">
|
<el-row :gutter="12">
|
||||||
<el-popover placement="top" trigger="click">
|
<el-col :span="6" v-for="(i, k) in item.devices" :key="k">
|
||||||
|
<el-popover placement="top" trigger="click">
|
||||||
|
<el-menu @select="(index) => setServeStatus(i.id, index)"
|
||||||
|
:style="{ 'borderRight': 'none' }">
|
||||||
|
<el-menu-item index="0">
|
||||||
|
<span slot="title">暂停</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="1">
|
||||||
|
<span slot="title">重启</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="2">
|
||||||
|
<span slot="title">关闭</span>
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
<el-card slot="reference"
|
||||||
|
:class="{ 'box-card': true, 'online': i.deviceStatus, 'offline': !i.deviceStatus }">
|
||||||
|
<div slot="header" class="header-title">
|
||||||
|
<span>{{ i.device_name }}</span>
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>设备类型</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.device_type }}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>IP/端口</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.config ? i.config[2] : "" }}
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>活动时间</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.startTime }}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>采集耗时</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.captureSpendTime }}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>成功次数</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.success }}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||||
|
<span>失败次数</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="14" style="padding-left:0px;">:{{ i.failed }}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-alert v-if="i.failedMsg" :title="i.failedMsg" type="error" :closable="false">
|
||||||
|
</el-alert>
|
||||||
|
<div v-else style="height:35px;"></div>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<el-menu @select="(index) => setServeStatus(i.id, index)" :style="{ 'borderRight': 'none' }">
|
</el-card>
|
||||||
<el-menu-item index="0">
|
</el-popover>
|
||||||
<span slot="title">暂停</span>
|
</el-col>
|
||||||
</el-menu-item>
|
</el-row>
|
||||||
<el-menu-item index="1">
|
|
||||||
<span slot="title">重启</span>
|
|
||||||
</el-menu-item>
|
|
||||||
<el-menu-item index="2">
|
|
||||||
<span slot="title">关闭</span>
|
|
||||||
</el-menu-item>
|
|
||||||
</el-menu>
|
|
||||||
<el-card slot="reference"
|
|
||||||
:class="{ 'box-card': true, 'online': i.device_status === 1, 'offline': i.device_status !== 1 }">
|
|
||||||
<div slot="header" class="header-title">
|
|
||||||
<span>{{ i.device_name }}</span>
|
|
||||||
</div>
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>设备类型</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.device_type }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- <el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>IP/端口</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.ip + ':' + i.port }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>活动时间</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.time }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>采集耗时</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.hs }}</el-col>
|
|
||||||
</el-row> -->
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>成功次数</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.success_count }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
|
||||||
<span>失败次数</span>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="14" style="padding-left:0px;">:{{ i.fail_count }}</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-alert v-if="i.error_mesage" :title="i.error_mesage" type="error" :closable="false">
|
|
||||||
</el-alert>
|
|
||||||
<div v-else style="height:35px;"></div>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-popover>
|
</div>
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
serverData: []
|
|
||||||
|
serverData: [],
|
||||||
|
deviceData: [],
|
||||||
|
key: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async getServe () {
|
async getServe () {
|
||||||
try {
|
try {
|
||||||
this.serverData = await this.$api.GET_SERVE_MONITORING()
|
this.serverData = Object.values(await this.$api.GET_ALL_DEVICES())
|
||||||
} catch (e) {
|
this.serverData.forEach((element, index) => {
|
||||||
console.log(e)
|
element.devices.forEach((item, i) => {
|
||||||
}
|
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + item.url + ':' + item.port, 'admin', '123456', item.device_name).then(res => {
|
||||||
},
|
if (res.IsSuccess) {
|
||||||
async setServeStatus (id, status) {
|
const temp = {
|
||||||
try {
|
config: res.Content.__config.split(' '),
|
||||||
// const data = { id: id, status: status }
|
startTime: res.Content.__startTime,
|
||||||
// await this.$api.SET_SERVE_STATUS(data)
|
captureSpendTime: res.Content.__captureSpendTime,
|
||||||
this.$message({
|
success: res.Content.__success,
|
||||||
message: '操作成功',
|
failed: res.Content.__failed,
|
||||||
type: 'success'
|
failedMsg: res.Content.__failedMsg,
|
||||||
|
deviceStatus: res.Content.__deviceStatus,
|
||||||
|
device_name: item.device_name,
|
||||||
|
device_type: item.device_type
|
||||||
|
}
|
||||||
|
this.$set(this.serverData[index].devices, i, temp)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
this.getServe()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
Reference in New Issue
Block a user