From 245cae84cd9b614bedda915599e89d99b50c5d15 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 16 二月 2020 22:45:49 +0800
Subject: [PATCH] 加入权限选择功能
---
WebService/src/main/resources/components/privilegePackage/add-staff-privilege/addStaffPrivilege.js | 46 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/WebService/src/main/resources/components/privilegePackage/add-staff-privilege/addStaffPrivilege.js b/WebService/src/main/resources/components/privilegePackage/add-staff-privilege/addStaffPrivilege.js
index 7e3231a..05a1ec4 100644
--- a/WebService/src/main/resources/components/privilegePackage/add-staff-privilege/addStaffPrivilege.js
+++ b/WebService/src/main/resources/components/privilegePackage/add-staff-privilege/addStaffPrivilege.js
@@ -11,22 +11,24 @@
_noAddPrivilegeGroup:[],
_currentTab:1,
selectPrivileges:[],
- selectPrivilegeGroups:[]
+ selectPrivilegeGroups:[],
+ quanGroup:false,
+ quan:false
}
},
watch: { // 鐩戣鍙屽悜缁戝畾鐨勬暟鎹暟缁�
addStaffPrivilegeInfo: {
handler(){ // 鏁版嵁鏁扮粍鏈夊彉鍖栧皢瑙﹀彂姝ゅ嚱鏁�
if(vc.component.addStaffPrivilegeInfo.selectPrivileges.length == vc.component.addStaffPrivilegeInfo._noAddPrivilege.length){
- document.querySelector('#quan').checked = true;
+ vc.component.addStaffPrivilegeInfo.quan= true;
}else {
- document.querySelector('#quan').checked = false;
+ vc.component.addStaffPrivilegeInfo.quan= false;
}
if(vc.component.addStaffPrivilegeInfo.selectPrivilegeGroups.length == vc.component.addStaffPrivilegeInfo._noAddPrivilegeGroup.length){
- document.querySelector('#quanGroup').checked = true;
+ vc.component.addStaffPrivilegeInfo.quanGroup= true;
}else {
- document.querySelector('#quanGroup').checked = false;
+ vc.component.addStaffPrivilegeInfo.quanGroup= false;
}
},
deep: true // 娣卞害鐩戣
@@ -112,16 +114,16 @@
var _selectPrivilegeGroups = vc.component.addStaffPrivilegeInfo.selectPrivilegeGroups;
var _selectPrivileges = vc.component.addStaffPrivilegeInfo.selectPrivileges;
if(vc.component.addStaffPrivilegeInfo._currentTab == 1){
- for(var _pIndex = 0;pIndex < _selectPrivilegeGroups.length;pIndex++){
+ for(var _pIndex = 0;_pIndex < _selectPrivilegeGroups.length;_pIndex++){
var _pgId = {
- pId: _selectPrivilegeGroups[pIndex]
+ pId: _selectPrivilegeGroups[_pIndex]
}
_pIds.push(_pgId);
}
}else{
- for(var _pIndex = 0;pIndex < _selectPrivileges.length;pIndex++){
+ for(var _pIndex = 0;_pIndex < _selectPrivileges.length;_pIndex++){
var _pId = {
- pId: _selectPrivileges[pIndex]
+ pId: _selectPrivileges[_pIndex]
}
_pIds.push(_pId);
}
@@ -159,7 +161,31 @@
vc.component.addStaffPrivilegeInfo.errorInfo = errInfo;
});
- }
+ },
+ checkAll:function(e){
+ var checkObj = document.querySelectorAll('.checkItem'); // 鑾峰彇鎵�鏈塩heckbox椤�
+ if(e.target.checked){ // 鍒ゅ畾鍏ㄩ�塩heckbox鐨勫嬀閫夌姸鎬�
+ for(var i=0;i<checkObj.length;i++){
+ if(!checkObj[i].checked){ // 灏嗘湭鍕鹃�夌殑checkbox閫夐」push鍒扮粦瀹氭暟缁勪腑
+ vc.component.addStaffPrivilegeInfo.selectPrivileges.push(checkObj[i].value);
+ }
+ }
+ }else { // 濡傛灉鏄幓鎺夊叏閫夊垯娓呯┖checkbox閫夐」缁戝畾鏁扮粍
+ vc.component.addStaffPrivilegeInfo.selectPrivileges = [];
+ }
+ },
+ checkAllGroup:function(e){
+ var checkObj = document.querySelectorAll('.checkGroupItem'); // 鑾峰彇鎵�鏈塩heckbox椤�
+ if(e.target.checked){ // 鍒ゅ畾鍏ㄩ�塩heckbox鐨勫嬀閫夌姸鎬�
+ for(var i=0;i<checkObj.length;i++){
+ if(!checkObj[i].checked){ // 灏嗘湭鍕鹃�夌殑checkbox閫夐」push鍒扮粦瀹氭暟缁勪腑
+ vc.component.addStaffPrivilegeInfo.selectPrivilegeGroups.push(checkObj[i].value);
+ }
+ }
+ }else { // 濡傛灉鏄幓鎺夊叏閫夊垯娓呯┖checkbox閫夐」缁戝畾鏁扮粍
+ vc.component.addStaffPrivilegeInfo.selectPrivilegeGroups = [];
+ }
+ }
}
});
--
Gitblit v1.8.0