123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- /**===========================================
- * @projectDescription IcomPersonNature.js
- * @use by IcomPersonNature.jsp
- * @author hongyan_guan
- * @create at 2008-08-27 星期三 下午 02:11:40
- * @update by
- ==============================================*/
- var gridr="";
- var dataModelr="";
- var dsr="";
-
- Ext.onReady(function(){
-
- //ext准备方法开始
- Ext.QuickTips.init();
- //定义读取数据的模版
- dataModelr = Ext.data.Record.create([
- { name:'id',mapping:'id'},
- { name:'name',mapping:'name'},
- { name:'telephone',mapping:'telephone'},
- { name:'position',mapping:'position'},
- { name:'status',mapping:'status'},
- { name:'orderNum',mapping:'orderNum'}
- ]);
-
- //定义列模板
- var colModelr = new Ext.grid.ColumnModel([
-
- new Ext.grid.RowNumberer(),
- {
- id:'id',
- header:"id",
- dataIndex:'id',
- hidden:true,
- width:80,
- sortable: true,
- align:'left' },
- {
- id:'position',
- header:"position",
- dataIndex:'position',
- hidden:true,
- width:80,
- sortable: true,
- align:'left' },
- {
- id:'name',
- header:"姓名",
- dataIndex:'name',
- hidden:false,
- width:100,
- fixed:false,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.TextField({allowBlank: false,allowNegative: true}) },
-
- {
- id:'telephone',
- header:"电话",
- dataIndex:'telephone',
- hidden:false,
- width:100,
- fixed:false,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.TextField({allowBlank: false,allowNegative: true}) },
- {
- id:'orderNum',
- header:"排序号",
- dataIndex:'orderNum',
- hidden:false,
- width:100,
- fixed:false,
- sortable: true,
- align:'left' ,
- editor: new Ext.form.NumberField({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),//store:carTypeStore
- 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+'/employeeAction!query.action'}),
- reader: new Ext.data.JsonReader({root: 'data'},dataModelr)
- });
- //定义列表对象
- gridr = new Ext.grid.EditorGridPanel({
- ds: dsr,
- clicksToEdit:1,
- selModel: new Ext.grid.RowSelectionModel(),
- cm: colModelr,
- frame:false,
- border:false
- });
- gridr.render('grid_personarea');
- dsr.load({params:{position:positionInnerCode}});
- //ext准备方法结束
- });
- /****************************************** 自定义函数 ********************************************************************************/
- var winHandle;
- /**
- * 新增或者修改后的保存
- */
- function saveIcomPersonNature() {
- var m = dsr.modified.slice(0);
- if(m.length == 0){
- setMessage('没有需要保存的条目!');
- return;
- }
- for(var j=0;j<m.length;j++){
- var fullName = m[j].data['name'];
-
- if(trim(fullName) == ''){
- setMessage('请填写名称!');
- 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+'/employeeAction!update.action',
- params:{data:jsonData},
- method: 'post',
- success: function ( result, request) {
- //如果失败 捕获后台自定义的异常
- if (isScript(result.responseText))return;
- dsr.modified = []; //将修改过的记录置为空,如果不清空,则修改过的数据会一直保留
- extMessage('保存成功!');
- dsr.reload({params:{position:positionInnerCode}});
- },
- 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+'/employeeAction!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 addNewRow(){
-
- if(positionInnerCode==""||positionInnerCode==null){
- setMessage("请选择岗位!");
- return;
- }
- var p = new dataModelr({
- id:'',
- position:positionInnerCode,
- name:'',
- orderNum:'',
- telephone:'',
- status:0
- });
- gridr.stopEditing();
- dsr.insert(0, p);
- gridr.startEditing(0, 0);
- }
- function userPeixun(){
- var m = gridr.getSelections();
- if(m.length == 0){
- setMessage('请选择要维护培训的人员数据!');
- return;
- }
- if(m.length == 1)
- {
- var tempUserCode=m[0].data['userCode'];
- winHandle=parent.openWindow(projectPath+'/personManage.do?method=doPeixunAction&forward=/permission/IcomPersonNaturePage/personPeixunGrid.jsp&userCode='+tempUserCode,600,405,'表单窗口',this.window);
- }
- }
-
|