Toolbar3.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. Ext.define('erp.view.hr.attendance.Toolbar3', {
  2. extend: 'Ext.toolbar.Toolbar',
  3. alias: 'widget.erpEmpToolbar3',
  4. items: [{
  5. xtype:'textfield',
  6. hideTrigger:false,
  7. labelAlign:'right',
  8. fieldLabel:'id',
  9. id: 'em_wddefaultid',
  10. name: 'em_wddefaultid',
  11. hidden:true
  12. },{
  13. xtype: 'dbfindtrigger',
  14. fieldLabel:'班次编号',
  15. labelAlign:'right',
  16. id: 'wd_code',
  17. name: 'wd_code',
  18. },{
  19. xtype: 'textfield',
  20. fieldLabel:'班次名称',
  21. labelAlign:'right',
  22. id: 'wd_name',
  23. name: 'wd_name',
  24. readOnly: true
  25. }, {
  26. xtype:'button',
  27. text : '保存设置',
  28. width: 80,
  29. style: {
  30. width: 80
  31. },
  32. id : 'submit',
  33. iconCls : 'x-button-icon-submit',
  34. handler : function(){
  35. var wdid = Ext.getCmp("em_wddefaultid").rawValue;
  36. var records = Ext.getCmp('tree-panel').getChecked();
  37. if (wdid == null || wdid == "") {
  38. Ext.MessageBox.alert("提示", "请选择班次!");
  39. return;
  40. }
  41. if (records.length == 0) {
  42. Ext.MessageBox.alert("提示", "请选择需要设置班次的员工!");
  43. return;
  44. }
  45. var ids = "";
  46. var selectIds = new Array();
  47. Ext.each(records, function(item, index) {
  48. selectIds.push(item.getPath('id'));
  49. ids = ids + item.get("id");
  50. if (index < records.length - 1) {
  51. ids = ids + ",";
  52. }
  53. });
  54. Ext.Ajax.request({
  55. url : basePath + 'hr/attendance/setEmpWorkDate.action',
  56. params : {
  57. wdid: wdid,
  58. condition: "em_id in (" + ids + ")"
  59. },
  60. method : 'post',
  61. callback : function(options,success,response){
  62. var ret = new Ext.decode(response.responseText);
  63. if (ret.success) {
  64. Ext.Msg.alert("提示", "设置成功!");
  65. var store = Ext.getCmp('tree-panel').getExpandItem();
  66. var ids = new Array();
  67. Ext.each(store,function(item,index){
  68. ids.push(item.getPath('id'));
  69. });
  70. Ext.getCmp('tree-panel').getTreeRootNode(0);
  71. setTimeout(function(){
  72. Ext.each(ids,function(id,index){
  73. Ext.getCmp('tree-panel').expandPath(id,'id');
  74. });
  75. },300);
  76. // setTimeout(function(){
  77. // Ext.each(records,function(item,index){
  78. //// Ext.getCmp('tree-panel').selectPath(id,'id');
  79. // Ext.getCmp('tree-panel').getSelectionModel().select(item);
  80. // });
  81. // },500);
  82. } else {
  83. Ext.Msg.alert('提示','操作失败!');
  84. }
  85. }
  86. });
  87. }
  88. }]
  89. });