From b74beee46cee6b4274e68246321af4f8b2a3b9ed Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Wed, 07 Dec 2022 09:38:43 +0800
Subject: [PATCH] 1、值班联系方式联动下拉

---
 src/views/scheduling/scheduling.vue |   65 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/src/views/scheduling/scheduling.vue b/src/views/scheduling/scheduling.vue
index 3d0cca1..933b558 100644
--- a/src/views/scheduling/scheduling.vue
+++ b/src/views/scheduling/scheduling.vue
@@ -32,7 +32,7 @@
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/scheduling/scheduling";
+  import {getList, getDetail, add, update, remove, getPliceman} from "@/api/scheduling/scheduling";
   import {mapGetters} from "vuex";
 
   export default {
@@ -64,11 +64,11 @@
             {
               label: "值班员",
               prop: "person",
-              type:"select",
-              dicUrl:"/api/policeman/policeman/all",
-              props:{
-                label:"name",
-                value:"id"
+              type: "select",
+              dicUrl: "",
+              props: {
+                label: "name",
+                value: "id"
               }
             },
             {
@@ -78,8 +78,8 @@
             {
               label: "值班岗位",
               prop: "station",
-              row:true,
-              span:24
+              row: true,
+              span: 24
             },
             {
               label: "开始时间",
@@ -110,11 +110,11 @@
             {
               label: "带班领导",
               prop: "leads",
-              type:"select",
-              dicUrl:"/api/policeman/policeman/all",
-              props:{
-                label:"name",
-                value:"id"
+              type: "select",
+              dicUrl: "",
+              props: {
+                label: "name",
+                value: "id"
               }
             },
             {
@@ -123,7 +123,8 @@
             },
           ]
         },
-        data: []
+        data: [],
+        policemanList: []
       };
     },
     computed: {
@@ -143,6 +144,29 @@
         });
         return ids.join(",");
       }
+    },
+    watch: {
+      'form.person': {
+        handler(res) {
+          this.policemanList.forEach(e => {
+            if (res == e.id) {
+              this.form.contact = e.contact
+            }
+          })
+        }
+      },
+      'form.leads': {
+        handler(res) {
+          this.policemanList.forEach(e => {
+            if (res == e.id) {
+              this.form.leadContact = e.contact
+            }
+          })
+        }
+      },
+    },
+    created() {
+      this.getPolicemanAll();
     },
     methods: {
       rowSave(row, done, loading) {
@@ -235,10 +259,10 @@
         this.selectionList = [];
         this.$refs.crud.toggleSelection();
       },
-      currentChange(currentPage){
+      currentChange(currentPage) {
         this.page.currentPage = currentPage;
       },
-      sizeChange(pageSize){
+      sizeChange(pageSize) {
         this.page.pageSize = pageSize;
       },
       refreshChange() {
@@ -253,6 +277,15 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      getPolicemanAll() {
+        getPliceman().then(res => {
+          this.policemanList = res.data.data
+          const securityIdColumn = this.findObject(this.option.column, "person")
+          securityIdColumn.dicData = this.policemanList
+          const securityIdColumns = this.findObject(this.option.column, "leads")
+          securityIdColumns.dicData = this.policemanList
+        })
       }
     }
   };

--
Gitblit v1.9.3