| | |
| | | </div> |
| | | </div> |
| | | <!-- <div class="part" v-if="groupList.length"> --> |
| | | <el-divider></el-divider> |
| | | <div class="part" v-if="groupList.length!==0 && Object.keys(curGroup)"> |
| | | <div class="title">绘制区域(用于算法分析)</div> |
| | | <div class="relative-partment" v-if="curGroup.cameras&&curGroup.cameras.length"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <el-divider></el-divider> |
| | | <div class="part relative-config" v-if="Object.keys(curGroup)"> |
| | | <div class="title"> |
| | | <div class="left"> |
| | |
| | | |
| | | export default { |
| | | components: { SlideCanvas }, |
| | | data () { |
| | | data() { |
| | | return { |
| | | cameraData: [], |
| | | relativeList: [], |
| | |
| | | cameraAndPolygonData: [] |
| | | } |
| | | }, |
| | | mounted () { |
| | | mounted() { |
| | | this.getAllCameraData(); |
| | | }, |
| | | methods: { |
| | | getAllCameraData () { |
| | | getAllCameraData() { |
| | | let _this = this; |
| | | getCamerasByServer().then(res => { |
| | | if (res.success) { |
| | |
| | | console.log(e) |
| | | }) |
| | | }, |
| | | polygonUpdate () { |
| | | polygonUpdate() { |
| | | this.getAllGroups(); |
| | | }, |
| | | delRelation (item, index) { |
| | | delRelation(item, index) { |
| | | let _this = this; |
| | | if (item.id) { |
| | | delRelation(item.id).then(res => { |
| | |
| | | _this.findRelationByGroup(); |
| | | } |
| | | }) |
| | | }else{ |
| | | this.relativeList.splice(index,1); |
| | | } else { |
| | | this.relativeList.splice(index, 1); |
| | | } |
| | | |
| | | }, |
| | | findRelationByGroup () { |
| | | findRelationByGroup() { |
| | | let _this = this; |
| | | findByGroup({ groupId: this.curGroup.id }).then(res => { |
| | | |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | saveRelativePolygon (item) { |
| | | debugger |
| | | saveRelativePolygon(item) { |
| | | // debugger |
| | | if (!item.sourceObj || !item.targetObj) { |
| | | this.$notify({ |
| | | type: 'warning', |
| | |
| | | }) |
| | | }, |
| | | |
| | | async findPolygonByIds (cameras) { |
| | | async findPolygonByIds(cameras) { |
| | | for (var i = 0; i < cameras.length; i++) { |
| | | if (Object.keys(cameras[i]).length == 0) |
| | | continue |
| | | let res = await getAllPolygon({ cameraId: cameras[i].id }); |
| | | cameras[i].canvasData = res.data; |
| | | } |
| | | return cameras |
| | | }, |
| | | |
| | | async getAllGroupInfo () { |
| | | async getAllGroupInfo() { |
| | | let _this = this; |
| | | console.log("_this.cameraData", _this.cameraData) |
| | | let res = await findCameraGroups(); |
| | | console.log("res", res); |
| | | let groupArr = res.data.map(item => { |
| | | let obj = {}; //group |
| | | obj.groupName = item.groupName; |
| | |
| | | // _this.checkCurrentGroup(_this.groupList[0]); |
| | | // }) |
| | | // }, |
| | | async getAllGroups () { |
| | | async getAllGroups() { |
| | | let _this = this; |
| | | let groups = await this.getAllGroupInfo(); |
| | | console.log("groups", groups) |
| | | for (var i = 0; i < groups.length; i++) { |
| | | groups[i].cameras = await _this.findPolygonByIds(groups[i].cameras) |
| | | } |
| | |
| | | this.groupList.length && this.checkCurrentGroup(_this.groupList[0]); |
| | | } else { |
| | | let group = this.groupList.find(one => one.id == this.groupForm.id); |
| | | if(group){ |
| | | if (group) { |
| | | this.groupList.length && this.checkCurrentGroup(group); |
| | | }else{ |
| | | } else { |
| | | this.groupList.length && this.checkCurrentGroup(_this.groupList[0]); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | addRelation () { |
| | | addRelation() { |
| | | let obj = { cameraArea1: '', cameraArea2: '' }; |
| | | this.relativeList.push(obj) |
| | | }, |
| | | |
| | | editGroup (group) { |
| | | debugger |
| | | editGroup(group) { |
| | | // debugger |
| | | this.groupModelVisible = true; |
| | | //this.$refs['groupForm'].resetFields(); |
| | | //this.groupForm = group; |
| | | this.groupForm = JSON.parse(JSON.stringify(group)); |
| | | }, |
| | | removeGroup (group) { |
| | | removeGroup(group) { |
| | | let _this = this; |
| | | delCameraGroup(group.id).then(res => { |
| | | _this.getAllGroups() |
| | | }) |
| | | }, |
| | | checkCurrentGroup (group) { |
| | | checkCurrentGroup(group) { |
| | | this.groupList.forEach(group => { |
| | | group.checked = false; |
| | | }); |
| | |
| | | tempArr = tempArr.concat(cameraArea) |
| | | }); |
| | | this.cameraAreas = tempArr; |
| | | console.log(this.cameraAreas) |
| | | }) |
| | | }, |
| | | confirmGroupDialog () { |
| | | confirmGroupDialog() { |
| | | //请求保存新建或编辑分组 |
| | | let _this = this; |
| | | let params = { |
| | |
| | | }) |
| | | //this.groupList.push(this.groupForm); |
| | | saveCameraGroupInfo(params).then(res => { |
| | | if(res.success){ |
| | | if (res.success) { |
| | | this.$notify({ |
| | | type: 'success', |
| | | message: '保存成功!' |
| | |
| | | this.groupModelVisible = false; |
| | | |
| | | }, |
| | | newGroup () { |
| | | newGroup() { |
| | | this.groupModelVisible = true; |
| | | this.$nextTick(() => { |
| | | this.$refs['groupForm'].resetFields(); |
| | |
| | | position: relative; |
| | | display: flex; |
| | | &:after { |
| | | content: ''; |
| | | content: ""; |
| | | position: absolute; |
| | | font-size: 0; |
| | | width: 1px; |
| | |
| | | margin-bottom: 20px; |
| | | .relative-partment { |
| | | width: 1200px; |
| | | margin: 0 auto; |
| | | // margin: 0 auto; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .area-wrap { |
| | |
| | | .right { |
| | | display: flex; |
| | | align-items: center; |
| | | .el-button + .el-button{ |
| | | .el-button + .el-button { |
| | | margin-left: 0; |
| | | } |
| | | } |