From c36183e7d11898b44ebbdc5899715cb68f9d7635 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 29 Nov 2022 09:25:42 +0800
Subject: [PATCH] 活动人员区域;活动车辆区域根据所选活动默认回填

---
 src/views/securityManage/securityManage.vue |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/src/views/securityManage/securityManage.vue b/src/views/securityManage/securityManage.vue
index 96f1894..49fb218 100644
--- a/src/views/securityManage/securityManage.vue
+++ b/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
+          }
+        })
       }
     }
   };

--
Gitblit v1.9.3