Просмотр исходного кода

权限组添加权限开发中

wuxw лет назад: 7
Родитель
Сommit
d5fe3077a7

+ 59 - 0
WebService/src/main/resources/components/add-privilege/addPrivilege.html

@@ -0,0 +1,59 @@
+<div id = "addPrivilegeModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="addPrivilegeModalLabel" aria-hidden="true" >
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h3 class="modal-title" id="addPrivilegeModalLabel">添加权限</h3>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class=" row">
+                    <div class="col-lg-12">
+                        <div class="ibox ">
+                                <div class="row">
+
+                                    <div class="col-sm-7 m-b-xs">
+
+                                    </div>
+                                    <div class="col-sm-5">
+                                        <div class="input-group">
+                                            <input placeholder="输入权限名称" type="text" class="form-control form-control-sm">
+                                            <span class="input-group-append">
+                                                <button type="button" class="btn btn-sm btn-primary">查询</button>
+                                            </span>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="table-responsive" style="margin-top:15px">
+                                    <table class="table table-striped">
+                                        <thead>
+                                        <tr>
+
+                                            <th>权限编码</th>
+                                            <th>权限名称</th>
+                                            <th>权限描述</th>
+                                            <th>创建时间</th>
+                                            <th>操作</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                            <tr v-for="noAddPrivilege in addPrivilegeInfo._noAddPrivilege">
+                                                <td>{{noAddPrivilege.pId}}</td>
+                                                <td>{{noAddPrivilege.name}}</td>
+                                                <td>{{noAddPrivilege.description}}</td>
+                                                <td>{{vc.dateFormat(noAddPrivilege.createTime)}}</td>
+                                                <td>
+                                                    <button class="btn btn-primary btn-xs">添加</button>
+                                                </td>
+                                            </tr>
+                                        </tbody>
+                                    </table>
+                                </div>
+
+                        </div>
+                    </div>
+                </div>
+        </div>
+    </div>
+</div>

+ 86 - 0
WebService/src/main/resources/components/add-privilege/addPrivilege.js

@@ -0,0 +1,86 @@
+(function(vc){
+
+    vc.extends({
+        data:{
+            addPrivilegeInfo:{
+                name:'',
+                description:'',
+                errorInfo:'',
+                _noAddPrivilege:[]
+            }
+        },
+         _initMethod:function(){
+
+         },
+         _initEvent:function(){
+             vc.component.$on('addPrivilege_openPrivilegeModel',function(_params){
+                $('#addPrivilegeModel').modal('show');
+                //查询没有添加的权限
+                vc.component.listNoAddPrivilege();
+            });
+        },
+        methods:{
+            listNoAddPrivilege:function(){
+                vc.component.addPrivilegeInfo._noAddPrivilege=[];
+                var param = {
+                    _id:'123'
+                }
+                vc.http.get(
+                            'addPrivilege',
+                            'listNoAddPrivilege',
+                            JSON.stringify(param),
+                             function(json,res){
+                                //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
+                                if(res.status == 200){
+                                    vc.component.addPrivilegeInfo._noAddPrivilege = JSON.parse(json);
+                                    return ;
+                                }
+                                vc.component.addPrivilegeInfo.errorInfo = json;
+                             },
+                             function(errInfo,error){
+                                console.log('请求失败处理');
+
+                                vc.component.addPrivilegeInfo.errorInfo = errInfo;
+                             });
+            },
+            saveAddPrivilegeGroup:function(){
+                if(!vc.component.addPrivilegeGroupValidate()){
+                    vc.component.addPrivilegeGroupInfo.errorInfo = vc.validate.errInfo;
+                    return ;
+                }
+                vc.component.addPrivilegeGroupInfo.errorInfo = "";
+                vc.http.post(
+                    'addPrivilegeGroup',
+                    'savePrivilegeGroupInfo',
+                    JSON.stringify(vc.component.addPrivilegeGroupInfo),
+                    {
+                        emulateJSON:true
+                     },
+                     function(json,res){
+                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
+                        if(res.status == 200){
+                            //关闭model
+                            $('#addPrivilegeGroupModel').modal('hide');
+                            vc.component.clearAddPrivilegeGroupInfo();
+                            vc.component.$emit('privilegeGroup_loadPrivilegeGroup',{});
+                            return ;
+                        }
+                        vc.component.addPrivilegeGroupInfo.errorInfo = json;
+                     },
+                     function(errInfo,error){
+                        console.log('请求失败处理');
+
+                        vc.component.addPrivilegeGroupInfo.errorInfo = errInfo;
+                     });
+            },
+            clearAddPrivilegeGroupInfo:function(){
+                vc.component.addPrivilegeGroupInfo = {
+                                            name:'',
+                                            description:'',
+                                            errorInfo:''
+                                        };
+            }
+        }
+    });
+
+})(window.vc);

+ 4 - 2
WebService/src/main/resources/components/privilege-group/privilegeGroup.js

@@ -33,7 +33,8 @@
                                 if(_groupsInfo.length > 0){
                                     vc.component.$emit('privilege_group_event',{
                                                                     _pgId:_groupsInfo[0].pgId,
-                                                                    _pgName:_groupsInfo[0].name
+                                                                    _pgName:_groupsInfo[0].name,
+                                                                    _storeId:_groupsInfo[0].storeId
                                                                 });
                                 }
 
@@ -46,7 +47,8 @@
             notifyQueryPrivilege:function(_pGroup){
                 vc.component.$emit('privilege_group_event',{
                     _pgId:_pGroup.pgId,
-                    _pgName:_pGroup.name
+                    _pgName:_pGroup.name,
+                    _storeId:_pGroup.storeId
                 });
             },
             openPrivilegeGroupModel:function(){

+ 9 - 2
WebService/src/main/resources/components/privilege/privilege.html

@@ -2,7 +2,12 @@
     <vc:create name="privilegeGroup"></vc:create>
     <div class="col-lg-9 animated fadeInRight">
         <div class="mail-box-header">
-            <button class="btn btn-primary btn-sm float-right" data-toggle="tooltip"  title="Refresh inbox"><i class="fa fa-plus"></i> 添加权限</button>
+            <button v-if="privilegeInfo._currentStoreId != '9999'"
+                    class="btn btn-primary btn-sm float-right"
+                    data-toggle="tooltip"
+                    title="Refresh inbox"
+                    v-on:click="openAddPrivilegeModel()"
+            ><i class="fa fa-plus"></i> 添加权限</button>
             <form method="get" action="index.html" class="float-right mail-search" style="margin-right:10px">
                 <div class="input-group">
                     <input type="text" class="form-control form-control-sm" name="search" placeholder="请输入权限名称">
@@ -37,7 +42,7 @@
                     <td class="mail-ontact">{{privilege.name}}</td>
                     <td class="mail-subject">{{privilege.description}}</td>
                     <td class="">{{vc.dateFormat(privilege.createTime)}}</td>
-                    <td class="text-right mail-date"><i class="glyphicon glyphicon-remove"></i></td>
+                    <td class="text-right mail-date"><i  v-if="privilegeInfo._currentStoreId != '9999'" class="glyphicon glyphicon-remove"></i></td>
                 </tr>
 
                 </tbody>
@@ -46,4 +51,6 @@
 
         </div>
     </div>
+
+    <vc:create name="addPrivilege"></vc:create>
 </div>

+ 6 - 1
WebService/src/main/resources/components/privilege/privilege.js

@@ -5,6 +5,7 @@
             privilegeInfo:{
                 _currentPgId:"",
                 _currentPgName:"",
+                _currentStoreId:"9999",
                 _privileges:[]
             }
         },
@@ -15,13 +16,14 @@
             vc.component.$on('privilege_group_event',function(_pgObj){
                 vc.component.privilegeInfo._currentPgId = _pgObj._pgId;
                 vc.component.privilegeInfo._currentPgName = _pgObj._pgName;
-
+                vc.component.privilegeInfo._currentStoreId = _pgObj._storeId;
                 //调用接口查询权限
                 vc.component._loadPrivilege(_pgObj._pgId);
             });
         },
         methods:{
             _loadPrivilege:function(_pgId){
+                vc.component.privilegeInfo._privileges=[];
                 var param = {
                                     params:{pgId:_pgId}
                                 };
@@ -37,6 +39,9 @@
                                 console.log('请求失败处理');
                              }
                            );
+            },
+            openAddPrivilegeModel:function(){
+                vc.component.$emit('addPrivilege_openPrivilegeModel',{});
             }
         }
     });