目录代码整合
This commit is contained in:
		
							
								
								
									
										131
									
								
								packages/device/monitor/AppMonitorDevice/AppMonitorDevice.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								packages/device/monitor/AppMonitorDevice/AppMonitorDevice.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,131 @@ | ||||
| <template> | ||||
|   <section class="AppMonitorDevice"> | ||||
|     <ai-list> | ||||
|       <ai-title slot="title" title="监控设备管理" isShowBottomBorder/> | ||||
|       <template #content> | ||||
|         <ai-search-bar> | ||||
|           <template #right> | ||||
|             <el-input prefix-icon="iconfont iconSearch" v-model="search.title" placeholder="设备名、MAC号" clearable | ||||
|             @clear="page.current = 1,search.title = '', getTableData()" | ||||
|                       v-throttle="() => {page.current = 1, getTableData()}" size="small"/> | ||||
|           </template> | ||||
|         </ai-search-bar> | ||||
|         <ai-table :tableData="tableData" :colConfigs="colConfigs" :total="page.total" :current.sync="page.current" | ||||
|                   :size.sync="page.size" @getList="getTableData"> | ||||
|           <el-table-column label="操作" slot="options" align="center"> | ||||
|             <el-row type="flex" slot-scope="{row}" align="middle" justify="center"> | ||||
|               <ai-area v-model="row.areaId" :instance="instance" :inputClicker="false" customClicker | ||||
|                        @change="handleSubmit(row)"> | ||||
|                 <el-button type="text">绑定</el-button> | ||||
|               </ai-area> | ||||
|               <el-button type="text" @click="handleLocate(row)">标绘</el-button> | ||||
|               <div/> | ||||
|               <el-button type="text" @click="handleShow(row)">设置</el-button> | ||||
|             </el-row> | ||||
|           </el-table-column> | ||||
|         </ai-table> | ||||
|       </template> | ||||
|     </ai-list> | ||||
|     <locate-dialog v-model="locate" :ins="instance" @confirm="v=>handleLocate(detail,v)"/> | ||||
|     <setting-dialog v-model="dialog" :ins="instance"/> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import LocateDialog from "../components/locateDialog"; | ||||
| import SettingDialog from "../components/settingDialog"; | ||||
|  | ||||
| export default { | ||||
|   name: "AppMonitorDevice", | ||||
|   components: {SettingDialog, LocateDialog}, | ||||
|   label: "监控设备管理", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function | ||||
|   }, | ||||
|   provide() { | ||||
|     return { | ||||
|       device: this | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     colConfigs() { | ||||
|       return [ | ||||
|         {type: 'selection'}, | ||||
|         {label: "设备名", prop: "deviceName"}, | ||||
|         {label: "上级归属", prop: "areaName"}, | ||||
|         {label: "设备型号", prop: "devModel"}, | ||||
|         {label: "MAC号", prop: "devMac"}, | ||||
|         {label: "标绘状态", render: (h, {row}) => h('span', null, row?.lat ? '已绑定' : '待绑定')}, | ||||
|         {slot: "options"} | ||||
|       ] | ||||
|     }, | ||||
|     isDetail() { | ||||
|       return !!this.$route.query?.id | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       search: {startTime: null, endTime: null, title: ""}, | ||||
|       page: {current: 1, size: 10, total: 0}, | ||||
|       tableData: [], | ||||
|       locate: false, | ||||
|       dialog: false, | ||||
|       detail: {} | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.dict.load("zyDeviceBindStatus") | ||||
|     if (this.isDetail) { | ||||
|       //TODO 待补充 | ||||
|     } else this.getTableData() | ||||
|   }, | ||||
|   methods: { | ||||
|     getTableData() { | ||||
|       this.instance.post("/app/appzyvideoequipment/getVideoList", null, { | ||||
|         params: {...this.search, ...this.page} | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.tableData = res.data.records | ||||
|           this.page.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleSubmit(row) { | ||||
|       return this.instance.post("/app/appzyvideoequipment/addOrUpdate", { | ||||
|         ...row, id: row.deviceId | ||||
|       }).then(res => { | ||||
|         if (res?.code == 0) { | ||||
|           this.$message.success("提交成功!") | ||||
|           this.getTableData() | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleShow(row) { | ||||
|       this.dialog = true | ||||
|       this.detail = row | ||||
|     }, | ||||
|     handleLocate(row, locate) { | ||||
|       if (locate) { | ||||
|         let {lat, lng} = locate.location | ||||
|         this.handleSubmit({...row, lat, lng}).then(() => { | ||||
|           this.locate = false | ||||
|           this.getTableData() | ||||
|         }) | ||||
|       } else { | ||||
|         this.locate = true | ||||
|         this.detail = row | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AppMonitorDevice { | ||||
|   ::v-deep .AiSearchBar { | ||||
|     margin-bottom: 10px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										301
									
								
								packages/device/monitor/AppMonitorManage/AppMonitorManage.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								packages/device/monitor/AppMonitorManage/AppMonitorManage.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,301 @@ | ||||
| <template> | ||||
|   <section class="AppMonitorManage"> | ||||
|     <device-slider :show.sync="slider" :ins="instance" :dict="dict" @select="handleSelectMonitor" | ||||
|                    :render-item="renderTreeItem" ref="DeviceSlider"/> | ||||
|     <div class="monitorPane"> | ||||
|       <div class="headerBar"> | ||||
|         <el-select default-first-option size="small" v-model="splitScreen"> | ||||
|           <i slot="prefix" class="iconfont iconjdq_led_Led1"/> | ||||
|           <el-option v-for="(op,i) in splitOps" :key="i" v-bind="op"/> | ||||
|         </el-select> | ||||
|         <!--        <el-button icon="el-icon-full-screen" @click="handleFullscreen">全屏</el-button>--> | ||||
|       </div> | ||||
|       <div class="videoList"> | ||||
|         <div class="videoBox" v-for="(m,i) in monitors" :key="i" :style="currentSplitStyle"> | ||||
|           <iframe :src="m.url" allow="autoplay *; microphone *; fullscreen *" allowfullscreen allowtransparency | ||||
|                   allowusermedia frameBorder="no"/> | ||||
|         </div> | ||||
|       </div> | ||||
|     </div> | ||||
|     <ai-dialog title="修改名称" :visible.sync="dialog" width="500px" @onConfirm="handleSubmit(selected)" | ||||
|                @closed="selected={}"> | ||||
|       <el-form ref="form" :model="selected" label-width="80px" size="small" :rules="rules"> | ||||
|         <el-form-item label="设备名称" prop="name"> | ||||
|           <el-input v-model="selected.name" clearable/> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|     <locate-dialog v-model="locate" :ins="instance" :latlng="latlng" @confirm="v=>handleLocate(selected,v)"/> | ||||
|     <ai-area custom-clicker :input-clicker="false" v-model="selected.areaId" :hideLevel="disabledLevel" :instance="instance" ref="BindArea" | ||||
|              @change="handleSubmit(selected)"/> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
|   import DeviceSlider from "../components/deviceSlider"; | ||||
|   import LocateDialog from "../components/locateDialog"; | ||||
|  | ||||
|   export default { | ||||
|     name: "AppMonitorManage", | ||||
|     components: {LocateDialog, DeviceSlider}, | ||||
|     label: "监控实况", | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       permissions: Function | ||||
|     }, | ||||
|     computed: { | ||||
|       splitOps() { | ||||
|         return [ | ||||
|           {label: "单分屏", value: 1, per: "100%"}, | ||||
|           {label: "四分屏", value: 4, per: "49%"}, | ||||
|           {label: "九分屏", value: 9, per: "32%"} | ||||
|         ] | ||||
|       }, | ||||
|       currentSplitStyle() { | ||||
|         let per = this.splitOps.find(e => e.value == this.splitScreen)?.per || "100%" | ||||
|         return {width: per, height: per} | ||||
|       }, | ||||
|       ...mapState(['user']) | ||||
|     }, | ||||
|  | ||||
|     data() { | ||||
|       return { | ||||
|         slider: true, | ||||
|         fullscreen: false, | ||||
|         splitScreen: 1, | ||||
|         monitors: [], | ||||
|         dialog: false, | ||||
|         locate: false, | ||||
|         selected: { | ||||
|           areaId: '' | ||||
|         }, | ||||
|         latlng: null, | ||||
|         disabledLevel: 0, | ||||
|         rules: { | ||||
|           name: [{required: true, message: "请填写 设备名称"}] | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.selected.areaId = this.user.info.areaId | ||||
|       this.disabledLevel = this.user.info.areaList.length | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       handleFullscreen() { | ||||
|         this.fullscreen = !this.fullscreen | ||||
|         this.$fullscreen(this.fullscreen) | ||||
|       }, | ||||
|       handleSelectMonitor(monitor) { | ||||
|         let {id} = monitor, | ||||
|             index = this.monitors.findIndex(e => e.id == id) | ||||
|         if (index > -1) { | ||||
|           this.monitors.splice(index, 1) | ||||
|           this.monitors.map((e, i) => { | ||||
|             if (i > index) { | ||||
|               this.showMonitor(e, true) | ||||
|             } | ||||
|           }) | ||||
|         } else if (this.monitors.length >= this.splitScreen && this.splitScreen > 1) { | ||||
|           this.$message.warning("可分屏监控已满,请先取消其他的监控") | ||||
|         } else { | ||||
|           this.showMonitor(monitor) | ||||
|         } | ||||
|       }, | ||||
|       showMonitor(monitor, refresh = false) { | ||||
|         let {id: deviceId} = monitor | ||||
|         deviceId && this.instance.post("/app/appzyvideoequipment/getWebSdkUrl", null, { | ||||
|           params: {deviceId} | ||||
|         }).then(res => { | ||||
|           if (res?.data) { | ||||
|             let data = JSON.parse(res.data) | ||||
|             if (refresh) { | ||||
|               monitor.url = data.url | ||||
|             } else if (this.splitScreen == 1) { | ||||
|               this.monitors = [{...monitor, ...data}] | ||||
|             } else { | ||||
|               this.monitors.push({...monitor, ...data}) | ||||
|             } | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       renderTreeItem: function (h, {node, data}) { | ||||
|         let show = data.deviceStatus==1 ? 'show' : '' | ||||
|         if (node.isLeaf) { | ||||
|           return ( | ||||
|               <div class="flexRow"> | ||||
|                 <i class={['iconfont', 'iconshipinjiankong', show]}/> | ||||
|                 <div>{node.label}</div> | ||||
|                 <el-dropdown class="menuBtn" onCommand={e => this.handleSliderOption(e, data)}> | ||||
|                   <i class="iconfont iconMore"/> | ||||
|                   <el-dropdown-menu slot="dropdown"> | ||||
|                     <el-dropdown-item command="edit">修改名称</el-dropdown-item> | ||||
|                     <el-dropdown-item command="area">行政地区</el-dropdown-item> | ||||
|                     <el-dropdown-item command="locate">地图标绘</el-dropdown-item> | ||||
|                   </el-dropdown-menu> | ||||
|                 </el-dropdown> | ||||
|               </div> | ||||
|           ) | ||||
|         } else return ( | ||||
|             <div class="flexRow"> | ||||
|               <div>{node.label}</div> | ||||
|               {data.id != 'no_area' ? <div class="sta"> | ||||
|                     <p>{data.online || 0}</p>/{data.sum || 0} | ||||
|                   </div> | ||||
|                   : <div/>} | ||||
|             </div> | ||||
|         ) | ||||
|       }, | ||||
|       handleSliderOption(command, data) { | ||||
|         this.selected = JSON.parse(JSON.stringify({...data, command})) | ||||
|         if (command == "edit") {//修改名称 | ||||
|           this.dialog = true | ||||
|         } else if (command == "area") {//绑定areaId | ||||
|           this.$refs.BindArea?.chooseArea() | ||||
|         } else if (command == "locate") {//地图标绘 | ||||
|           this.latlng = data.lat && data.lng ? { | ||||
|             lat: data.lat, | ||||
|             lng: data.lng | ||||
|           } : '' | ||||
|           this.locate = true | ||||
|         } | ||||
|       }, | ||||
|       handleSubmit(row) { | ||||
|         delete row.createTime | ||||
|         return this.instance.post("/app/appzyvideoequipment/addOrUpdate", { | ||||
|           ...row | ||||
|         }).then(res => { | ||||
|           if (res?.code == 0) { | ||||
|             this.$message.success("提交成功!") | ||||
|             this.dialog = false | ||||
|             this.$refs.DeviceSlider?.getDevices() | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|       handleLocate(row, locate) { | ||||
|         if (locate) { | ||||
|           let {lat, lng} = locate.location | ||||
|           this.handleSubmit({...row, lat, lng}).then(() => { | ||||
|             this.locate = false | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     beforeDestroy() { | ||||
|       this.monitors = [] | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AppMonitorManage { | ||||
|   display: flex; | ||||
|   background: #202330; | ||||
|   height: 100%; | ||||
|  | ||||
|   .monitorPane { | ||||
|     color: #fff; | ||||
|     flex: 1; | ||||
|     min-width: 0; | ||||
|     padding: 20px 20px 20px 4px; | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|  | ||||
|     ::v-deep .headerBar { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       justify-content: flex-end; | ||||
|       gap: 8px; | ||||
|       margin-bottom: 24px; | ||||
|  | ||||
|       .iconfont { | ||||
|         color: #fff; | ||||
|         height: 100%; | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         font-size: 20px; | ||||
|       } | ||||
|  | ||||
|       .el-input__icon { | ||||
|         color: #fff; | ||||
|       } | ||||
|  | ||||
|       .el-input__inner, .el-button { | ||||
|         color: #fff; | ||||
|         max-width: 100px; | ||||
|         background: #2C2F3E; | ||||
|         border: none; | ||||
|  | ||||
|         &:hover { | ||||
|           color: #26f; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .videoList { | ||||
|       display: flex; | ||||
|       justify-content: flex-start; | ||||
|       align-content: flex-start; | ||||
|       flex-wrap: wrap; | ||||
|       flex: 1; | ||||
|       min-height: 0; | ||||
|       overflow: hidden; | ||||
|       gap: 8px; | ||||
|     } | ||||
|  | ||||
|     .videoBox { | ||||
|       background: #000; | ||||
|       flex-shrink: 0; | ||||
|  | ||||
|       iframe { | ||||
|         width: 100%; | ||||
|         height: 100%; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   ::v-deep.el-tree-node__content:hover { | ||||
|     .menuBtn { | ||||
|       display: block; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   ::v-deep .flexRow { | ||||
|     flex: 1; | ||||
|     min-width: 0; | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|     gap: 8px; | ||||
|     font-size: 14px; | ||||
|     color: #fff; | ||||
|  | ||||
|     .iconfont { | ||||
|       color: #89b; | ||||
|  | ||||
|       &.show { | ||||
|         color: #19D286; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .sta { | ||||
|       display: flex; | ||||
|       flex: 1; | ||||
|       min-width: 0; | ||||
|  | ||||
|       & > p { | ||||
|         color: #19D286; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .menuBtn { | ||||
|       display: none; | ||||
|       position: absolute; | ||||
|       right: 4px; | ||||
|     } | ||||
|  | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										211
									
								
								packages/device/monitor/AppMonitorMap/AppMonitorMap.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								packages/device/monitor/AppMonitorMap/AppMonitorMap.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,211 @@ | ||||
| <template> | ||||
|   <section class="AppMonitorMap"> | ||||
|     <device-slider :show.sync="slider" :ins="instance" :dict="dict" @list="v=>list=v" @select="markerClickEvent"/> | ||||
|     <div id="amap"/> | ||||
|     <div ref="selectedInfoWin" class="selected"> | ||||
|       <b>{{ selected.deviceName }}</b> | ||||
|       <div>{{ selected.lng }},{{ selected.lat }}</div> | ||||
|       <div v-if="selected.address">{{ selected.address }}</div> | ||||
|       <div btn @click="handleShowMonitor">查看监控</div> | ||||
|     </div> | ||||
|     <el-dialog class="monitorDialog" :modal="false" :visible.sync="dialog" :title="selected.deviceName||'视频监控'" | ||||
|                width="640px" @closed="monitor=''"> | ||||
|       <iframe v-if="monitor" :src="monitor" allow="autoplay *; microphone *; fullscreen *" allowfullscreen | ||||
|               allowtransparency allowusermedia frameBorder="no"/> | ||||
|     </el-dialog> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import DeviceSlider from "../components/deviceSlider"; | ||||
| import AMapLoader from "@amap/amap-jsapi-loader"; | ||||
|  | ||||
| export default { | ||||
|   name: "AppMonitorMap", | ||||
|   components: {DeviceSlider}, | ||||
|   label: "监控地图", | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     dict: Object, | ||||
|     permissions: Function | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       slider: true, | ||||
|       AMap: null, | ||||
|       map: null, | ||||
|       selected: {}, | ||||
|       list: [], | ||||
|       deviceToken: "", | ||||
|       dialog: false, | ||||
|       monitor: "" | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
|     list: { | ||||
|       immediate: true, | ||||
|       handler(v) { | ||||
|         if (v.length > 0) { | ||||
|           this.renderDevicesOnMap() | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     initMap() { | ||||
|       return new Promise(resolve => AMapLoader.load({ | ||||
|         key: "b553334ba34f7ac3cd09df9bc8b539dc", | ||||
|         version: '2.0', | ||||
|         plugins: ['AMap.Marker', 'AMap.PlaceSearch'], | ||||
|       }).then(AMap => { | ||||
|         this.AMap = AMap | ||||
|         this.map = new this.AMap.Map('amap', { | ||||
|           zoom: 14, | ||||
|         }) | ||||
|         resolve() | ||||
|       })) | ||||
|     }, | ||||
|     renderDevicesOnMap() { | ||||
|       this.list?.map(e => { | ||||
|         if (this.AMap && e?.lat) { | ||||
|           e.marker = new this.AMap.Marker({ | ||||
|             icon: this.$cdn + 'monitor/camera.png', | ||||
|             position: new this.AMap.LngLat(e.lng, e.lat) | ||||
|           }).on('click', () => this.markerClickEvent(e)) | ||||
|           this.map.add(e.marker) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     markerClickEvent(device) { | ||||
|       if (device?.marker) { | ||||
|         this.map?.setCenter(new this.AMap.LngLat(device.lng, device.lat)) | ||||
|         device.marker.setIcon(this.$cdn + 'monitor/cameraSelected.png') | ||||
|         this.selected = device | ||||
|         let win = new this.AMap.InfoWindow({ | ||||
|           isCustom: true, | ||||
|           autoMove: true, | ||||
|           closeWhenClickMap: true, | ||||
|           content: this.$refs.selectedInfoWin | ||||
|         }).on('close', () => { | ||||
|           device.marker.setIcon(this.$cdn + 'monitor/camera.png') | ||||
|           this.selected = {} | ||||
|         }) | ||||
|         win.open(this.map, new this.AMap.LngLat(device.lng, device.lat)) | ||||
|       } | ||||
|     }, | ||||
|     getDeviceToken() { | ||||
|       this.instance.post("/app/appzyvideoequipment/getAppUserToken").then(res => { | ||||
|         if (res?.data) { | ||||
|           this.deviceToken = res.data | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleShowMonitor() { | ||||
|       this.dialog = true | ||||
|       this.instance.post("/app/appzyvideoequipment/getWebSdkUrl", null, { | ||||
|         params: {token: this.deviceToken, deviceId: this.selected.deviceId} | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           let data = JSON.parse(res.data) | ||||
|           this.monitor = data.url | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.initMap().then(() => setTimeout(() => this.renderDevicesOnMap(), 1000)) | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .AppMonitorMap { | ||||
|   background: #202330; | ||||
|   position: relative; | ||||
|  | ||||
|   .deviceSlider { | ||||
|     position: absolute; | ||||
|     left: 0; | ||||
|     top: 0; | ||||
|     bottom: 0; | ||||
|     z-index: 66; | ||||
|   } | ||||
|  | ||||
|   #amap { | ||||
|     width: 100%; | ||||
|     height: 100%; | ||||
|   } | ||||
|  | ||||
|   .selected { | ||||
|     background: #fff; | ||||
|     min-width: 280px; | ||||
|     box-sizing: border-box; | ||||
|     box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1); | ||||
|     padding: 12px; | ||||
|     color: #999; | ||||
|     font-size: 12px; | ||||
|  | ||||
|     b { | ||||
|       color: #333; | ||||
|       font-size: 16px; | ||||
|     } | ||||
|  | ||||
|     & > * + * { | ||||
|       margin-top: 4px; | ||||
|     } | ||||
|  | ||||
|     div[btn] { | ||||
|       cursor: pointer; | ||||
|       color: #89b; | ||||
|       font-size: 14px; | ||||
|     } | ||||
|  | ||||
|   } | ||||
|  | ||||
|   ::v-deep .monitorDialog { | ||||
|  | ||||
|     .el-dialog__header { | ||||
|       font-size: 14px; | ||||
|       color: #FFF; | ||||
|       height: 40px; | ||||
|       padding: 0 16px; | ||||
|       background: linear-gradient(180deg, #313B5B 0%, #1B202F 100%); | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       width: 100%; | ||||
|       box-sizing: border-box; | ||||
|  | ||||
|       span { | ||||
|         color: #fff; | ||||
|         flex: 1; | ||||
|         min-width: 0; | ||||
|       } | ||||
|  | ||||
|       .el-dialog__headerbtn { | ||||
|         position: relative; | ||||
|         top: unset; | ||||
|         right: unset; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .el-dialog__body { | ||||
|       padding: 0; | ||||
|       height: 360px; | ||||
|     } | ||||
|  | ||||
|     iframe { | ||||
|       width: 100%; | ||||
|       height: 100%; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   ::v-deep .amap-logo, ::v-deep .amap-copyright { | ||||
|     display: none !important; | ||||
|   } | ||||
|  | ||||
|   ::v-deep .amap-marker-label { | ||||
|     border-color: transparent; | ||||
|     box-shadow: 1px 1px 0 0 rgba(#999, .2); | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										233
									
								
								packages/device/monitor/components/deviceSlider.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										233
									
								
								packages/device/monitor/components/deviceSlider.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,233 @@ | ||||
| <template> | ||||
|   <section class="deviceSlider"> | ||||
|     <div class="mainPane" v-if="show"> | ||||
|       <div flex overview> | ||||
|         <b>监控设备</b> | ||||
|         <div> | ||||
|           <div>设备总数:{{ overview.total }}</div> | ||||
|           <div flex>在线设备:<p v-text="overview.online"/></div> | ||||
|         </div> | ||||
|         <el-progress type="circle" :width="40" :percentage="overview.percent" color="#19D286" :stroke-width="4"/> | ||||
|       </div> | ||||
|       <div flex search> | ||||
|         <el-select v-model="search.bind" size="mini" placeholder="全部" clearable @change="onChange"> | ||||
|           <el-option v-for="(op,i) in dict.getDict('deviceStatus')" :key="i" :value="op.dictValue" | ||||
|                      :label="op.dictName"/> | ||||
|         </el-select> | ||||
|         <el-input v-model="search.name" size="mini" placeholder="设备名称" prefix-icon="el-icon-search" | ||||
|                   @change="handleTreeFilter" clearable/> | ||||
|       </div> | ||||
|       <div title>设备列表</div> | ||||
|       <div fill class="deviceList"> | ||||
|         <el-scrollbar> | ||||
|           <el-tree ref="deviceTree" :data="treeData" :props="propsConfig" @node-click="handleNodeClick" | ||||
|                    :render-content="renderItem" :filter-node-method="handleFilter"/> | ||||
|         </el-scrollbar> | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="rightBtn" :class="{show}" @click="handleShow"> | ||||
|       <i class="iconfont iconArrow_Right"/> | ||||
|     </div> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| export default { | ||||
|   name: "deviceSlider", | ||||
|   props: { | ||||
|     show: Boolean, | ||||
|     ins: Function, | ||||
|     dict: Object, | ||||
|     renderItem: Function | ||||
|   }, | ||||
|   computed: { | ||||
|     overview() { | ||||
|       let total = this.list?.length || 0, | ||||
|           online = this.list?.filter(e => e.deviceStatus == 1)?.length || 0 | ||||
|       return { | ||||
|         total, online, | ||||
|         percent: Math.ceil(online / total * 100) || 0 | ||||
|       } | ||||
|     }, | ||||
|     propsConfig() { | ||||
|       return { | ||||
|         label: 'name', | ||||
|         children: 'children' | ||||
|       } | ||||
|     }, | ||||
|     treeData() { | ||||
|       let {list, noArea, staData} = this | ||||
|       let meta = [staData?.reduce((t, e) => { | ||||
|         return t.type <= e.type ? t : e | ||||
|       }, {name: '读取中...'})] | ||||
|       meta.map(p => this.addChild(p, [...staData, ...list].map(s => ({ | ||||
|         ...s, | ||||
|         parentId: s.areaId || s.parent_id | ||||
|       })))) | ||||
|       return [...meta, { | ||||
|         id: 'no_area', | ||||
|         name: '未知区划', | ||||
|         children: noArea | ||||
|       }] | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       list: [], | ||||
|       noArea: [], | ||||
|       staData: [], | ||||
|       name: '', | ||||
|       search: { | ||||
|         bind: '' | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     handleShow() { | ||||
|       this.$emit('update:show', !this.show) | ||||
|     }, | ||||
|     getDevices() { | ||||
|       this.ins.post("/app/appzyvideoequipment/tree", null, { | ||||
|         params: {size: 999} | ||||
|       }).then(res => { | ||||
|         if (res?.data) { | ||||
|           this.staData = res.data.count | ||||
|           this.list = res.data.list | ||||
|           this.noArea = res.data.noArea | ||||
|           this.$emit('list', this.list) | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleNodeClick(data) { | ||||
|       this.$emit('select', data) | ||||
|     }, | ||||
|     handleFilter(v, data) { | ||||
|       if (!v) { | ||||
|         return !this.search.bind ? true : data.deviceStatus === this.search.bind | ||||
|       } | ||||
|  | ||||
|       return data?.name?.indexOf(v) > -1  && (!this.search.bind ? true : data.deviceStatus === this.search.bind) | ||||
|     }, | ||||
|     handleTreeFilter(v) { | ||||
|       this.$refs.deviceTree?.filter(v) | ||||
|     }, | ||||
|  | ||||
|     onChange () { | ||||
|       this.$refs.deviceTree?.filter(this.search.name) | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.dict.load("deviceStatus") | ||||
|     this.getDevices() | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .deviceSlider { | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   flex-shrink: 0; | ||||
|   color: #fff; | ||||
|  | ||||
|   div[flex] { | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|   } | ||||
|  | ||||
|   div[fill] { | ||||
|     flex: 1; | ||||
|     min-width: 0; | ||||
|     min-height: 0; | ||||
|   } | ||||
|  | ||||
|   .mainPane { | ||||
|     width: 280px; | ||||
|     height: 100%; | ||||
|     background: #333C53; | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|     padding-top: 16px; | ||||
|     overflow: hidden; | ||||
|     box-sizing: border-box; | ||||
|  | ||||
|     b { | ||||
|       font-size: 18px; | ||||
|     } | ||||
|  | ||||
|     div[overview], div[search] { | ||||
|       box-sizing: border-box; | ||||
|       font-size: 12px; | ||||
|       justify-content: space-between; | ||||
|       padding: 0 16px; | ||||
|       gap: 4px; | ||||
|       margin-bottom: 16px; | ||||
|  | ||||
|       ::v-deep.el-input__inner { | ||||
|         color: #fff; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     div[title] { | ||||
|       height: 28px; | ||||
|       background: #3E4A69; | ||||
|       padding: 0 16px; | ||||
|       line-height: 28px; | ||||
|     } | ||||
|  | ||||
|     ::v-deep.deviceList { | ||||
|       padding: 0 8px; | ||||
|  | ||||
|       .el-scrollbar { | ||||
|         height: 100%; | ||||
|  | ||||
|         .el-scrollbar__wrap { | ||||
|           box-sizing: content-box; | ||||
|           padding-bottom: 17px; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     ::v-deep .el-progress__text, p { | ||||
|       color: #19D286; | ||||
|     } | ||||
|  | ||||
|     ::v-deep .el-input__inner { | ||||
|       background: #282F45; | ||||
|       border: none; | ||||
|     } | ||||
|  | ||||
|     ::v-deep .el-tree { | ||||
|       background: transparent; | ||||
|       color: #fff; | ||||
|  | ||||
|       .el-tree-node:focus > .el-tree-node__content, .el-tree-node__content:hover { | ||||
|         background: rgba(#fff, .1); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     ::v-deep .el-input__icon { | ||||
|       color: #89b; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .rightBtn { | ||||
|     width: 16px; | ||||
|     height: 80px; | ||||
|     background: url("https://cdn.cunwuyun.cn/monitor/drawerBtn.png"); | ||||
|     color: #fff; | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|     justify-content: center; | ||||
|  | ||||
|     .iconfont { | ||||
|       transition: transform 0.2s; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     &.show > .iconfont { | ||||
|       transform: rotate(180deg); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										181
									
								
								packages/device/monitor/components/locateDialog.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								packages/device/monitor/components/locateDialog.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,181 @@ | ||||
| <template> | ||||
|   <section class="locateDialog"> | ||||
|     <ai-dialog :visible.sync="dialog" title="标绘" @closed="$emit('visible',false),selected={}" | ||||
|                @opened="$nextTick(()=>initMap())" | ||||
|                @onConfirm="handleConfirm"> | ||||
|       <div id="amap" v-if="dialog"/> | ||||
|       <div class="poi"> | ||||
|         <el-input ref="poiInput" v-model="search" size="small" clearable @change="handleSearch" placeholder="请输入地点"/> | ||||
|       </div> | ||||
|       <el-form class="selected" v-if="!!selected.location" id="result" size="mini" label-suffix=":" | ||||
|                label-position="left"> | ||||
|         <div class="header"> | ||||
|           <i class="iconfont iconLocation"/> | ||||
|           <span v-html="[selected.location.lng, selected.location.lat].join(',')"/> | ||||
|         </div> | ||||
|         <el-form-item label="地点">{{ selected.name || "未知地名" }}</el-form-item> | ||||
|         <el-form-item label="类型" v-if="!!selected.type">{{ selected.type }}</el-form-item> | ||||
|         <el-form-item label="地址" v-if="!!selected.address">{{ selected.address }}</el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import AMapLoader from '@amap/amap-jsapi-loader' | ||||
|  | ||||
| export default { | ||||
|   name: "locateDialog", | ||||
|   model: { | ||||
|     prop: "visible", | ||||
|     event: "visible", | ||||
|   }, | ||||
|   props: ['latlng', 'visible'], | ||||
|   data() { | ||||
|     return { | ||||
|       dialog: false, | ||||
|       search: "", | ||||
|       poi: null, | ||||
|       map: null, | ||||
|       AMap: null, | ||||
|       selected: {}, | ||||
|       geo: null | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
|     visible(v) { | ||||
|       this.dialog = v | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     initMap() { | ||||
|       AMapLoader.load({ | ||||
|         key: "b553334ba34f7ac3cd09df9bc8b539dc", | ||||
|         version: '2.0', | ||||
|         plugins: ['AMap.PlaceSearch', 'AMap.Marker', 'AMap.Geolocation'], | ||||
|       }).then(AMap => { | ||||
|         this.AMap = AMap | ||||
|         this.map = new AMap.Map('amap', { | ||||
|           zoom: 14, | ||||
|           center: this.latlng ? [this.latlng.lng, this.latlng.lat] : '' | ||||
|         }).on('click', res => { | ||||
|           this.map.clearMap() | ||||
|           this.selected = {location: res.lnglat} | ||||
|           this.poi?.searchNearBy('', res.lnglat, 100) | ||||
|         }); | ||||
|         if (this.latlng) { | ||||
|           let marker = new AMap.Marker({ | ||||
|             position: [this.latlng.lng, this.latlng.lat] | ||||
|           }) | ||||
|           this.map.add(marker) | ||||
|         } | ||||
|         this.poi = new AMap.PlaceSearch().on('complete', ({poiList}) => { | ||||
|           this.map.clearMap() | ||||
|           if (poiList?.length > 0) { | ||||
|             poiList?.pois?.map(e => { | ||||
|               let marker = new AMap.Marker({ | ||||
|                 position: e.location, | ||||
|               }).on('click', () => this.selected = e) | ||||
|               this.map.add(marker) | ||||
|             }) | ||||
|           } else { | ||||
|             let marker = new AMap.Marker({ | ||||
|               position: this.selected.location, | ||||
|             }) | ||||
|             this.map.add(marker) | ||||
|           } | ||||
|         }) | ||||
|         this.geo = new AMap.Geolocation({ | ||||
|           enableHighAccuracy: true,//是否使用高精度定位 | ||||
|           zoomToAccuracy: true//定位成功后是否自动调整地图视野到定位点 | ||||
|         }) | ||||
|         this.map.addControl(this.geo) | ||||
|       }) | ||||
|     }, | ||||
|     handleSearch(v) { | ||||
|       if (v) { | ||||
|         this.poi.searchNearBy(v, this.map.getCenter(), 50000) | ||||
|       } | ||||
|     }, | ||||
|     handleConfirm() { | ||||
|       if (this.selected?.location) { | ||||
|         this.$emit('confirm', this.selected) | ||||
|       } else { | ||||
|         this.$message.error('请先选择坐标位置') | ||||
|       } | ||||
|  | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.dialog = this.visible | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .locateDialog { | ||||
|   ::v-deep .el-dialog__body { | ||||
|     padding: 0; | ||||
|     height: 480px; | ||||
|     position: relative; | ||||
|  | ||||
|     .ai-dialog__content--wrapper { | ||||
|       padding: 0 !important; | ||||
|     } | ||||
|  | ||||
|     #amap { | ||||
|       width: 100%; | ||||
|       height: 480px; | ||||
|  | ||||
|       .amap-logo, .amap-copyright { | ||||
|         display: none !important; | ||||
|       } | ||||
|  | ||||
|       .amap-marker-label { | ||||
|         border-color: transparent; | ||||
|         box-shadow: 1px 1px 0 0 rgba(#999, .2); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .poi { | ||||
|       position: absolute; | ||||
|       left: 10px; | ||||
|       top: 10px; | ||||
|       display: flex; | ||||
|       height: 32px; | ||||
|       flex-direction: column; | ||||
|  | ||||
|       div { | ||||
|         flex-shrink: 0; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     .selected { | ||||
|       position: absolute; | ||||
|       right: 16px; | ||||
|       top: 16px; | ||||
|       background: #fff; | ||||
|       min-width: 200px; | ||||
|       box-sizing: border-box; | ||||
|       box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); | ||||
|  | ||||
|       .header { | ||||
|         color: #fff; | ||||
|         background: #26f; | ||||
|         text-align: center; | ||||
|         display: flex; | ||||
|         align-items: center; | ||||
|         height: 32px; | ||||
|         font-size: 14px; | ||||
|         gap: 4px; | ||||
|         padding: 0 8px; | ||||
|       } | ||||
|  | ||||
|       .el-form-item { | ||||
|         padding: 0 8px; | ||||
|         margin: 0; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										91
									
								
								packages/device/monitor/components/settingDialog.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								packages/device/monitor/components/settingDialog.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
| <template> | ||||
|   <section class="settingDialog"> | ||||
|     <ai-dialog :visible.sync="dialog" title="基础设置" @close="$emit('visible',false)"> | ||||
|       <el-form ref="deviceForm" size="small" label-width="140px"> | ||||
|         <el-form-item label="设备名称" class="full"> | ||||
|           <el-input v-model="form.name" clearable placeholder="设备名称"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="摄像头状态"> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="高清视频"> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="摄像头麦克风"> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="状态指示灯"> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="夜视"> | ||||
|           <el-radio v-model="form.status" label="自动"/> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="旋转180°"> | ||||
|           <el-radio v-model="form.status" label="开启"/> | ||||
|           <el-radio v-model="form.status" label="关闭"/> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="WIFI网络" class="full">-</el-form-item> | ||||
|         <el-form-item label="MAC地址">(34:75:6b:c9:10)</el-form-item> | ||||
|         <el-form-item label="摄像头型号">C71</el-form-item> | ||||
|         <el-form-item label="固件">20.0326.251.2486</el-form-item> | ||||
|         <el-form-item label="嵌入式应用">2.3.37.8954</el-form-item> | ||||
|         <el-form-item label="IMEI">110003953100302</el-form-item> | ||||
|       </el-form> | ||||
|     </ai-dialog> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| export default { | ||||
|   name: "settingDialog", | ||||
|   model: { | ||||
|     prop: "visible", | ||||
|     event: "visible", | ||||
|   }, | ||||
|   props: { | ||||
|     visible: Boolean, | ||||
|     detail: {default: () => ({})} | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       dialog: false, | ||||
|       form: {} | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
|     visible(v) { | ||||
|       this.dialog = v | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.form = JSON.parse(JSON.stringify(this.form)) | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .settingDialog { | ||||
|   .el-form { | ||||
|     display: flex; | ||||
|     flex-wrap: wrap; | ||||
|   } | ||||
|  | ||||
|   ::v-deep .el-form-item { | ||||
|     width: 50%; | ||||
|  | ||||
|     .el-form-item__label { | ||||
|       padding-right: 40px; | ||||
|     } | ||||
|  | ||||
|     &.full { | ||||
|       width: 100%; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user