作者:风让我离开 | 来源:互联网 | 2023-06-03 13:38
etmvc+jQueryEasyUI+combobox澶??兼??浣?瀹??拌??叉????瀹?渚?-?轰?瑙??茬??????绠$??涓?????5寮?琛ㄦ????锛?濡?涓??
?轰?瑙??茬??????绠$??涓?????5寮?琛ㄦ????锛?濡?涓??撅?杩?????浠??瀹??板?瑙???ole杩?琛???????浣?锛?绠????ヨ?灏辨???瀵?olemenu杩?琛?娣诲????浣?锛?杩?????绔?富瑕???asyui-combobox?ュ??版????澶?????
?讳???璺???????濮???combobox锛?缁?瀹???????????锛??跺???规???????瑙??茶?峰??璇ヨ??插凡缁??ユ????????锛?璁剧疆combobox??涓??浜?????锛?????淇??瑰ソ????浜?锛??峰??combobox????涓??煎?????板??绔??琛?淇?瀛???
1???т欢??濮???
??????绔?tml锛?璁剧疆combobox??value?????d锛?text?????ame锛?浠g??濡?涓?锛?
??绔??峰??绯荤???????????锛?涔?灏辨??enu琛ㄧ??璁板?锛?浠g??濡?涓?锛?
public JsonView getAllMenus() throws Exception{
List
2???峰??瑙??插????ユ????????
??绔?S?????峰??褰???瑙???ole??id?????板??绔??峰??璇ヨ??叉?ユ??????????id?扮?锛?濡?涓?锛?
function newAuthorize(){
var row = grid.datagrid('getSelected');
if (row){
win1.window('open');
form1.form('load',row);
$.post('/ciccpsMember/role/getMenusByRid', { id:row.id},
function(result) {
if (result) {
//?峰??????menu??id
var t=[];
jsOnList=result.rows;
for(var i=0;i
??绔??规????绔???ョ??role??id?ヨ??版????峰??瀵瑰???????id杩???缁?瀹㈡?风?锛?浠g??濡?涓?锛?
//?规????茶???????id
public JsonView getMenusByRid(Integer id) throws Exception {
List rolemenuss = Rolemenus.findAll(Rolemenus.class, "rid =?", new Object[]{id}); //?规?????d??olemenu琛ㄤ腑?峰??????id
//????JSON?ㄧ???版?????骞惰???JSON瑙??
Map result = new HashMap();
result.put("rows", rolemenuss);
return new JsonView(result);
}
3????浜や慨?瑰????瑙??叉????
??绔?S?????峰??combobox??涓????煎?????板??绔??璁颁?瀵?ombobox?艰?琛?escape缂???锛?瑕?浠?%2C2%2C3??褰㈠?浼???锛??﹀???板??绔?氨?╀?涓??间?锛?浠g??濡?涓?锛?
function authorize(){
var id=$('#id').attr("value");
var r = $('#roleRight').combobox('getValues');
var rr=escape(r);
//$.messager.alert('??璇?,id+'ddd'+rr,'error');
$.post('/ciccpsMember/role/authorize', { id:id,rr:rr },
function(result) {
if (result.success) {
win1.window('close');
$.messager.show({
title:'??绀?,
msg:'瑙??叉??????????'
});
} else {
$.messager.alert('??璇?,result.msg,'error');
}
},'json');
}
??绔??峰????绔??杩??ョ???硷?杩?琛??版?????浣?锛?浠g??濡?涓?锛?
/**
* ??????浣?
*/
public JsonView authorize(Integer id,String rr) throws Exception {
//???ゆ?х??
Rolemenus.destroyAll(Rolemenus.class, "rid =?", new Object[]{id});
//杩藉???扮??
String[] ary = rr.split("%2C");
Rolemenus rm=null;
for(String item: ary){
//System.out.println(item);
rm=new Rolemenus();
rm.setRid(id);
rm.setMuid(Integer.parseInt(item));
rm.save();
}
return new JsonView("success:true");
}
?虫?锛?瑙??叉????灏卞??颁?锛?涓昏???涓ょ?硅?娉ㄦ??锛?涓????combobox璧?澶?涓??肩?????锛??︿?涓?氨???峰??combobox澶?涓??硷?1,2,3锛???瑕?杩?琛?escape缂???????浼??板??绔????????惧?涓?锛?
浠ヤ?灏辨?????????ㄩ?ㄥ??瀹癸?甯???瀵瑰ぇ瀹剁??瀛︿?????甯??╋?涔?甯???澶у?澶?澶??????????瀹躲??