From c761748876b5239a084e16b22f8d616897714175 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 07 十二月 2022 17:10:18 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_ui

---
 src/components/dispatch/index.vue |   93 ++++++++++++----------------------------------
 1 files changed, 24 insertions(+), 69 deletions(-)

diff --git a/src/components/dispatch/index.vue b/src/components/dispatch/index.vue
index 2089ae8..9f284e1 100644
--- a/src/components/dispatch/index.vue
+++ b/src/components/dispatch/index.vue
@@ -47,9 +47,7 @@
           <el-select
             v-model="dispatch.enforcementTeam"
             placeholder="閫夋嫨涓槦"
-            :disabled="
-              squadronOptions.length !== 0 && squadronOptions ? false : true
-            "
+            :disabled="!(squadronOptions.length !== 0 && squadronOptions)"
             @change="handleMidChange"
           >
             <el-option
@@ -66,9 +64,7 @@
           <el-select
             v-model="dispatch.lawEnforcer"
             placeholder="璇烽�夋嫨浜哄憳"
-            :disabled="
-              personOptions.length !== 0 && personOptions ? false : true
-            "
+            :disabled="!(personOptions.length !== 0 && personOptions)"
             @change="handlePerChange"
           >
             <el-option
@@ -121,15 +117,15 @@
 </template>
 <script>
 import MyMap from "@/components/map";
-import { parseTime } from "@/utils/index";
 export default {
   components: {
     MyMap,
   },
-  props: ["id", "changeDialog", "refresh", "mytype"],
+  props: ["id", "changeDialog", "refresh", "mytype", "isGetData"],
   created() {
     // 鍒ゆ柇杞﹁締绫诲瀷
     this.mytype === 1 ? this.getLawCarList() : this.getSoilCarList();
+    this.isGetDispatchData = this.isGetData ? this.isGetData : false;
     this.getDepartList();
   },
   data() {
@@ -150,13 +146,6 @@
         callback();
       } else {
         callback(new Error("娲鹃仯鎰忚涓嶈兘涓虹┖"));
-      }
-    };
-    const checkDistance = (rule, value, callback) => {
-      if (value) {
-        callback();
-      } else {
-        callback(new Error("璺濈涓嶈兘涓虹┖"));
       }
     };
     const checkTeam = (rule, value, callback) => {
@@ -218,12 +207,6 @@
         dispatchOpinion: [
           { required: true, trigger: "change", validator: checkOpinion },
         ],
-        // distance: [
-        //   { required: true, trigger: "change", validator: checkDistance },
-        // ],
-        // enforcementTeam: [
-        //     { required: true, trigger: 'change', validator: checkTeam }
-        // ],
         lawEnforcer: [
           { required: true, trigger: "change", validator: checkPerson },
         ],
@@ -238,57 +221,38 @@
           },
         ],
       },
-      carOptions: [
-        {
-          label: "杞﹁締涓�",
-          value: 1,
-        },
-        {
-          label: "杞﹁締浜�",
-          value: 2,
-        },
-      ],
+      carOptions: [],
       departOptions: [],
-      carOptions: [
-        {
-          label: "杞﹁締涓�",
-          value: 1,
-        },
-        {
-          label: "杞﹁締浜�",
-          value: 2,
-        },
-      ],
       squadronOptions: [],
       personOptions: [],
+      isGetDispatchData: true
     };
   },
   methods: {
     // 鎵ц璋冨害
     handleDispatch() {
-      console.log(this.dispatch);
       this.$refs.form.validate((valid) => {
-        console.log(valid);
         if (valid) {
-          const { dispatch, id } = this;
-          // dispatch.disposeDate = new Date();
-          console.log(id);
-          dispatch.baseCaseId = id;
-          console.log(dispatch);
-          this.$axios({
-            method: "post",
-            url: `sccg/dispatch_handle/dispatch`,
-            data: dispatch,
-          }).then((res) => {
-            this.$message({
-              type: res.code === 200 ? "success" : "error",
-              message: res.code === 200 ? "璋冨害鎴愬姛" : res.message,
+          if (this.isGetDispatchData) {
+            this.$emit('getDispatchData', this.dispatch);
+          } else {
+            const { dispatch, id } = this;
+            dispatch.baseCaseId = id;
+            this.$axios({
+              method: "post",
+              url: `sccg/dispatch_handle/dispatch`,
+              data: dispatch,
+            }).then((res) => {
+              this.$message({
+                type: res.code === 200 ? "success" : "error",
+                message: res.code === 200 ? "璋冨害鎴愬姛" : res.message,
+              });
+              this.refresh();
             });
-            this.$emit("changeDialog", { flag: false });
-            this.refresh();
-          });
+          }
+          this.$emit("changeDialog", { flag: false });
         } else {
-          return false;
+          this.$message.warning('璇锋鏌ュ繀濉」');
         }
       });
     },
@@ -303,7 +267,6 @@
         url: `sccg/car_Manage/query_enforce?current=1&size=1000`,
       }).then((res) => {
         this.carOptions = res.data.records;
-        console.log(res, this.carOptions);
       });
     },
     // 鑾峰彇娓e湡杞﹁締
@@ -326,7 +289,6 @@
     },
     // 鑾峰彇涓槦
     async getTeamList(id) {
-      console.log(id);
       await this.$axios({
         method: "get",
         url: `sccg/depart/query_father_children?fatherId=${id}`,
@@ -335,12 +297,10 @@
           this.squadronOptions = res.data;
         })
         .catch((err) => {
-          console.log(err);
         });
     },
     // 鑾峰彇閮ㄩ棬涓嬬殑鐢ㄦ埛
     async getDepartUserList(id) {
-      console.log(id);
       await this.$axios({
         method: "get",
         url: `sccg/admin/getDepartUser/${id}`,
@@ -372,9 +332,6 @@
       this.dispatch.contactWay = "";
       this.dispatch.lawEnforcerName = "";
       await this.getTeamList(id);
-      // if (this.squadronOptions.length === 0) {
-      //     await this.getDepartUserList(id);
-      // }
     },
     // 涓槦鏇存敼
     async handleMidChange(id) {
@@ -404,9 +361,7 @@
   watch: {
     "squadronOptions.length": {
       handler(newval, oldval) {
-        console.log(newval);
         if (newval === 0) {
-          console.log(1);
           this.$message({
             type: "warning",
             message: "璇ラ儴闂ㄤ笅娌℃湁涓槦",

--
Gitblit v1.8.0