Ext.define('erp.view.hr.emplmana.Employee', { extend : 'Ext.Viewport', hideBorders: true, initComponent : function() { var me = this; Ext.apply(me, { layout: 'anchor', items : [ { xtype : 'erpFormPanel', anchor : '100% 40%', saveUrl : 'hr/emplmana/saveEmployee.action', deleteUrl : 'hr/emplmana/deleteEmployee.action', updateUrl : 'hr/emplmana/updateEmployee.action', auditUrl : 'hr/employee/auditEmployee.action', submitUrl : 'hr/employee/submitEmployee.action', resSubmitUrl : 'hr/employee/resSubmitEmployee.action', resAuditUrl : 'hr/employee/resAuditEmployee.action', getIdUrl : 'common/getId.action?seq=Employee_SEQ', keyField : 'em_id', statusField : 'em_statuscode' },{ xtype:'tabpanel', anchor: '100% 50%', items:[{ xtype: 'gridpanel', id: 'grid', anchor : '100% 60%', title: '兼职信息设置', columns: [{ style :"text-align:center", text: '岗位名称', width: 160, dataIndex: 'jo_name', editor: { xtype: 'dbfindtrigger' }, dbfind: 'Job|jo_name', ignore: true },{ style :"text-align:center", text: '岗位描述', width: 200, dataIndex: 'jo_description', ignore: true },{ style :"text-align:center", text: '组织ID', width: 0, dataIndex: 'or_id', ignore: true },{ text: '组织信息', style :"text-align:center", width: 140, dataIndex: 'or_name', editor: { xtype: 'dbfindtrigger' }, dbfind: 'HrOrg|or_name', ignore: true },{ style :"text-align:center", xtype: 'actioncolumn', text: '操作', width: 100, align: 'center', items: [{ icon: basePath + 'resource/images/16/delete.png', tooltip: '删除', handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); warnMsg('确定删除?', function(btn){ if(btn == 'yes'){ view.ownerCt.deleteRecord(rec); } else if(btn == 'no'){ return; } }) } }] },{ text: ' ', hidden: true, dataIndex: 'jo_id' }], necessaryField: 'jo_id', GridUtil: Ext.create('erp.util.GridUtil'), dbfinds: [{ field: 'or_id', dbGridField: 'or_id' },{ field: 'or_name', dbGridField: 'or_name' },{ field: 'or_id', dbGridField: 'jo_orgid' },{ field: 'or_name', dbGridField: 'jo_orgname' },{ field: 'jo_name', dbGridField: 'jo_name' },{ field: 'jo_description', dbGridField: 'jo_description' },{ field: 'jo_id', dbGridField: 'jo_id' }], columnLines: true, plugins: [Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }),Ext.create('erp.view.core.plugin.CopyPasteMenu')], store: new Ext.data.Store({ fields: ['jo_name', 'jo_description', 'jo_id','or_id', 'or_name'], data: [{},{},{},{},{}] }), deleteRecord: function(record) { var empId = Ext.getCmp('em_id').getValue(); if(empId != null && empId > 0 && record.get('jo_id') >= 0 && record.get('jo_name') != null && record.get('jo_name') !='') { var grid = this, url = "hr/emplmana/deleteExtraJob.action"; grid.setLoading(true); Ext.Ajax.request({ url : basePath + url, params: { caller: caller, empId: empId, jobId: record.get('jo_id') }, method : 'post', callback : function(opt, success, response){ grid.setLoading(false); success && grid.store.remove(record); } }); } else { this.store.remove(record); } } },{ xtype: 'gridpanel', id: 'grid1', title: '组别信息设置', columns: [{ style :"text-align:center", text: '人员编号', width: 0, dataIndex: 'eg_emcode', editor: { xtype: 'dbfindtrigger' }, dbfind: 'UserGroup|ug_code', ignore: true },{ style :"text-align:center", text: '组别编号', width: 160, dataIndex: 'eg_groupcode', editor: { xtype: 'dbfindtrigger' }, dbfind: 'UserGroup|ug_code', ignore: true },{ style :"text-align:center", text: '组别名称', width: 220, dataIndex: 'eg_name', ignore: true },{ style :"text-align:center", text: '组别ID', width: 0, dataIndex: 'eg_id', ignore: true },{ style :"text-align:center", xtype: 'actioncolumn', text: '操作', width: 100, align: 'center', items: [{ icon: basePath + 'resource/images/16/delete.png', tooltip: '删除', handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); warnMsg('确定删除?', function(btn){ if(btn == 'yes'){ view.ownerCt.deleteRecord1(rec); } else if(btn == 'no'){ return; } }) } }] }], necessaryField: 'eg_groupcode', GridUtil: Ext.create('erp.util.GridUtil'), dbfinds: [{ field: 'eg_groupcode', dbGridField: 'ug_code' },{ field: 'eg_name', dbGridField: 'ug_name' }], columnLines: true, plugins: [Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }),Ext.create('erp.view.core.plugin.CopyPasteMenu')], store: new Ext.data.Store({ fields: ['eg_emcode', 'eg_name', 'eg_id','eg_groupcode'], data: [{},{},{},{}] }), deleteRecord1: function(record) { var emCode = Ext.getCmp('em_code').getValue(); var usergroup=record.get('eg_groupcode'); if(emCode != null && usergroup != null) { var grid = this, url = "hr/emplmana/deleteUserGroup.action"; grid.setLoading(false); Ext.Ajax.request({ url : basePath + url, params: { caller: caller, emCode: emCode, usergroup: usergroup }, method : 'post', callback : function(opt, success, response){ grid.setLoading(false); success && grid.store.remove(record); } }); } else { this.store.remove(record); } } }] }] }); me.callParent(arguments); } });