【web】 接口对接

dev
Wangxin 9 months ago
parent 0c1f14058d
commit 2ed865fe46
  1. 2
      ALOps_sys_fe/alops-ui/package.json
  2. 9
      ALOps_sys_fe/alops-ui/src/api/QandA/knowledge.js
  3. 10
      ALOps_sys_fe/alops-ui/src/api/device/deviceType.js
  4. 11
      ALOps_sys_fe/alops-ui/src/api/inMonitoring/devicesState.js
  5. 43
      ALOps_sys_fe/alops-ui/src/views/QandA/knowledge/index.vue
  6. 3
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/cardItem.vue
  7. 149
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/detail.vue
  8. 34
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/history.vue
  9. 4
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/index.vue

@ -29,6 +29,7 @@
"axios": "0.28.1", "axios": "0.28.1",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"core-js": "3.37.1", "core-js": "3.37.1",
"dayjs": "^1.11.18",
"echarts": "5.4.0", "echarts": "5.4.0",
"element-ui": "2.15.14", "element-ui": "2.15.14",
"file-saver": "2.0.5", "file-saver": "2.0.5",
@ -37,6 +38,7 @@
"js-beautify": "1.13.0", "js-beautify": "1.13.0",
"js-cookie": "3.0.1", "js-cookie": "3.0.1",
"jsencrypt": "3.0.0-rc.1", "jsencrypt": "3.0.0-rc.1",
"lodash": "^4.17.21",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"quill": "2.0.2", "quill": "2.0.2",
"screenfull": "5.0.2", "screenfull": "5.0.2",

@ -30,16 +30,19 @@ export function uploadedFilesList(query) {
// 新增 // 新增
export function add(data) { export function add(data) {
return request({ return request({
url: api + 'upload', url: api + '/upload',
method: 'post', method: 'post',
data: data data: data,
headers: {
'Content-Type': 'multipart/form-data'
}
}) })
} }
// 修改 // 修改
export function update(data) { export function update(data) {
return request({ return request({
url: api + 'upload', url: api + '/update-knowledge',
method: 'put', method: 'put',
data: data data: data
}) })

@ -1,4 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
const api = '/device/deviceType/' const api = '/device/deviceType/'
// 查询详细 // 查询详细
@ -18,6 +19,15 @@ export function list(query) {
}) })
} }
// 历史预警
export function history(query) {
return request({
url: '/inMonitoring/alertmessage/',
method: 'get',
params: query
})
}
// 新增 // 新增
export function add(data) { export function add(data) {
return request({ return request({

@ -2,7 +2,7 @@ import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi"; import { parseStrEmpty } from "@/utils/ruoyi";
const api = '/device/files/' const api = '/device/files/'
// 查询多台设备列表 // 查询多台设备列表-s首页
export function list(query) { export function list(query) {
return request({ return request({
url: api + 'monitorById', url: api + 'monitorById',
@ -11,6 +11,15 @@ export function list(query) {
}) })
} }
// 查询多台设备列表-s首页
export function monitorpageList(query) {
return request({
url: api + 'monitorpage',
method: 'get',
params: query
})
}
// 查询单台设备 // 查询单台设备
export function getInfo(id) { export function getInfo(id) {
return request({ return request({

@ -14,13 +14,15 @@
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" key="id" prop="id"/> <el-table-column
<el-table-column label="文件名称" align="center" key="title" prop="title" :show-overflow-tooltip="true" /> label="序号"
<el-table-column label="描述" align="center" key="description" prop="description" :show-overflow-tooltip="true" /> width="60"
<el-table-column label="创建人" align="center" key="createBy" prop="createBy" :show-overflow-tooltip="true" /> type="index"
<el-table-column label="创建时间" align="center" prop="createDate" width="160"> ></el-table-column>
<el-table-column label="文件名称" align="center" key="source" prop="source" :show-overflow-tooltip="true" />
<el-table-column label="更新时间" align="center" prop="uploadTime" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createDate) }}</span> <span>{{ parseTime(scope.row.uploadTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
@ -41,19 +43,13 @@
<el-form ref="form" :model="form" :rules="rules" label-width="90px"> <el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="文档标题" prop="title"> <el-form-item label="文档标题" prop="source">
<el-input v-model="form.title" placeholder="请输入文档标题" maxlength="30" /> <el-input v-model="form.source" placeholder="请输入文档标题" maxlength="30" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="文档简介" prop="description"> <el-form-item label="上传文件" prop="file">
<el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入文档简介" /> <ImageUpload @input="upImage" :value="form.filePath" :fileType="['docx','txt']" listType="txt"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="上传文件" prop="fileUrl">
<ImageUpload @input="upImage" :value="form.fileUrl" :fileType="['docx','txt']" listType="txt"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -178,7 +174,7 @@ export default {
}, },
upImage(fileList){ upImage(fileList){
console.log(fileList) console.log(fileList)
this.form.fileUrl = fileList this.form.file = fileList
}, },
@ -235,18 +231,25 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
const formData = new FormData();
formData.append("source", this.form.source)
formData.append("description", this.form.description)
formData.append("file", this.form.file)
if (this.form.id != undefined) { if (this.form.id != undefined) {
update(this.form).then(response => { update(formData).then(response => {
this.$modal.msgSuccess("修改成功") this.$modal.msgSuccess("修改成功")
this.open = false this.open = false
this.getList() this.getList()
}) })
} else { } else {
add(this.form).then(response => { add(formData).then(response => {
this.$modal.msgSuccess("新增成功") this.$modal.msgSuccess("新增成功")
this.open = false this.open = false
this.getList() this.getList()
}) }).catch(error => console.error('上传失败', error));
} }
} }
}) })

@ -18,7 +18,7 @@
<div class="device-box"> <div class="device-box">
<div class="device-image"> <div class="device-image">
<img v-if="cardData.image" :src="cardData.image" alt="" class="device-icon"> <img v-if="cardData.image" :src="baseUrl+cardData.equImage" alt="" class="device-icon">
<i v-else class="fas fa-server"></i> <i v-else class="fas fa-server"></i>
</div> </div>
<div class="device-info"> <div class="device-info">
@ -101,6 +101,7 @@ export default {
}, },
data() { data() {
return { return {
baseUrl: process.env.VUE_APP_BASE_API
} }
}, },
mounted() { mounted() {

@ -16,7 +16,7 @@
</div> </div>
<div class="top-section-con"> <div class="top-section-con">
<div class="device-image"> <div class="device-image">
<img v-if="details.image" :src="details.image" alt="" class="device-icon"> <img v-if="details.equImage" :src="baseUrl+details.equImage" alt="" class="device-icon">
<i v-else class="fas fa-server"></i> <i v-else class="fas fa-server"></i>
</div> </div>
<!-- 设备基本信息 --> <!-- 设备基本信息 -->
@ -158,16 +158,17 @@
设备运行数据 设备运行数据
</h2> </h2>
<el-date-picker <el-date-picker
v-model="daterange" v-model="DateValue"
type="daterange" type="datetimerange"
value-format="yyyy-MM-dd hh:mm:ss"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期"> end-placeholder="结束日期"
@change="handleDateChange">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="chart-container" id="performanceChart"></div> <div class="chart-container" id="performanceChart"></div>
<div class="chart-container" id="trafficChart"></div>
</div> </div>
<!-- 右侧参数 --> <!-- 右侧参数 -->
@ -182,7 +183,7 @@
<div class="metrics-grid"> <div class="metrics-grid">
<div class="bottom-item" v-if="tabIndex == 0"> <div class="bottom-item" v-if="tabIndex == 0">
<History/> <History :dsId="dsId"/>
</div> </div>
</div> </div>
</div> </div>
@ -195,6 +196,7 @@
import { getInfo, historyQuery } from "@/api/inMonitoring/devicesState" import { getInfo, historyQuery } from "@/api/inMonitoring/devicesState"
import * as echarts from 'echarts' import * as echarts from 'echarts'
import dayjs from 'dayjs';
require('echarts/theme/macarons') // echarts theme require('echarts/theme/macarons') // echarts theme
import History from './history.vue' import History from './history.vue'
export default { export default {
@ -202,7 +204,7 @@ export default {
components: { History }, components: { History },
data() { data() {
return { return {
dateRange: [], DateValue: [dayjs().subtract(1, 'month').format('YYYY-MM-DD HH:mm:ss'),dayjs().format('YYYY-MM-DD HH:mm:ss')],
selectedTab: 1, selectedTab: 1,
tabs: [ tabs: [
{ name: '历史预警' }, { name: '历史预警' },
@ -211,35 +213,35 @@ export default {
{ name: '路由表信息' }, { name: '路由表信息' },
], ],
tabIndex: 0, tabIndex: 0,
dsId:'',
details: {}, details: {},
historyQueryList: { historyQueryList: {
minTime: '', maxTime:dayjs().format('YYYY-MM-DD HH:mm:ss'),
maxTime: '', minTime:dayjs().subtract(1, 'month').format('YYYY-MM-DD HH:mm:ss'),
pageNum: 1, pageNum: 1,
pageSize: 1000, pageSize: 1000,
}, },
baseUrl: process.env.VUE_APP_BASE_API
} }
}, },
mounted() { mounted() {
let routeList = this.$route.params; let routeList = this.$route.params;
this.initCharts(); let dsId = routeList.id;
this.getInfoFun(routeList.id) console.log("%c ⚓: mounted -> dsId ", "font-size:16px;background-color:#8f8576;color:white;", dsId)
this.gethistoryQuery(routeList.id) this.getInfoFun(dsId)
this.gethistoryQuery(dsId)
}, },
methods: { methods: {
initCharts() { initCharts() {
// //
let details = this.details;
const performanceChart = echarts.init(document.getElementById('performanceChart')); const performanceChart = echarts.init(document.getElementById('performanceChart'));
performanceChart.setOption({ performanceChart.setOption({
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: { legend: {
data: ['CPU使用率', '内存使用率'], data: ['CPU使用率', '内存使用率', '健康度', '设备温度'],
textStyle: { textStyle: {
color: '#718096' color: '#718096'
} }
@ -253,7 +255,7 @@ mounted() {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'], data: [...details.timeList],
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#cbd5e0' color: '#cbd5e0'
@ -280,12 +282,20 @@ mounted() {
} }
} }
}, },
dataZoom: [
{
type: 'inside', //
xAxisIndex: 0,
start: 0,
end: 50
}
],
series: [ series: [
{ {
name: 'CPU使用率', name: 'CPU使用率',
type: 'line', type: 'line',
smooth: true, smooth: true,
data: [45, 52, 38, 66, 58, 62, 48], data: [...details.cpuList],
lineStyle: { lineStyle: {
color: '#ed8936' color: '#ed8936'
}, },
@ -311,7 +321,7 @@ mounted() {
name: '内存使用率', name: '内存使用率',
type: 'line', type: 'line',
smooth: true, smooth: true,
data: [30, 45, 35, 50, 42, 38, 32], data: [...details.memoryList],
lineStyle: { lineStyle: {
color: '#4299e1' color: '#4299e1'
}, },
@ -332,81 +342,26 @@ mounted() {
}] }]
} }
} }
}
]
});
//
const trafficChart = echarts.init(document.getElementById('trafficChart'));
trafficChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ['入站流量', '出站流量'],
textStyle: {
color: '#718096'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
axisLine: {
lineStyle: {
color: '#cbd5e0'
}
},
axisLabel: {
color: '#718096'
}
},
yAxis: {
type: 'value',
name: 'MB/s',
axisLine: {
lineStyle: {
color: '#cbd5e0'
}
},
axisLabel: {
color: '#718096'
},
splitLine: {
lineStyle: {
color: 'rgba(203, 213, 224, 0.6)'
}
}
}, },
series: [
{ {
name: '入站流量', name: '健康度',
type: 'bar', type: 'bar',
data: [320, 332, 301, 334, 390, 330, 320], data: [...details.healthList],
itemStyle: { itemStyle: {
color: '#4299e1' color: '#4299e1'
} }
}, },
{ {
name: '出站流量', name: '设备温度',
type: 'bar', type: 'bar',
data: [220, 182, 191, 234, 290, 330, 310], data: [...details.temperatureList],
itemStyle: { itemStyle: {
color: '#ed8936' color: '#ed8936'
} }
} }
] ]
}); });
// //
window.addEventListener('resize', function() { window.addEventListener('resize', function() {
performanceChart.resize(); performanceChart.resize();
@ -424,6 +379,7 @@ mounted() {
}, },
/** 设备管理基本信息(获取设备指定时间段内的历史监控信息) */ /** 设备管理基本信息(获取设备指定时间段内的历史监控信息) */
gethistoryQuery(id) { gethistoryQuery(id) {
console.log("%c 🖼: gethistoryQuery -> id ", "font-size:16px;background-color:#c07203;color:white;", id)
this.loading = true this.loading = true
let queryForm = { let queryForm = {
id: id, id: id,
@ -432,10 +388,15 @@ mounted() {
historyQuery(queryForm).then(response => { historyQuery(queryForm).then(response => {
this.details = response.data this.details = response.data
this.loading = false this.loading = false
this.initCharts();
} }
) )
}, },
handleDateChange(date) {
this.historyQueryList.minTime = date[0]
this.historyQueryList.maxTime = date[1]
this.gethistoryQuery(this.$route.params.id)
}
} }
} }
</script> </script>
@ -585,11 +546,23 @@ mounted() {
color: #4299e1; color: #4299e1;
opacity: 0.8; opacity: 0.8;
} }
.device-icon{
width: 100%;
}
.device-info { .device-info {
display: flex; display: flex;
flex-direction:column; flex-direction:column;
gap: 15px; background: linear-gradient(135deg, #edf2f7, #e2e8f0);
border-radius: 12px;
border: 1px solid rgba(226, 232, 240, 0.8);
transition: all 0.3s ease;
}
.device-info:hover {
background: rgba(255, 255, 255, 0.9);
border-color: rgba(66, 153, 225, 0.3);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
} }
.info-title { .info-title {
@ -597,24 +570,16 @@ mounted() {
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
text-align: center; text-align: center;
padding-top: 10px;
} }
.info-item { .info-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 8px 12px; padding: 8px 12px;
background: rgba(255, 255, 255, 0.7);
border-radius: 12px;
border: 1px solid rgba(226, 232, 240, 0.8);
transition: all 0.3s ease;
} }
.info-item:hover {
background: rgba(255, 255, 255, 0.9);
border-color: rgba(66, 153, 225, 0.3);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.info-label { .info-label {
font-size: 13px; font-size: 13px;

@ -1,9 +1,8 @@
<template> <template>
<div class=""> <div class="">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col> <el-col>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList">
<el-table-column <el-table-column
label="序号" label="序号"
width="60" width="60"
@ -13,27 +12,26 @@
<el-table-column label="预警等级" align="center" key="name" prop="name" :show-overflow-tooltip="true" /> <el-table-column label="预警等级" align="center" key="name" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="预警信息" align="center" key="description" prop="description" :show-overflow-tooltip="true" /> <el-table-column label="预警信息" align="center" key="description" prop="description" :show-overflow-tooltip="true" />
<el-table-column label="预警状态" align="center" key="createBy" prop="createBy" :show-overflow-tooltip="true" /> <el-table-column label="预警状态" align="center" key="createBy" prop="createBy" :show-overflow-tooltip="true" />
<el-table-column label="处理人" align="center" key="createBy" prop="createBy" :show-overflow-tooltip="true" /> <el-table-column label="处理人" align="center" key="handler" prop="handler" :show-overflow-tooltip="true" />
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script>
import { list, del, add, update } from "@/api/device/deviceType" import { history } from "@/api/device/deviceType"
import { getToken } from "@/utils/auth"
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css" import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css" import "splitpanes/dist/splitpanes.css"
export default { export default {
name: "User", name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'], props: {
components: { Treeselect, Splitpanes, Pane }, dsId: {
type: String,
default: 'chart'
}
},
data() { data() {
return { return {
// //
@ -51,15 +49,25 @@ export default {
} }
}, },
created() { created() {
},
watch: {
dsId: {
handler(val) {
console.log("%c ☄: handler -> val ", "font-size:16px;background-color:#b2181b;color:white;", val)
this.getList() this.getList()
}, },
deep: true,
immediate: true
}
},
methods: { methods: {
/** 查询类型列表 */ /** 查询类型列表 */
getList() { getList() {
let dsId = this.dsId || 0
this.loading = true this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { history({equId:11}).then(response => {
console.log("%c ⛓: getList -> response ", "font-size:16px;background-color:#7f0cdd;color:white;", response)
this.userList = response.rows this.userList = response.rows
this.total = response.total
this.loading = false this.loading = false
} }
) )

@ -146,7 +146,7 @@
</template> </template>
<script> <script>
import { list, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/inMonitoring/devicesState" import { monitorpageList, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/inMonitoring/devicesState"
import { getToken } from "@/utils/auth" import { getToken } from "@/utils/auth"
import Treeselect from "@riophae/vue-treeselect" import Treeselect from "@riophae/vue-treeselect"
import cardItem from "./cardItem.vue" import cardItem from "./cardItem.vue"
@ -277,7 +277,7 @@ export default {
/** 查询设备列表 */ /** 查询设备列表 */
getList() { getList() {
this.loading = true this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { monitorpageList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows this.userList = response.rows
this.total = response.total this.total = response.total
this.loading = false this.loading = false

Loading…
Cancel
Save