Commit 40a7ddf8 by cwq0219

系统监控-接口

1 parent 07107144
......@@ -7,6 +7,9 @@
import axios from '@/plugin/axios'
import sign from './sign'
import {
methods as sysMonitorMethods
} from './systemMonitor'
const request = (params,method) => {
params.source = ''
params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
......@@ -21,4 +24,7 @@ const request = (params,method) => {
data:sign(params)
})
}
export default request
export {
request,
sysMonitorMethods
}
......@@ -5,7 +5,7 @@
* @Last Modified time: 2019-08-26 18:02:55
*/
import request from './request'
import { request } from './request'
import RequestMethods from "./request.methods";
const path = ''
// export function AccountLogin (data) {
......
const path = 'fims.system.'
const methods = {
Search: `${path}list`,
Report: `${path}report`
}
export {
methods
}
\ No newline at end of file
import Vue from 'vue'
export default new Vue({
methods: {
warningTips(message) {
this.$notify({
type: 'warning',
title: message
})
},
okTips(message) {
this.$notify({
type: 'success',
title: message || '操作成功'
})
},
errorTips(message) {
this.$notify({
type: 'error',
title: message || '操作失败'
})
}
}
})
......@@ -29,8 +29,8 @@
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col span="12">车辆列表</el-col>
<el-col span="12" style="text-align: right">
<el-col :span="12">车辆列表</el-col>
<el-col :span="12" style="text-align: right">
<el-button @click="handleAdd">添加车辆</el-button>
</el-col>
</el-row>
......
......@@ -26,8 +26,8 @@
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col span="12">子系统列表</el-col>
<el-col span="12" style="text-align: right">
<el-col :span="12">子系统列表</el-col>
<el-col :span="12" style="text-align: right">
<el-button @click="handleAdd">添加子系统</el-button>
</el-col>
</el-row>
......
......@@ -26,12 +26,12 @@
label-width="100px"
>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable></el-input>
</el-form-item>
<el-form-item label="归属车辆段">
<el-select v-model="searchForm.belongCar" placeholder="请选择归属车辆段" filterable clearable>
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" filterable clearable>
<el-option
v-for="(item,index) in belongCarArr"
v-for="(item,index) in stationCodeArr"
:key="index"
:label="item.label"
:value="item.value"
......@@ -39,16 +39,16 @@
</el-select>
</el-form-item>
<el-form-item label="车辆状态">
<el-select v-model="searchForm.status" placeholder="请选择车辆状态" filterable clearable>
<el-option value="1" label="在网"></el-option>
<el-option value="2" label="离网"></el-option>
<el-select v-model="searchForm.openType" placeholder="请选择车辆状态" filterable clearable>
<el-option value="1" label="是"></el-option>
<el-option value="2" label="否"></el-option>
</el-select>
</el-form-item>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subSystemNum" placeholder="请输入子系统编号" clearable></el-input>
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item>
<el-form-item label="子系统状态">
<el-select v-model="searchForm.subSystemStatus" placeholder="请选择子系统状态" filterable clearable>
<el-select v-model="searchForm.onlineStatus" placeholder="请选择子系统状态" filterable clearable>
<el-option value="1" label="在网"></el-option>
<el-option value="2" label="离网"></el-option>
</el-select>
......@@ -58,13 +58,14 @@
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col span="12">车辆状态列表</el-col>
<el-col span="12" style="text-align: right">
<el-col :span="12">车辆状态列表</el-col>
<el-col :span="12" style="text-align: right">
<el-button>导出</el-button>
</el-col>
</el-row>
<el-table
:data="tableData"
v-loading="tableLoading"
border
style="margin: 20px 0;"
>
......@@ -83,7 +84,7 @@
align="center"
>
<template v-if="item.prop" slot-scope="scope">
<template v-if="item.prop == 'subSystemStatus'">
<template v-if="item.prop == 'onlineStatus'">
<el-tag v-if="tableData[scope.$index][item.prop] == '在网'" type="success" size="medium">{{ tableData[scope.$index][item.prop] }}</el-tag>
<el-tag v-else type="info" size="medium">{{ tableData[scope.$index][item.prop] }}</el-tag>
</template>
......@@ -109,6 +110,8 @@
</template>
<script>
import { request, sysMonitorMethods } from '@api/request'
import notice from '@/common/notice'
export default {
name: 'systemMonitor',
data () {
......@@ -186,13 +189,13 @@ export default {
},
// 搜索
searchForm: {
carNum: '',
belongCar: '',
status: '',
subSystemNum: '',
subSystemStatus: ''
trafficCode: '',
stationCode: '',
openType: '',
subsystemCode: '',
onlineStatus: ''
},
belongCarArr: [{
stationCodeArr: [{
label: '归属1',
value: '1'
}, {
......@@ -200,46 +203,26 @@ export default {
value: '2'
}],
// 表格
tableData: [{
subSystemNum: '3#1F',
subSystemType: '座椅',
subSystemStatus: '在网',
carNum: 'CRH45661-5648',
belongCar: '青岛',
text: '00x4561aa'
}, {
subSystemNum: '3#2F',
subSystemType: '座椅',
subSystemStatus: '离网',
carNum: 'CRH45661-5648',
belongCar: '青岛',
text: '00x4561aa'
}, {
subSystemNum: '3#3F',
subSystemType: '座椅',
subSystemStatus: '在网',
carNum: 'CRH45661-5648',
belongCar: '青岛',
text: '00x4561aa'
}],
tableData: [],
tableLoading: false,
tableColumns: [{
label: '子系统编号',
prop: 'subSystemNum'
prop: 'subsystemCode'
}, {
label: '子系统类型',
prop: 'subSystemType'
}, {
label: '子系统状态',
prop: 'subSystemStatus'
prop: 'onlineStatus'
}, {
label: '车辆编号',
prop: 'carNum'
prop: 'trafficCode'
}, {
label: '归属车辆段',
prop: 'belongCar'
prop: 'stationCode'
}, {
label: '故障内容',
prop: 'text'
prop: 'downDescription'
}],
// 翻页
currentPage: 1,
......@@ -249,23 +232,65 @@ export default {
},
mounted () {
this.drawPie()
// this.drawPie()
this.getList()
this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
this.getPie()
},
methods: {
drawPie () {
this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
this.totalOptions.series[0].data[0].value = 400
this.totalOptions.series[0].data[1].value = 45
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams() {
return {
pageSize: this.pageSize,
currentPage: this.currentPage,
...this.searchForm
}
},
getList() {
const params = this.getParams()
params.method = sysMonitorMethods.Search
request(params).then(res => {
this.tableData = res
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
getPie(systemTypeId = 1) {
const params = {
method: sysMonitorMethods.Report,
systemTypeId: systemTypeId
}
// console.log(params)
request(params).then(res => {
this.drawPie(res)
}).catch(err => {
notice.errorTips(err)
})
},
/* 接口请求-end */
/* onlineNum Int 在网数量
offlineNum int 离网数量
normalNum Int 正常数量
breakdownNum Int 故障数量 */
drawPie (params) {
this.totalOptions.series[0].data[0].value = params.onlineNum
this.totalOptions.series[0].data[1].value = params.offlineNum
this.totalOptions.series[1].data[0].value = 400
this.totalOptions.series[1].data[1].value = 45
this.totalOptions.series[1].data[0].value = params.normalNum
this.totalOptions.series[1].data[1].value = params.breakdownNum
this.totalECharts.setOption(this.totalOptions)
},
radioChange (label) {
console.log(label)
// console.log(label)
// 请求后端数据--参数
var value = ''
for (var i in this.systemTypeArr) {
......@@ -275,39 +300,30 @@ export default {
}
}
// 调接口
if (value === '1') {
this.totalOptions.series[0].data[0].value = 400
this.totalOptions.series[0].data[1].value = 45
this.totalOptions.series[1].data[0].value = 400
this.totalOptions.series[1].data[1].value = 45
} else {
this.totalOptions.series[0].data[0].value = 200
this.totalOptions.series[0].data[1].value = 45
this.totalOptions.series[1].data[0].value = 200
this.totalOptions.series[1].data[1].value = 45
}
this.totalECharts.setOption(this.totalOptions)
this.getPie(value)
},
// 搜索
handleSearch () {
console.log(this.searchForm)
// 调接口
this.tableLoading = true
this.loadingGetList()
},
// 页码
handleSizeChange (value) {
console.log(value)
this.pageSize = value
// 调接口
this.tableLoading = true
this.loadingGetList()
},
handleCurrentChange (value) {
console.log(value)
this.currentPage = value
// 调接口
this.tableLoading = true
this.loadingGetList()
}
}
}
......
......@@ -94,6 +94,7 @@ module.exports = {
.end()
// 重新设置 alias
config.resolve.alias
.set('@', resolve('src'))
.set('@api', resolve('src/api'))
// 判断环境加入模拟数据
// const entry = config.entry('app')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!