瀏覽代碼

Merge branch 'zengjun'

LD 5 年之前
父節點
當前提交
6d2a8b422d

+ 23 - 9
resources/views/maintenance/role/edit.blade.php

@@ -44,7 +44,7 @@
                             <input name="authority" hidden   v-model="authorities" >
                             <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
                                 <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                                    <li  :data-original-title="authority.style ? '双击删除权限' :'双击添加权限'"    v-for="authority in authoritiesAll" v-if="authority.permission=='允许'" :id="authority.name" class="list-group-item list-group-item-action pt-0 pb-0"
+                                    <li  :data-original-title="authority.style ? '双击删除权限' :'双击添加权限'"    v-for="authority in authoritiesFilterAll" v-if="authority.permission=='允许'" :id="authority.name" class="list-group-item list-group-item-action pt-0 pb-0"
                                          @dblclick="selectedAuthority(authority)" :class="authority.style ? 'active' :''"><span style="cursor: default;" :id="authority.name"> @{{ authority.name }} </span></li>
                                 </ul>
                             </div>
@@ -112,7 +112,12 @@
             el:"#editPanel",
             data:{
                 authoritiesAll:[
-                        @foreach( $authoritiesAll as $authority )
+                    @foreach( $authoritiesAll as $authority )
+                    {id:'{{$authority->id}}',name:'{{$authority->alias_name}}',style:false,permission:'{{$authority->permission}}'},
+                    @endforeach
+                ],
+                authoritiesFilterAll:[
+                    @foreach( $authoritiesAll as $authority )
                     {id:'{{$authority->id}}',name:'{{$authority->alias_name}}',style:false,permission:'{{$authority->permission}}'},
                     @endforeach
                 ],
@@ -193,20 +198,29 @@
                 seekAuthority:function (e) {
                     let $val=e.target.value;
                     let authoritiesAll=this.authoritiesAll;
+                    let authoritiesFilterAll = this.authoritiesFilterAll;
                     let bool = false;
-                    authoritiesAll.every(function (authorityAll) {
-                        let name=authorityAll.name;
+                    authoritiesAll.every(function (authorities) {
+                        let name=authorities.name;
                         if (name.includes($val)){
-                            location.href="#"+authorityAll.name;
                             bool = true;
                             return false;
                         }
                         return  true;
                     });
-                    setTimeout(function () {
-                        if(bool){ $(e.target).focus();}
-                    },10)
-
+                    console.log(bool);
+                    if($val === '' ){
+                        this.authoritiesFilterAll = this.authoritiesAll;
+                    }else if(bool) {
+                        this.authoritiesFilterAll = [];
+                        for (let i = 0; i < authoritiesAll.length; i++) {
+                            let authorities = authoritiesAll[i];
+                            let name = authorities.name;
+                            if (name.includes($val)) {
+                                this.authoritiesFilterAll.push(authorities);
+                            }
+                        }
+                    }
                 },
             },
         });

+ 175 - 113
resources/views/maintenance/user/create.blade.php

@@ -23,7 +23,9 @@
                                 <label for="name" class="col-md-3 col-form-label text-md-right">姓名</label>
 
                                 <div class="col-md-7">
-                                    <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
+                                    <input id="name" type="text"
+                                           class="form-control @error('name') is-invalid @enderror" name="name"
+                                           value="{{ old('name') }}" required autocomplete="name" autofocus>
 
                                     @error('name')
                                     <span class="invalid-feedback" role="alert">
@@ -37,7 +39,9 @@
                                 <label for="email" class="col-md-3 col-form-label text-md-right">Email地址</label>
 
                                 <div class="col-md-7">
-                                    <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
+                                    <input id="email" type="email"
+                                           class="form-control @error('email') is-invalid @enderror" name="email"
+                                           value="{{ old('email') }}" required autocomplete="email">
 
                                     @error('email')
                                     <span class="invalid-feedback" role="alert">
@@ -51,7 +55,9 @@
                                 <label for="password" class="col-md-3 col-form-label text-md-right">密码</label>
 
                                 <div class="col-md-7">
-                                    <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
+                                    <input id="password" type="password"
+                                           class="form-control @error('password') is-invalid @enderror" name="password"
+                                           required autocomplete="new-password">
 
                                     @error('password')
                                     <span class="invalid-feedback" role="alert">
@@ -64,7 +70,8 @@
                                 <label for="password-confirm" class="col-md-3 col-form-label text-md-right">重输密码</label>
 
                                 <div class="col-md-7">
-                                    <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
+                                    <input id="password-confirm" type="password" class="form-control"
+                                           name="password_confirmation" required autocomplete="new-password">
                                 </div>
                             </div>
                             <div class="form-group row">
@@ -73,33 +80,42 @@
                                 <div class="col-md-7">
                                     <select class="form-control" name="userWorkgroupID" id="userWorkgroupID">
                                         <option></option>
-                                        <option v-for="userWorkgroup in userWorkgroups" :value="userWorkgroup.id">@{{ userWorkgroup.name }}</option>
+                                        <option v-for="userWorkgroup in userWorkgroups" :value="userWorkgroup.id">@{{
+                                            userWorkgroup.name }}
+                                        </option>
                                     </select>
                                 </div>
                             </div>
                             <div class="form-group row">
                                 <label for="role" class="col-md-3 col-form-label text-md-right">角色</label>
                                 <div class="col-md-7">
-                                    <input type="text"  class="form-control tooltipTarget" placeholder="定位角色"
+                                    <input type="text" class="form-control tooltipTarget" placeholder="定位角色"
                                            @input="seekRole($event)" title="输入关键词快速定位"></div>
                             </div>
                             <div class="form-group row">
                                 <label class="col-md-3"></label>
                                 <div class="col-md-4">
-                                    <input name="role" hidden    v-model="roles" >
-                                    <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
-                                        <ul class="list-group tooltipTarget" style="width: 100%" onselectstart="return false;">
-                                            <li  :data-original-title="role.style ? '双击删除角色' : '双击添加角色'"    v-for="role in rolesAll" :id="role.name"
-                                                 class="tooltipTarget list-group-item list-group-item-action pt-0 pb-0"
-                                                  @dblclick="selectedRole(role)" :class="role.style ? 'active' :''"><span style="cursor: default;" > @{{ role.name }}  </span></li>
+                                    <input name="role" hidden v-model="roles">
+                                    <div class="input-group"
+                                         style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
+                                        <ul class="list-group tooltipTarget" style="width: 100%"
+                                            onselectstart="return false;">
+                                            <li :data-original-title="role.style ? '双击删除角色' : '双击添加角色'"
+                                                v-for="role in rolesFilter" :id="role.name"
+                                                class="tooltipTarget list-group-item list-group-item-action pt-0 pb-0"
+                                                @dblclick="selectedRole(role)" :class="role.style ? 'active' :''"><span
+                                                    style="cursor: default;"> @{{ role.name }}  </span></li>
                                         </ul>
                                     </div>
                                 </div>
                                 <div class="col-md-3">
-                                    <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
+                                    <div class="input-group"
+                                         style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
                                         <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                                            <li  title="双击删除角色"    v-for="role in rolesList" :id="role.name" class="list-group-item list-group-item-action pt-0 pb-0"
-                                                 @dblclick="selectedRole(role)" ><span style="cursor: default;" > @{{ role.name }}  </span></li>
+                                            <li title="双击删除角色" v-for="role in rolesList" :id="role.name"
+                                                class="list-group-item list-group-item-action pt-0 pb-0"
+                                                @dblclick="selectedRole(role)"><span style="cursor: default;"> @{{ role.name }}  </span>
+                                            </li>
                                         </ul>
                                     </div>
                                 </div>
@@ -107,26 +123,34 @@
                             <div class="form-group row">
                                 <label for="carrier" class="col-md-3 col-form-label text-md-right">可见承运商</label>
                                 <div class="col-md-7">
-                                    <input type="text"  class="form-control tooltipTarget" placeholder="定位承运商"
+                                    <input type="text" class="form-control tooltipTarget" placeholder="定位承运商"
                                            @input="seekCarrier($event)" title="输入关键词快速定位"></div>
                             </div>
                             <div class="form-group row">
                                 <label class="col-md-3"></label>
                                 <div class="col-md-4">
-                                    <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
-                                        <ul class="list-group tooltipTarget" style="width: 100%" onselectstart="return false;">
-                                            <li  :data-original-title="carrier.style ? '双击删除承运商' : '双击添加承运商'"    v-for="carrier in carriersAll" :id="carrier.name"
-                                                 class="tooltipTarget list-group-item list-group-item-action pt-0 pb-0"
-                                                 @dblclick="selectedCarrier(carrier)" :class="carrier.style ? 'active' :''"><span style="cursor: default;" > @{{ carrier.name }}  </span></li>
+                                    <div class="input-group"
+                                         style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
+                                        <ul class="list-group tooltipTarget" style="width: 100%"
+                                            onselectstart="return false;">
+                                            <li :data-original-title="carrier.style ? '双击删除承运商' : '双击添加承运商'"
+                                                v-for="carrier in carriersFilter" :id="carrier.name"
+                                                class="tooltipTarget list-group-item list-group-item-action pt-0 pb-0"
+                                                @dblclick="selectedCarrier(carrier)"
+                                                :class="carrier.style ? 'active' :''"><span style="cursor: default;"> @{{ carrier.name }}  </span>
+                                            </li>
                                         </ul>
                                     </div>
                                 </div>
                                 <div class="col-md-3">
-                                    <input name="carrier" hidden   v-model="carriers" >
-                                    <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
+                                    <input name="carrier" hidden v-model="carriers">
+                                    <div class="input-group"
+                                         style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
                                         <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                                            <li  title="双击删除承运商"    v-for="carrier in carriersList"  class="list-group-item list-group-item-action pt-0 pb-0"
-                                                 @dblclick="selectedCarrier(carrier)" ><span style="cursor: default;" > @{{ carrier.name }}  </span></li>
+                                            <li title="双击删除承运商" v-for="carrier in carriersList"
+                                                class="list-group-item list-group-item-action pt-0 pb-0"
+                                                @dblclick="selectedCarrier(carrier)"><span style="cursor: default;"> @{{ carrier.name }}  </span>
+                                            </li>
                                         </ul>
                                     </div>
                                 </div>
@@ -150,55 +174,73 @@
 
 @section('lastScript')
     <script>
-        let vueList=new Vue({
-            el:"#editPanel",
-            data:{
-                userWorkgroups:[
+        let vueList = new Vue({
+            el: "#editPanel",
+            data: {
+                userWorkgroups: [
                     @foreach($userWorkgroups as $userWorkgroup)
                     {!! $userWorkgroup !!},
                     @endforeach
                 ],
-                rolesAll:[
-                    @foreach( $rolesAll as $role )
-                    {id:'{{$role->id}}',name:'{{$role->name}}',style:false},
+                rolesAll: [
+                        @foreach( $rolesAll as $role )
+                    {
+                        id: '{{$role->id}}', name: '{{$role->name}}', style: false
+                    },
                     @endforeach
                 ],
-                roles:[{{old('role')}}],
-                rolesList:[],
-                carriersAll:[
-                    @foreach($carriers as $carrier)
-                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}',style:false},
+                rolesFilter: [
+                        @foreach( $rolesAll as $role )
+                    {
+                        id: '{{$role->id}}', name: '{{$role->name}}', style: false
+                    },
                     @endforeach
                 ],
-                carriers:[{{old('carrier')}}],
-                carriersList:[],
+                roles: [{{old('role')}}],
+                rolesList: [],
+                carriersAll: [
+                        @foreach($carriers as $carrier)
+                    {
+                        id: '{{$carrier->id}}', name: '{{$carrier->name}}', style: false
+                    },
+                    @endforeach
+                ],
+                carriersFilter: [
+                        @foreach($carriers as $carrier)
+                    {
+                        id: '{{$carrier->id}}', name: '{{$carrier->name}}', style: false
+                    },
+                    @endforeach
+                ],
+                carriers: [{{old('carrier')}}],
+                carriersList: [],
             },
-            mounted:function(){
-                $(".tooltipTarget").tooltip({'trigger':'hover'});
-                if (this.roles.length>0){
-                    let rolesAll=this.rolesAll;
-                    let roles=this.roles;
-                    let rolesList=this.rolesList;
+            mounted: function () {
+                $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                if (this.roles.length > 0) {
+                    let rolesAll = this.rolesAll;
+                    let roles = this.roles;
+                    let rolesList = this.rolesList;
                     for (let i = 0; i < roles.length; i++) {
                         rolesAll.every(function (roleAll) {
                             if (roleAll.id == roles[i]) {
                                 roleAll.style = true;
-                                rolesList.push({'id':roleAll.id,'name':roleAll.name});
+                                rolesList.push({'id': roleAll.id, 'name': roleAll.name});
                                 return false;
                             }
                             return true;
                         });
                     }
                 }
-                if (this.carriers.length>0){
-                    let carriersAll=this.carriersAll;
-                    let carriers=this.carriers;
-                    let carriersList=this.carriersList;
+                if (this.carriers.length > 0) {
+                    let carriersAll = this.carriersAll;
+                    let carriers = this.carriers;
+                    let carriersList = this.carriersList;
                     for (let i = 0; i < carriers.length; i++) {
                         carriersAll.every(function (carrierAll) {
                             if (carrierAll.id == carriers[i]) {
                                 carrierAll.style = true;
-                                carriersList.push({'id':carrierAll.id,'name':carrierAll.name});
+                                carriersList.push({'id': carrierAll.id, 'name': carrierAll.name});
                                 return false;
                             }
                             return true;
@@ -206,16 +248,16 @@
                     }
                 }
             },
-            methods:{
-                selectedCarrier:function (e) {
-                    let carriers=this.carriers;
-                    let carriersAll=this.carriersAll;
-                    let carriersList=this.carriersList;
-                    let isCarrier=true;
-                    if (carriers&&carriersAll) {
+            methods: {
+                selectedCarrier: function (e) {
+                    let carriers = this.carriers;
+                    let carriersAll = this.carriersAll;
+                    let carriersList = this.carriersList;
+                    let isCarrier = true;
+                    if (carriers && carriersAll) {
                         for (let i = 0; i < carriers.length; i++) {
                             if (carriers[i] == e.id) {
-                                carriers.splice(i,1);
+                                carriers.splice(i, 1);
                                 carriersAll.every(function (carrierAll) {
                                     if (carrierAll.id == e.id) {
                                         carrierAll.style = false;
@@ -223,60 +265,68 @@
                                     }
                                     return true;
                                 });
-                                carriersList.every(function (carrier,i) {
-                                    if (carrier.id==e.id){
-                                        carriersList.splice(i,1);
+                                carriersList.every(function (carrier, i) {
+                                    if (carrier.id == e.id) {
+                                        carriersList.splice(i, 1);
                                         return false;
                                     }
                                     return true;
                                 });
-                                isCarrier= false;
+                                isCarrier = false;
                                 break;
                             }
-                            isCarrier= true;
+                            isCarrier = true;
                         }
                     }
-                    if (isCarrier || !carriers){
+                    if (isCarrier || !carriers) {
                         carriers.push(e.id);
                         carriersAll.every(function (carrierAll) {
-                            if (carrierAll.id==e.id){
-                                carrierAll.style=true;
-                                carriersList.push({'id':carrierAll.id,'name':carrierAll.name});
+                            if (carrierAll.id == e.id) {
+                                carrierAll.style = true;
+                                carriersList.push({'id': carrierAll.id, 'name': carrierAll.name});
                                 return false;
                             }
-                            return  true;
+                            return true;
                         });
                     }
-                    setTimeout(function(){
-                        $(".tooltipTarget").tooltip({'trigger':'hover'});
-                    },10)
+                    setTimeout(function () {
+                        $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                    }, 10)
                 },
-                seekCarrier:function (e) {
-                    let $val=e.target.value;
-                    let carriersAll=this.carriersAll;
+                seekCarrier: function (e) {
+                    let $val = e.target.value;
+                    let carriersAll = this.carriersAll;
                     let bool = false;
                     carriersAll.every(function (carrierAll) {
-                        let name=carrierAll.name;
-                        if (name.includes($val)){
-                            location.href="#"+carrierAll.name;
-                            bool =true;
+                        let name = carrierAll.name;
+                        if (name.includes($val)) {
+                            bool = true;
                             return false;
                         }
-                        return  true;
+                        return true;
                     });
-                    setTimeout(function () {
-                        if(bool){ $(e.target).focus();}
-                    },10)
+                    if($val==='' && !bool){
+                        this.carriersFilter = this.carriersAll;
+                    }else if(bool){
+                        this.carriersFilter= [];
+                        for (let i = 0; i < carriersAll.length; i++) {
+                            let carries = carriersAll[i];
+                            let name = carries.name;
+                            if(name.includes($val)){
+                                this.carriersFilter.push(carries);
+                            }
+                        }
+                    }
                 },
-                selectedRole:function (e) {
-                    let roles=this.roles;
-                    let rolesAll=this.rolesAll;
-                    let rolesList=this.rolesList;
-                    let isRole=true;
-                    if (roles&&rolesAll) {
+                selectedRole: function (e) {
+                    let roles = this.roles;
+                    let rolesAll = this.rolesAll;
+                    let rolesList = this.rolesList;
+                    let isRole = true;
+                    if (roles && rolesAll) {
                         for (let i = 0; i < roles.length; i++) {
                             if (roles[i] == e.id) {
-                                roles.splice(i,1);
+                                roles.splice(i, 1);
                                 rolesAll.every(function (roleAll) {
                                     if (roleAll.id == e.id) {
                                         roleAll.style = false;
@@ -284,50 +334,62 @@
                                     }
                                     return true;
                                 });
-                                rolesList.every(function (role,i) {
-                                    if (role.id==e.id){
-                                        rolesList.splice(i,1);
+                                rolesList.every(function (role, i) {
+                                    if (role.id == e.id) {
+                                        rolesList.splice(i, 1);
                                         return false;
                                     }
                                     return true;
                                 });
-                                isRole= false;
+                                isRole = false;
                                 break;
                             }
-                            isRole= true;
+                            isRole = true;
                         }
                     }
-                    if (isRole || !roles){
+                    if (isRole || !roles) {
                         roles.push(e.id);
                         rolesAll.every(function (roleAll) {
-                            if (roleAll.id==e.id){
-                                roleAll.style=true;
-                                rolesList.push({'id':roleAll.id,'name':roleAll.name});
+                            if (roleAll.id == e.id) {
+                                roleAll.style = true;
+                                rolesList.push({'id': roleAll.id, 'name': roleAll.name});
                                 return false;
                             }
-                            return  true;
+                            return true;
                         });
                     }
-                    setTimeout(function(){
-                        $(".tooltipTarget").tooltip({'trigger':'hover'});
-                    },10)
+                    setTimeout(function () {
+                        $(".tooltipTarget").tooltip({'trigger': 'hover'});
+                    }, 10)
                 },
-                seekRole:function (e) {
-                    let $val=e.target.value;
-                    let rolesAll=this.rolesAll;
+                seekRole: function (e) {
+                    let $val = e.target.value;
+                    let rolesAll = this.rolesAll;
+                    let rolesFilter = this.rolesFilter;
                     let bool = false;
                     rolesAll.every(function (roleAll) {
-                        let name=roleAll.name;
-                        if (name.includes($val)){
-                            location.href="#"+roleAll.name;
+                        let name = roleAll.name;
+                        if (name.includes($val)) {
                             bool = true;
                             return false;
                         }
-                        return  true;
+                        return true;
                     });
-                    setTimeout(function () {
-                        if(bool){ $(e.target).focus();}
-                    },10)
+                    console.log(bool);
+                    if ($val === '' && bool) {
+                        this.rolesFilter = this.rolesAll;
+                    } else if (bool) {
+                        this.rolesFilter = [];
+                        for (let i = 0; i < rolesAll.length; i++) {
+                            let role = rolesAll[i];
+                            console.log(role);
+                            let name = role.name;
+                            if (name.includes($val)) {
+                                console.log(name);
+                                this.rolesFilter.push(role);
+                            }
+                        }
+                    }
 
                 },
             },

+ 36 - 12
resources/views/maintenance/user/edit.blade.php

@@ -64,7 +64,7 @@
                             <input name="role" hidden    v-model="roles" >
                             <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
                                 <ul class="list-group tooltipTarget" style="width: 100%" onselectstart="return false;">
-                                    <li  :data-original-title="role.style ? '双击删除角色' :'双击添加角色'"    v-for="role in rolesAll" :id="role.name" class="list-group-item list-group-item-action pt-0 pb-0"
+                                    <li  :data-original-title="role.style ? '双击删除角色' :'双击添加角色'"    v-for="role in rolesFilter" :id="role.name" class="list-group-item list-group-item-action pt-0 pb-0"
                                          @dblclick="selectedRole(role)" :class="role.style ? 'active' :''"><span style="cursor: default;" :id="role.name"> @{{ role.name }}  </span></li>
                                 </ul>
                             </div>
@@ -92,7 +92,7 @@
                             <input name="carrier" hidden   v-model="carriers" >
                             <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
                                 <ul class="list-group tooltipTarget" style="width: 100%" onselectstart="return false;">
-                                    <li  :data-original-title="carrier.style ? '双击删除承运商' :'双击添加承运商'"    v-for="carrier in carriersAll" :id="carrier.name" class="list-group-item list-group-item-action pt-0 pb-0"
+                                    <li  :data-original-title="carrier.style ? '双击删除承运商' :'双击添加承运商'"    v-for="carrier in carriersFilter" :id="carrier.name" class="list-group-item list-group-item-action pt-0 pb-0"
                                          @dblclick="selectedCarrier(carrier)" :class="carrier.style ? 'active' :''"><span style="cursor: default;" > @{{ carrier.name }}  </span></li>
                                 </ul>
                             </div>
@@ -136,6 +136,11 @@
                     {id:'{{$role->id}}',name:'{{$role->name}}',style:false},
                     @endforeach
                 ],
+                rolesFilter:[
+                        @foreach( $rolesAll as $role )
+                    {id:'{{$role->id}}',name:'{{$role->name}}',style:false},
+                    @endforeach
+                ],
                 roles:[
                     @if(old('role'))
                         {{ old('role') }}
@@ -160,6 +165,11 @@
                         @endforeach
                     @endif
                 ],
+                carriersFilter:[
+                    @foreach($carriers as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}',style:false},
+                    @endforeach
+                ],
                 carriersList:[],
             },
             mounted:function(){
@@ -244,18 +254,25 @@
                     let $val=e.target.value;
                     let carriersAll=this.carriersAll;
                     let bool = false;
-                    carriersAll.every(function (carrierAll) {
-                        let name=carrierAll.name;
+                    carriersAll.every(function (carriersAll) {
+                        let name=carriersAll.name;
                         if (name.includes($val)){
-                            location.href="#"+carrierAll.name;
                             bool = true;
                             return false;
                         }
                         return  true;
                     });
-                    setTimeout(function () {
-                        if(bool){ $(e.target).focus();}
-                    })
+                    if($val === '' ){
+                        this.rolesFilter = this.rolesAll;
+                    }else if(bool){
+                        this.carriersFilter = [];
+                        for (let i = 0; i <carriersAll.length ; i++) {
+                            let carrier = carriersAll[i];
+                            if(carrier.name.includes($val)){
+                                this.carriersFilter.push(carrier);
+                            }
+                        }
+                    }
                 },
                 selectedRole:function (e) {
                     let roles=this.roles;
@@ -308,15 +325,22 @@
                     rolesAll.every(function (roleAll) {
                         let name=roleAll.name;
                         if (name.includes($val)){
-                            location.href="#"+roleAll.name;
                             bool = true;
                             return false;
                         }
                         return  true;
                     });
-                    setTimeout(function () {
-                        if(bool){$(e.target).focus();}
-                    },10)
+                    if($val === '' ){
+                        this.rolesFilter = this.rolesAll;
+                    }else if(bool){
+                        this.rolesFilter = [];
+                        for (let i = 0; i <rolesAll.length ; i++) {
+                            let role = rolesAll[i];
+                            if(role.name.includes($val)){
+                                this.rolesFilter.push(role);
+                            }
+                        }
+                    }
                 },
             },
         });

+ 30 - 25
resources/views/waybill/edit.blade.php

@@ -234,16 +234,18 @@
                         </div>
                         <label for="amount_unit_id" class=" col-form-label text-right ">单位:</label>
                         <div class="col-1.5 form-inline">
-                            <label for="amount_unit_id1" class="ml-1" :class="errors['amount_unit_id'] ? 'text-danger' :''" >件</label><input id="amount_unit_id1" type="radio" value="4" class="form-control form-control-sm ml-1"
+                            {{--{{--:class="errors['amount_unit_id'] ? 'text-danger' :''"--}}--}}
+                            <label for="amount_unit_id1" class="ml-1  @error('amount_unit_id') text-danger @enderror"  >件</label><input id="amount_unit_id1" type="radio" value="4" class="form-control form-control-sm ml-1"
                                                          name="amount_unit_id" v-model="waybillPriceModel.amount_unit_id">
-                            <label for="amount_unit_id1" class="ml-1" :class="errors['amount_unit_id'] ? 'text-danger' :''">托</label><input id="amount_unit_id1" type="radio" value="5" class="form-control form-control-sm ml-1"
+                            <label for="amount_unit_id1" class="ml-1 @error('amount_unit_id') text-danger @enderror"  >托</label><input id="amount_unit_id1" type="radio" value="5" class="form-control form-control-sm ml-1"
                                                          :class="errors['amount_unit_id'] ? 'is-invalid' :''" name="amount_unit_id" v-model="waybillPriceModel.amount_unit_id">
-                            @error('amount_unit_id')
-                            <span class="invalid-feedback" role="alert">
-                                        <strong>{{ $message }}</strong>
-                                    </span>
-                            @enderror
                         </div>
+                        @error('amount_unit_id')
+                        <div class="col-2 form-inline">
+                            <label class="form-control-static text-danger small font-weight-bold">{{$message}}</label>
+                        </div>
+                        @enderror
+
                     </div>
                     <div class="form-group row">
                         <label for="carrier_id" class="col-2 col-form-label text-right text-primary">里程数</label>
@@ -481,26 +483,29 @@
                 is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
                     this.errors=[];
                     let url='{{url('waybill/is/waybillPriceModel')}}';
-                    document.getElementById('waybillForm').submit();
 
                     let _this=this;
-                    // axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
-                    //     carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
-                    //     .then(
-                    //         function (response) {
-                    //             if (response.data.error){_this.errors=response.data.error;return;}
-                    //             if (!response.data.success) {
-                    //                 document.getElementById('waybillPriceModel').value='';
-                    //                 tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
-                    //                     function () {
-                    //                         document.getElementById('waybillForm').submit();
-                    //                     });
-                    //             }else{
-                    //                 document.getElementById('waybillPriceModel').value=response.data.success;
-                    //                 document.getElementById('waybillForm').submit();
-                    //             }
-                    //         }
-                    //     );
+                    axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
+                        carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
+                        .then(
+                            function (response) {
+
+                                if (response.data.error){
+                                    console.log(response.data.error);
+                                    _this.errors=response.data.error;return;}
+
+                                if (!response.data.success) {
+                                    document.getElementById('waybillPriceModel').value='';
+                                    tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
+                                        function () {
+                                            document.getElementById('waybillForm').submit();
+                                        });
+                                }else{
+                                    document.getElementById('waybillPriceModel').value=response.data.success;
+                                    document.getElementById('waybillForm').submit();
+                                }
+                            }
+                        );
                 },
                 submitForm(){
                     let type=document.getElementById('type').value;