20260329:设备管理界面加机构筛选;根据IP获取经纬度失败直接返回;自动获取imei优化

This commit is contained in:
George 2026-03-29 18:35:27 +08:00
parent 60cb958daa
commit 6dbfa2f09c
7 changed files with 885 additions and 732 deletions

View File

@ -99,6 +99,12 @@ public class PowerOnTriggerTaskExecutor {
log.warn("设备不存在,无法下发指令,设备编号:{}", serialNumber); log.warn("设备不存在,无法下发指令,设备编号:{}", serialNumber);
return; return;
} }
if (StringUtils.isNotEmpty(device.getImei()) && StringUtils.isNotEmpty(device.getIccid()) && (device.getLongitude() != null && device.getLatitude() != null)) {
log.warn("设备IMEI/ICCID/位置信息不为空,无需下发指令,设备编号:{}", serialNumber);
return;
}
if (!(device.getDeviceType() == DeviceType.DIRECT_DEVICE.getCode() || device.getDeviceType() == DeviceType.GATEWAY.getCode())) { if (!(device.getDeviceType() == DeviceType.DIRECT_DEVICE.getCode() || device.getDeviceType() == DeviceType.GATEWAY.getCode())) {
log.warn("设备类型不为直连或网关,无需下发指令,设备编号:{}", serialNumber); log.warn("设备类型不为直连或网关,无需下发指令,设备编号:{}", serialNumber);
return; return;

View File

@ -30,7 +30,7 @@ public class DeviceAllShortOutput {
private String productName; private String productName;
/** /**
* 设备类型(1-直连设备、2-网关子设备、3-网关设备) * 设备类型(1-直连设备、2-网关设备、3-监控设备 4-网关子设备)
*/ */
private Integer deviceType; private Integer deviceType;

View File

@ -1647,7 +1647,7 @@ public class DeviceServiceImpl implements IDeviceService {
AddressInfo addressInfo = service.getAddressByCoordinate(platformCoordinate); AddressInfo addressInfo = service.getAddressByCoordinate(platformCoordinate);
String networkAddress = StringUtils.isEmpty(addressInfo.getBuilding()) ? addressInfo.getFormattedAddress() : addressInfo.getBuilding(); String networkAddress = StringUtils.isEmpty(addressInfo.getBuilding()) ? addressInfo.getFormattedAddress() : addressInfo.getBuilding();
device.setNetworkAddress(networkAddress); device.setNetworkAddress(networkAddress);
log.info("{}- 设置地址:{}", device.getSerialNumber(), networkAddress); log.info("{}- LBS设备设置地址:{}", device.getSerialNumber(), networkAddress);
} }
return; return;
} }
@ -1655,7 +1655,11 @@ public class DeviceServiceImpl implements IDeviceService {
// 根据IP获取地址 // 根据IP获取地址
String address = ipAddressService.getAddressByIP(ip); String address = ipAddressService.getAddressByIP(ip);
device.setNetworkAddress(address); device.setNetworkAddress(address);
log.info("{}- 设置地址:{}", device.getSerialNumber(), address); // 地址获取失败 直接返回
if (StringUtils.isEmpty(address) || "内网IP".equals(address) || "未知地址".equals(address)) {
log.error("{}- IP获取地址失败:{}", device.getSerialNumber(), address);
return;
}
// 查询经纬度 // 查询经纬度
Coordinate coordinate = service.getCoordinateByAddress(address); Coordinate coordinate = service.getCoordinateByAddress(address);
Coordinate wgs84Coordinate = service.convertToWgs84(coordinate); Coordinate wgs84Coordinate = service.convertToWgs84(coordinate);

View File

@ -48,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceType" column="device_type" /> <result property="deviceType" column="device_type" />
<result property="imei" column="imei" /> <result property="imei" column="imei" />
<result property="iccid" column="iccid" /> <result property="iccid" column="iccid" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
</resultMap> </resultMap>
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult"> <resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
@ -463,7 +465,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select select
p.device_type as device_type, p.device_type as device_type,
d.imei as imei, d.imei as imei,
d.iccid as iccid d.iccid as iccid,
d.longitude,
d.latitude
from iot_device d from iot_device d
left join iot_product p on p.product_id = d.product_id left join iot_product p on p.product_id = d.product_id
where d.serial_number = #{serialNumber} where d.serial_number = #{serialNumber}

View File

@ -426,6 +426,8 @@
"device.index.105953-3": "Please Enter DeviceNum", "device.index.105953-3": "Please Enter DeviceNum",
"device.index.105953-4": "Device Status", "device.index.105953-4": "Device Status",
"device.index.105953-5": "Please Select The Device Status", "device.index.105953-5": "Please Select The Device Status",
"device.index.105953-59": "Organization",
"device.index.105953-60": "Select organization (empty = current dept)",
"device.index.105953-6": "My Group", "device.index.105953-6": "My Group",
"device.index.105953-7": "Please Select My Group", "device.index.105953-7": "Please Select My Group",
"device.index.105953-8": "Search", "device.index.105953-8": "Search",

View File

@ -426,6 +426,8 @@
"device.index.105953-3": "请输入设备编号", "device.index.105953-3": "请输入设备编号",
"device.index.105953-4": "设备状态", "device.index.105953-4": "设备状态",
"device.index.105953-5": "请选择设备状态", "device.index.105953-5": "请选择设备状态",
"device.index.105953-59": "机构",
"device.index.105953-60": "请选择机构(空则本部门)",
"device.index.105953-6": "我的分组", "device.index.105953-6": "我的分组",
"device.index.105953-7": "请选择我的分组", "device.index.105953-7": "请选择我的分组",
"device.index.105953-8": "搜索", "device.index.105953-8": "搜索",

View File

@ -14,17 +14,37 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('device.index.105953-59')" prop="deptId" class="compact-dept">
<treeselect
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
:clearable="true"
:placeholder="$t('device.index.105953-60')"
append-to-body
class="treeselect-mini"
style="width: 150px"
/>
</el-form-item>
<template v-if="searchShow"> <template v-if="searchShow">
<el-form-item :label="$t('device.index.105953-6')"> <el-form-item :label="$t('device.index.105953-6')">
<el-select v-model="queryParams.groupId" :placeholder="$t('device.index.105953-7')" clearable style="width: 150px"> <el-select v-model="queryParams.groupId" :placeholder="$t('device.index.105953-7')" clearable
<el-option v-for="group in myGroupList" :key="group.groupId" :label="group.groupName" :value="group.groupId" /> style="width: 150px">
<el-option v-for="group in myGroupList" :key="group.groupId" :label="group.groupName"
:value="group.groupId"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
<el-form-item style="float: right"> <el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('device.index.105953-8') }}</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('device.index.105953-9') }}</el-button> {{ $t('device.index.105953-8') }}
</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{
$t('device.index.105953-9')
}}
</el-button>
<el-button type="text" @click="searchChange"> <el-button type="text" @click="searchChange">
{{ searchShow ? $t('template.index.891112-113') : $t('template.index.891112-112') }} {{ searchShow ? $t('template.index.891112-113') : $t('template.index.891112-112') }}
<i :class="{ 'el-icon-arrow-down': !searchShow, 'el-icon-arrow-up': searchShow }"></i> <i :class="{ 'el-icon-arrow-down': !searchShow, 'el-icon-arrow-up': searchShow }"></i>
@ -42,8 +62,12 @@
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleEditDevice" v-hasPermi="['iot:device:add']">{{ $t('device.index.105953-11') }}</el-dropdown-item> <el-dropdown-item command="handleEditDevice" v-hasPermi="['iot:device:add']">
<el-dropdown-item command="handleBatchImport" v-hasPermi="['iot:device:add']">{{ $t('device.index.105953-12') }}</el-dropdown-item> {{ $t('device.index.105953-11') }}
</el-dropdown-item>
<el-dropdown-item command="handleBatchImport" v-hasPermi="['iot:device:add']">
{{ $t('device.index.105953-12') }}
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-col> </el-col>
@ -54,36 +78,54 @@
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="handleSelectAllot" v-hasPermi="['iot:device:assignment']">{{ $t('device.index.105953-14') }}</el-dropdown-item> <el-dropdown-item command="handleSelectAllot" v-hasPermi="['iot:device:assignment']">
<el-dropdown-item command="handleImportAllot" v-hasPermi="['iot:device:assignment']">{{ $t('device.index.105953-15') }}</el-dropdown-item> {{ $t('device.index.105953-14') }}
</el-dropdown-item>
<el-dropdown-item command="handleImportAllot" v-hasPermi="['iot:device:assignment']">
{{ $t('device.index.105953-15') }}
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button size="mini" type="primary" plain @click="recycleDevice" v-hasPermi="['iot:device:recovery']">{{ $t('device.index.105953-16') }}</el-button> <el-button size="mini" type="primary" plain @click="recycleDevice" v-hasPermi="['iot:device:recovery']">
{{ $t('device.index.105953-16') }}
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-dropdown @command="(command) => handleCommandMore(command)" v-hasPermi="['iot:device:record:list', 'iot:device:batchGenerator']"> <el-dropdown @command="(command) => handleCommandMore(command)"
v-hasPermi="['iot:device:record:list', 'iot:device:batchGenerator']">
<el-button size="mini" type="primary" plain> <el-button size="mini" type="primary" plain>
{{ $t('device.index.105953-48') }} {{ $t('device.index.105953-48') }}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="importRecord" v-hasPermi="['iot:device:record:list']">{{ $t('device.index.105953-49') }}</el-dropdown-item> <el-dropdown-item command="importRecord" v-hasPermi="['iot:device:record:list']">
<el-dropdown-item command="generateSerialNumber" v-hasPermi="['iot:device:batchGenerator']">{{ $t('device.index.105953-50') }}</el-dropdown-item> {{ $t('device.index.105953-49') }}
<el-dropdown-item command="recycleRecord" v-hasPermi="['iot:device:record:list']">{{ $t('device.index.105953-51') }}</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item command="allotRecord" v-hasPermi="['iot:device:record:list']">{{ $t('device.index.105953-52') }}</el-dropdown-item> <el-dropdown-item command="generateSerialNumber" v-hasPermi="['iot:device:batchGenerator']">
{{ $t('device.index.105953-50') }}
</el-dropdown-item>
<el-dropdown-item command="recycleRecord" v-hasPermi="['iot:device:record:list']">
{{ $t('device.index.105953-51') }}
</el-dropdown-item>
<el-dropdown-item command="allotRecord" v-hasPermi="['iot:device:record:list']">
{{ $t('device.index.105953-52') }}
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-col> </el-col>
<el-col :span="1.5" style="line-height: 28px"> <el-col :span="1.5" style="line-height: 28px">
<el-checkbox v-model="queryParams.showChild" style="margin: 0px 10px" @change="handleQuery">{{ $t('device.index.105953-18') }}</el-checkbox> <el-checkbox v-model="queryParams.showChild" style="margin: 0px 10px" @change="handleQuery">
<el-tooltip :content="$t('device.index.105953-19')" placement="top"><i class="el-icon-question"></i></el-tooltip> {{ $t('device.index.105953-18') }}
</el-checkbox>
<el-tooltip :content="$t('device.index.105953-19')" placement="top"><i class="el-icon-question"></i>
</el-tooltip>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">
<template> <template>
<el-tooltip effect="dark" content="切换卡片/列表" placement="top"> <el-tooltip effect="dark" content="切换卡片/列表" placement="top">
<el-button size="mini" circle icon="el-icon-s-grid" @click="handleChangeShowType" /> <el-button size="mini" circle icon="el-icon-s-grid" @click="handleChangeShowType"/>
</el-tooltip> </el-tooltip>
</template> </template>
</right-toolbar> </right-toolbar>
@ -91,12 +133,14 @@
<div v-if="showType == 'list'"> <div v-if="showType == 'list'">
<el-table v-loading="loading" :data="deviceList" :border="false"> <el-table v-loading="loading" :data="deviceList" :border="false">
<el-table-column :label="$t('device.index.105953-20')" align="center" header-align="center" prop="deviceId" width="50" /> <el-table-column :label="$t('device.index.105953-20')" align="center" header-align="center" prop="deviceId"
<el-table-column :label="$t('device.index.105953-0')" align="center" header-align="center" prop="deviceName" min-width="180" /> width="50"/>
<el-table-column :label="$t('device.index.105953-2')" align="center" prop="serialNumber" min-width="180" /> <el-table-column :label="$t('device.index.105953-0')" align="center" header-align="center" prop="deviceName"
<el-table-column :label="$t('device.index.105953-21')" align="center" prop="productName" min-width="180" /> min-width="180"/>
<el-table-column :label="$t('device.index.105953-22')" align="center" prop="transport" min-width="90" /> <el-table-column :label="$t('device.index.105953-2')" align="center" prop="serialNumber" min-width="180"/>
<el-table-column :label="$t('device.index.105953-23')" align="center" prop="protocolCode" min-width="150" /> <el-table-column :label="$t('device.index.105953-21')" align="center" prop="productName" min-width="180"/>
<el-table-column :label="$t('device.index.105953-22')" align="center" prop="transport" min-width="90"/>
<el-table-column :label="$t('device.index.105953-23')" align="center" prop="protocolCode" min-width="150"/>
<el-table-column :label="$t('device.index.105953-24')" align="center" prop="subDeviceCount" width="80"> <el-table-column :label="$t('device.index.105953-24')" align="center" prop="subDeviceCount" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.subDeviceCount }} {{ scope.row.subDeviceCount }}
@ -104,27 +148,33 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('device.index.105953-25')" align="center" prop="isShadow" width="80"> <el-table-column :label="$t('device.index.105953-25')" align="center" prop="isShadow" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" size="small" v-if="scope.row.isShadow == 1">{{ $t('device.index.105953-26') }}</el-tag> <el-tag type="success" size="small" v-if="scope.row.isShadow == 1">{{
$t('device.index.105953-26')
}}
</el-tag>
<el-tag type="info" size="small" v-else>{{ $t('device.index.105953-27') }}</el-tag> <el-tag type="info" size="small" v-else>{{ $t('device.index.105953-27') }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('device.index.105953-28')" align="center" prop="status" width="80"> <el-table-column :label="$t('device.index.105953-28')" align="center" prop="status" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.iot_device_status" :value="scope.row.status" size="small" /> <dict-tag :options="dict.type.iot_device_status" :value="scope.row.status" size="small"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('device.index.105953-29')" align="center" prop="rssi" width="60"> <el-table-column :label="$t('device.index.105953-29')" align="center" prop="rssi" width="60">
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon v-if="scope.row.status == 3 && scope.row.rssi >= '-55'" icon-class="wifi_4" /> <svg-icon v-if="scope.row.status == 3 && scope.row.rssi >= '-55'" icon-class="wifi_4"/>
<svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-70' && scope.row.rssi < '-55'" icon-class="wifi_3" /> <svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-70' && scope.row.rssi < '-55'"
<svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-85' && scope.row.rssi < '-70'" icon-class="wifi_2" /> icon-class="wifi_3"/>
<svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-100' && scope.row.rssi < '-85'" icon-class="wifi_1" /> <svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-85' && scope.row.rssi < '-70'"
<svg-icon v-else icon-class="wifi_0" /> icon-class="wifi_2"/>
<svg-icon v-else-if="scope.row.status == 3 && scope.row.rssi >= '-100' && scope.row.rssi < '-85'"
icon-class="wifi_1"/>
<svg-icon v-else icon-class="wifi_0"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('device.index.105953-30')" align="center" prop="locationWay" width="100"> <el-table-column :label="$t('device.index.105953-30')" align="center" prop="locationWay" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.iot_location_way" :value="scope.row.locationWay" size="small" /> <dict-tag :options="dict.type.iot_location_way" :value="scope.row.locationWay" size="small"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('device.index.105953-31')" align="center" prop="firmwareVersion" width="80"> <el-table-column :label="$t('device.index.105953-31')" align="center" prop="firmwareVersion" width="80">
@ -143,75 +193,105 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" :label="$t('device.index.105953-34')" align="center" class-name="small-padding fixed-width" width="183"> <el-table-column fixed="right" :label="$t('device.index.105953-34')" align="center"
class-name="small-padding fixed-width" width="183">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:device:remove']"> <el-button type="text" size="small" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['iot:device:remove']">
{{ $t('device.index.105953-35') }} {{ $t('device.index.105953-35') }}
</el-button> </el-button>
<el-button type="text" size="small" icon="el-icon-view" @click="handleEditDevice(scope.row)" v-hasPermi="['iot:device:query']"> <el-button type="text" size="small" icon="el-icon-view" @click="handleEditDevice(scope.row)"
v-hasPermi="['iot:device:query']">
{{ $t('device.index.105953-36') }} {{ $t('device.index.105953-36') }}
</el-button> </el-button>
<el-button type="text" size="small" @click="openSummaryDialog(scope.row)" v-if="form.deviceId != 0" v-hasPermi="['iot:device:query']"> <el-button type="text" size="small" @click="openSummaryDialog(scope.row)" v-if="form.deviceId != 0"
v-hasPermi="['iot:device:query']">
{{ $t('device.index.105953-37') }} {{ $t('device.index.105953-37') }}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination style="margin-bottom: 20px" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList" /> <pagination style="margin-bottom: 20px" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList"/>
</div> </div>
<div v-if="showType == 'card'"> <div v-if="showType == 'card'">
<el-row :gutter="20" v-loading="loading" style="display: flex; flex-wrap: wrap;"> <el-row :gutter="20" v-loading="loading" style="display: flex; flex-wrap: wrap;">
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" v-for="(item, index) in deviceList" :key="index" style="margin-bottom: 20px; text-align: center; display: flex;"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" v-for="(item, index) in deviceList" :key="index"
<el-card :body-style="{ padding: '20px', display: 'flex', flexDirection: 'column', height: '100%' }" shadow="always" style="width: 100%; display: flex; flex-direction: column;"> style="margin-bottom: 20px; text-align: center; display: flex;">
<el-card :body-style="{ padding: '20px', display: 'flex', flexDirection: 'column', height: '100%' }"
shadow="always" style="width: 100%; display: flex; flex-direction: column;">
<el-row type="flex" :gutter="10" justify="space-between"> <el-row type="flex" :gutter="10" justify="space-between">
<el-col :span="20" style="text-align: left"> <el-col :span="20" style="text-align: left">
<el-link type="" :underline="false" @click="handleDeviceDetail(item)" style="font-weight: bold; font-size: 16px; line-height: 32px; display: flex; align-items: center; width: 100%;"> <el-link type="" :underline="false" @click="handleDeviceDetail(item)"
<el-tooltip class="item" effect="dark" :content="$t('device.index.105953-38')" placement="top-start"> style="font-weight: bold; font-size: 16px; line-height: 32px; display: flex; align-items: center; width: 100%;">
<svg-icon icon-class="share" style="font-size: 20px; flex-shrink: 0;" v-if="item.isOwner != 1" /> <el-tooltip class="item" effect="dark" :content="$t('device.index.105953-38')"
placement="top-start">
<svg-icon icon-class="share" style="font-size: 20px; flex-shrink: 0;" v-if="item.isOwner != 1"/>
</el-tooltip> </el-tooltip>
<svg-icon icon-class="device" style="flex-shrink: 0;" v-if="item.isOwner == 1" /> <svg-icon icon-class="device" style="flex-shrink: 0;" v-if="item.isOwner == 1"/>
<el-tooltip :content="item.deviceName" placement="top" :disabled="!item.deviceName || item.deviceName.length <= 20"> <el-tooltip :content="item.deviceName" placement="top"
<span style="margin: 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;">{{ item.deviceName }}</span> :disabled="!item.deviceName || item.deviceName.length <= 20">
<span
style="margin: 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;">{{
item.deviceName
}}</span>
</el-tooltip> </el-tooltip>
<!-- <el-tag size="mini" type="info">Ver {{item.firmwareVersion}}</el-tag>--> <!-- <el-tag size="mini" type="info">Ver {{item.firmwareVersion}}</el-tag>-->
<!-- <el-text v-if="item.protocolCode" type="info" size="mini" style="font-size: 14px; color: #ccc">{{ item.protocolCode }}</el-text> --> <!-- <el-text v-if="item.protocolCode" type="info" size="mini" style="font-size: 14px; color: #ccc">{{ item.protocolCode }}</el-text> -->
</el-link> </el-link>
</el-col> </el-col>
<el-col :span="1.5" style="font-size: 20px; padding-top: 5px; cursor: pointer"> <el-col :span="1.5" style="font-size: 20px; padding-top: 5px; cursor: pointer">
<svg-icon icon-class="qrcode" @click="openSummaryDialog(item)" v-hasPermi="['iot:device:query']" /> <svg-icon icon-class="qrcode" @click="openSummaryDialog(item)" v-hasPermi="['iot:device:query']"/>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<div style="font-size: 28px; color: #ccc"> <div style="font-size: 28px; color: #ccc">
<svg-icon v-if="item.status == 3 && item.rssi >= '-55'" icon-class="wifi_4" /> <svg-icon v-if="item.status == 3 && item.rssi >= '-55'" icon-class="wifi_4"/>
<svg-icon v-else-if="item.status == 3 && item.rssi >= '-70' && item.rssi < '-55'" icon-class="wifi_3" /> <svg-icon v-else-if="item.status == 3 && item.rssi >= '-70' && item.rssi < '-55'"
<svg-icon v-else-if="item.status == 3 && item.rssi >= '-85' && item.rssi < '-70'" icon-class="wifi_2" /> icon-class="wifi_3"/>
<svg-icon v-else-if="item.status == 3 && item.rssi >= '-100' && item.rssi < '-85'" icon-class="wifi_1" /> <svg-icon v-else-if="item.status == 3 && item.rssi >= '-85' && item.rssi < '-70'"
<svg-icon v-else icon-class="wifi_0" /> icon-class="wifi_2"/>
<svg-icon v-else-if="item.status == 3 && item.rssi >= '-100' && item.rssi < '-85'"
icon-class="wifi_1"/>
<svg-icon v-else icon-class="wifi_0"/>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="10" style="flex: 1; min-height: 0;"> <el-row :gutter="10" style="flex: 1; min-height: 0;">
<el-col :span="17" style="display: flex; flex-direction: column;"> <el-col :span="17" style="display: flex; flex-direction: column;">
<div style="text-align: left; line-height: 28px; min-height: 28px; word-wrap: break-word; overflow-wrap: break-word; flex-shrink: 0;"> <div
<dict-tag :options="dict.type.iot_device_status" :value="item.status" size="mini" style="display: inline-block; margin-bottom: 4px; vertical-align: middle;" /> style="text-align: left; line-height: 28px; min-height: 28px; word-wrap: break-word; overflow-wrap: break-word; flex-shrink: 0;">
<dict-tag :options="dict.type.iot_device_status" :value="item.status" size="mini"
style="display: inline-block; margin-bottom: 4px; vertical-align: middle;"/>
<span style="display: inline-block; margin: 0 5px 4px 5px; vertical-align: middle;"> <span style="display: inline-block; margin: 0 5px 4px 5px; vertical-align: middle;">
<el-tag type="primary" size="mini" v-if="item.protocolCode" style="margin-bottom: 4px;">{{ item.protocolCode }}</el-tag> <el-tag type="primary" size="mini" v-if="item.protocolCode"
style="margin-bottom: 4px;">{{ item.protocolCode }}</el-tag>
</span> </span>
<el-tag type="primary" size="mini" v-if="item.transport" style="margin-bottom: 4px;">{{ item.transport }}</el-tag> <el-tag type="primary" size="mini" v-if="item.transport" style="margin-bottom: 4px;">
<el-tag type="danger" size="mini" style="display: inline-block; margin: 0 0 4px 5px;" v-if="item.alertCount"> {{ item.transport }}
</el-tag>
<el-tag type="danger" size="mini" style="display: inline-block; margin: 0 0 4px 5px;"
v-if="item.alertCount">
{{ $t('device.index.105953-53') }}{{ item.alertCount.unprocessedCount }} {{ $t('device.index.105953-53') }}{{ item.alertCount.unprocessedCount }}
</el-tag> </el-tag>
</div> </div>
<el-descriptions :column="1" size="mini" style="margin-top: 8px; flex: 1;"> <el-descriptions :column="1" size="mini" style="margin-top: 8px; flex: 1;">
<el-descriptions-item :label="$t('device.index.105953-20')"> <el-descriptions-item :label="$t('device.index.105953-20')">
<el-tooltip :content="item.serialNumber" placement="top" :disabled="!item.serialNumber || item.serialNumber.length <= 15"> <el-tooltip :content="item.serialNumber" placement="top"
<span style="display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ item.serialNumber }}</span> :disabled="!item.serialNumber || item.serialNumber.length <= 15">
<span
style="display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{
item.serialNumber
}}</span>
</el-tooltip> </el-tooltip>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('device.index.105953-39')"> <el-descriptions-item :label="$t('device.index.105953-39')">
<el-tooltip :content="item.productName" placement="top" :disabled="!item.productName || item.productName.length <= 20"> <el-tooltip :content="item.productName" placement="top"
<span style="display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ item.productName }}</span> :disabled="!item.productName || item.productName.length <= 20">
<span
style="display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{
item.productName
}}</span>
</el-tooltip> </el-tooltip>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('device.index.105953-32')"> <el-descriptions-item :label="$t('device.index.105953-32')">
@ -254,13 +334,16 @@
</el-col> </el-col>
</el-row> </el-row>
<el-button-group style="margin-top: 15px; width: 100%; display: flex; justify-content: center;"> <el-button-group style="margin-top: 15px; width: 100%; display: flex; justify-content: center;">
<el-button type="danger" size="mini" style="padding: 5px 10px; flex: 1;" icon="el-icon-delete" @click="handleDelete(item)" v-hasPermi="['iot:device:remove']"> <el-button type="danger" size="mini" style="padding: 5px 10px; flex: 1;" icon="el-icon-delete"
@click="handleDelete(item)" v-hasPermi="['iot:device:remove']">
{{ $t('device.index.105953-35') }} {{ $t('device.index.105953-35') }}
</el-button> </el-button>
<el-button type="primary" size="mini" style="padding: 5px 15px; flex: 1;" icon="el-icon-view" @click="handleEditDevice(item, 'basic')" v-hasPermi="['iot:device:query']"> <el-button type="primary" size="mini" style="padding: 5px 15px; flex: 1;" icon="el-icon-view"
@click="handleEditDevice(item, 'basic')" v-hasPermi="['iot:device:query']">
{{ $t('device.index.105953-36') }} {{ $t('device.index.105953-36') }}
</el-button> </el-button>
<el-button type="success" size="mini" style="padding: 5px 15px; flex: 1;" icon="el-icon-odometer" @click="handleRunDevice(item)" v-hasPermi="['iot:device:query']"> <el-button type="success" size="mini" style="padding: 5px 15px; flex: 1;" icon="el-icon-odometer"
@click="handleRunDevice(item)" v-hasPermi="['iot:device:query']">
{{ $t('device.index.105953-40') }} {{ $t('device.index.105953-40') }}
</el-button> </el-button>
</el-button-group> </el-button-group>
@ -268,7 +351,8 @@
</el-col> </el-col>
</el-row> </el-row>
<el-empty :description="$t('device.index.105953-41')" v-if="total == 0"></el-empty> <el-empty :description="$t('device.index.105953-41')" v-if="total == 0"></el-empty>
<pagination style="margin: 0 0 20px 0" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList" /> <pagination style="margin: 0 0 20px 0" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList"/>
</div> </div>
</el-card> </el-card>
@ -283,11 +367,14 @@
<el-dialog :title="$t('device.index.105953-54')" :visible.sync="openGenerate" width="500px" append-to-body> <el-dialog :title="$t('device.index.105953-54')" :visible.sync="openGenerate" width="500px" append-to-body>
<el-form v-model="elForm" style="height: 100%; padding: 0 20px"> <el-form v-model="elForm" style="height: 100%; padding: 0 20px">
<el-form-item label-width="80px" :label="$t('device.index.105953-55')"> <el-form-item label-width="80px" :label="$t('device.index.105953-55')">
<el-input v-model="elForm.count" type="number" style="width: 240px" :max="200" oninput="if(value>200)value=200;if(value<0)value=0"></el-input> <el-input v-model="elForm.count" type="number" style="width: 240px" :max="200"
oninput="if(value>200)value=200;if(value<0)value=0"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-hasPermi="['iot:device:batchGenerator']">{{ $t('device.index.105953-56') }}</el-button> <el-button type="primary" @click="submitForm" v-hasPermi="['iot:device:batchGenerator']">
{{ $t('device.index.105953-56') }}
</el-button>
<el-button @click="openGenerate = false">{{ $t('device.index.105953-57') }}</el-button> <el-button @click="openGenerate = false">{{ $t('device.index.105953-57') }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -306,9 +393,10 @@
<script> <script>
import vueQr from 'vue-qr'; import vueQr from 'vue-qr';
import { listDeviceShort, delDevice } from '@/api/iot/device'; import {listDeviceShort, delDevice} from '@/api/iot/device';
import { listGroup } from '@/api/iot/group'; import {listGroup} from '@/api/iot/group';
import { delSipDeviceBySipId } from '@/api/iot/sipdevice'; import {deptsTreeSelect} from '@/api/system/user';
import {delSipDeviceBySipId} from '@/api/iot/sipdevice';
import auth from '@/plugins/auth'; import auth from '@/plugins/auth';
import Treeselect from '@riophae/vue-treeselect'; import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css'; import '@riophae/vue-treeselect/dist/vue-treeselect.css';
@ -317,6 +405,7 @@ import allotImport from './allot-import-dialog';
import importRecord from './import-record'; import importRecord from './import-record';
import recycleRecord from './recycle-record'; import recycleRecord from './recycle-record';
import allotRecord from './allot-record'; import allotRecord from './allot-record';
export default { export default {
name: 'Device', name: 'Device',
dicts: ['iot_device_status', 'iot_is_enable', 'iot_location_way', 'iot_transport_type'], dicts: ['iot_device_status', 'iot_is_enable', 'iot_location_way', 'iot_transport_type'],
@ -349,17 +438,20 @@ export default {
deviceList: [], deviceList: [],
// 我的分组列表数据 // 我的分组列表数据
myGroupList: [], myGroupList: [],
// 机构树
deptOptions: [],
// 根路径 // 根路径
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 12, pageSize: 12,
showChild: true, showChild: false,
entrance: 1, entrance: 1,
deviceName: null, deviceName: null,
productId: null, productId: null,
groupId: null, groupId: null,
deptId: null,
productName: null, productName: null,
userId: null, userId: null,
userName: null, userName: null,
@ -416,6 +508,7 @@ export default {
this.queryParams.productId = null; this.queryParams.productId = null;
this.queryParams.groupId = null; this.queryParams.groupId = null;
} }
this.getDeptTree();
this.connectMqtt(); this.connectMqtt();
}, },
activated() { activated() {
@ -618,6 +711,12 @@ export default {
} }
this.$mqttTool.subscribe(topics); this.$mqttTool.subscribe(topics);
}, },
/** 查询机构下拉树 */
getDeptTree() {
deptsTreeSelect().then((response) => {
this.deptOptions = response.data || [];
});
},
/** 查询设备分组列表 */ /** 查询设备分组列表 */
getGroupList() { getGroupList() {
this.loading = true; this.loading = true;
@ -656,7 +755,8 @@ export default {
...this.$route.query, ...this.$route.query,
pageNum: this.queryParams.pageNum, pageNum: this.queryParams.pageNum,
}, },
}).catch(() => {}); }).catch(() => {
});
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -669,6 +769,8 @@ export default {
this.queryParams.productId = null; this.queryParams.productId = null;
this.queryParams.groupId = null; this.queryParams.groupId = null;
this.queryParams.serialNumber = null; this.queryParams.serialNumber = null;
this.queryParams.deptId = null;
this.queryParams.showChild = false;
this.resetForm('queryForm'); this.resetForm('queryForm');
this.handleQuery(); this.handleQuery();
}, },
@ -745,7 +847,8 @@ export default {
this.getList(); this.getList();
this.$modal.msgSuccess(this.$t('device.index.105953-47')); this.$modal.msgSuccess(this.$t('device.index.105953-47'));
}) })
.catch(() => {}); .catch(() => {
});
}, },
/** 未启用设备影子*/ /** 未启用设备影子*/
shadowUnEnable(device, thingsModel) { shadowUnEnable(device, thingsModel) {
@ -770,6 +873,10 @@ export default {
.iot-device { .iot-device {
padding: 20px; padding: 20px;
::v-deep .compact-dept {
margin-left: -28px;
}
::v-deep .el-upload-dragger { ::v-deep .el-upload-dragger {
width: 510px; width: 510px;
} }
@ -778,4 +885,32 @@ export default {
font-size: 12px; font-size: 12px;
} }
} }
::v-deep .treeselect-mini {
.vue-treeselect__control {
min-height: 28px;
height: 28px;
border-radius: 4px;
}
.vue-treeselect__placeholder,
.vue-treeselect__single-value {
font-size: 12px;
line-height: 26px;
}
.vue-treeselect__value-remove {
line-height: 24px;
}
.vue-treeselect__arrow {
top: 6px;
}
// 如果下拉菜单也需要迷你风格
.vue-treeselect__option {
font-size: 12px;
padding: 4px 8px;
}
}
</style> </style>