zhanghua
2022-10-13 8805eebe39d6470059616decd9fb10ab1f153088
src/components/dispatch/index.vue
@@ -118,14 +118,14 @@
            if (value) {
                callback();
            } else {
                callback(new Error('执法人员不能为空'))
                callback()
            }
        }
        const checkNumber = (rule, value, callback) => {
            if (value) {
                callback();
            } else {
                callback(new Error('执法人员编号不能为空'))
                callback()
            }
        }
        return {
@@ -143,7 +143,7 @@
            rules: {
                contactWay: [
                    {
                        required: true, trigger: 'blur', validator: checkPhone
                        required: false, trigger: 'blur', validator: checkPhone
                    }
                ],
                dispatchOpinion: [
@@ -159,7 +159,7 @@
                    { required: true, trigger: 'change', validator: checkPerson }
                ],
                lawEnforcerName: [
                    { required: true, trigger: 'change', validator: checkNumber }
                    { required: false, trigger: 'change', validator: checkNumber }
                ],
            },
            carOptions: [
@@ -291,7 +291,9 @@
            this.dispatch.lawEnforcer = '';
            this.dispatch.enforcementTeam = '';
            await this.getTeamList(id);
            await this.getDepartUserList(id);
            if(this.squadronOptions.length===0){
                await this.getDepartUserList(id);
            }
        },
        // 中队更改
        async handleMidChange(id) {
@@ -300,17 +302,21 @@
        },
        // 人员更改
        async handlePerChange(id){
            await this.getLawUser(id);
            let obj =  await this.getLawUser(id);
            this.dispatch.lawEnforcerName = obj.nickName;
            this.dispatch.contactWay = obj.mobile;
        },
        // 获取执法人员信息
        async getLawUser(id){
            let obj = {}
            await this.$axios({
                method:'get',
                url:`sccg/admin/${id}`
            })
            .then(res=>{
                console.log(res);
                obj = res.data;
            })
            return obj;
        }
    }
}