Commit 9ae520a58a805df5a0e8447d327e8459c5e6d845
1 parent
ef58f29c
feat(channel): 新增通道支持自定义名称、位置及云台类型
Showing
2 changed files
with
286 additions
and
112 deletions
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; | @@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform; | ||
| 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 7 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; | 7 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; |
| 8 | import org.apache.ibatis.annotations.*; | 8 | import org.apache.ibatis.annotations.*; |
| 9 | -import org.apache.ibatis.annotations.Param; | ||
| 10 | import org.springframework.stereotype.Repository; | 9 | import org.springframework.stereotype.Repository; |
| 11 | 10 | ||
| 12 | import java.util.List; | 11 | import java.util.List; |
| @@ -31,7 +30,7 @@ public interface DeviceChannelMapper { | @@ -31,7 +30,7 @@ public interface DeviceChannelMapper { | ||
| 31 | @Update(value = {" <script>" + | 30 | @Update(value = {" <script>" + |
| 32 | "UPDATE wvp_device_channel " + | 31 | "UPDATE wvp_device_channel " + |
| 33 | "SET update_time=#{updateTime}" + | 32 | "SET update_time=#{updateTime}" + |
| 34 | - "<if test='name != null'>, name=#{name}</if>" + | 33 | + ", custom_name=#{name}" + |
| 35 | "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + | 34 | "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + |
| 36 | "<if test='model != null'>, model=#{model}</if>" + | 35 | "<if test='model != null'>, model=#{model}</if>" + |
| 37 | "<if test='owner != null'>, owner=#{owner}</if>" + | 36 | "<if test='owner != null'>, owner=#{owner}</if>" + |
| @@ -49,12 +48,12 @@ public interface DeviceChannelMapper { | @@ -49,12 +48,12 @@ public interface DeviceChannelMapper { | ||
| 49 | "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + | 48 | "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + |
| 50 | "<if test='port != null'>, port=#{port}</if>" + | 49 | "<if test='port != null'>, port=#{port}</if>" + |
| 51 | "<if test='password != null'>, password=#{password}</if>" + | 50 | "<if test='password != null'>, password=#{password}</if>" + |
| 52 | - "<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" + | 51 | + "<if test='PTZType != null'>, custom_ptz_type=#{PTZType}</if>" + |
| 53 | "<if test='status != null'>, status=#{status}</if>" + | 52 | "<if test='status != null'>, status=#{status}</if>" + |
| 54 | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + | 53 | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + |
| 55 | "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + | 54 | "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + |
| 56 | - "<if test='longitude != null'>, longitude=#{longitude}</if>" + | ||
| 57 | - "<if test='latitude != null'>, latitude=#{latitude}</if>" + | 55 | + ", custom_longitude=#{longitude}" + |
| 56 | + ", custom_latitude=#{latitude}" + | ||
| 58 | "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" + | 57 | "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" + |
| 59 | "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" + | 58 | "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" + |
| 60 | "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" + | 59 | "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" + |
| @@ -67,7 +66,43 @@ public interface DeviceChannelMapper { | @@ -67,7 +66,43 @@ public interface DeviceChannelMapper { | ||
| 67 | 66 | ||
| 68 | @Select(value = {" <script>" + | 67 | @Select(value = {" <script>" + |
| 69 | "SELECT " + | 68 | "SELECT " + |
| 70 | - "dc.* " + | 69 | + "dc.id, " + |
| 70 | + "dc.channel_id, " + | ||
| 71 | + "COALESCE(dc.custom_name, dc.name) AS name, " + | ||
| 72 | + "dc.manufacture, " + | ||
| 73 | + "dc.model, " + | ||
| 74 | + "dc.owner, " + | ||
| 75 | + "dc.civil_code, " + | ||
| 76 | + "dc.block, " + | ||
| 77 | + "dc.address, " + | ||
| 78 | + "dc.parent_id, " + | ||
| 79 | + "dc.safety_way, " + | ||
| 80 | + "dc.register_way, " + | ||
| 81 | + "dc.cert_num, " + | ||
| 82 | + "dc.certifiable, " + | ||
| 83 | + "dc.err_code, " + | ||
| 84 | + "dc.end_time, " + | ||
| 85 | + "dc.secrecy, " + | ||
| 86 | + "dc.ip_address, " + | ||
| 87 | + "dc.port, " + | ||
| 88 | + "dc.password, " + | ||
| 89 | + "COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " + | ||
| 90 | + "dc.status, " + | ||
| 91 | + "COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " + | ||
| 92 | + "COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " + | ||
| 93 | + "dc.stream_id, " + | ||
| 94 | + "dc.device_id, " + | ||
| 95 | + "dc.parental, " + | ||
| 96 | + "dc.has_audio, " + | ||
| 97 | + "dc.create_time, " + | ||
| 98 | + "dc.update_time, " + | ||
| 99 | + "dc.sub_count, " + | ||
| 100 | + "dc.longitude_gcj02, " + | ||
| 101 | + "dc.latitude_gcj02, " + | ||
| 102 | + "dc.longitude_wgs84, " + | ||
| 103 | + "dc.latitude_wgs84, " + | ||
| 104 | + "dc.business_group_id, " + | ||
| 105 | + "dc.gps_time " + | ||
| 71 | "from " + | 106 | "from " + |
| 72 | "wvp_device_channel dc " + | 107 | "wvp_device_channel dc " + |
| 73 | "WHERE " + | 108 | "WHERE " + |
| @@ -154,7 +189,7 @@ public interface DeviceChannelMapper { | @@ -154,7 +189,7 @@ public interface DeviceChannelMapper { | ||
| 154 | " dc.id,\n" + | 189 | " dc.id,\n" + |
| 155 | " dc.channel_id,\n" + | 190 | " dc.channel_id,\n" + |
| 156 | " dc.device_id,\n" + | 191 | " dc.device_id,\n" + |
| 157 | - " dc.name,\n" + | 192 | + " COALESCE(dc.custom_name, dc.name) AS name,\n" + |
| 158 | " de.manufacturer,\n" + | 193 | " de.manufacturer,\n" + |
| 159 | " de.host_address,\n" + | 194 | " de.host_address,\n" + |
| 160 | " dc.sub_count,\n" + | 195 | " dc.sub_count,\n" + |
| @@ -392,10 +427,10 @@ public interface DeviceChannelMapper { | @@ -392,10 +427,10 @@ public interface DeviceChannelMapper { | ||
| 392 | @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") | 427 | @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") |
| 393 | List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode); | 428 | List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode); |
| 394 | 429 | ||
| 395 | - @Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " + | 430 | + @Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " + |
| 396 | " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " + | 431 | " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " + |
| 397 | - " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " + | ||
| 398 | - " dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " + | 432 | + " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " + |
| 433 | + " COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " + | ||
| 399 | " from wvp_device_channel dc" + | 434 | " from wvp_device_channel dc" + |
| 400 | " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" + | 435 | " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" + |
| 401 | " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" + | 436 | " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" + |
web_src/src/components/channelList.vue
| @@ -33,98 +33,156 @@ | @@ -33,98 +33,156 @@ | ||
| 33 | <el-option label="流畅" :value="true"></el-option> | 33 | <el-option label="流畅" :value="true"></el-option> |
| 34 | </el-select> | 34 | </el-select> |
| 35 | </div> | 35 | </div> |
| 36 | - <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button> | ||
| 37 | - <el-button v-if="showTree" icon="iconfont icon-list" circle size="mini" @click="switchList()"></el-button> | ||
| 38 | - <el-button v-if="!showTree" icon="iconfont icon-tree" circle size="mini" @click="switchTree()"></el-button> | 36 | + <el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button> |
| 37 | + <el-button v-if="showTree" icon="iconfont icon-list" circle size="mini" @click="switchList()"></el-button> | ||
| 38 | + <el-button v-if="!showTree" icon="iconfont icon-tree" circle size="mini" @click="switchTree()"></el-button> | ||
| 39 | + </div> | ||
| 39 | </div> | 40 | </div> |
| 40 | - </div> | ||
| 41 | - <devicePlayer ref="devicePlayer" ></devicePlayer> | ||
| 42 | - <el-container v-loading="isLoging" style="height: 82vh;"> | ||
| 43 | - <el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree" > | ||
| 44 | - <DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent" ></DeviceTree> | ||
| 45 | - </el-aside> | ||
| 46 | - <el-main style="padding: 5px;"> | ||
| 47 | - <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" header-row-class-name="table-header"> | ||
| 48 | - <el-table-column prop="channelId" label="通道编号" min-width="200"> | ||
| 49 | - </el-table-column> | ||
| 50 | - <el-table-column prop="deviceId" label="设备编号" min-width="200"> | ||
| 51 | - </el-table-column> | ||
| 52 | - <el-table-column prop="name" label="通道名称" min-width="200"> | ||
| 53 | - </el-table-column> | ||
| 54 | - <el-table-column label="快照" min-width="120"> | ||
| 55 | - <template v-slot:default="scope"> | ||
| 56 | - <el-image | ||
| 57 | - :src="getSnap(scope.row)" | ||
| 58 | - :preview-src-list="getBigSnap(scope.row)" | ||
| 59 | - @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)" | ||
| 60 | - :fit="'contain'" | ||
| 61 | - style="width: 60px"> | ||
| 62 | - <div slot="error" class="image-slot"> | ||
| 63 | - <i class="el-icon-picture-outline"></i> | 41 | + <devicePlayer ref="devicePlayer"></devicePlayer> |
| 42 | + <el-container v-loading="isLoging" style="height: 82vh;"> | ||
| 43 | + <el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree"> | ||
| 44 | + <DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent"></DeviceTree> | ||
| 45 | + </el-aside> | ||
| 46 | + <el-main style="padding: 5px;"> | ||
| 47 | + <el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%" | ||
| 48 | + header-row-class-name="table-header"> | ||
| 49 | + <el-table-column prop="channelId" label="通道编号" min-width="200"> | ||
| 50 | + </el-table-column> | ||
| 51 | + <el-table-column prop="deviceId" label="设备编号" min-width="200"> | ||
| 52 | + </el-table-column> | ||
| 53 | + <el-table-column prop="name" label="通道名称" min-width="200"> | ||
| 54 | + <template v-slot:default="scope"> | ||
| 55 | + <el-input | ||
| 56 | + v-show="scope.row.edit" | ||
| 57 | + v-model="scope.row.name" | ||
| 58 | + placeholder="通道名称" | ||
| 59 | + :maxlength="255" | ||
| 60 | + show-word-limit | ||
| 61 | + clearable | ||
| 62 | + /> | ||
| 63 | + <span v-show="!scope.row.edit">{{ scope.row.name }}</span> | ||
| 64 | + </template> | ||
| 65 | + </el-table-column> | ||
| 66 | + <el-table-column label="快照" min-width="120"> | ||
| 67 | + <template v-slot:default="scope"> | ||
| 68 | + <el-image | ||
| 69 | + :src="getSnap(scope.row)" | ||
| 70 | + :preview-src-list="getBigSnap(scope.row)" | ||
| 71 | + @error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)" | ||
| 72 | + :fit="'contain'" | ||
| 73 | + style="width: 60px"> | ||
| 74 | + <div slot="error" class="image-slot"> | ||
| 75 | + <i class="el-icon-picture-outline"></i> | ||
| 76 | + </div> | ||
| 77 | + </el-image> | ||
| 78 | + </template> | ||
| 79 | + </el-table-column> | ||
| 80 | + <el-table-column prop="subCount" label="子节点数" min-width="120"> | ||
| 81 | + </el-table-column> | ||
| 82 | + <el-table-column prop="manufacture" label="厂家" min-width="120"> | ||
| 83 | + </el-table-column> | ||
| 84 | + <el-table-column label="位置信息" min-width="200"> | ||
| 85 | + <template v-slot:default="scope"> | ||
| 86 | + <el-input | ||
| 87 | + v-show="scope.row.edit" | ||
| 88 | + v-model="scope.row.location" | ||
| 89 | + placeholder="例:117.234,36.378" | ||
| 90 | + :maxlength="30" | ||
| 91 | + show-word-limit | ||
| 92 | + clearable | ||
| 93 | + /> | ||
| 94 | + <span v-show="!scope.row.edit">{{ scope.row.location }}</span> | ||
| 95 | + </template> | ||
| 96 | + </el-table-column> | ||
| 97 | + <el-table-column prop="PTZType" label="云台类型" min-width="120"> | ||
| 98 | + <template v-slot:default="scope"> | ||
| 99 | + <el-select v-show="scope.row.edit" v-model="scope.row.PTZType" | ||
| 100 | + placeholder="云台类型" filterable> | ||
| 101 | + <el-option | ||
| 102 | + v-for="(value, key) in ptzTypes" | ||
| 103 | + :key="key" | ||
| 104 | + :label="value" | ||
| 105 | + :value="key" | ||
| 106 | + /> | ||
| 107 | + </el-select> | ||
| 108 | + <div v-show="!scope.row.edit">{{ scope.row.PTZTypeText }}</div> | ||
| 109 | + </template> | ||
| 110 | + </el-table-column> | ||
| 111 | + <el-table-column label="开启音频" min-width="120"> | ||
| 112 | + <template slot-scope="scope"> | ||
| 113 | + <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF"> | ||
| 114 | + </el-switch> | ||
| 115 | + </template> | ||
| 116 | + </el-table-column> | ||
| 117 | + <el-table-column label="状态" min-width="120"> | ||
| 118 | + <template slot-scope="scope"> | ||
| 119 | + <div slot="reference" class="name-wrapper"> | ||
| 120 | + <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag> | ||
| 121 | + <el-tag size="medium" type="info" v-if="scope.row.status === false">离线</el-tag> | ||
| 64 | </div> | 122 | </div> |
| 65 | - </el-image> | ||
| 66 | - </template> | ||
| 67 | - </el-table-column> | ||
| 68 | - <el-table-column prop="subCount" label="子节点数" min-width="120"> | ||
| 69 | - </el-table-column> | ||
| 70 | - <el-table-column prop="manufacture" label="厂家" min-width="120"> | ||
| 71 | - </el-table-column> | ||
| 72 | - <el-table-column label="位置信息" min-width="200"> | ||
| 73 | - <template slot-scope="scope"> | ||
| 74 | - <span v-if="scope.row.longitude*scope.row.latitude > 0">{{ scope.row.longitude }},<br>{{ scope.row.latitude }}</span> | ||
| 75 | - <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span> | ||
| 76 | - </template> | ||
| 77 | - </el-table-column> | ||
| 78 | - <el-table-column prop="PTZTypeText" label="云台类型" min-width="120"/> | ||
| 79 | - <el-table-column label="开启音频" min-width="120"> | ||
| 80 | - <template slot-scope="scope"> | ||
| 81 | - <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF"> | ||
| 82 | - </el-switch> | ||
| 83 | - </template> | ||
| 84 | - </el-table-column> | ||
| 85 | - <el-table-column label="状态" min-width="120"> | ||
| 86 | - <template slot-scope="scope"> | ||
| 87 | - <div slot="reference" class="name-wrapper"> | ||
| 88 | - <el-tag size="medium" v-if="scope.row.status === true">在线</el-tag> | ||
| 89 | - <el-tag size="medium" type="info" v-if="scope.row.status === false">离线</el-tag> | ||
| 90 | - </div> | ||
| 91 | - </template> | ||
| 92 | - </el-table-column> | 123 | + </template> |
| 124 | + </el-table-column> | ||
| 93 | 125 | ||
| 94 | 126 | ||
| 95 | - <el-table-column label="操作" min-width="280" fixed="right"> | ||
| 96 | - <template slot-scope="scope"> | ||
| 97 | - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play" type="text" @click="sendDevicePush(scope.row)">播放</el-button> | ||
| 98 | - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-switch-button" type="text" style="color: #f56c6c" v-if="!!scope.row.streamId" | ||
| 99 | - @click="stopDevicePush(scope.row)">停止 | ||
| 100 | - </el-button> | ||
| 101 | - <el-divider direction="vertical"></el-divider> | ||
| 102 | - <el-button size="medium" icon="el-icon-s-open" type="text" v-if="scope.row.subCount > 0 || scope.row.parental === 1" | ||
| 103 | - @click="changeSubchannel(scope.row)">查看 | ||
| 104 | - </el-button> | ||
| 105 | - <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider> | ||
| 106 | - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-camera" type="text" @click="queryRecords(scope.row)">设备录像 | ||
| 107 | - </el-button> | ||
| 108 | - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy" | ||
| 109 | - type="text" @click="queryCloudRecords(scope.row)">云端录像 | ||
| 110 | - </el-button> | ||
| 111 | - </template> | ||
| 112 | - </el-table-column> | ||
| 113 | - </el-table> | ||
| 114 | - <el-pagination | ||
| 115 | - style="float: right" | ||
| 116 | - @size-change="handleSizeChange" | ||
| 117 | - @current-change="currentChange" | ||
| 118 | - :current-page="currentPage" | ||
| 119 | - :page-size="count" | ||
| 120 | - :page-sizes="[15, 25, 35, 50]" | ||
| 121 | - layout="total, sizes, prev, pager, next" | ||
| 122 | - :total="total"> | ||
| 123 | - </el-pagination> | ||
| 124 | - </el-main> | ||
| 125 | - </el-container> | 127 | + <el-table-column label="操作" min-width="340" fixed="right"> |
| 128 | + <template slot-scope="scope"> | ||
| 129 | + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play" | ||
| 130 | + type="text" @click="sendDevicePush(scope.row)">播放 | ||
| 131 | + </el-button> | ||
| 132 | + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" | ||
| 133 | + icon="el-icon-switch-button" | ||
| 134 | + type="text" style="color: #f56c6c" v-if="!!scope.row.streamId" | ||
| 135 | + @click="stopDevicePush(scope.row)">停止 | ||
| 136 | + </el-button> | ||
| 137 | + <el-divider direction="vertical"></el-divider> | ||
| 138 | + <el-button | ||
| 139 | + v-if="scope.row.edit" | ||
| 140 | + size="medium" | ||
| 141 | + type="text" | ||
| 142 | + icon="el-icon-edit-outline" | ||
| 143 | + @click="handleSave(scope.row)" | ||
| 144 | + > | ||
| 145 | + 保存 | ||
| 146 | + </el-button> | ||
| 147 | + <el-button | ||
| 148 | + v-else | ||
| 149 | + size="medium" | ||
| 150 | + type="text" | ||
| 151 | + icon="el-icon-edit" | ||
| 152 | + @click="handleEdit(scope.row)" | ||
| 153 | + > | ||
| 154 | + 编辑 | ||
| 155 | + </el-button> | ||
| 156 | + <el-divider direction="vertical"></el-divider> | ||
| 157 | + <el-button size="medium" icon="el-icon-s-open" type="text" | ||
| 158 | + v-if="scope.row.subCount > 0 || scope.row.parental === 1" | ||
| 159 | + @click="changeSubchannel(scope.row)">查看 | ||
| 160 | + </el-button> | ||
| 161 | + <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider> | ||
| 162 | + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" | ||
| 163 | + icon="el-icon-video-camera" | ||
| 164 | + type="text" @click="queryRecords(scope.row)">设备录像 | ||
| 165 | + </el-button> | ||
| 166 | + <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy" | ||
| 167 | + type="text" @click="queryCloudRecords(scope.row)">云端录像 | ||
| 168 | + </el-button> | ||
| 169 | + </template> | ||
| 170 | + </el-table-column> | ||
| 171 | + </el-table> | ||
| 172 | + <el-pagination | ||
| 173 | + style="float: right" | ||
| 174 | + @size-change="handleSizeChange" | ||
| 175 | + @current-change="currentChange" | ||
| 176 | + :current-page="currentPage" | ||
| 177 | + :page-size="count" | ||
| 178 | + :page-sizes="[15, 25, 35, 50]" | ||
| 179 | + layout="total, sizes, prev, pager, next" | ||
| 180 | + :total="total"> | ||
| 181 | + </el-pagination> | ||
| 182 | + </el-main> | ||
| 183 | + </el-container> | ||
| 126 | 184 | ||
| 127 | - <!--设备列表--> | 185 | + <!--设备列表--> |
| 128 | 186 | ||
| 129 | </div> | 187 | </div> |
| 130 | </template> | 188 | </template> |
| @@ -163,16 +221,23 @@ export default { | @@ -163,16 +221,23 @@ export default { | ||
| 163 | beforeUrl: "/deviceList", | 221 | beforeUrl: "/deviceList", |
| 164 | isLoging: false, | 222 | isLoging: false, |
| 165 | showTree: false, | 223 | showTree: false, |
| 166 | - loadSnap: {} | 224 | + loadSnap: {}, |
| 225 | + ptzTypes: { | ||
| 226 | + 0: "未知", | ||
| 227 | + 1: "球机", | ||
| 228 | + 2: "半球", | ||
| 229 | + 3: "固定枪机", | ||
| 230 | + 4: "遥控枪机" | ||
| 231 | + } | ||
| 167 | }; | 232 | }; |
| 168 | }, | 233 | }, |
| 169 | 234 | ||
| 170 | mounted() { | 235 | mounted() { |
| 171 | if (this.deviceId) { | 236 | if (this.deviceId) { |
| 172 | - this.deviceService.getDevice(this.deviceId, (result)=>{ | ||
| 173 | - this.device = result; | 237 | + this.deviceService.getDevice(this.deviceId, (result) => { |
| 238 | + this.device = result; | ||
| 174 | 239 | ||
| 175 | - }, (error)=>{ | 240 | + }, (error) => { |
| 176 | console.log("获取设备信息失败") | 241 | console.log("获取设备信息失败") |
| 177 | console.error(error) | 242 | console.error(error) |
| 178 | }) | 243 | }) |
| @@ -227,6 +292,14 @@ export default { | @@ -227,6 +292,14 @@ export default { | ||
| 227 | if (res.data.code === 0) { | 292 | if (res.data.code === 0) { |
| 228 | that.total = res.data.data.total; | 293 | that.total = res.data.data.total; |
| 229 | that.deviceChannelList = res.data.data.list; | 294 | that.deviceChannelList = res.data.data.list; |
| 295 | + that.deviceChannelList.forEach(e => { | ||
| 296 | + e.PTZType = e.PTZType + ""; | ||
| 297 | + that.$set(e, "edit", false); | ||
| 298 | + that.$set(e, "location", ""); | ||
| 299 | + if (e.longitude && e.latitude) { | ||
| 300 | + that.$set(e, "location", e.longitude + "," + e.latitude); | ||
| 301 | + } | ||
| 302 | + }); | ||
| 230 | // 防止出现表格错位 | 303 | // 防止出现表格错位 |
| 231 | that.$nextTick(() => { | 304 | that.$nextTick(() => { |
| 232 | that.$refs.channelListTable.doLayout(); | 305 | that.$refs.channelListTable.doLayout(); |
| @@ -248,7 +321,7 @@ export default { | @@ -248,7 +321,7 @@ export default { | ||
| 248 | this.$axios({ | 321 | this.$axios({ |
| 249 | method: 'get', | 322 | method: 'get', |
| 250 | url: '/api/play/start/' + deviceId + '/' + channelId, | 323 | url: '/api/play/start/' + deviceId + '/' + channelId, |
| 251 | - params:{ | 324 | + params: { |
| 252 | isSubStream: this.isSubStream | 325 | isSubStream: this.isSubStream |
| 253 | } | 326 | } |
| 254 | }).then(function (res) { | 327 | }).then(function (res) { |
| @@ -271,7 +344,7 @@ export default { | @@ -271,7 +344,7 @@ export default { | ||
| 271 | that.initData(); | 344 | that.initData(); |
| 272 | }, 1000) | 345 | }, 1000) |
| 273 | 346 | ||
| 274 | - }else{ | 347 | + } else { |
| 275 | that.$message.error(res.data.msg); | 348 | that.$message.error(res.data.msg); |
| 276 | } | 349 | } |
| 277 | }).catch(function (e) { | 350 | }).catch(function (e) { |
| @@ -297,7 +370,7 @@ export default { | @@ -297,7 +370,7 @@ export default { | ||
| 297 | this.$axios({ | 370 | this.$axios({ |
| 298 | method: 'get', | 371 | method: 'get', |
| 299 | url: '/api/play/stop/' + this.deviceId + "/" + itemData.channelId, | 372 | url: '/api/play/stop/' + this.deviceId + "/" + itemData.channelId, |
| 300 | - params:{ | 373 | + params: { |
| 301 | isSubStream: this.isSubStream | 374 | isSubStream: this.isSubStream |
| 302 | } | 375 | } |
| 303 | }).then(function (res) { | 376 | }).then(function (res) { |
| @@ -326,7 +399,7 @@ export default { | @@ -326,7 +399,7 @@ export default { | ||
| 326 | return; | 399 | return; |
| 327 | } | 400 | } |
| 328 | setTimeout(() => { | 401 | setTimeout(() => { |
| 329 | - let url = (process.env.NODE_ENV === 'development'? "debug": "") + '/api/device/query/snap/' + deviceId + '/' + channelId | 402 | + let url = (process.env.NODE_ENV === 'development' ? "debug" : "") + '/api/device/query/snap/' + deviceId + '/' + channelId |
| 330 | this.loadSnap[deviceId + channelId]++ | 403 | this.loadSnap[deviceId + channelId]++ |
| 331 | document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime()) | 404 | document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime()) |
| 332 | }, 1000) | 405 | }, 1000) |
| @@ -363,10 +436,18 @@ export default { | @@ -363,10 +436,18 @@ export default { | ||
| 363 | online: this.online, | 436 | online: this.online, |
| 364 | channelType: this.channelType | 437 | channelType: this.channelType |
| 365 | } | 438 | } |
| 366 | - }).then( (res) =>{ | 439 | + }).then((res) => { |
| 367 | if (res.data.code === 0) { | 440 | if (res.data.code === 0) { |
| 368 | this.total = res.data.data.total; | 441 | this.total = res.data.data.total; |
| 369 | this.deviceChannelList = res.data.data.list; | 442 | this.deviceChannelList = res.data.data.list; |
| 443 | + this.deviceChannelList.forEach(e => { | ||
| 444 | + e.PTZType = e.PTZType + ""; | ||
| 445 | + this.$set(e, "edit", false); | ||
| 446 | + this.$set(e, "location", ""); | ||
| 447 | + if (e.longitude && e.latitude) { | ||
| 448 | + this.$set(e, "location", e.longitude + "," + e.latitude); | ||
| 449 | + } | ||
| 450 | + }); | ||
| 370 | // 防止出现表格错位 | 451 | // 防止出现表格错位 |
| 371 | this.$nextTick(() => { | 452 | this.$nextTick(() => { |
| 372 | this.$refs.channelListTable.doLayout(); | 453 | this.$refs.channelListTable.doLayout(); |
| @@ -376,7 +457,7 @@ export default { | @@ -376,7 +457,7 @@ export default { | ||
| 376 | }).catch(function (error) { | 457 | }).catch(function (error) { |
| 377 | console.log(error); | 458 | console.log(error); |
| 378 | }); | 459 | }); |
| 379 | - }else { | 460 | + } else { |
| 380 | this.$axios({ | 461 | this.$axios({ |
| 381 | method: 'get', | 462 | method: 'get', |
| 382 | url: `/api/device/query/tree/channel/${this.deviceId}`, | 463 | url: `/api/device/query/tree/channel/${this.deviceId}`, |
| @@ -385,7 +466,7 @@ export default { | @@ -385,7 +466,7 @@ export default { | ||
| 385 | page: this.currentPage, | 466 | page: this.currentPage, |
| 386 | count: this.count, | 467 | count: this.count, |
| 387 | } | 468 | } |
| 388 | - }).then((res)=> { | 469 | + }).then((res) => { |
| 389 | if (res.data.code === 0) { | 470 | if (res.data.code === 0) { |
| 390 | this.total = res.data.total; | 471 | this.total = res.data.total; |
| 391 | this.deviceChannelList = res.data.list; | 472 | this.deviceChannelList = res.data.list; |
| @@ -417,14 +498,14 @@ export default { | @@ -417,14 +498,14 @@ export default { | ||
| 417 | refresh: function () { | 498 | refresh: function () { |
| 418 | this.initData(); | 499 | this.initData(); |
| 419 | }, | 500 | }, |
| 420 | - switchTree: function (){ | 501 | + switchTree: function () { |
| 421 | this.showTree = true; | 502 | this.showTree = true; |
| 422 | this.deviceChannelList = []; | 503 | this.deviceChannelList = []; |
| 423 | this.parentChannelId = 0; | 504 | this.parentChannelId = 0; |
| 424 | this.currentPage = 1; | 505 | this.currentPage = 1; |
| 425 | 506 | ||
| 426 | }, | 507 | }, |
| 427 | - switchList: function (){ | 508 | + switchList: function () { |
| 428 | this.showTree = false; | 509 | this.showTree = false; |
| 429 | this.deviceChannelList = []; | 510 | this.deviceChannelList = []; |
| 430 | this.parentChannelId = 0; | 511 | this.parentChannelId = 0; |
| @@ -435,12 +516,70 @@ export default { | @@ -435,12 +516,70 @@ export default { | ||
| 435 | console.log(device) | 516 | console.log(device) |
| 436 | if (!!!data.channelId) { | 517 | if (!!!data.channelId) { |
| 437 | this.parentChannelId = device.deviceId; | 518 | this.parentChannelId = device.deviceId; |
| 438 | - }else { | 519 | + } else { |
| 439 | this.parentChannelId = data.channelId; | 520 | this.parentChannelId = data.channelId; |
| 440 | } | 521 | } |
| 441 | this.initData(); | 522 | this.initData(); |
| 442 | - } | 523 | + }, |
| 524 | + // 保存 | ||
| 525 | + handleSave(row) { | ||
| 526 | + if (row.location) { | ||
| 527 | + const segements = row.location.split(","); | ||
| 528 | + if (segements.length !== 2) { | ||
| 529 | + this.$message.warning("位置信息格式有误,例:117.234,36.378"); | ||
| 530 | + return; | ||
| 531 | + } else { | ||
| 532 | + row.longitude = parseFloat(segements[0]); | ||
| 533 | + row.latitude = parseFloat(segements[1]); | ||
| 534 | + if (!(row.longitude && row.latitude)) { | ||
| 535 | + this.$message.warning("位置信息格式有误,例:117.234,36.378"); | ||
| 536 | + return; | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + } else { | ||
| 540 | + delete row.longitude; | ||
| 541 | + delete row.latitude; | ||
| 542 | + } | ||
| 543 | + Object.keys(row).forEach(key => { | ||
| 544 | + const value = row[key]; | ||
| 545 | + if (value === null || value === undefined || (typeof value === "string" && value.trim() === "")) { | ||
| 546 | + delete row[key]; | ||
| 547 | + } | ||
| 548 | + }); | ||
| 549 | + this.$axios({ | ||
| 550 | + method: 'post', | ||
| 551 | + url: `/api/device/query/channel/update/${this.deviceId}`, | ||
| 552 | + params: row | ||
| 553 | + }).then(response => { | ||
| 554 | + if (response.data.code === 0) { | ||
| 555 | + this.$message.success("修改成功!"); | ||
| 556 | + this.initData(); | ||
| 557 | + } else { | ||
| 558 | + this.$message.error("修改失败!"); | ||
| 559 | + } | ||
| 560 | + }).catch(_ => { | ||
| 561 | + this.$message.error("修改失败!"); | ||
| 562 | + }) | ||
| 563 | + }, | ||
| 564 | + // 是否正在编辑 | ||
| 565 | + isEdit() { | ||
| 566 | + let editing = false; | ||
| 567 | + this.deviceChannelList.forEach(e => { | ||
| 568 | + if (e.edit) { | ||
| 569 | + editing = true; | ||
| 570 | + } | ||
| 571 | + }); | ||
| 443 | 572 | ||
| 573 | + return editing; | ||
| 574 | + }, | ||
| 575 | + // 编辑 | ||
| 576 | + handleEdit(row) { | ||
| 577 | + if (this.isEdit()) { | ||
| 578 | + this.$message.warning('请保存当前编辑项!'); | ||
| 579 | + } else { | ||
| 580 | + row.edit = true; | ||
| 581 | + } | ||
| 582 | + } | ||
| 444 | } | 583 | } |
| 445 | }; | 584 | }; |
| 446 | </script> | 585 | </script> |