|
@@ -205,4 +205,48 @@ $(document).ready(() => {
|
|
|
window.location.reload();
|
|
|
})
|
|
|
});
|
|
|
+ $('[name=copy-permission]').click(function() {
|
|
|
+ let data = $('[name=set-permission]', $(this).parent()).attr('data-account');
|
|
|
+ $('#source-permission').val(data);
|
|
|
+ data = JSON.parse(data);
|
|
|
+ const html = [];
|
|
|
+ for (const u of subProjectAllAccountList) {
|
|
|
+ if (u.id === data.id) continue;
|
|
|
+ html.push('<tr>');
|
|
|
+ html.push(`<td class=text-center><input type="checkbox" name="copy-batch-check" id="${u.permission_id}"></td>`);
|
|
|
+ html.push(`<td>${u.name}</td>`);
|
|
|
+ html.push(`<td>${u.role}</td>`);
|
|
|
+ html.push(`<td>${u.company}</td>`);
|
|
|
+ html.push('</tr>');
|
|
|
+ }
|
|
|
+ $('#copy-batch-users').html(html.join(''));
|
|
|
+ $('#copy-permission').modal('show');
|
|
|
+ });
|
|
|
+ $('#copy-batch-all').click(function() {
|
|
|
+ for (const c of $('[name=copy-batch-check]')) {
|
|
|
+ c.checked = this.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#copy-batch-ok').click(function() {
|
|
|
+ const source = JSON.parse($('#source-permission').val());
|
|
|
+ const updateData = [];
|
|
|
+ const batchUser = $('[name=copy-batch-check]:checked');
|
|
|
+ if (batchUser.length === 0) {
|
|
|
+ toastr.warning('未选择账号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const user of batchUser) {
|
|
|
+ const data = { id: user.getAttribute('id') };
|
|
|
+ const permissionCheck = $('[name="permission-check"]');
|
|
|
+ for (const pc of permissionCheck) {
|
|
|
+ const ptype = pc.getAttribute('ptype');
|
|
|
+ data[ptype + '_permission'] = source[ptype + '_permission'];
|
|
|
+ }
|
|
|
+ updateData.push(data);
|
|
|
+ }
|
|
|
+ postData(`/sp/${spid}/setting/user/permission/update`, { update: updateData }, function() {
|
|
|
+ window.location.reload();
|
|
|
+ })
|
|
|
+ })
|
|
|
});
|