123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- var gridr="";
- var dataModelr="";
- var dsr="";
- var record_start=0;
- var start=0;
- var limit=getLimitNum();
- Ext.onReady(function(){
-
- //ext准备方法开始
- Ext.QuickTips.init();
- //定义读取数据的模版
- dataModelr = Ext.data.Record.create([
- { name:'id',mapping:'id'},
- { name:'name',mapping:'name'},
- { name:'userid',mapping:'userid'},
- { name:'loginname',mapping:'loginname'},
- { name:'loginpwd',mapping:'loginpwd'},
- { name:'mac',mapping:'mac'},
- { name:'status',mapping:'status'}
- ]);
-
- //定义列模板
- var colModelr = new Ext.grid.ColumnModel([
-
- new Ext.grid.RowNumberer({
- header: "序号",
- width: 36,
- height:60,
- renderer: function(value,metadata,record,rowIndex){
- return record_start + 1 + rowIndex;
- }
- }),
- {
- id:'id',
- header:"id",
- dataIndex:'id',
- hidden:true,
- width:80,
- sortable: true,
- align:'left' },
- {
- id:'name',
- header:"姓名",
- dataIndex:'name',
- hidden:false,
- width:80,
- sortable: true,
- align:'left' },
- {
- id:'userid',
- header:"员工编号",
- dataIndex:'userid',
- hidden:true,
- width:180,
- sortable: true,
- align:'left' },
- {
- id:'loginname',
- header:"账号",
- dataIndex:'loginname',
- hidden:false,
- width:80,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.TextField({allowBlank: false,allowNegative: true})},
- {
- id:'loginpwd',
- header:"密码",
- dataIndex:'loginpwd',
- inputType:'password',
-
- hidden:false,
- width:100,
- fixed:false,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.TextField({allowBlank: false,allowNegative: true}) },
-
- {
- id:'mac',
- header:"MAC地址",
- dataIndex:'mac',
- hidden:false,
- width:100,
- fixed:false,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.TextField({allowBlank: false,allowNegative: true}) },
- {
- id:'status',
- header:"状态",
- dataIndex:'status',
- hidden:false,
- width:80,
- fixed:true,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.ComboBox({
-
- store:Ideal.ComboBoxR.getStore(parent.dicContainer[104].childrenJson),
- displayField:'name',
- typeAhead: false,
- valueField:'value',
- forceSelection:true,
- hiddenName :'ILocked',
- lazyRender :true,
- readOnly : true,
- mode: 'local',
- triggerAction: 'all',
- listClass: 'x-combo-list-small'
- }),
- renderer:Ideal.ComboBoxR.getRenderer}
- ]);
-
- //定义存储器,从后台读取json数据
- dsr = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({url: projectPath+'/permissionsAction!query.action'}),
- reader: new Ext.data.JsonReader({totalProperty:'total',root: 'data'},dataModelr)
- });
- var pagingBar = new Ext.PagingToolbar({
- pageSize: limit,
- store: dsr,
- autoWidth: true,
- displayInfo: true,
- beforePageText: "第",
- afterPageText: "页,共{0}页",
- firstText: "首页",
- prevText: "上一页",
- nextText: "下一页",
- lastText: "尾页",
- refreshText: "刷新",
- displayMsg: "当前显示记录从{0}-{1} 总{2}条记录",
- emptyMsg: "没有相关记录!",
- doLoad:function(start){
- record_start=start;
- var o = {}, pn = this.paramNames;
- o[pn.start] = start;
- o[pn.limit] = this.pageSize;
- if(this.fireEvent('beforechange', this, o) !== false){
- dsr.load({params:o});
- }
- }
- });
- //定义列表对象
- gridr = new Ext.grid.EditorGridPanel({
- ds: dsr,
- clicksToEdit:1,
- selModel: new Ext.grid.RowSelectionModel(),
- cm: colModelr,
- frame:false,
- border:false,
- bbar: pagingBar
- });
- gridr.render('grid_userarea');
- dsr.on('beforeload', function(){
- this.baseParams={position:positionInnerCode,deptid:deptcode};
-
- });
- dsr.load({params:{start:start,limit:limit}});
-
-
- //ext准备方法结束
-
- //ext准备方法结束
- });
- /****************************************** 自定义函数 ********************************************************************************/
- var winHandle;
- var value;
- var te;
- /**
- * 新增或者修改后的保存
- */
- function doValidateEdit(e){
- value = e.value;
- var columnName = e.field;
- var id=e.record.data['id'];
- var loginname=e.record.data['loginname'];
-
- $.post(prjContextPath+"/permissionsAction!queryJiaoyan.action",
- {
- loginname:loginname
- }, callBackFunc);
- }
- function callBackFunc(json) {
- if (json != null && json.success != null) {
- if (json.success == "0") {
- te.value='';
- //alert(te.value='');
- alert('用户已存在');
- return 0;
- }
- } else {
- alert('用户可用');
- }
- }
- function resetpwd(){
-
- var m = gridr.getSelections();
- if(m.length==0){
- setMessage('请选择要维护的数据!');
- return;
- }
- if(m.length == 1)
- {
-
- var tempUserCode=m[0].data['id'];
- var loginpwd=m[0].data['loginpwd'];
- $.post(projectPath+"/permissionsAction!resetpwd.action", {id:tempUserCode,loginpwd:111111}, callFuncresetpwd);
-
- }
- }
- function callFuncresetpwd(json){
- if(json!=null){
- if(json.success=="1"){
- //alert('提示:发文成功!');
- dsr.reload();
- }
- }else{
- alert('提示:初始化失败!');
- }
- }
- function saveIcomPersonNature() {
-
- var m = dsr.modified.slice(0);
- if(m.length == 0){
- setMessage('没有需要保存的条目!');
- return;
- }
- for(var j=0;j<m.length;j++){
- var loginname = m[j].data['loginname'];
-
- if(trim(loginname) == ''){
- setMessage('请填写账户!');
- return;
- }
- var loginpwd = m[j].data['loginpwd'];
-
-
- if(fucCheckLength(loginpwd)!= 6){
- setMessage('请填写6位字符密码!');
- return;
- }
- if(!(checkIsStrNum(loginpwd))){
- setMessage('密码由数字和字母组成!');
- return;
- }
- var mac= m[j].data['mac'];
- if(trim(mac) == ''){
- setMessage('请填写MAC地址!');
- return;
- }
-
- }
- var jsonData = "[";
- for ( var i = 0, len = m.length; i < len; i++ ){
- var ss = Ext.util.JSON.encode(m[i].data);
- if ( i==0 )
- jsonData = jsonData + ss;
- else
- jsonData = jsonData + "," + ss;
- }
- jsonData = jsonData + "]";
-
- if(jsonData == '[]'){
- setMessage('请填写完整信息!');
- return;
- }
- //end
- Ext.Ajax.request({
- url : prjContextPath+'/permissionsAction!updateBatch.action',
- params:{data:jsonData},
- method: 'post',
- success: function ( result, request) {
- //如果失败 捕获后台自定义的异常
- if (isScript(result.responseText))return;
- dsr.modified = []; //将修改过的记录置为空,如果不清空,则修改过的数据会一直保留
- extMessage('保存成功!');
- dsr.reload({params:{position:positionInnerCode,deptid:deptcode}});
- },
- failure: function ( result, request) {
- }
- });
- }
- /**
- * 删除提示操作
- */
- function deleteIcomPersonNature()
- {
- var m = gridr.getSelections();
- if(m.length == 0){
- setMessage('请选择要删除的数据!');
- return;
- }
- if(m.length > 0)
- {
- parent._confirm_msg_show( '确定要删除选中的数据吗?' , this.window.name+'.deleteIcomPersonNature_deleteCall(1)');
- }
- }
- /**
- * 删除操作,用户做选择后回调函数
- */
- function deleteIcomPersonNature_deleteCall(btn)
- {
- //如果点击确定
- if(btn == '1')
- {
- var m = gridr.getSelections();
-
- var ballPlatCode = new Array();
- for(i=0;i<m.length;i++){
- ballPlatCode[ballPlatCode.length]=m[i].data['id'];
- }
- if(ballPlatCode.length == 0)
- return;
- Ext.Ajax.request({
- url : projectPath+'/permissionsAction!delete.action',
- method: 'POST',
- params:{idArray:ballPlatCode},
- success: function ( result, request ) {
- //如果失败 捕获后台自定义的异常
- if (isScript(result.responseText))return;
- gridr.modified = [];
- dsr.reload({params:{position:positionInnerCode}});
- extMessage('删除成功!');
- },
- failure: function ( result, request) {
- }
- });
- }else{
- return;
- }
- }
- //编辑单条数据
- function updateNewRow(){
- var m = gridr.getSelections();
- if(m.length == 0){
- setMessage('请选择要维护的数据!');
- return;
- }
- if(m.length == 1){
- var id=m[0].data['id'];
- if(id!=''){
- var userid=m[0].data['userid'];
- var url='/system/permissions/userRoleRange.jsp?id='+id+'&userid='+userid;
- winHandle=parent.parent.openWindow(projectPath+url,420,360,'设置用户角色',this.window);
- }else{
- setMessage('提示:您选择的用户尚未创建系统帐号信息!');
- }
- }
- }
- function closeWindow(){
- if(winHandle!=null){
- winHandle.reset();
- }
- }
- function updatepwd(){
- var url='/system/permissions/user_view.jsp';
- winHandle=parent.openWindow(projectPath+url,300,210,'设置用户密码',this.window);
- }
-
-
|