zhangzengfei
2021-02-04 0175cda6150656bc74b34c6f6c71edd1e1fc653c
src/pages/panoramicView/components/RelateCamera.vue
@@ -58,7 +58,7 @@
        </div>
      </div>
      <div class="relative-list">
        <div class="relative-item" v-for="item in relativeList" :key="item.id">
        <div class="relative-item" v-for="(item,index) in relativeList" :key="item.id">
          <div class="left">
            <el-select v-model="item.sourceObj" value-key="polygonId" size="small">
              <el-option
@@ -80,9 +80,18 @@
          </div>
          <div class="right">
            <el-button type="text" @click="saveRelativePolygon(item)">保存</el-button>
            <div class="btn-del" @click="delRelation(item)">
              <i class="el-icon-delete"></i>
            </div>
            <el-popconfirm title="确定删除该配置吗?" @onConfirm="delRelation(item)" v-if="item.id">
              <el-button class="btn-del" slot="reference" type="text" icon="el-icon-delete"></el-button>
            </el-popconfirm>
            <el-button
              @click="delRelation(item,index)"
              class="btn-del"
              slot="reference"
              type="text"
              icon="el-icon-delete"
              v-else
            ></el-button>
          </div>
        </div>
      </div>
@@ -170,17 +179,22 @@
    polygonUpdate () {
      this.getAllGroups();
    },
    delRelation (item) {
    delRelation (item, index) {
      let _this = this;
      delRelation(item.id).then(res => {
        if (res.success) {
          this.$notify({
            type: 'success',
            message: res.data
          });
          _this.findRelationByGroup();
        }
      })
      if (item.id) {
        delRelation(item.id).then(res => {
          if (res.success) {
            this.$notify({
              type: 'success',
              message: res.data
            });
            _this.findRelationByGroup();
          }
        })
      }else{
        this.relativeList.splice(index,1);
      }
    },
    findRelationByGroup () {
      let _this = this;
@@ -201,6 +215,20 @@
    },
    saveRelativePolygon (item) {
      debugger
      if (!item.sourceObj || !item.targetObj) {
        this.$notify({
          type: 'warning',
          message: '请完善关联区域信息!'
        });
        return;
      }
      if (item.sourceObj.cameraId == item.targetObj.cameraId) {
        this.$notify({
          type: 'warning',
          message: '相同摄像机不存在关联区域,请重新选择!'
        });
        return;
      }
      let _this = this;
      let params = {
        groupId: this.curGroup.id,
@@ -282,8 +310,20 @@
        groups[i].cameras = await _this.findPolygonByIds(groups[i].cameras)
      }
      this.groupList = groups;
      //选中第一个
      this.groupList.length && this.checkCurrentGroup(_this.groupList[0]);
      this.groupList.reverse();
      //如果刚新建则选中第一个,编辑则选中编辑的那条
      if (!this.groupForm.id) {
        this.groupList.length && this.checkCurrentGroup(_this.groupList[0]);
      } else {
        let group = this.groupList.find(one => one.id == this.groupForm.id);
        if(group){
          this.groupList.length && this.checkCurrentGroup(group);
        }else{
          this.groupList.length && this.checkCurrentGroup(_this.groupList[0]);
        }
      }
    },
@@ -293,9 +333,11 @@
    },
    editGroup (group) {
      debugger
      this.groupModelVisible = true;
      //this.$refs['groupForm'].resetFields();
      this.groupForm = group;
      //this.groupForm = group;
      this.groupForm = JSON.parse(JSON.stringify(group));
    },
    removeGroup (group) {
      let _this = this;
@@ -306,8 +348,9 @@
    checkCurrentGroup (group) {
      this.groupList.forEach(group => {
        group.checked = false;
      })
      });
      this.curGroup = group;
      this.groupForm = JSON.parse(JSON.stringify(group));
      this.curGroup.checked = true;
      this.findRelationByGroup();
      //查询第一个分组下摄像机区域
@@ -370,6 +413,12 @@
      })
      //this.groupList.push(this.groupForm);
      saveCameraGroupInfo(params).then(res => {
        if(res.success){
          this.$notify({
            type: 'success',
            message: '保存成功!'
          })
        }
        _this.getAllGroups();
      })
      this.groupModelVisible = false;
@@ -440,8 +489,8 @@
      .details {
        display: -webkit-box;
        overflow: hidden;
        text-overflow:ellipsis;
        word-break:break-all;
        text-overflow: ellipsis;
        word-break: break-all;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        //flex-wrap: wrap;
@@ -512,6 +561,9 @@
        .right {
          display: flex;
          align-items: center;
          .el-button + .el-button{
            margin-left: 0;
          }
        }
        i {
          font-size: 20px;