<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: zhangyi2652 $ $Date: 2010/11/30 06:19:07 $ $Revision: 1.2 $ $Purpose: 角色分配功能 --> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:view> <a:link id="sys_role_function_link" url="${/request/@context_path}/modules/sys/public/sys_role_function.lsc"/> <script type="text/javascript"><![CDATA[ function close() { $('assign_function').close(); } function save() { var role_id='${/parameter/@role_id}'; var ds = $('function_tree_ds'); var records=ds.getAll(); var array=[]; var n=0; for (var i=0,j=records.length;i<j;i++) { var record=records[i]; if(record.get('checked')=='Y') { array[n]={ role_id:role_id, function_id:record.get('function_id'), sequence:record.get('sequence'), expanded:record.get('expanded'), checked:record.get('checked') }; n++; } } var data={}; data['functions']=array; data['role_id']=role_id; Leaf.request({ url: $('sys_role_function_link').getUrl(), para: data, success: function (res) { Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); }, scope: this }); } function expandEditorFunction(record, name) { if (record.get('function_type') == 'G') { return 'grid_cb'; } else { return ''; } } ]]></script> <a:dataSets> <a:dataSet id="function_tree_ds" autoCount="false" autoQuery="true" fetchAll="true" model="sys.sys_role_function_view" queryUrl="${/request/@context_path}/autocrud/sys.sys_role_function_view/query?role_id=${/parameter/@role_id}"> <a:fields> <a:field name="function_code" readOnly="true"/> <a:field name="function_name" readOnly="true"/> <a:field name="expanded" checkedValue="Y" uncheckedValue="N"/> </a:fields> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:gridButton click="save" text="HLS.SAVE"/> <a:gridButton click="close" text="HLS.CLOSE"/> </a:screenTopToolbar> <a:treeGrid id="functionTreeGrid" bindTarget="function_tree_ds" expandField="_expanded" height="530" idField="function_id" parentField="parent_function_id" showCheckBox="true" width="570"> <a:columns> <a:column name="function_name" width="250"/> <a:column name="function_code" width="120"/> <a:column name="expanded" editorFunction="expandEditorFunction" width="80"/> <a:column name="sequence" align="right" editor="grid_nf" width="100"/> </a:columns> <a:editors> <a:numberField id="grid_nf"/> <a:checkBox id="grid_cb"/> </a:editors> </a:treeGrid> </a:screenBody> </a:view> </a:screen>