解决权限bug
This commit is contained in:
@@ -1348,11 +1348,11 @@
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
ids += row[i].id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
//批量更新会员的预收款信息
|
||||
for(var i = 0;i < row.length; i ++) {
|
||||
@@ -1422,10 +1422,10 @@
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
ids += row[i].id;
|
||||
break;
|
||||
}
|
||||
ids += row[i].Id + ",";
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
@@ -1474,10 +1474,10 @@
|
||||
{
|
||||
if(i == row.length-1)
|
||||
{
|
||||
ids += row[i].Id;
|
||||
ids += row[i].id;
|
||||
break;
|
||||
}
|
||||
ids += row[i].Id + ",";
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
|
||||
@@ -89,11 +89,11 @@
|
||||
}
|
||||
//按钮权限列表
|
||||
else if (lei == 3) {
|
||||
var btnStr = userBusinessList[0].btnStr;
|
||||
var btnStr = userBusinessList[0].btnstr;
|
||||
if (btnStr != null) {
|
||||
btnStr = JSON.parse(btnStr);
|
||||
for (var j = 0; j < btnStr.length; j++) {
|
||||
btnStrList.push(btnStr[j]);
|
||||
var btnObj = JSON.parse(btnStr);
|
||||
for (var j = 0; j < btnObj.length; j++) {
|
||||
btnStrList.push(btnObj[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,11 +184,10 @@
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
showRoleDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
@@ -427,7 +426,7 @@
|
||||
alert("请选择一条数据再操作!");
|
||||
return false;
|
||||
}
|
||||
this.href = "/pages/manage/roleApp.html?id=" + currentRow.Id;
|
||||
this.href = "/pages/manage/roleApp.html?id=" + currentRow.id;
|
||||
});
|
||||
|
||||
//分配功能
|
||||
@@ -437,7 +436,7 @@
|
||||
alert("请选择一条数据再操作!");
|
||||
return false;
|
||||
}
|
||||
this.href = "/pages/manage/roleFunctions.html?id=" + currentRow.Id;
|
||||
this.href = "/pages/manage/roleFunctions.html?id=" + currentRow.id;
|
||||
});
|
||||
|
||||
//分配按钮
|
||||
@@ -447,7 +446,7 @@
|
||||
alert("请选择一条数据再操作!");
|
||||
return false;
|
||||
}
|
||||
this.href = "/pages/manage/rolePushBtn.html?id=" + currentRow.Id;
|
||||
this.href = "/pages/manage/rolePushBtn.html?id=" + currentRow.id;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -111,11 +111,10 @@
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
showDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
@@ -127,29 +126,32 @@
|
||||
|
||||
function showDetails(pageNo, pageSize) {
|
||||
$.ajax({
|
||||
url: "/userBusiness/getBasicData.action",
|
||||
url: "/userBusiness/getBasicData",
|
||||
type: "get",
|
||||
data: {
|
||||
Type: 'RoleFunctions',
|
||||
KeyId: keyId
|
||||
},
|
||||
success: function (res) {
|
||||
if (res && res.showModel && res.showModel.map && res.showModel.map.userBusinessList && res.showModel.map.userBusinessList[0]) {
|
||||
userBusinessId = res.showModel.map.userBusinessList[0].id;
|
||||
roleBtnStr = res.showModel.map.userBusinessList[0].btnStr;
|
||||
var getValue = res.showModel.map.userBusinessList[0].value;
|
||||
if (res && res.code === 200) {
|
||||
var ubList = res.data.userBusinessList;
|
||||
userBusinessId = ubList[0].id;
|
||||
roleBtnStr = ubList[0].btnstr;
|
||||
var getValue = ubList[0].value;
|
||||
getValue = getValue.substring(1, getValue.length - 1);
|
||||
if (getValue.indexOf("][")) {
|
||||
var arr = getValue.split("][");
|
||||
arr = arr.toString();
|
||||
$.ajax({
|
||||
url: "/functions/findByIds.action",
|
||||
url: "/functions/findByIds",
|
||||
type: "get",
|
||||
data: {
|
||||
FunctionsIDs: arr
|
||||
functionsIds: arr
|
||||
},
|
||||
success: function (rec) {
|
||||
$("#tableData").datagrid('loadData', JSON.parse(rec));
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#tableData").datagrid('loadData', res.data);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.messager.alert('提示', '查询数据异常,请稍后再试!', 'error');
|
||||
@@ -228,14 +230,14 @@
|
||||
btnStr = JSON.stringify(bindArr);
|
||||
}
|
||||
$.ajax({
|
||||
url: "/userBusiness/updateBtnStr.action",
|
||||
type: "get",
|
||||
url: "/userBusiness/updateBtnStr",
|
||||
type: "post",
|
||||
data: {
|
||||
UserBusinessID: userBusinessId,
|
||||
BtnStr: btnStr
|
||||
userBusinessId: userBusinessId,
|
||||
btnStr: btnStr
|
||||
},
|
||||
success: function (res) {
|
||||
if (res) {
|
||||
if (res && res.code === 200) {
|
||||
self.parent.$.colorbox.close();
|
||||
alert("操作成功!");
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.Functions;
|
||||
import com.jsh.erp.service.functions.FunctionsService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
@@ -232,4 +233,41 @@ public class FunctionsController {
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id列表查找功能信息
|
||||
* @param functionsIds
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/findByIds")
|
||||
public BaseResponseInfo findByIds(@RequestParam("functionsIds") String functionsIds,
|
||||
HttpServletRequest request) {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
List<Functions> dataList = functionsService.findByIds(functionsIds);
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("total", dataList.size());
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != dataList) {
|
||||
for (Functions functions : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("Id", functions.getId());
|
||||
item.put("Name", functions.getName());
|
||||
item.put("PushBtn", functions.getPushbtn());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
res.code = 200;
|
||||
res.data = outer;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,4 +209,51 @@ public class SupplierController {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户对应客户显示
|
||||
* @param type
|
||||
* @param keyId
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/findUserCustomer")
|
||||
public JSONArray findUserCustomer(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
||||
HttpServletRequest request) {
|
||||
JSONArray arr = new JSONArray();
|
||||
try {
|
||||
List<Supplier> dataList = supplierService.findUserCustomer();
|
||||
//开始拼接json数据
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("id", 1);
|
||||
outer.put("text", "客户列表");
|
||||
outer.put("state", "open");
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != dataList) {
|
||||
for (Supplier supplier : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("id", supplier.getId());
|
||||
item.put("text", supplier.getSupplier());
|
||||
//勾选判断1
|
||||
Boolean flag = false;
|
||||
try {
|
||||
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + supplier.getId().toString() + "]");
|
||||
} catch (Exception e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>设置用户对应的客户:类型" + type + " KeyId为: " + keyId + " 存在异常!");
|
||||
}
|
||||
if (flag == true) {
|
||||
item.put("checked", true);
|
||||
}
|
||||
//结束
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("children", dataArray);
|
||||
arr.add(outer);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,4 +57,30 @@ public class UserBusinessController {
|
||||
}
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色的按钮权限
|
||||
* @param userBusinessId
|
||||
* @param btnStr
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/updateBtnStr")
|
||||
public BaseResponseInfo updateBtnStr(@RequestParam(value ="userBusinessId", required = false) Long userBusinessId,
|
||||
@RequestParam(value ="btnStr", required = false) String btnStr,
|
||||
HttpServletRequest request) {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
int back = userBusinessService.updateBtnStr(userBusinessId, btnStr);
|
||||
if(back > 0) {
|
||||
res.code = 200;
|
||||
res.data = "成功";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "查询权限失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,13 @@ public class FunctionsService {
|
||||
List<Functions> list = functionsMapper.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Functions> findByIds(String functionsIds){
|
||||
List<Long> idList = StringUtil.strToLongList(functionsIds);
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
example.createCriteria().andEnabledEqualTo(true).andIdIn(idList);
|
||||
example.setOrderByClause("Sort asc");
|
||||
List<Functions> list = functionsMapper.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,4 +108,12 @@ public class SupplierService {
|
||||
example.createCriteria().andIdIn(ids);
|
||||
return supplierMapper.updateByExampleSelective(supplier, example);
|
||||
}
|
||||
|
||||
public List<Supplier> findUserCustomer(){
|
||||
SupplierExample example = new SupplierExample();
|
||||
example.createCriteria().andTypeEqualTo("客户");
|
||||
example.setOrderByClause("id desc");
|
||||
List<Supplier> list = supplierMapper.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,4 +89,12 @@ public class UserBusinessService {
|
||||
}
|
||||
}
|
||||
|
||||
public int updateBtnStr(Long userBusinessId, String btnStr) {
|
||||
UserBusiness userBusiness = new UserBusiness();
|
||||
userBusiness.setBtnstr(btnStr);
|
||||
UserBusinessExample example = new UserBusinessExample();
|
||||
example.createCriteria().andIdEqualTo(userBusinessId);
|
||||
return userBusinessMapper.updateByExampleSelective(userBusiness, example);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user