|
@@ -61,7 +61,17 @@
|
|
|
<ul id="Huifold1" class="Huifold">
|
|
|
<#list companyInfoList as company>
|
|
|
<li class="item company_list">
|
|
|
- <h4><label class="permission-class"><input type="checkbox" class="company_checkbox" len="${company.storeInfoList?size}" value="${company.companyId}" id="permission-${company.companyId}">${company.companyName}</label><b>+</b></h4>
|
|
|
+ <h4>
|
|
|
+ <label class="permission-class">
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ class="company_checkbox"
|
|
|
+ len="${company.storeInfoList?size}"
|
|
|
+ value="${company.companyId}"
|
|
|
+ id="permission-${company.companyId}">${company.companyName}
|
|
|
+ </label>
|
|
|
+ <b>+</b>
|
|
|
+ </h4>
|
|
|
<div class="info">
|
|
|
<table class="table table-border table-bordered">
|
|
|
<thead>
|
|
@@ -71,7 +81,16 @@
|
|
|
<#list company.storeInfoList as store>
|
|
|
<tr>
|
|
|
<th>
|
|
|
- <label><input type="checkbox" len="0" id="permission-input-${store.storeId!''}" class="ermissions ermissions-${store.storeId!''} store_once" name="haveId" <#if store.isSelectDepart??><#if store.isSelectDepart == 1>checked="checked"</#if></#if> value="${store.storeId}">选中</label>
|
|
|
+ <label>
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ len="0"
|
|
|
+ id="permission-input-${store.storeId!''}"
|
|
|
+ class="ermissions ermissions-${store.storeId!''} store_once"
|
|
|
+ name="haveId"
|
|
|
+ <#if store.isSelectDepart??><#if store.isSelectDepart == 1>checked="checked"</#if></#if>
|
|
|
+ value="${store.storeId}">选中
|
|
|
+ </label>
|
|
|
</th>
|
|
|
<td>${store.storeName!""}</td>
|
|
|
<td>${store.storeRemark!""}</td>
|
|
@@ -113,39 +132,39 @@
|
|
|
|
|
|
// 表单提交
|
|
|
$("#btn-sub").click(function(){
|
|
|
- var array = new Array();
|
|
|
- var ps = $(".check-permission");
|
|
|
- var j = 0;
|
|
|
- for (var i = 0; i < ps.length; i++) {
|
|
|
+ let array = [];
|
|
|
+ let ps = $(".check-permission");
|
|
|
+ let j = 0;
|
|
|
+ for (let i = 0; i < ps.length; i++) {
|
|
|
if (ps[i].checked) {
|
|
|
array[j] = $(ps[i]).attr("val");
|
|
|
j ++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (array.length == 0) {
|
|
|
+ if (array.length === 0) {
|
|
|
layer.msg('您没有提管理员选择权限,如果想管理员看不见菜单,请禁用管理员用户!',{icon: 5,time:4500});
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//勾选的销售公司
|
|
|
- var companyIds = "";
|
|
|
+ let companyIds = "";
|
|
|
//勾选的店铺
|
|
|
- var storeIds = "";
|
|
|
+ let storeIds = "";
|
|
|
|
|
|
$(".company_checkbox").each(function () {
|
|
|
- var companyId = $(this).val();
|
|
|
+ let companyId = $(this).val();
|
|
|
if($(this).is(':checked')){
|
|
|
- if(companyIds == ""){
|
|
|
+ if(companyIds === ""){
|
|
|
companyIds = companyId;
|
|
|
}else{
|
|
|
companyIds += "," + companyId
|
|
|
}
|
|
|
}else{
|
|
|
$(this).parents(".company_list").find(".store_once").each(function () {
|
|
|
- var storeId = $(this).val();
|
|
|
+ let storeId = $(this).val();
|
|
|
if($(this).is(':checked')){
|
|
|
- if(storeIds == ""){
|
|
|
+ if(storeIds === ""){
|
|
|
storeIds = storeId
|
|
|
}else{
|
|
|
storeIds += "," + storeId
|
|
@@ -153,7 +172,7 @@
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
$.post(root_path + "/admin/sys/edit_permission",{"adminId":$("#hidden-adminid-input").val(), "perms":array, "companyIds":companyIds, "storeIds":storeIds},function(result){
|
|
|
if (result.returnCode != 200 || result.returnCode != 200) {
|
|
@@ -265,8 +284,9 @@
|
|
|
|
|
|
//选择销售公司,对应的店铺都选中
|
|
|
$(".company_checkbox").click(function(event) {
|
|
|
- var $company_list_context = $(this).parents(".company_list");
|
|
|
- if($(this).is(':checked')){//取消选中
|
|
|
+ var $company_list_context = $(this).parent().parent().parent();
|
|
|
+ if($(this).is(':checked')){
|
|
|
+ //取消选中
|
|
|
$company_list_context.find(".store_once").prop("checked",true);
|
|
|
}else{
|
|
|
$company_list_context.find(".store_once").removeAttr("checked");
|
|
@@ -282,12 +302,17 @@
|
|
|
function controlCheck() {
|
|
|
//初始化销售公司是否都选择了
|
|
|
$(".company_list").each(function () {
|
|
|
- var flag = true;
|
|
|
- $(this).find(".store_once").each(function () {
|
|
|
- if(!$(this).is(':checked')) {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- })
|
|
|
+ let flag = true;
|
|
|
+ let onces = $(this).find(".store_once");
|
|
|
+ if (onces.length <= 0) {
|
|
|
+ flag = false;
|
|
|
+ } else {
|
|
|
+ onces.each(function () {
|
|
|
+ if(!$(this).is(':checked')) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
if(flag){
|
|
|
$(this).find(".company_checkbox").prop("checked",true);
|
|
|
}else{
|