上饶市警务平台后台管理前端
guoshilong
2022-11-29 c36183e7d11898b44ebbdc5899715cb68f9d7635
src/views/securityManage/securityManage.vue
@@ -48,6 +48,7 @@
<script>
  import {getPage, getDetails, add, update, remove} from "@/api/securityManage/securityManage";
  import {getAll} from "@/api/security/security";
  import {mapGetters} from "vuex";
  import MapBox from "@/components/map/mapBox";
@@ -83,11 +84,16 @@
              prop:"securityId",
              search: true,
              type:"select",
              dicUrl:"/api/security/security/all",
              dicData:[],
              props:{
                label:"name",
                value:"id"
              }
              },
              rules: [{
                required: true,
                message: "请选择所属活动",
                trigger: "blur"
              }]
            },
            {
              label: "警员",
@@ -103,6 +109,7 @@
              label: "所属机构",
              prop: "deptId",
              type: "tree",
              disabled:true,
              dicUrl: "api/blade-system/dept/lazy-list",
              props:{
                label:'deptName',
@@ -111,11 +118,6 @@
              },
              search: true,
              searchSpan:4,
              rules: [{
                required: true,
                message: "请选择所属机构",
                trigger: "blur"
              }]
            },
            {
              label: "类型",
@@ -146,6 +148,7 @@
        data: [],
        isDetail:false,
        routeRange:"",
        securityList:[],
      };
    },
    computed: {
@@ -164,6 +167,21 @@
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    created() {
      this.getSecurityList()
    },
    watch:{
      //根据活动回显机构
      'form.securityId':{
        handler(newVal,oldVal){
          this.securityList.forEach(e=>{
            if (e.id == newVal){
              this.form.deptId = e.deptId
            }
          })
        }
      }
    },
    methods: {
@@ -279,6 +297,16 @@
          this.loading = false;
          this.selectionClear();
        });
      },
      //获取所有活动集合
      getSecurityList(){
        getAll().then(res=>{
          if (res.data.code == 200){
            this.securityList = res.data.data
            const securityIdColumn = this.findObject(this.option.column,"securityId")
            securityIdColumn.dicData = this.securityList
          }
        })
      }
    }
  };