mirror of
https://gitee.com/beecue/fastbee.git
synced 2026-05-08 00:34:41 +08:00
更新
This commit is contained in:
File diff suppressed because it is too large
Load Diff
222
vue/src/views/iot/device/device-functionlog.vue
Normal file
222
vue/src/views/iot/device/device-functionlog.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="请选择设备从机:" label-width="120px" v-if="isSubDev">
|
||||
<el-select v-model="queryParams.slaveId" placeholder="请选择设备从机" @change="selectSlave">
|
||||
<el-option v-for="slave in slaveList" :key="slave.slaveId" :label="`${slave.deviceName} (从机地址:${slave.slaveId})`" :value="slave.slaveId"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日志类型" prop="funType">
|
||||
<el-select v-model="queryParams.funType" placeholder="请选择类型" clearable size="small">
|
||||
<el-option v-for="dict in dict.type.iot_function_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标识符" prop="identify">
|
||||
<el-input v-model="queryParams.identify" placeholder="请输入标识符" clearable size="small" @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="daterangeTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column :label="showName" align="center" prop="identify" />
|
||||
<el-table-column label="指令类型" align="center" prop="funType" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.iot_function_type" :value="scope.row.funType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设置值" align="center" prop="funValue" />
|
||||
<el-table-column label="设备编号" align="center" prop="serialNumber" />
|
||||
<el-table-column label="下发时间" align="center" prop="createTime" />
|
||||
<el-table-column label="下发结果描述" align="center" prop="resultMsg" />
|
||||
<el-table-column label="操作" align="center" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:device:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listLog, delLog } from '@/api/iot/functionLog';
|
||||
|
||||
export default {
|
||||
name: 'device-func',
|
||||
dicts: ['iot_function_type', 'iot_yes_no'],
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后
|
||||
device: function (newVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.isSubDev = this.deviceInfo.subDeviceList && this.deviceInfo.subDeviceList.length > 0;
|
||||
this.showName = this.isSubDev ? '寄存器地址' : '标识符';
|
||||
this.queryParams.deviceId = this.deviceInfo.deviceId;
|
||||
this.queryParams.slaveId = this.deviceInfo.slaveId;
|
||||
this.queryParams.serialNumber = this.deviceInfo.serialNumber;
|
||||
this.slaveList = newVal.subDeviceList;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备服务下发日志表格数据
|
||||
logList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
//设备数据
|
||||
deviceInfo: {},
|
||||
// 时间范围
|
||||
daterangeTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
identify: null,
|
||||
funType: null,
|
||||
funValue: null,
|
||||
messageId: null,
|
||||
deviceName: null,
|
||||
serialNumber: null,
|
||||
mode: null,
|
||||
userId: null,
|
||||
resultMsg: null,
|
||||
resultCode: null,
|
||||
slaveId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
//是否是modbus设备组
|
||||
isSubDev: false,
|
||||
showName: null,
|
||||
slaveList: [],
|
||||
// 表单校验
|
||||
rules: {
|
||||
identify: [{ required: true, message: '标识符不能为空', trigger: 'blur' }],
|
||||
funType: [{ required: true, message: '功能下发类型不能为空', trigger: 'change' }],
|
||||
funValue: [{ required: true, message: '日志值不能为空', trigger: 'blur' }],
|
||||
serialNumber: [{ required: true, message: '设备编号不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.queryParams.serialNumber = this.device.serialNumber;
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备服务下发日志列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (null != this.daterangeTime && '' != this.daterangeTime) {
|
||||
this.queryParams.beginTime = this.daterangeTime[0];
|
||||
this.queryParams.endTime = this.daterangeTime[1];
|
||||
}
|
||||
if (this.queryParams.slaveId) {
|
||||
this.queryParams.serialNumber = this.queryParams.serialNumber + '_' + this.queryParams.slaveId;
|
||||
}
|
||||
listLog(this.queryParams).then((response) => {
|
||||
this.logList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
identify: null,
|
||||
funType: null,
|
||||
funValue: null,
|
||||
messageId: null,
|
||||
deviceName: null,
|
||||
serialNumber: null,
|
||||
mode: null,
|
||||
userId: null,
|
||||
resultMsg: null,
|
||||
resultCode: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
remark: null,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备服务下发日志编号为"' + ids + '"的数据项?')
|
||||
.then(function () {
|
||||
return delLog(ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('删除成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download(
|
||||
'iot/log/export',
|
||||
{
|
||||
...this.queryParams,
|
||||
},
|
||||
`log_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
},
|
||||
//选择从机
|
||||
selectSlave() {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -3,22 +3,25 @@
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="日志类型" prop="logType">
|
||||
<el-select v-model="queryParams.logType" placeholder="请选择类型" clearable size="small">
|
||||
<el-option v-for="dict in dict.type.iot_device_log_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in dict.type.iot_event_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标识符" prop="identity">
|
||||
<el-input v-model="queryParams.identity" placeholder="请输入标识符" clearable size="small" @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="daterangeTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceLogList" size="mini">
|
||||
<el-table v-loading="loading" :data="deviceLogList" size="mini">
|
||||
<el-table-column label="类型" align="center" prop="logType" width="120">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.iot_device_log_type" :value="scope.row.logType" />
|
||||
<dict-tag :options="dict.type.iot_event_type" :value="scope.row.logType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模式" align="center" prop="logType" width="120">
|
||||
@@ -56,15 +59,12 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
listDeviceLog
|
||||
} from "@/api/iot/deviceLog";
|
||||
import {
|
||||
cacheJsonThingsModel
|
||||
} from "@/api/iot/model";
|
||||
listEventLog
|
||||
} from "../../../api/iot/eventLog";
|
||||
|
||||
export default {
|
||||
name: "DeviceLog",
|
||||
dicts: ['iot_device_log_type', "iot_yes_no"],
|
||||
dicts: ['iot_event_type', "iot_yes_no"],
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
@@ -76,10 +76,10 @@ export default {
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.queryParams.deviceId = this.deviceInfo.deviceId;
|
||||
this.queryParams.serialNumber = this.deviceInfo.serialNumber;
|
||||
this.getList();
|
||||
// 获取物模型
|
||||
this.getCacheThingsModdel(this.deviceInfo.productId);
|
||||
// 解析缓存物模型
|
||||
this.thingsModel = this.deviceInfo.cacheThingsModel;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -101,20 +101,24 @@ export default {
|
||||
logType: null,
|
||||
logValue: null,
|
||||
deviceId: null,
|
||||
serialNumber: null,
|
||||
deviceName: null,
|
||||
identity: null,
|
||||
isMonitor: null,
|
||||
},
|
||||
// 时间范围
|
||||
daterangeTime: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
this.queryParams.serialNumber = this.device.serialNumber;
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备日志列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceLog(this.queryParams).then(response => {
|
||||
listEventLog(this.addDateRange(this.queryParams, this.daterangeTime)).then(response => {
|
||||
this.deviceLogList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
@@ -128,20 +132,14 @@ export default {
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.daterangeTime=[];
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('iot/deviceLog/export', {
|
||||
this.download('iot/event/export', {
|
||||
...this.queryParams
|
||||
}, `deviceLog_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 获取物模型*/
|
||||
getCacheThingsModdel(productId) {
|
||||
// 获取缓存的Json物模型
|
||||
cacheJsonThingsModel(productId).then(response => {
|
||||
this.thingsModel = JSON.parse(response.data);
|
||||
});
|
||||
}, `eventLog_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 格式化显示数据定义 */
|
||||
formatValueDisplay(row) {
|
||||
@@ -149,17 +147,29 @@ export default {
|
||||
if (row.logType == 1) {
|
||||
let propertyItem = this.getThingsModelItem(1, row.identity);
|
||||
if (propertyItem != "") {
|
||||
return propertyItem.name + ': <span style="color:#409EFF;">' + this.getThingsModelItemValue(propertyItem, row.logValue) + ' ' + (propertyItem.datatype.unit != undefined ? propertyItem.datatype.unit : '') + '</span>';
|
||||
return (propertyItem.parentName ? '[' + propertyItem.parentName + (propertyItem.arrayIndex ? propertyItem.arrayIndex : '') + '] ' : '') +
|
||||
propertyItem.name +
|
||||
': <span style="color:#409EFF;">' + this.getThingsModelItemValue(propertyItem, row.logValue) + ' ' +
|
||||
(propertyItem.datatype.unit != undefined ? propertyItem.datatype.unit : '') + '</span>';
|
||||
}
|
||||
} else if (row.logType == 2) {
|
||||
let functionItem = this.getThingsModelItem(2, row.identity);
|
||||
if (functionItem != "") {
|
||||
return functionItem.name + ': <span style="color:#409EFF">' + this.getThingsModelItemValue(functionItem, row.logValue) + ' ' + (functionItem.datatype.unit != undefined ? functionItem.datatype.unit : '') + '</span>';
|
||||
return (functionItem.parentName ? '[' + functionItem.parentName + (functionItem.arrayIndex ? functionItem.arrayIndex : '') + '] ' : '') +
|
||||
functionItem.name +
|
||||
': <span style="color:#409EFF">' + this.getThingsModelItemValue(functionItem, row.logValue) + ' ' +
|
||||
(functionItem.datatype.unit != undefined ? functionItem.datatype.unit : '') + '</span>';
|
||||
}
|
||||
} else if (row.logType == 3) {
|
||||
let eventItem = this.getThingsModelItem(3, row.identity);
|
||||
if (eventItem != "") {
|
||||
return eventItem.name + ': <span style="color:#409EFF">' + this.getThingsModelItemValue(eventItem, row.logValue) + ' ' + (eventItem.datatype.unit != undefined ? eventItem.datatype.unit : '') + '</span>';
|
||||
return (eventItem.parentName ? '[' + eventItem.parentName + (eventItem.arrayIndex ? eventItem.arrayIndex : '') + '] ' : '') +
|
||||
eventItem.name +
|
||||
': <span style="color:#409EFF">' + this.getThingsModelItemValue(eventItem, row.logValue) + ' ' +
|
||||
(eventItem.datatype.unit != undefined ? eventItem.datatype.unit : '') + '</span>';
|
||||
}
|
||||
else {
|
||||
return row.logValue;
|
||||
}
|
||||
} else if (row.logType == 4) {
|
||||
return '<span style="font-weight:bold">设备升级</span>';
|
||||
@@ -172,6 +182,7 @@ export default {
|
||||
},
|
||||
/** 获取物模型项中的值*/
|
||||
getThingsModelItemValue(item, oldValue) {
|
||||
// 枚举和布尔转换为文字
|
||||
if (item.datatype.type == "bool") {
|
||||
if (oldValue == "0") {
|
||||
return item.datatype.falseText;
|
||||
@@ -191,15 +202,95 @@ export default {
|
||||
getThingsModelItem(type, identity) {
|
||||
if (type == 1 && this.thingsModel.properties) {
|
||||
for (let i = 0; i < this.thingsModel.properties.length; i++) {
|
||||
//普通类型 integer/decimal/string/emum//bool
|
||||
if (this.thingsModel.properties[i].id == identity) {
|
||||
return this.thingsModel.properties[i];
|
||||
}
|
||||
// 对象 object
|
||||
if (this.thingsModel.properties[i].datatype.type == "object") {
|
||||
for (let j = 0; j < this.thingsModel.properties[i].datatype.params.length; j++) {
|
||||
if (this.thingsModel.properties[i].datatype.params[j].id == identity) {
|
||||
this.thingsModel.properties[i].datatype.params[j].parentName = this.thingsModel.properties[i].name;
|
||||
return this.thingsModel.properties[i].datatype.params[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数组 array
|
||||
if (this.thingsModel.properties[i].datatype.type == "array" && this.thingsModel.properties[i].datatype.arrayType) {
|
||||
if (this.thingsModel.properties[i].datatype.arrayType == "object") {
|
||||
// 数组元素格式:array_01_parentId_humidity,array_01_前缀终端上报时加上,物模型中没有
|
||||
let realIdentity = identity;
|
||||
let arrayIndex = 0;
|
||||
if (identity.indexOf("array_") > -1) {
|
||||
arrayIndex = identity.substring(6, 8);
|
||||
realIdentity = identity.substring(9);
|
||||
}
|
||||
for (let j = 0; j < this.thingsModel.properties[i].datatype.params.length; j++) {
|
||||
if (this.thingsModel.properties[i].datatype.params[j].id == realIdentity) {
|
||||
// 标注索引和父级名称
|
||||
this.thingsModel.properties[i].datatype.params[j].arrayIndex = Number(arrayIndex) + 1;
|
||||
this.thingsModel.properties[i].datatype.params[j].parentName = this.thingsModel.properties[i].name;
|
||||
return this.thingsModel.properties[i].datatype.params[j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 普通类型
|
||||
for (let j = 0; j < this.thingsModel.properties[i].datatype.arrayCount.length; j++) {
|
||||
if (this.thingsModel.properties[i].id == realIdentity) {
|
||||
this.thingsModel.properties[i].arrayIndex = Number(arrayIndex) + 1;
|
||||
this.thingsModel.properties[i].parentName = "元素";
|
||||
return this.thingsModel.properties[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else if (type == 2 && this.thingsModel.functions) {
|
||||
for (let i = 0; i < this.thingsModel.functions.length; i++) {
|
||||
//普通类型 integer/decimal/string/emum/bool
|
||||
if (this.thingsModel.functions[i].id == identity) {
|
||||
return this.thingsModel.functions[i];
|
||||
}
|
||||
// 对象 object
|
||||
if (this.thingsModel.functions[i].datatype.type == "object") {
|
||||
for (let j = 0; j < this.thingsModel.functions[i].datatype.params.length; j++) {
|
||||
if (this.thingsModel.functions[i].datatype.params[j].id == identity) {
|
||||
this.thingsModel.functions[i].datatype.params[j].parentName = this.thingsModel.functions[i].name;
|
||||
return this.thingsModel.functions[i].datatype.params[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数组 array
|
||||
if (this.thingsModel.functions[i].datatype.type == "array" && this.thingsModel.functions[i].datatype.arrayType) {
|
||||
// 数组元素格式:array_01_parentId_humidity,array_01_前缀终端上报时加上,物模型中没有
|
||||
let realIdentity = identity;
|
||||
let arrayIndex = 0;
|
||||
if (identity.indexOf("array_") > -1) {
|
||||
arrayIndex = identity.substring(6, 8);
|
||||
realIdentity = identity.substring(9);
|
||||
}
|
||||
if (this.thingsModel.functions[i].datatype.arrayType == "object") {
|
||||
for (let j = 0; j < this.thingsModel.functions[i].datatype.params.length; j++) {
|
||||
if (this.thingsModel.functions[i].datatype.params[j].id == realIdentity) {
|
||||
// 标注索引和父级名称
|
||||
this.thingsModel.functions[i].datatype.params[j].arrayIndex = Number(arrayIndex) + 1;
|
||||
this.thingsModel.functions[i].datatype.params[j].parentName = this.thingsModel.functions[i].name;
|
||||
return this.thingsModel.functions[i].datatype.params[j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 普通类型
|
||||
for (let j = 0; j < this.thingsModel.functions[i].datatype.arrayCount.length; j++) {
|
||||
if (this.thingsModel.functions[i].id == realIdentity) {
|
||||
this.thingsModel.functions[i].arrayIndex = Number(arrayIndex) + 1;
|
||||
this.thingsModel.functions[i].parentName = "元素";
|
||||
return this.thingsModel.functions[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else if (type == 3 && this.thingsModel.events) {
|
||||
for (let i = 0; i < this.thingsModel.events.length; i++) {
|
||||
|
||||
296
vue/src/views/iot/device/device-monitor.vue
Normal file
296
vue/src/views/iot/device/device-monitor.vue
Normal file
@@ -0,0 +1,296 @@
|
||||
<template>
|
||||
<div style="padding-left: 20px">
|
||||
<el-form :inline="true" label-width="100px">
|
||||
<el-form-item label="监测间隔(ms)">
|
||||
<el-tooltip class="item" effect="light" content="取值范围500-10000毫秒" placement="top">
|
||||
<el-input v-model="monitorInterval" placeholder="请输入监测间隔" type="number" clearable size="small" style="width: 180px" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item label="监测次数">
|
||||
<el-tooltip class="item" effect="light" content="取值方位1-300" placement="top">
|
||||
<el-input v-model="monitorNumber" placeholder="请输入监测次数" type="number" clearable size="small" style="width: 180px" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="success" icon="el-icon-video-play" size="mini" @click="beginMonitor()" style="margin-left: 30px">开始监测</el-button>
|
||||
<el-button type="danger" icon="el-icon-video-pause" size="mini" @click="stopMonitor()">停止监测</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="20" v-loading="chartLoading" element-loading-text="正在接收设备数据,请耐心等待......" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
|
||||
<el-col :span="12" v-for="(item, index) in monitorThings" :key="index" style="margin-bottom: 20px">
|
||||
<el-card shadow="hover" :body-style="{ paddingTop: '10px', marginBottom: '-20px' }">
|
||||
<div ref="monitor" style="height: 210px; padding: 0"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DeviceMonitor',
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后,刷新列表
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
// 监测数据
|
||||
this.monitorThings = this.deviceInfo.monitorList;
|
||||
// 监测数据集合初始化
|
||||
this.dataList = [];
|
||||
for (let i = 0; i < this.monitorThings.length; i++) {
|
||||
this.dataList.push({
|
||||
id: this.monitorThings[i].id,
|
||||
name: this.monitorThings[i].name,
|
||||
data: [],
|
||||
});
|
||||
// this.dataList[i].data.push(["2022-03-14 23:32:09", "30"]);
|
||||
}
|
||||
// 绘制监测图表
|
||||
this.$nextTick(function () {
|
||||
this.getMonitorChart();
|
||||
});
|
||||
this.mqttCallback();
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 实时监测间隔
|
||||
monitorInterval: 1000,
|
||||
// 实时监测次数
|
||||
monitorNumber: 60,
|
||||
// 图表集合
|
||||
chart: [],
|
||||
// 图表数据集合
|
||||
dataList: [],
|
||||
// 监测物模型
|
||||
monitorThings: [],
|
||||
// 图表遮罩层
|
||||
chartLoading: false,
|
||||
// 设备信息
|
||||
deviceInfo: {},
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
/**
|
||||
* Mqtt发布消息
|
||||
* @device 设备
|
||||
* @model 物模型 ,type 类型(1=属性,2=功能,3=OTA升级(商业版支持),4=实时监测)
|
||||
* */
|
||||
mqttPublish(device, model) {
|
||||
let topic = '';
|
||||
let message = '';
|
||||
if (model.type == 4) {
|
||||
// 实时监测
|
||||
topic = '/' + device.productId + '/' + device.serialNumber + '/monitor/get';
|
||||
message = '{"count":' + model.value + ',"interval":' + this.monitorInterval + '}';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (topic != '') {
|
||||
// 发布
|
||||
this.$mqttTool
|
||||
.publish(topic, message, model.name)
|
||||
.then((res) => {
|
||||
this.$modal.notifySuccess(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$modal.notifyError(res);
|
||||
});
|
||||
}
|
||||
},
|
||||
/* Mqtt回调处理 */
|
||||
mqttCallback() {
|
||||
this.$mqttTool.client.on('message', (topic, message, buffer) => {
|
||||
let topics = topic.split('/');
|
||||
let productId = topics[1];
|
||||
let deviceNum = topics[2];
|
||||
message = JSON.parse(message.toString());
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
if (topics[3] == 'status') {
|
||||
console.log('接收到【设备状态】主题:', topic);
|
||||
console.log('接收到【设备状态】内容:', message);
|
||||
// 更新列表中设备的状态
|
||||
if (this.deviceInfo.serialNumber == deviceNum) {
|
||||
this.deviceInfo.status = message.status;
|
||||
this.deviceInfo.isShadow = message.isShadow;
|
||||
this.deviceInfo.rssi = message.rssi;
|
||||
}
|
||||
}
|
||||
if (topics[3] == 'monitor') {
|
||||
console.log('接收到【实时监测】主题:', topic);
|
||||
console.log('接收到【实时监测】内容:', message);
|
||||
// 实时监测
|
||||
this.chartLoading = false;
|
||||
for (let k = 0; k < message.length; k++) {
|
||||
let value = message[k].value;
|
||||
let id = message[k].id;
|
||||
let remark = message[k].remark;
|
||||
// 数据加载到图表
|
||||
for (let i = 0; i < this.dataList.length; i++) {
|
||||
if (id == this.dataList[i].id) {
|
||||
// 普通类型匹配
|
||||
if (this.dataList[i].length > 50) {
|
||||
this.dataList[i].shift();
|
||||
}
|
||||
this.dataList[i].data.push([this.getTime(), value]);
|
||||
// 更新图表
|
||||
this.chart[i].setOption({
|
||||
series: [
|
||||
{
|
||||
data: this.dataList[i].data,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
} else if (this.dataList[i].id.indexOf('array_') == 0) {
|
||||
// 数组类型匹配,例如:gateway_temperature,图表id去除前缀后匹配
|
||||
let index = this.dataList[i].id.substring(6, 8);
|
||||
let identity = this.dataList[i].id.substring(9);
|
||||
if (identity == id) {
|
||||
let values = value.split(',');
|
||||
if (this.dataList[i].length > 50) {
|
||||
this.dataList[i].shift();
|
||||
}
|
||||
this.dataList[i].data.push([this.getTime(), values[index]]);
|
||||
// 更新图表
|
||||
this.chart[i].setOption({
|
||||
series: [
|
||||
{
|
||||
data: this.dataList[i].data,
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 更新实时监测参数*/
|
||||
beginMonitor() {
|
||||
if (this.deviceInfo.status != 3) {
|
||||
this.$modal.alertError('设备不在线,下发指令失败');
|
||||
return;
|
||||
}
|
||||
// 清空图表数据
|
||||
for (let i = 0; i < this.dataList.length; i++) {
|
||||
this.dataList[i].data = [];
|
||||
}
|
||||
if (this.monitorInterval < 500 || this.monitorInterval > 10000) {
|
||||
this.$modal.alertError('实时监测的间隔范围500-10000毫秒');
|
||||
}
|
||||
if (this.monitorNumber == 0 || this.monitorNumber > 300) {
|
||||
this.$modal.alertError('实时监测数量范围1-300');
|
||||
}
|
||||
// Mqtt发布实时监测消息
|
||||
let model = {};
|
||||
model.name = '更新实时监测';
|
||||
model.value = this.monitorNumber;
|
||||
model.type = 4;
|
||||
this.mqttPublish(this.deviceInfo, model);
|
||||
this.chartLoading = true;
|
||||
},
|
||||
/** 停止实时监测 */
|
||||
stopMonitor() {
|
||||
if (this.deviceInfo.status != 3) {
|
||||
this.$modal.alertError('设备不在线,下发指令失败');
|
||||
return;
|
||||
}
|
||||
this.chartLoading = false;
|
||||
// Mqtt发布实时监测
|
||||
let model = {};
|
||||
model.name = '关闭实时监测';
|
||||
model.value = 0;
|
||||
model.type = 4;
|
||||
this.mqttPublish(this.deviceInfo, model);
|
||||
},
|
||||
/**监测数据 */
|
||||
getMonitorChart() {
|
||||
let color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
|
||||
for (let i = 0; i < this.monitorThings.length; i++) {
|
||||
// 设置宽度
|
||||
this.$refs.monitor[i].style.width = document.documentElement.clientWidth / 2 - 255 + 'px';
|
||||
this.chart[i] = this.$echarts.init(this.$refs.monitor[i]);
|
||||
var option;
|
||||
option = {
|
||||
title: {
|
||||
left: 'center',
|
||||
text: this.monitorThings[i].name + ' (单位 ' + (this.monitorThings[i].datatype.unit != undefined ? this.monitorThings[i].datatype.unit : '无') + ')',
|
||||
textStyle: {
|
||||
fontSize: 14,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
top: '50px',
|
||||
left: '20px',
|
||||
right: '20px',
|
||||
bottom: '10px',
|
||||
containLabel: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
animation: true,
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
show: false,
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, '100%'],
|
||||
splitLine: {
|
||||
show: true,
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: this.monitorThings[i].name,
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
sampling: 'lttb',
|
||||
itemStyle: {
|
||||
color: i > 9 ? color[0] : color[i],
|
||||
},
|
||||
areaStyle: {},
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
option && this.chart[i].setOption(option);
|
||||
}
|
||||
},
|
||||
/* 获取当前时间*/
|
||||
getTime() {
|
||||
let date = new Date();
|
||||
let y = date.getFullYear();
|
||||
let m = date.getMonth() + 1;
|
||||
let d = date.getDate();
|
||||
let H = date.getHours();
|
||||
let mm = date.getMinutes();
|
||||
let s = date.getSeconds();
|
||||
m = m < 10 ? '0' + m : m;
|
||||
d = d < 10 ? '0' + d : d;
|
||||
H = H < 10 ? '0' + H : H;
|
||||
return y + '-' + m + '-' + d + ' ' + H + ':' + mm + ':' + s;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,192 +1,225 @@
|
||||
<template>
|
||||
<div style="padding-left:20px;">
|
||||
<div style="padding-left: 20px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="75px" style="">
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="daterangeTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大数量">
|
||||
<el-input v-model="queryParams.total"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="getStatisticData">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="23">
|
||||
<div v-for="(item,index) in monitorThings" :key="index" style="margin-bottom:30px;">
|
||||
<el-card shadow="hover" :body-style="{ padding: '10px 0px',overflow:'auto' }" v-loading="loading">
|
||||
<div ref="statisticMap" style="height:300px;width:1080px;"></div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="75px">
|
||||
<el-form-item label="请选择设备从机:" label-width="120px" v-if="isSubDev">
|
||||
<el-select v-model="queryParams.slaveId" placeholder="请选择设备从机" @change="selectSlave">
|
||||
<el-option v-for="slave in slaveList" :key="slave.slaveId" :label="`${slave.deviceName} (${slave.slaveId})`"
|
||||
:value="slave.slaveId"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间范围">
|
||||
<el-date-picker v-model="daterangeTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="getListHistory">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="23">
|
||||
<div v-for="(item, index) in staticList" :key="index" style="margin-bottom: 30px">
|
||||
<el-card shadow="hover" :body-style="{ padding: '10px 0px', overflow: 'auto' }" v-loading="loading">
|
||||
<div ref="statisticMap" style="height: 300px; width: 1080px"></div>
|
||||
</el-card>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts';
|
||||
import {
|
||||
cacheJsonThingsModel
|
||||
} from "@/api/iot/model";
|
||||
import {
|
||||
listMonitor
|
||||
} from "@/api/iot/deviceLog";
|
||||
import { listHistory } from '@/api/iot/deviceLog';
|
||||
|
||||
export default {
|
||||
name: "device-statistic",
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
name: 'device-statistic',
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.getCacheThingsModdel(this.deviceInfo.productId);
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.isSubDev = this.deviceInfo.subDeviceList && this.deviceInfo.subDeviceList.length > 0;
|
||||
this.queryParams.slaveId = this.deviceInfo.slaveId;
|
||||
this.queryParams.serialNumber = this.deviceInfo.serialNumber;
|
||||
this.slaveList = newVal.subDeviceList;
|
||||
// 监测数据
|
||||
if (this.isSubDev) {
|
||||
this.staticList = this.deviceInfo.cacheThingsModel['properties'].filter((item) => {
|
||||
return item.tempSlaveId == this.queryParams.slaveId;
|
||||
});
|
||||
} else {
|
||||
this.staticList = this.deviceInfo.staticList;
|
||||
}
|
||||
// 加载图表
|
||||
this.$nextTick(function () {
|
||||
// 绘制图表
|
||||
this.getStatistic();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
// 设备信息
|
||||
deviceInfo: {},
|
||||
// 统计物模型
|
||||
staticList: [],
|
||||
// 图表集合
|
||||
chart: [],
|
||||
// 激活时间范围
|
||||
daterangeTime: [this.getTime(), this.getTime()],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
serialNumber: null,
|
||||
identity: '',
|
||||
slaveId: undefined,
|
||||
},
|
||||
// 对象数组类型物模型暂存数据
|
||||
arrayData: [],
|
||||
// 子设备列表
|
||||
slaveList: [],
|
||||
isSubDev: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 获取统计数据
|
||||
// this.getListHistory();
|
||||
},
|
||||
methods: {
|
||||
/** 获取当前日期 **/
|
||||
getTime() {
|
||||
let date = new Date();
|
||||
let y = date.getFullYear();
|
||||
let m = date.getMonth() + 1;
|
||||
let d = date.getDate();
|
||||
m = m < 10 ? '0' + m : m;
|
||||
d = d < 10 ? '0' + d : d;
|
||||
return y + '-' + m + '-' + d;
|
||||
},
|
||||
/* 获取监测历史数据*/
|
||||
getListHistory() {
|
||||
this.loading = true;
|
||||
this.queryParams.serialNumber = this.queryParams.slaveId ? this.deviceInfo.serialNumber + '_' + this.queryParams.slaveId : this.deviceInfo.serialNumber;
|
||||
if (null != this.daterangeTime && '' != this.daterangeTime) {
|
||||
this.queryParams.beginTime = this.daterangeTime[0];
|
||||
this.queryParams.endTime = this.daterangeTime[1] + ' 23:59';
|
||||
}
|
||||
listHistory(this.queryParams).then((res) => {
|
||||
for (let key in res.data) {
|
||||
for (let i = 0; i < this.staticList.length; i++) {
|
||||
if (key == this.staticList[i].id) {
|
||||
// 对象转数组
|
||||
let dataList = [];
|
||||
for (let j = 0; j < res.data[key].length; j++) {
|
||||
let item = [];
|
||||
item[0] = res.data[key][j].time;
|
||||
item[1] = res.data[key][j].value;
|
||||
dataList.push(item);
|
||||
}
|
||||
// 图表显示数据
|
||||
this.chart[i].setOption({
|
||||
series: [
|
||||
{
|
||||
data: dataList,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
// 设备信息
|
||||
deviceInfo: {},
|
||||
// 监测物模型
|
||||
monitorThings: [],
|
||||
// 图表集合
|
||||
chart: [],
|
||||
// 激活时间范围
|
||||
daterangeTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
deviceId: 0,
|
||||
identity: "",
|
||||
total: 1000,
|
||||
|
||||
/**监测统计数据 */
|
||||
getStatistic() {
|
||||
let color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
|
||||
for (let i = 0; i < this.staticList.length; i++) {
|
||||
// 设置宽度
|
||||
this.$refs.statisticMap[i].style.width = document.documentElement.clientWidth - 510 + 'px';
|
||||
this.chart[i] = this.$echarts.init(this.$refs.statisticMap[i]);
|
||||
var option;
|
||||
option = {
|
||||
animationDurationUpdate: 3000,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
title: {
|
||||
left: 'center',
|
||||
text: this.staticList[i].name + '统计 (单位 ' + (this.staticList[i].datatype && this.staticList[i].datatype.unit != undefined ? this.staticList[i].datatype.unit : '无') + ')',
|
||||
},
|
||||
grid: {
|
||||
top: '80px',
|
||||
left: '50px',
|
||||
right: '20px',
|
||||
bottom: '80px',
|
||||
// containLabel: true,
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: 'none',
|
||||
},
|
||||
restore: {},
|
||||
saveAsImage: {},
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
dataZoom: [
|
||||
{
|
||||
type: 'inside',
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
{
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: this.staticList[i].name,
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
sampling: 'lttb',
|
||||
itemStyle: {
|
||||
color: i > 9 ? color[0] : color[i],
|
||||
},
|
||||
areaStyle: {},
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
option && this.chart[i].setOption(option);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
/*选择从机*/
|
||||
selectSlave() {
|
||||
this.staticList = this.deviceInfo.cacheThingsModel['properties'].filter((item) => {
|
||||
return item.tempSlaveId == this.queryParams.slaveId;
|
||||
});
|
||||
// 加载图表
|
||||
this.$nextTick(function () {
|
||||
// 绘制图表
|
||||
this.getStatistic();
|
||||
// 获取统计数据
|
||||
this.getListHistory();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 获取物模型*/
|
||||
getCacheThingsModdel(productId) {
|
||||
// 获取缓存的Json物模型
|
||||
cacheJsonThingsModel(productId).then(response => {
|
||||
let thingsModel = JSON.parse(response.data);
|
||||
// 筛选监测数据
|
||||
this.monitorThings = thingsModel.properties.filter(item => item.isMonitor == 1);
|
||||
// 加载图表
|
||||
this.$nextTick(function () {
|
||||
// 绘制图表
|
||||
this.getStatistic();
|
||||
// 获取统计数据
|
||||
this.getStatisticData(this.monitorThings);
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
/** 获取统计数据 */
|
||||
getStatisticData() {
|
||||
this.loading = true;
|
||||
for (let i = 0; i < this.monitorThings.length; i++) {
|
||||
this.queryParams.deviceId = this.deviceInfo.deviceId;
|
||||
this.queryParams.identity = this.monitorThings[i].id;
|
||||
if (null != this.daterangeTime && '' != this.daterangeTime) {
|
||||
this.queryParams.beginTime = this.daterangeTime[0];
|
||||
this.queryParams.endTime = this.daterangeTime[1]+" 23:59";
|
||||
}
|
||||
listMonitor(this.queryParams).then(response => {
|
||||
let data = response.rows;
|
||||
// 对象转数组
|
||||
let dataList = [];
|
||||
for (let j = 0; j < data.length; j++) {
|
||||
let item = [];
|
||||
item[0] = data[j].time;
|
||||
item[1] = data[j].value;
|
||||
dataList.push(item);
|
||||
}
|
||||
this.chart[i].setOption({
|
||||
series: [{
|
||||
data: dataList
|
||||
}]
|
||||
});
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
/**监测统计数据 */
|
||||
getStatistic() {
|
||||
let color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
|
||||
for (let i = 0; i < this.monitorThings.length; i++) {
|
||||
// 设置宽度
|
||||
this.$refs.statisticMap[i].style.width = (document.documentElement.clientWidth - 510) + "px";
|
||||
console.log(this.$refs.statisticMap[i]);
|
||||
|
||||
this.chart[i] = echarts.init(this.$refs.statisticMap[i]);
|
||||
var option;
|
||||
option = {
|
||||
animationDurationUpdate: 3000,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
},
|
||||
title: {
|
||||
left: 'center',
|
||||
text: this.monitorThings[i].name + '统计 (单位 ' + (this.monitorThings[i].datatype.unit != undefined ? this.monitorThings[i].datatype.unit : "无") + ")",
|
||||
},
|
||||
grid: {
|
||||
top: '80px',
|
||||
left: '40px',
|
||||
right: '20px',
|
||||
bottom: '60px',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
dataZoom: {
|
||||
yAxisIndex: 'none'
|
||||
},
|
||||
restore: {},
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
dataZoom: [{
|
||||
type: 'inside',
|
||||
start: 0,
|
||||
end: 100
|
||||
},
|
||||
{
|
||||
start: 0,
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
series: [{
|
||||
name: this.monitorThings[i].name,
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
sampling: 'lttb',
|
||||
itemStyle: {
|
||||
color: i > 9 ? color[0] : color[i]
|
||||
},
|
||||
areaStyle: {},
|
||||
data: []
|
||||
}]
|
||||
};
|
||||
option && this.chart[i].setOption(option);
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,234 +1,348 @@
|
||||
<template>
|
||||
<div style="padding-left:20px;">
|
||||
<div style="padding-left: 20px">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-share" size="mini" @click="selectUser" v-hasPermi="['iot:device:share']">分享设备</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="getList">刷新</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-share" size="mini" @click="shareDevice" v-hasPermi="['iot:device:share']">分享设备</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="getList">刷新</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceUserList" @selection-change="handleSelectionChange" size="mini">
|
||||
<el-table-column label="用户编号" align="center" prop="userId" width="100" />
|
||||
<el-table-column label="用户名称" align="center" prop="userName" />
|
||||
<el-table-column label="手机号码" align="center" prop="phonenumber" width="150" />
|
||||
<el-table-column label="用户类型" align="center" prop="isOwner" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="primary" v-if="scope.row.isOwner">主人</el-tag>
|
||||
<el-tag type="success" v-else>分享</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分享时间" align="center" prop="createTime" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="left" prop="remark" header-align="center" min-width="150" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:device:share']" v-if="scope.row.isOwner==0">备注</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:device:share']" v-if="scope.row.isOwner==0">取消分享</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户编号" align="center" prop="userId" width="100" />
|
||||
<el-table-column label="用户名称" align="center" prop="userName" />
|
||||
<el-table-column label="手机号码" align="center" prop="phonenumber" width="150" />
|
||||
<el-table-column label="用户类型" align="center" prop="isOwner" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="primary" v-if="scope.row.isOwner">主人</el-tag>
|
||||
<el-tag type="success" v-else>分享</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分享时间" align="center" prop="createTime" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="left" prop="remark" header-align="center" min-width="150" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:device:share']" v-if="scope.row.isOwner == 0">编辑</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:device:share']" v-if="scope.row.isOwner == 0">取消分享</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改设备用户对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="4" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<!--设备分享对话框-->
|
||||
<el-dialog title="设备分享" :visible.sync="open" width="800px">
|
||||
<div style="margin-top: -50px">
|
||||
<el-divider></el-divider>
|
||||
</div>
|
||||
<!--用户查询-->
|
||||
<el-form :model="permParams" ref="queryForm" :rules="rules" :inline="true" label-width="80px" v-if="type == 1">
|
||||
<el-form-item label="手机号码" prop="phonenumber">
|
||||
<el-input type="text" placeholder="请输入用户手机号码" v-model="permParams.phonenumber" minlength="10" clearable size="small" show-word-limit style="width: 240px" @keyup.enter.native="handleQuery"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="userQuery">查询用户</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!--用户信息和权限设置-->
|
||||
<div v-loading="permsLoading" style="background-color: #f8f8f9; line-height: 28px">
|
||||
<div v-if="message" style="padding: 20px">{{ message }}</div>
|
||||
<div v-if="form.userId" style="padding: 15px">
|
||||
<div style="font-weight: bold; line-height: 28px">用户信息</div>
|
||||
<span style="width: 80px; display: inline-block">用户ID:</span>
|
||||
<span>{{ form.userId }}</span>
|
||||
<br />
|
||||
<span style="width: 80px; display: inline-block">手机号码:</span>
|
||||
<span>{{ form.phonenumber }}</span>
|
||||
<br />
|
||||
<span style="width: 80px; display: inline-block">用户名称:</span>
|
||||
<span>{{ form.userName }}</span>
|
||||
<br />
|
||||
<!--选择权限-->
|
||||
<div style="font-weight: bold; margin: 15px 0 10px">设置用户权限</div>
|
||||
<el-table :data="sharePermissionList" highlight-current-row size="mini" ref="multipleTable" @select="handleSelectionChange" @select-all="handleSelectionAll">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="权限名称" align="center" key="modelName" prop="modelName" />
|
||||
<el-table-column label="权限标识" align="center" key="identifier" prop="identifier" />
|
||||
<el-table-column label="备注信息" align="left" min-width="100" header-align="center" key="remark" prop="remark" />
|
||||
</el-table>
|
||||
<!--选择权限-->
|
||||
<div style="font-weight: bold; margin: 15px 0 10px">备注信息</div>
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="2" />
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="!form.userId || !deviceInfo.deviceId">确定</el-button>
|
||||
<el-button @click="closeSelectUser">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选择用户 -->
|
||||
<user-list ref="userList" :device="devices" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userList from "./user-list"
|
||||
import {
|
||||
listDeviceUser,
|
||||
getDeviceUser,
|
||||
delDeviceUser,
|
||||
updateDeviceUser
|
||||
} from "@/api/iot/deviceuser";
|
||||
import { addDeviceUser, listDeviceUser, getDeviceUser, delDeviceUser, updateDeviceUser, shareUser } from '@/api/iot/deviceuser';
|
||||
import { permListModel } from '@/api/iot/model';
|
||||
|
||||
export default {
|
||||
name: "device-user",
|
||||
dicts: ['iot_yes_no'],
|
||||
components: {
|
||||
userList
|
||||
name: 'device-user',
|
||||
dicts: ['iot_yes_no'],
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
props: {
|
||||
device: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后,刷新列表
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
this.devices = [newVal];
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.queryParams.deviceId = this.deviceInfo.deviceId;
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 设备列表
|
||||
devices: [],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备用户表格数据
|
||||
deviceUserList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deviceName: null,
|
||||
userName: null,
|
||||
userId: null,
|
||||
tenantName: null,
|
||||
isOwner: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
deviceName: [{
|
||||
required: true,
|
||||
message: "设备名称不能为空",
|
||||
trigger: "blur"
|
||||
}],
|
||||
userName: [{
|
||||
required: true,
|
||||
message: "用户昵称不能为空",
|
||||
trigger: "blur"
|
||||
}],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
watch: {
|
||||
// 获取到父组件传递的device后,刷新列表
|
||||
device: function (newVal, oldVal) {
|
||||
this.deviceInfo = newVal;
|
||||
if (this.deviceInfo && this.deviceInfo.deviceId != 0) {
|
||||
this.queryParams.deviceId = this.deviceInfo.deviceId;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备用户列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceUser(this.queryParams).then(response => {
|
||||
this.deviceUserList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
deviceId: null,
|
||||
userId: null,
|
||||
deviceName: null,
|
||||
userName: null,
|
||||
tenantId: null,
|
||||
tenantName: null,
|
||||
isOwner: null,
|
||||
limitNum: null,
|
||||
delFlag: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.deviceId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备用户";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const deviceId = row.deviceId || this.ids
|
||||
getDeviceUser(deviceId, row.userId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "用户备注";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
if (this.form.deviceId != null) {
|
||||
updateDeviceUser(this.form).then(response => {
|
||||
this.$modal.msgSuccess("备注成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 类型,1=新增,2=更新
|
||||
type: 1,
|
||||
// 消息提示
|
||||
message: '',
|
||||
// 权限遮罩层
|
||||
permsLoading: false,
|
||||
// 权限列表
|
||||
sharePermissionList: [],
|
||||
// 设备信息
|
||||
deviceInfo: {},
|
||||
// 是否显示选择用户弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
permParams: {
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
deviceId: null,
|
||||
},
|
||||
// 查询表单验证
|
||||
rules: {
|
||||
phonenumber: [
|
||||
{
|
||||
required: true,
|
||||
message: '手机号码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '手机号码长度为11位',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备用户表格数据
|
||||
deviceUserList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deviceName: null,
|
||||
userName: null,
|
||||
userId: null,
|
||||
tenantName: null,
|
||||
isOwner: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.queryParams.deviceId = this.device.deviceId;
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备用户列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceUser(this.queryParams).then((response) => {
|
||||
this.deviceUserList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
deviceId: null,
|
||||
userId: null,
|
||||
deviceName: null,
|
||||
userName: null,
|
||||
perms: null,
|
||||
phonenumber: null,
|
||||
remark: null,
|
||||
};
|
||||
this.sharePermissionList = [];
|
||||
this.message = '';
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.type = 2; //更新
|
||||
getDeviceUser(row.deviceId, row.userId).then((response) => {
|
||||
this.form = response.data;
|
||||
// 查询物模型权限列表
|
||||
this.getPermissionList();
|
||||
this.open = true;
|
||||
});
|
||||
},
|
||||
// 设备分享
|
||||
shareDevice() {
|
||||
this.type = 1; // 新增
|
||||
this.open = true;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const deviceUser = row;
|
||||
this.$modal
|
||||
.confirm('确认取消分享设备?')
|
||||
.then(function () {
|
||||
return delDeviceUser(deviceUser);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess('取消分享成功');
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 用户按钮操作 */
|
||||
userQuery() {
|
||||
this.$refs['queryForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.reset();
|
||||
this.getShareUser();
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查询用户 */
|
||||
getShareUser() {
|
||||
this.permsLoading = true;
|
||||
if (!this.deviceInfo.deviceId) {
|
||||
this.$modal.alert('查询不到设备信息,请刷新后重试');
|
||||
return;
|
||||
}
|
||||
this.permParams.deviceId = this.deviceInfo.deviceId;
|
||||
shareUser(this.permParams).then((response) => {
|
||||
if (response.data) {
|
||||
this.form = response.data;
|
||||
// 查询物模型权限列表
|
||||
this.getPermissionList();
|
||||
} else {
|
||||
this.permsLoading = false;
|
||||
this.message = '查询不到用户信息,或者该用户已经是设备用户';
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查询产品物模型设备权限列表 */
|
||||
async getPermissionList() {
|
||||
let perms = [];
|
||||
if (this.form.perms) {
|
||||
perms = this.form.perms.split(',');
|
||||
}
|
||||
console.log('deviceInfo', this.deviceInfo);
|
||||
permListModel(this.deviceInfo.productId).then((response) => {
|
||||
// 固定增加设备系统相关权限
|
||||
this.sharePermissionList = [
|
||||
{
|
||||
identifier: 'timer',
|
||||
modelName: '设备定时',
|
||||
remark: '定时执行任务',
|
||||
},
|
||||
{
|
||||
identifier: 'log',
|
||||
modelName: '设备日志',
|
||||
remark: '包含事件日志和指令日志',
|
||||
},
|
||||
{
|
||||
identifier: 'monitor',
|
||||
modelName: '实时监测',
|
||||
remark: '下发实时监测指令后,图表实时显示设备上报数据',
|
||||
},
|
||||
{
|
||||
identifier: 'statistic',
|
||||
modelName: '监测统计',
|
||||
remark: '图表显示存储的历史监测数据',
|
||||
},
|
||||
];
|
||||
this.sharePermissionList = this.sharePermissionList.concat(response.data);
|
||||
|
||||
// 设置选中
|
||||
if (perms.length > 0) {
|
||||
for (let i = 0; i < this.sharePermissionList.length; i++) {
|
||||
for (let j = 0; j < perms.length; j++) {
|
||||
if (this.sharePermissionList[i].identifier == perms[j]) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.multipleTable.toggleRowSelection(this.sharePermissionList[i], true);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const deviceUser = row;
|
||||
this.$modal.confirm('确认取消分享设备?').then(function () {
|
||||
return delDeviceUser(deviceUser);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("取消分享成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('iot/deviceUser/export', {
|
||||
...this.queryParams
|
||||
}, `deviceUser_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 选择用户
|
||||
selectUser() {
|
||||
this.devices = [this.device]
|
||||
this.$refs.userList.openSelectUser = true;
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
this.permsLoading = false;
|
||||
});
|
||||
},
|
||||
// 重置查询
|
||||
resetUserQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.reset();
|
||||
},
|
||||
// 关闭选择用户
|
||||
closeSelectUser() {
|
||||
this.open = false;
|
||||
this.resetUserQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.form.perms = selection.map((x) => x.identifier).join(',');
|
||||
},
|
||||
// 全选事件处理
|
||||
handleSelectionAll(selection) {
|
||||
this.form.perms = selection.map((x) => x.identifier).join(',');
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
if (this.type == 2) {
|
||||
// 更新设备用户
|
||||
updateDeviceUser(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
this.resetUserQuery();
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else if (this.type == 1) {
|
||||
// 添加设备用户
|
||||
this.form.deviceId = this.deviceInfo.deviceId;
|
||||
this.form.deviceName = this.deviceInfo.deviceName;
|
||||
addDeviceUser(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.resetUserQuery();
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,6 +103,10 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listProduct(this.queryParams).then(response => {
|
||||
//产品列表初始化isSelect值,用于单选
|
||||
for (let i = 0; i < response.rows.length; i++) {
|
||||
response.rows[i].isSelect = false;
|
||||
}
|
||||
this.productList = response.rows;
|
||||
this.total = response.total;
|
||||
if (this.productId != 0) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user