zhangzengfei
2020-09-01 59ad7ba6452b2028fd7faca000c626a148256620
fix: do not allow empty data to be saved. for area manager
1个文件已修改
57 ■■■■■ 已修改文件
src/pages/areaManage/index/App.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/areaManage/index/App.vue
@@ -58,7 +58,7 @@
import { guid } from '@/scripts/util.js'
import { findAllPolygons, getAllAreas, saveAreaInfo, delArea } from '@/api/camera'
export default {
  data () {
  data() {
    return {
      isEdit: false,
      groups: [],
@@ -98,19 +98,19 @@
      checkedData: []
    }
  },
  mounted () {
  mounted() {
    this.renderTable();
    this.getAllPolygons();
  },
  methods: {
    renderTable () {
    renderTable() {
      getAllAreas().then(res => {
        if (res.code == 200) {
          this.groups = res.data
        }
      })
    },
    getAllPolygons () {
    getAllPolygons() {
      findAllPolygons().then(res => {
        if (res.code == 200) {
          this.areaData = res.data.map(item => {
@@ -127,11 +127,10 @@
        }
      });
    },
    edit (row) {
    edit(row) {
      this.isEdit = true;
      this.dialogFormVisible = true;
      this.areaForm = row;
      debugger
      //回显穿梭框
      let _this = this;
      _this.checkedData = [];
@@ -148,7 +147,7 @@
      });
      console.log(this.checkedData)
    },
    createArea () {
    createArea() {
      this.isEdit = false;
      this.dialogFormVisible = true;
      this.areaForm = JSON.parse(JSON.stringify(this.areaForm));
@@ -158,7 +157,7 @@
      this.areaForm.camPolygons = [];
      this.checkedData = [];
    },
    removeItem (id) {
    removeItem(id) {
      this.$confirm('确定删除该项吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -177,34 +176,23 @@
      });
    },
    getIdCode () {
    getIdCode() {
      this.areaForm.id = guid();
    },
    handleChange (value, direction, movedKeys) {
    handleChange(value, direction, movedKeys) {
      console.log(value, direction, movedKeys);
    },
    save () {
      // this.checkedData.forEach(item=>{
      //   let node = JSON.parse(item);
      //   this.camPolygon.cameraId = node.cameraId;
      //   this.camPolygon.cameraName = node.cameraName;
      //   this.pgn.polygonId = node.polygonId;
      //   this.pgn.polygonName = node.polygonName;
      //   this.camPolygon.pgns.push(this.pgn);
      //   this.areaForm.camPolygons.push(this.camPolygon);
      //   let _this = this;
      //   saveAreaInfo(this.areaForm).then(res=>{
      //     if(res.code==200){
      //       _this.$notify({
      //         type:'success',
      //         message:'保存成功!'
      //       });
      //       _this.dialogFormVisible = false;
      //       _this.getAllAreas();
      //     }
      //   })
      // });
    save() {
      if (this.areaForm.id === "") {
        this.$notify({
          type: 'error',
          message: '区域ID不能为空'
        });
        return;
      }
      let tempArr = [];
      let tempIdArr = [];
      this.areaForm.camPolygons = [];
@@ -238,7 +226,6 @@
      })
      let _this = this;
      console.log(this.areaForm);
      debugger
      saveAreaInfo(this.areaForm).then(res => {
        if (res.code == 200) {
          _this.$notify({
@@ -334,7 +321,7 @@
/deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label {
  overflow: visible;
}
/deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label span{
/deep/.el-transfer-panel__item.el-checkbox .el-checkbox__label span {
  font-size: 12px !important;
  padding-right: 20px;
}
@@ -344,7 +331,7 @@
  .el-checkbox__label {
  font-size: 14px !important;
}
/deep/.el-transfer-panel{
  width:300px;
/deep/.el-transfer-panel {
  width: 300px;
}
</style>