|
|
|
@ -17,89 +17,81 @@
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="所属场景" prop="sceneId">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.sceneId"
|
|
|
|
|
placeholder="请输入所属场景"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="所属监控单元" prop="monitorUnitId">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.monitorUnitId"
|
|
|
|
|
placeholder="请输入所属监控单元"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
<el-form-item label="设备类型" prop="networkingMode">
|
|
|
|
|
<el-select v-model="queryParams.deviceType" placeholder="请选择设备类型" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="所属场景" prop="sceneId">
|
|
|
|
|
<el-select v-model="queryParams.sceneId" placeholder="请选择" @input="sceneChange">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(scene, index) in scenes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="scene.sceneName"
|
|
|
|
|
:value="scene.sceneId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="接入协议" prop="accessProtocol">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.accessProtocol"
|
|
|
|
|
placeholder="请输入接入协议"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="数据格式" prop="dataFormat">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.dataFormat"
|
|
|
|
|
placeholder="请输入数据格式"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
<el-form-item label="监控单元" prop="monitorUnitId">
|
|
|
|
|
<treeselect v-model="queryParams.monitorUnitId" :options="editedMonitorUnits" :show-count="true"
|
|
|
|
|
placeholder="请选择所属监控单元" :normalizer="normalizer" :flat="true" clearable style="width: 200px;"/>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="设备模型" prop="deviceModeId">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.deviceModeId"
|
|
|
|
|
placeholder="请输入设备模型"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="接入网关协议" prop="accessGwProtocol">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.accessGwProtocol"
|
|
|
|
|
placeholder="请输入接入网关协议"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备激活时间" prop="activeTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="queryParams.activeTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="请选择设备激活时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
<el-select v-model="queryParams.deviceModeId" placeholder="请选择" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(editedDeviceMode, index) in editedDeviceModes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="editedDeviceMode.deviceModeName"
|
|
|
|
|
:value="editedDeviceMode.deviceModeId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备图片地址" prop="devicePic">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.devicePic"
|
|
|
|
|
placeholder="请输入设备图片地址"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="激活状态" prop="activeStatus">
|
|
|
|
|
<el-select v-model="queryParams.activeStatus" placeholder="请选择" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_active_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="网络地址" prop="ipAddress">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.ipAddress"
|
|
|
|
|
placeholder="请输入网络地址"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="设备状态" prop="deviceStatus">
|
|
|
|
|
<el-select v-model="queryParams.deviceStatus" placeholder="请选择" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_device_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="租户ID" prop="tenantId">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.tenantId"
|
|
|
|
|
placeholder="请输入租户ID"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
<el-form-item label="在线状态" prop="onlineStatus">
|
|
|
|
|
<el-select v-model="queryParams.onlineStatus" placeholder="请选择" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_online_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</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>
|
|
|
|
@ -160,25 +152,42 @@
|
|
|
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
|
|
|
<el-table-column label="设备编号" align="center" prop="deviceCode"/>
|
|
|
|
|
<el-table-column label="设备名称" align="center" prop="deviceName"/>
|
|
|
|
|
<el-table-column label="所属场景" align="center" prop="sceneId"/>
|
|
|
|
|
<el-table-column label="所属监控单元" align="center" prop="monitorUnitId"/>
|
|
|
|
|
<el-table-column label="设备类型" align="center" prop="deviceType"/>
|
|
|
|
|
<el-table-column label="联网方式" align="center" prop="networkingMode"/>
|
|
|
|
|
<el-table-column label="接入协议" align="center" prop="accessProtocol"/>
|
|
|
|
|
<el-table-column label="数据格式" align="center" prop="dataFormat"/>
|
|
|
|
|
<el-table-column label="设备模型" align="center" prop="deviceModeId"/>
|
|
|
|
|
<el-table-column label="接入网关协议" align="center" prop="accessGwProtocol"/>
|
|
|
|
|
<el-table-column label="激活状态" align="center" prop="activeStatus"/>
|
|
|
|
|
<el-table-column label="设备状态" align="center" prop="deviceStatus"/>
|
|
|
|
|
<el-table-column label="设备类型" align="center" prop="deviceType">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.hw_device_type" :value="scope.row.deviceType"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column label="所属租户" align="center" prop="tenantName"/>
|
|
|
|
|
<el-table-column label="所属场景" align="center" prop="sceneName"/>
|
|
|
|
|
<el-table-column label="监控单元" align="center" prop="monitorUnitName"/>
|
|
|
|
|
<el-table-column label="设备模型" align="center" prop="deviceModeName"/>
|
|
|
|
|
<el-table-column label="激活状态" align="center" prop="activeStatus">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.hw_device_active_status" :value="scope.row.activeStatus"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="设备激活时间" align="center" prop="activeTime" width="180">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.activeTime, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="设备图片地址" align="center" prop="devicePic"/>
|
|
|
|
|
<el-table-column label="网络地址" align="center" prop="ipAddress"/>
|
|
|
|
|
<el-table-column label="租户" align="center" prop="tenantId"/>
|
|
|
|
|
<el-table-column label="在线状态" align="center" prop="onlineStatus"/>
|
|
|
|
|
<el-table-column label="设备状态" align="center" prop="deviceStatus">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-switch
|
|
|
|
|
v-model="scope.row.deviceStatus"
|
|
|
|
|
active-value="0"
|
|
|
|
|
inactive-value="1"
|
|
|
|
|
@change="handleDeviceStatusChange(scope.row)"
|
|
|
|
|
></el-switch>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column label="在线状态" align="center" prop="onlineStatus">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.hw_device_online_status" :value="scope.row.onlineStatus"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
@ -211,15 +220,26 @@
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改设备信息对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-form-item label="设备编号" prop="deviceCode">
|
|
|
|
|
<el-input v-model="form.deviceCode" placeholder="请输入设备编号"/>
|
|
|
|
|
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" maxlength="20"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备名称" prop="deviceName">
|
|
|
|
|
<el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备类型" prop="networkingMode">
|
|
|
|
|
<el-select v-model="form.deviceType" placeholder="请选择设备类型" @input="deviceTypeChange">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="所属场景" prop="sceneId">
|
|
|
|
|
<el-select v-model="form.sceneId" placeholder="请选择" :input="getMonitorUnitTree()">
|
|
|
|
|
<el-select v-model="form.sceneId" placeholder="请选择" @input="sceneChange">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(scene, index) in scenes"
|
|
|
|
|
:key="index"
|
|
|
|
@ -229,18 +249,13 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="所属监控单元" prop="monitorUnitId">
|
|
|
|
|
<el-select v-model="form.monitorUnitId" placeholder="请选择" :disabled="disabled">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(monitorUnit, index) in monitorUnits"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="monitorUnit.monitorUnitName"
|
|
|
|
|
:value="monitorUnit.monitorUnitId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="监控单元" prop="monitorUnitId">
|
|
|
|
|
<treeselect v-model="form.monitorUnitId" :options="editedMonitorUnits" :show-count="true"
|
|
|
|
|
placeholder="请选择所属监控单元" :normalizer="normalizer" :flat="true"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联网方式" prop="networkingMode">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="联网方式" prop="networkingMode" v-if="deviceVisible">
|
|
|
|
|
<el-select v-model="form.networkingMode" placeholder="请选择数据类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_networking_mode"
|
|
|
|
@ -249,23 +264,49 @@
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="接入协议" prop="accessProtocol">
|
|
|
|
|
<el-input v-model="form.accessProtocol" placeholder="请输入接入协议"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="数据格式" prop="dataFormat">
|
|
|
|
|
<el-input v-model="form.dataFormat" placeholder="请输入数据格式"/>
|
|
|
|
|
<el-form-item label="接入协议" prop="accessProtocol" v-if="deviceVisible">
|
|
|
|
|
<el-select v-model="form.accessProtocol" placeholder="请选择接入协议">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_access_protocol"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="parseInt(dict.value)"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="关联设备" prop="releatedDeviceId">
|
|
|
|
|
<el-input v-model="form.releatedDeviceId" placeholder="请输入关联设备,hw_device表中国的device_id"/>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="数据格式" prop="dataFormat" v-if="deviceVisible">
|
|
|
|
|
<el-select v-model="form.accessProtocol" placeholder="请选择数据格式">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.hw_device_data_format"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="parseInt(dict.value)"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="设备模型" prop="deviceModeId">
|
|
|
|
|
<el-input v-model="form.deviceModeId" placeholder="请输入设备模型"/>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="关联网关" prop="releatedDeviceId" v-if="subDeviceVisible">
|
|
|
|
|
<el-select v-model="form.releatedDeviceId" placeholder="请选择">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(editedGatewayDevice, index) in editedGatewayDevices"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="editedGatewayDevice.deviceName"
|
|
|
|
|
:value="editedGatewayDevice.deviceId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="接入网关协议" prop="accessGwProtocol">
|
|
|
|
|
<el-input v-model="form.accessGwProtocol" placeholder="请输入接入网关协议"/>
|
|
|
|
|
<el-form-item label="设备模型" prop="deviceModeId" v-if="subDeviceVisible">
|
|
|
|
|
<el-select v-model="form.deviceModeId" placeholder="请选择">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(editedDeviceMode, index) in editedDeviceModes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="editedDeviceMode.deviceModeName"
|
|
|
|
|
:value="editedDeviceMode.deviceModeId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="描述" prop="remark">
|
|
|
|
@ -324,11 +365,25 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {listDevice, getDevice, delDevice, addDevice, updateDevice,getMonitorTree} from "@/api/business/device";
|
|
|
|
|
import {getScenes} from "@/api/business/scene";
|
|
|
|
|
import {
|
|
|
|
|
listDevice,
|
|
|
|
|
getDevice,
|
|
|
|
|
delDevice,
|
|
|
|
|
addDevice,
|
|
|
|
|
updateDevice,
|
|
|
|
|
getScenes,
|
|
|
|
|
getMonitorTree,
|
|
|
|
|
getDeviceModes,
|
|
|
|
|
getGatewayDevices,
|
|
|
|
|
changeDeviceStatus
|
|
|
|
|
} from "@/api/business/device";
|
|
|
|
|
import {getToken} from "@/utils/auth";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
import {changeUserStatus} from "@/api/system/user";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {Treeselect},
|
|
|
|
|
dicts: ['hw_device_type', 'hw_device_networking_mode', 'hw_device_access_protocol', 'hw_device_data_format', 'hw_device_active_status', 'hw_device_device_status', 'hw_device_online_status'],
|
|
|
|
|
name: "Device",
|
|
|
|
|
props: {
|
|
|
|
@ -373,12 +428,27 @@ export default {
|
|
|
|
|
deviceList: [],
|
|
|
|
|
//场景列表
|
|
|
|
|
scenes: [],
|
|
|
|
|
//监控单元列表
|
|
|
|
|
monitorUnits: [],
|
|
|
|
|
//编辑页面监控单元树
|
|
|
|
|
editedMonitorUnits: undefined,
|
|
|
|
|
//编辑页面设备模型列表
|
|
|
|
|
editedDeviceModes: [],
|
|
|
|
|
//编辑页面网关设备列表
|
|
|
|
|
editedGatewayDevices: [],
|
|
|
|
|
|
|
|
|
|
subDeviceVisible: false,//子设备字段是否显示
|
|
|
|
|
deviceVisible: false,//网关设备或直连设备字段是否显示
|
|
|
|
|
|
|
|
|
|
DEVICE_TYPE_GATEWAY_DEVICE: "1",//网关设备
|
|
|
|
|
DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT: "2",//网关子设备
|
|
|
|
|
DEVICE_TYPE_DIRECT_CONNECT_DEVICE: "3",//直连设备
|
|
|
|
|
|
|
|
|
|
DEVICE_ACCESS_PROTOCOL_WIFI: "1",//网关接入协议WIFI
|
|
|
|
|
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
@ -409,38 +479,25 @@ export default {
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
deviceCode: [
|
|
|
|
|
{required: true, message: "设备编号不能为空", trigger: "blur"}
|
|
|
|
|
{required: true, message: "设备编号不能为空", trigger: "blur"},
|
|
|
|
|
{
|
|
|
|
|
pattern: /^[a-z][a-z0-9_]+$/,
|
|
|
|
|
message: "2-20个字符,由小写字母、数字或下划线组成,开头必须为小写字母",
|
|
|
|
|
trigger: "blur"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
deviceName: [
|
|
|
|
|
{required: true, message: "设备名称不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
sceneId: [
|
|
|
|
|
{required: true, message: "所属场景,关联hw_scene表的scene_id字段不能为空", trigger: "blur"}
|
|
|
|
|
{required: true, message: "所属场景不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
deviceType: [
|
|
|
|
|
{required: true, message: "设备类型不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
networkingMode: [
|
|
|
|
|
{required: true, message: "联网方式(1:Wi-Fi,2、蜂窝(2G/3G/4G/5G),3、以太网,4、其他)不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
accessProtocol: [
|
|
|
|
|
{required: true, message: "接入协议不能为空", trigger: "blur"}
|
|
|
|
|
monitorUnitId: [
|
|
|
|
|
{required: true, message: "监控单元不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
dataFormat: [
|
|
|
|
|
{required: true, message: "数据格式不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
activeStatus: [
|
|
|
|
|
{required: true, message: "激活状态不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
deviceStatus: [
|
|
|
|
|
{required: true, message: "设备状态不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
tenantId: [
|
|
|
|
|
{required: true, message: "租户ID,关联hw_tenant的tenant_id不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
onlineStatus: [
|
|
|
|
|
{required: true, message: "在线状态不能为空", trigger: "change"}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
number: 0,
|
|
|
|
|
uploadList: [],
|
|
|
|
@ -455,9 +512,7 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
getMonitorTree().then(response => {
|
|
|
|
|
alert(JSON.stringify(response.data));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.getList();
|
|
|
|
|
getScenes().then(response => {
|
|
|
|
|
this.scenes = response.data;
|
|
|
|
@ -473,11 +528,18 @@ export default {
|
|
|
|
|
showTip() {
|
|
|
|
|
return this.isShowTip && (this.fileType || this.fileSize);
|
|
|
|
|
},
|
|
|
|
|
formatRow() {
|
|
|
|
|
return (row) => {
|
|
|
|
|
// let languages = this.languages;
|
|
|
|
|
// for (let i = 0; i < languages.length; i++) {
|
|
|
|
|
// if (languages[i].languageCode === row.languageCode) {
|
|
|
|
|
// return languages[i].languageName;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getMonitorUnitTree(){
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
/** 查询设备信息列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
@ -500,7 +562,7 @@ export default {
|
|
|
|
|
deviceName: null,
|
|
|
|
|
sceneId: null,
|
|
|
|
|
monitorUnitId: null,
|
|
|
|
|
deviceType: 2,
|
|
|
|
|
deviceType: "2",
|
|
|
|
|
networkingMode: null,
|
|
|
|
|
accessProtocol: null,
|
|
|
|
|
dataFormat: null,
|
|
|
|
@ -540,15 +602,35 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.fileList = [];
|
|
|
|
|
this.reset();
|
|
|
|
|
this.subDeviceVisible = true;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加设备信息";
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.fileList = [];
|
|
|
|
|
const deviceId = row.deviceId || this.ids
|
|
|
|
|
getDevice(deviceId).then(response => {
|
|
|
|
|
|
|
|
|
|
if (response.data.devicePic != null) {
|
|
|
|
|
let previewFile = {};
|
|
|
|
|
previewFile.url = response.data.devicePic
|
|
|
|
|
this.fileList.push(previewFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getEditedMonitorTree(response.data.sceneId);
|
|
|
|
|
if (response.data.deviceType === this.DEVICE_TYPE_GATEWAY_DEVICE || response.data.deviceType === this.DEVICE_TYPE_DIRECT_CONNECT_DEVICE) {
|
|
|
|
|
this.subDeviceVisible = false;
|
|
|
|
|
this.deviceVisible = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.subDeviceVisible = true;
|
|
|
|
|
this.deviceVisible = false;
|
|
|
|
|
this.getEditedDeviceModes(response.data.sceneId);
|
|
|
|
|
this.getGatewayDevices(response.data.sceneId);
|
|
|
|
|
}
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改设备信息";
|
|
|
|
@ -560,6 +642,31 @@ export default {
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.deviceType === this.DEVICE_TYPE_GATEWAY_DEVICE || this.form.deviceType === this.DEVICE_TYPE_DIRECT_CONNECT_DEVICE) {
|
|
|
|
|
// if(this.form.net)
|
|
|
|
|
// networkingMode: [
|
|
|
|
|
// {required: true, message: "联网方式(1:Wi-Fi,2、蜂窝(2G/3G/4G/5G),3、以太网,4、其他)不能为空", trigger: "blur"}
|
|
|
|
|
// ],
|
|
|
|
|
// accessProtocol: [
|
|
|
|
|
// {required: true, message: "接入协议不能为空", trigger: "blur"}
|
|
|
|
|
// ],
|
|
|
|
|
// dataFormat: [
|
|
|
|
|
// {required: true, message: "数据格式不能为空", trigger: "blur"}
|
|
|
|
|
// ],
|
|
|
|
|
} else {
|
|
|
|
|
if (this.form.releatedDeviceId === null || this.form.releatedDeviceId === undefined
|
|
|
|
|
|| this.form.releatedDeviceId === '') {
|
|
|
|
|
this.$modal.msgWarning("请选择关联网关");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.form.deviceModeId === null || this.form.deviceModeId === undefined
|
|
|
|
|
|| this.form.deviceModeId === '') {
|
|
|
|
|
this.$modal.msgWarning("请选择设备模型");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.form.deviceId != null) {
|
|
|
|
|
updateDevice(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
@ -634,7 +741,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 文件个数超出
|
|
|
|
|
handleExceed() {
|
|
|
|
|
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} limit!`);
|
|
|
|
|
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
|
|
|
|
|
},
|
|
|
|
|
// 上传成功回调
|
|
|
|
|
handleUploadSuccess(res, file) {
|
|
|
|
@ -691,7 +798,94 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getEditedMonitorTree(sceneId) {
|
|
|
|
|
getMonitorTree(sceneId).then(response => {
|
|
|
|
|
this.editedMonitorUnits = response.data;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getEditedDeviceModes(sceneId) {
|
|
|
|
|
getDeviceModes(sceneId).then(response => {
|
|
|
|
|
this.editedDeviceModes = response.data;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getGatewayDevices(sceneId) {
|
|
|
|
|
getGatewayDevices(sceneId).then(response => {
|
|
|
|
|
this.editedGatewayDevices = response.data;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sceneChange(sceneId) {
|
|
|
|
|
this.form.monitorUnitId = null;
|
|
|
|
|
this.queryParams.monitorUnitId = null;
|
|
|
|
|
this.form.deivceModeId = null;
|
|
|
|
|
this.queryParams.deviceModeId = null;
|
|
|
|
|
this.getEditedMonitorTree(sceneId);
|
|
|
|
|
this.getEditedDeviceModes(sceneId);
|
|
|
|
|
this.getGatewayDevices(sceneId);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deviceTypeChange(deviceType) {
|
|
|
|
|
if (deviceType === this.DEVICE_TYPE_GATEWAY_DEVICE || deviceType === this.DEVICE_TYPE_DIRECT_CONNECT_DEVICE) {
|
|
|
|
|
this.form.releatedDeviceId = null;
|
|
|
|
|
this.form.deviceModeId = null;
|
|
|
|
|
this.form.accessProtocol = this.DEVICE_ACCESS_PROTOCOL_WIFI;
|
|
|
|
|
this.form.networkingMode = "1";
|
|
|
|
|
this.deviceVisible = true;
|
|
|
|
|
this.subDeviceVisible = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.form.networkingMode = null;
|
|
|
|
|
this.form.accessProtocol = null;
|
|
|
|
|
this.form.dataFormat = null;
|
|
|
|
|
this.subDeviceVisible = true;
|
|
|
|
|
this.deviceVisible = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
monitorUnitSelect(node) {
|
|
|
|
|
if (node.children !== undefined) {
|
|
|
|
|
this.form.monitorUnitId = null;
|
|
|
|
|
this.$modal.msgWarning("请选择子级监控单元");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
normalizer(node) {
|
|
|
|
|
return {
|
|
|
|
|
id: node.id,
|
|
|
|
|
label: node.label,
|
|
|
|
|
children: node.children,
|
|
|
|
|
isDisabled: node.children !== undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// if (!node.children) {
|
|
|
|
|
// return {
|
|
|
|
|
// id: node.monitorUnitId,
|
|
|
|
|
// label: node.monitorUnitName
|
|
|
|
|
// };
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 设备状态修改
|
|
|
|
|
handleDeviceStatusChange(row) {
|
|
|
|
|
if(row.deviceStatus==='0' && row.activeStatus === '0'){
|
|
|
|
|
this.$modal.msgSuccess("激活后才能修改为发布状态");
|
|
|
|
|
row.deviceStatus = row.deviceStatus === "0" ? "1" : "0";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let text = row.deviceStatus === "1" ? "测试" : "发布";
|
|
|
|
|
this.$modal.confirm('确认要改为'+text+'状态吗?').then(function () {
|
|
|
|
|
return changeDeviceStatus(row.deviceId, row.deviceStatus);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.$modal.msgSuccess("修改状态成功");
|
|
|
|
|
}).catch(function () {
|
|
|
|
|
row.deviceStatus = row.deviceStatus === "0" ? "1" : "0";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|