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 | 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 7 | 7 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; |
| 8 | 8 | import org.apache.ibatis.annotations.*; |
| 9 | -import org.apache.ibatis.annotations.Param; | |
| 10 | 9 | import org.springframework.stereotype.Repository; |
| 11 | 10 | |
| 12 | 11 | import java.util.List; |
| ... | ... | @@ -31,7 +30,7 @@ public interface DeviceChannelMapper { |
| 31 | 30 | @Update(value = {" <script>" + |
| 32 | 31 | "UPDATE wvp_device_channel " + |
| 33 | 32 | "SET update_time=#{updateTime}" + |
| 34 | - "<if test='name != null'>, name=#{name}</if>" + | |
| 33 | + ", custom_name=#{name}" + | |
| 35 | 34 | "<if test='manufacture != null'>, manufacture=#{manufacture}</if>" + |
| 36 | 35 | "<if test='model != null'>, model=#{model}</if>" + |
| 37 | 36 | "<if test='owner != null'>, owner=#{owner}</if>" + |
| ... | ... | @@ -49,12 +48,12 @@ public interface DeviceChannelMapper { |
| 49 | 48 | "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + |
| 50 | 49 | "<if test='port != null'>, port=#{port}</if>" + |
| 51 | 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 | 52 | "<if test='status != null'>, status=#{status}</if>" + |
| 54 | 53 | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + |
| 55 | 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 | 57 | "<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" + |
| 59 | 58 | "<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" + |
| 60 | 59 | "<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" + |
| ... | ... | @@ -67,7 +66,43 @@ public interface DeviceChannelMapper { |
| 67 | 66 | |
| 68 | 67 | @Select(value = {" <script>" + |
| 69 | 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 | 106 | "from " + |
| 72 | 107 | "wvp_device_channel dc " + |
| 73 | 108 | "WHERE " + |
| ... | ... | @@ -154,7 +189,7 @@ public interface DeviceChannelMapper { |
| 154 | 189 | " dc.id,\n" + |
| 155 | 190 | " dc.channel_id,\n" + |
| 156 | 191 | " dc.device_id,\n" + |
| 157 | - " dc.name,\n" + | |
| 192 | + " COALESCE(dc.custom_name, dc.name) AS name,\n" + | |
| 158 | 193 | " de.manufacturer,\n" + |
| 159 | 194 | " de.host_address,\n" + |
| 160 | 195 | " dc.sub_count,\n" + |
| ... | ... | @@ -392,10 +427,10 @@ public interface DeviceChannelMapper { |
| 392 | 427 | @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") |
| 393 | 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 | 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 | 434 | " from wvp_device_channel dc" + |
| 400 | 435 | " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" + |
| 401 | 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 | 33 | <el-option label="流畅" :value="true"></el-option> |
| 34 | 34 | </el-select> |
| 35 | 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 | 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 | 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 | 187 | </div> |
| 130 | 188 | </template> |
| ... | ... | @@ -163,16 +221,23 @@ export default { |
| 163 | 221 | beforeUrl: "/deviceList", |
| 164 | 222 | isLoging: false, |
| 165 | 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 | 235 | mounted() { |
| 171 | 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 | 241 | console.log("获取设备信息失败") |
| 177 | 242 | console.error(error) |
| 178 | 243 | }) |
| ... | ... | @@ -227,6 +292,14 @@ export default { |
| 227 | 292 | if (res.data.code === 0) { |
| 228 | 293 | that.total = res.data.data.total; |
| 229 | 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 | 304 | that.$nextTick(() => { |
| 232 | 305 | that.$refs.channelListTable.doLayout(); |
| ... | ... | @@ -248,7 +321,7 @@ export default { |
| 248 | 321 | this.$axios({ |
| 249 | 322 | method: 'get', |
| 250 | 323 | url: '/api/play/start/' + deviceId + '/' + channelId, |
| 251 | - params:{ | |
| 324 | + params: { | |
| 252 | 325 | isSubStream: this.isSubStream |
| 253 | 326 | } |
| 254 | 327 | }).then(function (res) { |
| ... | ... | @@ -271,7 +344,7 @@ export default { |
| 271 | 344 | that.initData(); |
| 272 | 345 | }, 1000) |
| 273 | 346 | |
| 274 | - }else{ | |
| 347 | + } else { | |
| 275 | 348 | that.$message.error(res.data.msg); |
| 276 | 349 | } |
| 277 | 350 | }).catch(function (e) { |
| ... | ... | @@ -297,7 +370,7 @@ export default { |
| 297 | 370 | this.$axios({ |
| 298 | 371 | method: 'get', |
| 299 | 372 | url: '/api/play/stop/' + this.deviceId + "/" + itemData.channelId, |
| 300 | - params:{ | |
| 373 | + params: { | |
| 301 | 374 | isSubStream: this.isSubStream |
| 302 | 375 | } |
| 303 | 376 | }).then(function (res) { |
| ... | ... | @@ -326,7 +399,7 @@ export default { |
| 326 | 399 | return; |
| 327 | 400 | } |
| 328 | 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 | 403 | this.loadSnap[deviceId + channelId]++ |
| 331 | 404 | document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime()) |
| 332 | 405 | }, 1000) |
| ... | ... | @@ -363,10 +436,18 @@ export default { |
| 363 | 436 | online: this.online, |
| 364 | 437 | channelType: this.channelType |
| 365 | 438 | } |
| 366 | - }).then( (res) =>{ | |
| 439 | + }).then((res) => { | |
| 367 | 440 | if (res.data.code === 0) { |
| 368 | 441 | this.total = res.data.data.total; |
| 369 | 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 | 452 | this.$nextTick(() => { |
| 372 | 453 | this.$refs.channelListTable.doLayout(); |
| ... | ... | @@ -376,7 +457,7 @@ export default { |
| 376 | 457 | }).catch(function (error) { |
| 377 | 458 | console.log(error); |
| 378 | 459 | }); |
| 379 | - }else { | |
| 460 | + } else { | |
| 380 | 461 | this.$axios({ |
| 381 | 462 | method: 'get', |
| 382 | 463 | url: `/api/device/query/tree/channel/${this.deviceId}`, |
| ... | ... | @@ -385,7 +466,7 @@ export default { |
| 385 | 466 | page: this.currentPage, |
| 386 | 467 | count: this.count, |
| 387 | 468 | } |
| 388 | - }).then((res)=> { | |
| 469 | + }).then((res) => { | |
| 389 | 470 | if (res.data.code === 0) { |
| 390 | 471 | this.total = res.data.total; |
| 391 | 472 | this.deviceChannelList = res.data.list; |
| ... | ... | @@ -417,14 +498,14 @@ export default { |
| 417 | 498 | refresh: function () { |
| 418 | 499 | this.initData(); |
| 419 | 500 | }, |
| 420 | - switchTree: function (){ | |
| 501 | + switchTree: function () { | |
| 421 | 502 | this.showTree = true; |
| 422 | 503 | this.deviceChannelList = []; |
| 423 | 504 | this.parentChannelId = 0; |
| 424 | 505 | this.currentPage = 1; |
| 425 | 506 | |
| 426 | 507 | }, |
| 427 | - switchList: function (){ | |
| 508 | + switchList: function () { | |
| 428 | 509 | this.showTree = false; |
| 429 | 510 | this.deviceChannelList = []; |
| 430 | 511 | this.parentChannelId = 0; |
| ... | ... | @@ -435,12 +516,70 @@ export default { |
| 435 | 516 | console.log(device) |
| 436 | 517 | if (!!!data.channelId) { |
| 437 | 518 | this.parentChannelId = device.deviceId; |
| 438 | - }else { | |
| 519 | + } else { | |
| 439 | 520 | this.parentChannelId = data.channelId; |
| 440 | 521 | } |
| 441 | 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 | 585 | </script> | ... | ... |