From 676722551d0bc2f8caa0644961e60deef3f0d532 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期一, 10 十月 2022 18:08:27 +0800
Subject: [PATCH] 修改遗留问题,新增店铺管理删除、编辑,新增车辆管理模块

---
 src/components/dispatch/index.vue |  191 +++++++++++++++++++++++++++++++----------------
 1 files changed, 126 insertions(+), 65 deletions(-)

diff --git a/src/components/dispatch/index.vue b/src/components/dispatch/index.vue
index 73c86db..66d3df2 100644
--- a/src/components/dispatch/index.vue
+++ b/src/components/dispatch/index.vue
@@ -23,25 +23,26 @@
             <div class="form-person">
                 <!-- 閮ㄩ棬 -->
                 <el-form-item label="閫夋嫨浜哄憳:" prop="dispatchOpinion">
-                    <el-select v-model="dispatch.dispatchOpinion" placeholder="璇烽�夋嫨閮ㄩ棬">
-                        <el-option v-for="item in departOptions" :key="item.value" :label="item.label"
-                            :value="item.value">
+                    <el-select v-model="dispatch.dispatchOpinion" placeholder="璇烽�夋嫨閮ㄩ棬" @change="handleTopChange">
+                        <el-option v-for="item in departOptions" :key="item.id" :label="item.departName"
+                            :value="item.id">
                         </el-option>
                     </el-select>
                 </el-form-item>
                 <!-- 涓槦 -->
                 <el-form-item prop="enforcementTeam" class="person-item">
-                    <el-select v-model="dispatch.enforcementTeam" placeholder="閫夋嫨涓槦">
-                        <el-option v-for="item in squadronOptions" :key="item.value" :label="item.label"
-                            :value="item.value">
+                    <el-select v-model="dispatch.enforcementTeam" placeholder="閫夋嫨涓槦"
+                        :disabled="squadronOptions.length!==0?false:true" @change="handleMidChange">
+                        <el-option v-for="item in squadronOptions" :key="item.id" :label="item.departName"
+                            :value="item.id">
                         </el-option>
                     </el-select>
                 </el-form-item>
                 <el-form-item prop='lawEnforcer' class="person-item">
                     <!-- 浜哄憳 -->
-                    <el-select v-model="dispatch.lawEnforcer" placeholder="璇烽�夋嫨浜哄憳">
-                        <el-option v-for="item in personOptions" :key="item.value" :label="item.label"
-                            :value="item.value">
+                    <el-select v-model="dispatch.lawEnforcer" placeholder="璇烽�夋嫨浜哄憳"
+                        :disabled="personOptions.length !== 0 ? false:true" @change="handlePerChange">
+                        <el-option v-for="item in personOptions" :key="item.id" :label="item.username" :value="item.id">
                         </el-option>
                     </el-select>
                 </el-form-item>
@@ -59,7 +60,7 @@
             </div>
         </el-form>
         <div class="map">
-            <MyMap></MyMap>
+            <!-- <MyMap></MyMap> -->
         </div>
         <div class="footer">
             <el-button type="primary" @click="handleDispatch">纭畾</el-button>
@@ -73,9 +74,11 @@
     components: {
         MyMap
     },
-    props: ['id','changeDialog','refresh'],
+    props: ['id', 'changeDialog', 'refresh', 'mytype'],
     created() {
-        console.log(this.id);
+        // 鍒ゆ柇杞﹁締绫诲瀷
+        this.mytype === 1 ? this.getLawCarList() : this.getSoilCarList();
+        this.getDepartList();
     },
     data() {
         const checkPhone = (rule, value, callback) => {
@@ -102,13 +105,6 @@
                 callback();
             } else {
                 callback(new Error('璺濈涓嶈兘涓虹┖'))
-            }
-        }
-        const checkCar = (rule, value, callback) => {
-            if (value) {
-                callback();
-            } else {
-                callback(new Error('鎵ф硶杞﹁締涓嶈兘涓虹┖'))
             }
         }
         const checkTeam = (rule, value, callback) => {
@@ -156,12 +152,9 @@
                 distance: [
                     { required: true, trigger: 'change', validator: checkDistance }
                 ],
-                enforcementCar: [
-                    { required: true, trigger: 'change', validator: checkCar }
-                ],
-                enforcementTeam: [
-                    { required: true, trigger: 'change', validator: checkTeam }
-                ],
+                // enforcementTeam: [
+                //     { required: true, trigger: 'change', validator: checkTeam }
+                // ],
                 lawEnforcer: [
                     { required: true, trigger: 'change', validator: checkPerson }
                 ],
@@ -180,14 +173,6 @@
                 },
             ],
             departOptions: [
-                {
-                    label: '閮ㄩ棬涓�',
-                    value: 1,
-                },
-                {
-                    label: '閮ㄩ棬浜�',
-                    value: 2,
-                },
             ],
             carOptions: [
                 {
@@ -200,24 +185,9 @@
                 },
             ],
             squadronOptions: [
-                {
-                    label: '涓槦涓�',
-                    value: 1,
-                },
-                {
-                    label: '涓槦浜�',
-                    value: 2,
-                },
             ],
             personOptions: [
-                {
-                    label: '浜哄憳涓�',
-                    value: 1,
-                },
-                {
-                    label: '浜哄憳浜�',
-                    value: 2,
-                },
+
             ],
         }
     },
@@ -228,32 +198,119 @@
             this.$refs.form.validate((valid) => {
                 console.log(valid);
                 if (valid) {
-                    const {dispatch,id} = this;
+                    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
+                        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,
+                        .then(res => {
+                            this.$message({
+                                type: res.code === 200 ? 'success' : 'error',
+                                message: res.code === 200 ? '璋冨害鎴愬姛' : res.message,
+                            })
+                            this.$emit('changeDialog', { flag: false });
+                            this.refresh();
                         })
-                        this.$emit('changeDialog',{flag:false});
-                        this.refresh();
-                    })
                 } else {
                     return false;
                 }
             })
         },
         // 鍙栨秷璋冨害
-        handleBack(){
-            this.$emit('changeDialog',{flag:false})
+        handleBack() {
+            this.$emit('changeDialog', { flag: false })
+        },
+        // 鑾峰彇鎵ф硶杞﹁締
+        getLawCarList() {
+            this.$axios({
+                method: 'get',
+                url: `sccg/car_Manage/query_enforce?current=1&size=1000`
+            })
+                .then(res => {
+                    this.carOptions = res.data.orders;
+                    console.log(res);
+                })
+        },
+        // 鑾峰彇娓e湡杞﹁締
+        getSoilCarList() {
+            this.$axios({
+                method: 'get',
+                url: `sccg/car_Manage/query_slag?current=1&size=1000`
+            })
+                .then(res => {
+                    this.carOptions = res.data.orders;
+                    console.log(res);
+                })
+        },
+        // 鑾峰彇椤剁骇閮ㄩ棬
+        getDepartList() {
+            this.$axios({
+                method: 'get',
+                url: `sccg/depart/query_father`,
+            })
+                .then(res => {
+                    this.departOptions = res.data;
+                })
+        },
+        // 鑾峰彇涓槦
+        async getTeamList(id) {
+            await this.$axios({
+                method: 'get',
+                url: `sccg/depart/query_father_children?fatherId=${id}`
+            })
+                .then(res => {
+                    this.squadronOptions = res.data;
+                })
+                .catch(err => {
+                    console.log(err);
+                })
+        },
+        // 鑾峰彇閮ㄩ棬涓嬬殑鐢ㄦ埛
+        async getDepartUserList(id) {
+            await this.$axios({
+                method: 'get',
+                url: `sccg/admin/getDepartUser/${id}`,
+            })
+                .then(res => {
+                    this.personOptions = res.data;
+                })
+                .catch(err => {
+                    this.$message({
+                    type: 'error',
+                    message: '璇ラ儴闂ㄤ汉鍛樹笉瓒筹紝璇锋崲涓儴闂�'
+                })
+                })
+        },
+        // 閮ㄩ棬鏇存敼
+        async handleTopChange(id) {
+            this.dispatch.lawEnforcer = '';
+            this.dispatch.enforcementTeam = '';
+            await this.getTeamList(id);
+            await this.getDepartUserList(id);
+        },
+        // 涓槦鏇存敼
+        async handleMidChange(id) {
+            this.dispatch.lawEnforcer = '';
+            await this.getDepartUserList(id);
+        },
+        // 浜哄憳鏇存敼
+        async handlePerChange(id){
+            await this.getLawUser(id);
+        },
+        // 鑾峰彇鎵ф硶浜哄憳淇℃伅
+        async getLawUser(id){
+            await this.$axios({
+                method:'get',
+                url:`sccg/admin/${id}`
+            })
+            .then(res=>{
+                console.log(res);
+            })
         }
     }
 }
@@ -261,12 +318,15 @@
 <style lang="scss" scoped>
 .dispatch {
     padding: 50px 20px 10px;
-    .form-person{
+
+    .form-person {
         display: flex;
-        .person-item{
+
+        .person-item {
             margin-left: -100px;
         }
     }
+
     .form-footer {
         display: flex;
         align-items: center;
@@ -282,7 +342,8 @@
         height: 388px;
         width: 100%;
     }
-    .footer{
+
+    .footer {
         display: flex;
         justify-content: flex-end;
         padding: 10px 20px;

--
Gitblit v1.8.0