update
This commit is contained in:
@ -162,7 +162,7 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{
|
{{
|
||||||
scope.row.deviceType
|
scope.row.deviceType
|
||||||
? deviceTypeList.find((v) => v.value == scope.row.deviceType)
|
? deviceTypeList.find(v => v.value == scope.row.deviceType)
|
||||||
.label
|
.label
|
||||||
: ''
|
: ''
|
||||||
}}
|
}}
|
||||||
@ -177,8 +177,25 @@
|
|||||||
<el-table-column align="center" prop="version" label="可升级软件版本">
|
<el-table-column align="center" prop="version" label="可升级软件版本">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="升级状态">
|
<el-table-column align="center" label="升级状态">
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">
|
||||||
{{ scope.row.isUpdate == 0 ? '已' : '可' }}升级
|
{{ scope.row.isUpdate == 0 ? '已' : '可' }}升级
|
||||||
|
</template> -->
|
||||||
|
<template #default="{row}">
|
||||||
|
<el-progress
|
||||||
|
v-if="row.updateStatus == '1'"
|
||||||
|
type="circle"
|
||||||
|
:width="40"
|
||||||
|
:stroke-width="2"
|
||||||
|
status="success"
|
||||||
|
:percentage="100"
|
||||||
|
></el-progress>
|
||||||
|
<el-progress
|
||||||
|
v-else
|
||||||
|
type="circle"
|
||||||
|
:width="40"
|
||||||
|
:stroke-width="2"
|
||||||
|
:percentage="0"
|
||||||
|
></el-progress>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="上次升级时间">
|
<el-table-column align="center" label="上次升级时间">
|
||||||
@ -269,7 +286,7 @@ import {
|
|||||||
OTAUpdate,
|
OTAUpdate,
|
||||||
OTAUpdates,
|
OTAUpdates,
|
||||||
getNodeOTAHistory,
|
getNodeOTAHistory,
|
||||||
nodeOTAHistoryExport,
|
nodeOTAHistoryExport
|
||||||
} from '@/api/firmware/firmwareupdate';
|
} from '@/api/firmware/firmwareupdate';
|
||||||
import { select as projectSelect } from '@/api/hardware/project';
|
import { select as projectSelect } from '@/api/hardware/project';
|
||||||
import { select as productSelect } from '@/api/hardware/product';
|
import { select as productSelect } from '@/api/hardware/product';
|
||||||
@ -279,7 +296,7 @@ import { userSelect } from '@/api/system/user';
|
|||||||
export default {
|
export default {
|
||||||
name: 'FirmwareUpdate',
|
name: 'FirmwareUpdate',
|
||||||
components: {
|
components: {
|
||||||
Region,
|
Region
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -290,7 +307,7 @@ export default {
|
|||||||
queryProjectSelectList: [],
|
queryProjectSelectList: [],
|
||||||
isUpdateList: [
|
isUpdateList: [
|
||||||
{ label: '已升级', value: 0 },
|
{ label: '已升级', value: 0 },
|
||||||
{ label: '可升级', value: 1 },
|
{ label: '可升级', value: 1 }
|
||||||
],
|
],
|
||||||
value: '',
|
value: '',
|
||||||
options: '',
|
options: '',
|
||||||
@ -303,14 +320,14 @@ export default {
|
|||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10
|
||||||
},
|
},
|
||||||
deviceTypeList: [
|
deviceTypeList: [
|
||||||
{ label: '锐能设备', value: 'rn' },
|
{ label: '锐能设备', value: 'rn' },
|
||||||
{ label: '铁塔设备', value: 'tt' },
|
{ label: '铁塔设备', value: 'tt' }
|
||||||
],
|
],
|
||||||
nodeOTAHistoryDialog: false,
|
nodeOTAHistoryDialog: false,
|
||||||
nodeOTAHistoryData: [],
|
nodeOTAHistoryData: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -335,12 +352,12 @@ export default {
|
|||||||
this.$confirm('是否确认导出所有节点升级记录?', '警告', {
|
this.$confirm('是否确认导出所有节点升级记录?', '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function() {
|
||||||
return nodeOTAHistoryExport();
|
return nodeOTAHistoryExport();
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -387,12 +404,12 @@ export default {
|
|||||||
this.$confirm(`是否确认升级${deviceId}?`, '警告', {
|
this.$confirm(`是否确认升级${deviceId}?`, '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.OTAUpdate([{ productId, nodeId, deviceId }]);
|
this.OTAUpdate([{ productId, nodeId, deviceId }]);
|
||||||
})
|
})
|
||||||
.catch((res) => {});
|
.catch(res => {});
|
||||||
},
|
},
|
||||||
handleOTAUpdate() {
|
handleOTAUpdate() {
|
||||||
if (this.ids.length) {
|
if (this.ids.length) {
|
||||||
@ -401,18 +418,18 @@ export default {
|
|||||||
});
|
});
|
||||||
const h = this.$createElement;
|
const h = this.$createElement;
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
`是否确认批量升级\r\n${snap.map((v) => v.deviceId).join(',\r\n')}?`,
|
`是否确认批量升级\r\n${snap.map(v => v.deviceId).join(',\r\n')}?`,
|
||||||
'警告',
|
'警告',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.OTAUpdate(snap);
|
this.OTAUpdate(snap);
|
||||||
})
|
})
|
||||||
.catch((res) => {});
|
.catch(res => {});
|
||||||
} else {
|
} else {
|
||||||
let snap = Object.assign({}, this.queryParams);
|
let snap = Object.assign({}, this.queryParams);
|
||||||
delete snap.pageNum;
|
delete snap.pageNum;
|
||||||
@ -420,12 +437,12 @@ export default {
|
|||||||
this.$confirm(`是否确认批量升级?`, '警告', {
|
this.$confirm(`是否确认批量升级?`, '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.OTAUpdates(snap);
|
this.OTAUpdates(snap);
|
||||||
})
|
})
|
||||||
.catch((res) => {});
|
.catch(res => {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -458,14 +475,18 @@ export default {
|
|||||||
this.ids = selection;
|
this.ids = selection;
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
list(this.queryParams).then((response) => {
|
list(this.queryParams).then(response => {
|
||||||
this.tableData = response.rows;
|
this.tableData = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleUpdate() {},
|
handleUpdate() {}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style scoped>
|
||||||
|
::v-deep .el-progress__text {
|
||||||
|
font-size: 16px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<span>设备SN:{{ info.deviceId }}</span>
|
<span>设备SN:{{ info.deviceId }}</span>
|
||||||
<el-divider class="mt10 mb10"></el-divider>
|
<el-divider class="mt10 mb10"></el-divider>
|
||||||
<span
|
<span
|
||||||
>设备类型:{{
|
>设备类型:{{
|
||||||
info.deviceType
|
info.deviceType
|
||||||
? this.deviceTypeList.find(v => v.value == info.deviceType).label
|
? this.deviceTypeList.find(v => v.value == info.deviceType).label
|
||||||
: ''
|
: ''
|
||||||
@ -83,7 +83,7 @@
|
|||||||
type="danger"
|
type="danger"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleCommand(item, 1)"
|
@click="handleCommand(item, 1)"
|
||||||
>设备重置
|
>设备重置
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -128,8 +128,8 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<div class="tr">
|
<div class="tr">
|
||||||
<span style="margin-right: 20px">{{
|
<span style="margin-right: 20px">{{
|
||||||
signalUpdateTime | formatDate
|
signalUpdateTime | formatDate
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="
|
v-if="
|
||||||
v.key == '01305001' ||
|
v.key == '01305001' ||
|
||||||
@ -141,7 +141,7 @@
|
|||||||
plain
|
plain
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="open(v)"
|
@click="open(v)"
|
||||||
>点击输入
|
>点击输入
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-else-if="v.key == '01308001'"
|
v-else-if="v.key == '01308001'"
|
||||||
@ -168,7 +168,7 @@
|
|||||||
plain
|
plain
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="openDialog(info.deviceId, v.key)"
|
@click="openDialog(info.deviceId, v.key)"
|
||||||
>历史性能
|
>历史性能
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -196,7 +196,7 @@
|
|||||||
<!-- :picker-options="pickerOptions" -->
|
<!-- :picker-options="pickerOptions" -->
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<span style="margin-left: 20px"
|
<span style="margin-left: 20px"
|
||||||
><el-button type="primary" @click="getNewData">查询</el-button></span
|
><el-button type="primary" @click="getNewData">查询</el-button></span
|
||||||
>
|
>
|
||||||
<div ref="echa" style="width: 100%; height: 600px"></div>
|
<div ref="echa" style="width: 100%; height: 600px"></div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -204,10 +204,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getKeyHistory, info, updateValue } from '@/api/hardware/device';
|
import { getKeyHistory, info, updateValue } from '@/api/hardware/device'
|
||||||
import { getProvinceByCode } from '@/api/hardware/province';
|
import { getProvinceByCode } from '@/api/hardware/province'
|
||||||
import { handleOffsetAndRange } from '../../../utils/offsetMap';
|
import { handleOffsetAndRange } from '../../../utils/offsetMap'
|
||||||
import ReconnectingWebSocket from 'reconnecting-websocket';
|
import ReconnectingWebSocket from 'reconnecting-websocket'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceDetail',
|
name: 'DeviceDetail',
|
||||||
@ -248,49 +248,49 @@ export default {
|
|||||||
{ label: '锐能设备', value: 'rn' },
|
{ label: '锐能设备', value: 'rn' },
|
||||||
{ label: '铁塔设备', value: 'tt' }
|
{ label: '铁塔设备', value: 'tt' }
|
||||||
]
|
]
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectDate() {
|
selectDate() {
|
||||||
if (!this.selectDate) {
|
if (!this.selectDate) {
|
||||||
this.selectDate = '';
|
this.selectDate = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 过充 单体过充阈值
|
// 过充 单体过充阈值
|
||||||
overcharge() {
|
overcharge() {
|
||||||
let a = this.signal.find(item => item.keyCN == '单体过充阈值');
|
let a = this.signal.find(item => item.keyCN == '单体过充阈值')
|
||||||
return a ? a.valueCN - 0 : null;
|
return a ? a.valueCN - 0 : null
|
||||||
},
|
},
|
||||||
// 过放 单体过放阈值
|
// 过放 单体过放阈值
|
||||||
overdischarge() {
|
overdischarge() {
|
||||||
let a = this.signal.find(item => item.keyCN == '单体过放阈值');
|
let a = this.signal.find(item => item.keyCN == '单体过放阈值')
|
||||||
return a ? a.valueCN - 0 : null;
|
return a ? a.valueCN - 0 : null
|
||||||
},
|
},
|
||||||
// 过压 单体过压阈值
|
// 过压 单体过压阈值
|
||||||
overVoltage() {
|
overVoltage() {
|
||||||
let a = this.signal.find(item => item.keyCN == '单体过压阈值');
|
let a = this.signal.find(item => item.keyCN == '单体过压阈值')
|
||||||
return a ? a.valueCN - 0 : null;
|
return a ? a.valueCN - 0 : null
|
||||||
},
|
},
|
||||||
// 欠压 单体欠压阈值
|
// 欠压 单体欠压阈值
|
||||||
underVoltage() {
|
underVoltage() {
|
||||||
let a = this.signal.find(item => item.keyCN == '单体欠压阈值');
|
let a = this.signal.find(item => item.keyCN == '单体欠压阈值')
|
||||||
return a ? a.valueCN - 0 : null;
|
return a ? a.valueCN - 0 : null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
let { id } = this.$route.query;
|
let { id } = this.$route.query
|
||||||
if (!id) {
|
if (!id) {
|
||||||
this.msgError('无设备ID');
|
this.msgError('无设备ID')
|
||||||
this.$router.go(-1);
|
this.$router.go(-1)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
this.id = id;
|
this.id = id
|
||||||
this.getDetail();
|
this.getDetail()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initWebsocket();
|
this.initWebsocket()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleOffsetAndRange,
|
handleOffsetAndRange,
|
||||||
@ -301,29 +301,30 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
item.value = command;
|
item.value = command
|
||||||
let query = this.info;
|
let query = this.info
|
||||||
query['signal'] = item;
|
query['signal'] = item
|
||||||
updateValue(query).then(({ code, data, message }) => {
|
updateValue(query).then(({ code, data, message }) => {
|
||||||
if (200 == code) {
|
if (200 == code) {
|
||||||
this.msgSuccess(message);
|
this.msgSuccess(message)
|
||||||
this.getDetail();
|
this.getDetail()
|
||||||
} else {
|
} else {
|
||||||
this.msgError(message);
|
this.msgError(message)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
|
||||||
// this.$message('click on item ' + command);
|
// this.$message('click on item ' + command);
|
||||||
},
|
},
|
||||||
open(item) {
|
open(item) {
|
||||||
let keyVla = '';
|
let keyVla = ''
|
||||||
if (item.key == '01305001') {
|
if (item.key == '01305001') {
|
||||||
keyVla = '数值20-3600';
|
keyVla = '数值20-3600'
|
||||||
} else if (item.key == '01306001') {
|
} else if (item.key == '01306001') {
|
||||||
keyVla = '字符串';
|
keyVla = '字符串'
|
||||||
} else {
|
} else {
|
||||||
keyVla = '数值20-600';
|
keyVla = '数值20-600'
|
||||||
}
|
}
|
||||||
this.$prompt(`请输入${keyVla}`, '提示', {
|
this.$prompt(`请输入${keyVla}`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@ -332,67 +333,68 @@ export default {
|
|||||||
inputErrorMessage: '校验失败'
|
inputErrorMessage: '校验失败'
|
||||||
})
|
})
|
||||||
.then(({ value }) => {
|
.then(({ value }) => {
|
||||||
item.value = value;
|
item.value = value
|
||||||
let query = this.info;
|
let query = this.info
|
||||||
query['signal'] = item;
|
query['signal'] = item
|
||||||
updateValue(query).then(({ code, data, message }) => {
|
updateValue(query).then(({ code, data, message }) => {
|
||||||
if (200 == code) {
|
if (200 == code) {
|
||||||
this.msgSuccess(message);
|
this.msgSuccess(message)
|
||||||
this.getDetail();
|
this.getDetail()
|
||||||
} else {
|
} else {
|
||||||
this.msgError(message);
|
this.msgError(message)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// this.msgInfo('取消输入');
|
// this.msgInfo('取消输入');
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getDetail() {
|
getDetail() {
|
||||||
info(this.id).then(async ({ code, msg, info }) => {
|
info(this.id).then(async({ code, msg, info }) => {
|
||||||
if (200 == code) {
|
if (200 == code) {
|
||||||
info.proName = await this.getProvinceByCode(info.proCode);
|
info.proName = await this.getProvinceByCode(info.proCode)
|
||||||
info.cityName = await this.getProvinceByCode(info.cityCode);
|
info.cityName = await this.getProvinceByCode(info.cityCode)
|
||||||
info.disName = await this.getProvinceByCode(info.disCode);
|
info.disName = await this.getProvinceByCode(info.disCode)
|
||||||
this.info = info;
|
|
||||||
|
this.info = info
|
||||||
if (info.deviceSignal) {
|
if (info.deviceSignal) {
|
||||||
let deviceSignal = JSON.parse(info.deviceSignal.signalJsonTurn);
|
let deviceSignal = JSON.parse(info.deviceSignal.signalJsonTurn)
|
||||||
this.signal = deviceSignal.signal;
|
this.signal = deviceSignal?.signal
|
||||||
this.defaultSignal = info.defaultSignal;
|
this.defaultSignal = info.defaultSignal
|
||||||
// console.log(info.deviceSignal.signalJsonTurn);
|
// console.log(info.deviceSignal.signalJsonTurn);
|
||||||
// console.log(this.signal);
|
// console.log(this.signal);
|
||||||
// let a = deviceSignal.signal.find(
|
// let a = deviceSignal.signal.find(
|
||||||
// item => item.keyCN == '单体过充阈值'
|
// item => item.keyCN == '单体过充阈值'
|
||||||
// );
|
// );
|
||||||
// console.log(a.valueCN);
|
// console.log(a.valueCN);
|
||||||
this.signalUpdateTime = info.deviceSignal.updateTime;
|
this.signalUpdateTime = info.deviceSignal.updateTime
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.msgError(msg);
|
this.msgError(msg)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getProvinceByCode(code) {
|
getProvinceByCode(code) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getProvinceByCode(code)
|
getProvinceByCode(code)
|
||||||
.then(({ code, msg, data }) => {
|
.then(({ code, msg, data }) => {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
resolve(data.cityName);
|
resolve(data?.cityName)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(msg);
|
this.$message.error(msg)
|
||||||
reject({ msg, code });
|
reject({ msg, code })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
reject(error);
|
reject(error)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
openDialog(deviceId, key) {
|
openDialog(deviceId, key) {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.queryParams.deviceId = deviceId;
|
this.queryParams.deviceId = deviceId
|
||||||
this.queryParams.key = key;
|
this.queryParams.key = key
|
||||||
this.getChartData();
|
this.getChartData()
|
||||||
},
|
},
|
||||||
|
|
||||||
// getDay(mss) {
|
// getDay(mss) {
|
||||||
@ -404,33 +406,33 @@ export default {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
getNewData() {
|
getNewData() {
|
||||||
if (this.selectDate == '') return this.$message.info('请选择日期');
|
if (this.selectDate == '') return this.$message.info('请选择日期')
|
||||||
// let a = new Date(this.selectDate[0]).getTime();
|
// let a = new Date(this.selectDate[0]).getTime();
|
||||||
// let b = new Date(this.selectDate[1]).getTime();
|
// let b = new Date(this.selectDate[1]).getTime();
|
||||||
// const minTime = b - a;
|
// const minTime = b - a;
|
||||||
// const flag = this.getDay(minTime);
|
// const flag = this.getDay(minTime);
|
||||||
this.queryParams.startTime = this.selectDate[0];
|
this.queryParams.startTime = this.selectDate[0]
|
||||||
this.queryParams.endTime = this.selectDate[1];
|
this.queryParams.endTime = this.selectDate[1]
|
||||||
this.getChartData();
|
this.getChartData()
|
||||||
},
|
},
|
||||||
getChartData() {
|
getChartData() {
|
||||||
getKeyHistory(this.queryParams).then(data => {
|
getKeyHistory(this.queryParams).then(data => {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initChart(data);
|
this.initChart(data)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
initChart(data) {
|
initChart(data) {
|
||||||
var echarts = require('echarts');
|
var echarts = require('echarts')
|
||||||
this.centerChart = echarts.init(this.$refs.echa);
|
this.centerChart = echarts.init(this.$refs.echa)
|
||||||
let months = [];
|
let months = []
|
||||||
let nums = [];
|
let nums = []
|
||||||
data.map(item => {
|
data.map(item => {
|
||||||
for (const k in item) {
|
for (const k in item) {
|
||||||
months.push(k);
|
months.push(k)
|
||||||
nums.push(item[k]);
|
nums.push(item[k])
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
let option = {
|
let option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis'
|
trigger: 'axis'
|
||||||
@ -441,27 +443,27 @@ export default {
|
|||||||
dataView: {
|
dataView: {
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
optionToContent: function(opt) {
|
optionToContent: function(opt) {
|
||||||
let axisData = opt.xAxis[0].data; //坐标数据
|
let axisData = opt.xAxis[0].data //坐标数据
|
||||||
let series = opt.series; //折线图数据
|
let series = opt.series //折线图数据
|
||||||
let tdHeads = '<td>序号</td><td>时间</td>'; //表头
|
let tdHeads = '<td>序号</td><td>时间</td>' //表头
|
||||||
let tdBodys = ''; //数据
|
let tdBodys = '' //数据
|
||||||
series.forEach(function(item) {
|
series.forEach(function(item) {
|
||||||
//组装表头
|
//组装表头
|
||||||
tdHeads += `<td style="text-align:center">${item.name}</td>`;
|
tdHeads += `<td style="text-align:center">${item.name}</td>`
|
||||||
});
|
})
|
||||||
let table = `<table style="width:100%;text-align: center"><tbody><tr>${tdHeads} </tr>`;
|
let table = `<table style="width:100%;text-align: center"><tbody><tr>${tdHeads} </tr>`
|
||||||
for (let i = 0, l = axisData.length; i < l; i++) {
|
for (let i = 0, l = axisData.length; i < l; i++) {
|
||||||
for (let j = 0; j < series.length; j++) {
|
for (let j = 0; j < series.length; j++) {
|
||||||
//组装表数据
|
//组装表数据
|
||||||
tdBodys += `<td>${series[j].data[i]}</td>`;
|
tdBodys += `<td>${series[j].data[i]}</td>`
|
||||||
}
|
}
|
||||||
table += `<tr><td>${i + 1}</td><td >${
|
table += `<tr><td>${i + 1}</td><td >${
|
||||||
axisData[i]
|
axisData[i]
|
||||||
}</td>${tdBodys}</tr>`;
|
}</td>${tdBodys}</tr>`
|
||||||
tdBodys = '';
|
tdBodys = ''
|
||||||
}
|
}
|
||||||
table += '</tbody></table>';
|
table += '</tbody></table>'
|
||||||
return table;
|
return table
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// restore: {},
|
// restore: {},
|
||||||
@ -473,7 +475,7 @@ export default {
|
|||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: months.map(function(str) {
|
data: months.map(function(str) {
|
||||||
return str.replace(' ', '\n');
|
return str.replace(' ', '\n')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
@ -490,21 +492,21 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
}
|
||||||
this.centerChart.setOption(option);
|
this.centerChart.setOption(option)
|
||||||
},
|
},
|
||||||
initWebsocket() {
|
initWebsocket() {
|
||||||
const wsBaseUrl =
|
const wsBaseUrl =
|
||||||
process.env.NODE_ENV === 'development'
|
process.env.NODE_ENV === 'development'
|
||||||
? '192.168.110.10:8080'
|
? '192.168.110.10:8080'
|
||||||
: `${window.location.host}${process.env.VUE_APP_BASE_API}`;
|
: `${window.location.host}:8080`
|
||||||
this.websocket = new ReconnectingWebSocket(`ws://${wsBaseUrl}/ws`);
|
this.websocket = new ReconnectingWebSocket(`ws://${wsBaseUrl}/ws`)
|
||||||
this.websocket.addEventListener('message', e => {
|
this.websocket.addEventListener('message', e => {
|
||||||
this.$message.success(e.data);
|
this.$message.success(e.data)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -39,8 +39,9 @@ module.exports = {
|
|||||||
// target: `http://47.115.73.110:8080`,
|
// target: `http://47.115.73.110:8080`,
|
||||||
// target: `http://121.37.250.170:8080`,
|
// target: `http://121.37.250.170:8080`,
|
||||||
// target: `http://192.168.0.129:8080`,
|
// target: `http://192.168.0.129:8080`,
|
||||||
|
target: `http://120.79.217.22:81/api`,
|
||||||
// target: `http://192.168.0.131:8080`,
|
// target: `http://192.168.0.131:8080`,
|
||||||
target: `http://192.168.110.10:8080`,
|
// target: `http://192.168.110.10:8080`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
|
Reference in New Issue
Block a user