MailboxController.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Ext.define('school.view.Interaction.mailbox.MailboxController', {
  2. extend: 'Ext.app.ViewController',
  3. alias: 'controller.interaction-mailbox-mailbox',
  4. // 回复
  5. ReplyClick: function () {
  6. Ext.MessageBox.show({
  7. title: '回复处理',
  8. msg: '回复对象:'+rec.data.code,
  9. width:500,
  10. height:600,
  11. buttons: Ext.MessageBox.OKCANCEL,
  12. multiline: true,
  13. scope: this,
  14. fn: this.showResultText,//处理输入的文字
  15. });
  16. },
  17. // 导出
  18. exportClick: function () {
  19. Ext.Msg.alert('导出', '我是导出');
  20. },
  21. //删除
  22. deleteClick: function (o) {
  23. let gird = o.ownerCt.ownerCt;
  24. let data = gird.getSelectionModel().getSelection();
  25. if(data.length == 0){
  26. Ext.Msg.alert("提示","您最少要选择一条数据");
  27. }else{
  28. //1.先得到ID的数据(name)
  29. let st = gird.getStore();
  30. let ids = [];
  31. Ext.Array.each(data,function(record){
  32. ids.push(record.get('name'));
  33. })
  34. Ext.MessageBox.confirm('删除邮件','你确定要删除吗?',function(btn){
  35. if (btn == 'yes') {
  36. //2.后台操作(delet)
  37. // Ext.Ajax.request({
  38. // url:'/extjs/extjs!deleteData.action',
  39. // params:{ids:ids.join(",")},
  40. // method:'POST',
  41. // timeout:2000,
  42. // success:function(response,opts){
  43. // Ext.Array.each(data,function(record){
  44. // st.remove(record);
  45. // })
  46. // }
  47. // })
  48. //3.前端操作DOM进行删除(ExtJs)
  49. Ext.Array.each(data,function(record){
  50. st.remove(record);
  51. })
  52. }
  53. });
  54. }
  55. },
  56. // 批量回复
  57. batchClick: function (o) {
  58. let gird = o.ownerCt.ownerCt;
  59. let items = gird.getStore().data.items;//所有的内容
  60. let batch = [];
  61. for (let i = 0; i < items.length; i++) {
  62. if (items[i].data.Handle) {
  63. batch.push(items[i].data.code)
  64. Ext.MessageBox.show({
  65. title: '回复处理',
  66. msg: '回复对象:'+batch.join(','),
  67. width:500,
  68. height:600,
  69. buttons: Ext.MessageBox.OKCANCEL,
  70. multiline: true,
  71. scope: this,
  72. fn: this.showResultText,//回调函数
  73. });
  74. }
  75. }
  76. },
  77. // 回调函数
  78. showResultText: function (btn,text) {
  79. if (btn == 'ok') {
  80. alert('点击的按钮是:'+btn+'内容是:'+text);
  81. } else {
  82. return
  83. }
  84. },
  85. });