|
@@ -248,5 +248,49 @@ $(document).ready(() => {
|
|
|
postData(`/sp/${spid}/setting/user/permission/update`, { update: updateData }, function() {
|
|
|
window.location.reload();
|
|
|
})
|
|
|
- })
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#copy-user-batch').on('show.bs.modal', function() {
|
|
|
+ $('#cub-sp-all')[0].checked = false;
|
|
|
+ for (const c of $('[name=cub-sp-check]')) {
|
|
|
+ c.checked = false;
|
|
|
+ }
|
|
|
+ $('#cub-user-all')[0].checked = false;
|
|
|
+ for (const c of $('[name=cub-user-check]')) {
|
|
|
+ c.checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#cub-sp-all').click(function() {
|
|
|
+ for (const c of $('[name=cub-sp-check]')) {
|
|
|
+ c.checked = this.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#cub-user-all').click(function() {
|
|
|
+ for (const c of $('[name=cub-user-check]')) {
|
|
|
+ c.checked = this.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#copy-user-batch-ok').click(function() {
|
|
|
+ const spCheck = $('[name=cub-sp-check]:checked');
|
|
|
+ if (spCheck.length === 0) {
|
|
|
+ toastr.warning('未选择项目');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const userCheck = $('[name=cub-user-check]:checked');
|
|
|
+ if (userCheck.length === 0) {
|
|
|
+ toastr.warning('未选择账号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const copyData = { spid: [], uid: [] };
|
|
|
+ for (const sp of spCheck) {
|
|
|
+ copyData.spid.push(sp.getAttribute('spid'));
|
|
|
+ }
|
|
|
+ for (const u of userCheck) {
|
|
|
+ copyData.uid.push(parseInt(u.getAttribute('uid')));
|
|
|
+ }
|
|
|
+ postData(`/sp/${spid}/setting/user/permission/update`, { copy: copyData }, function(result) {
|
|
|
+ toastr.success('设置成功');
|
|
|
+ $('#copy-user-batch').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|