Ext.define('school.view.Interaction.mailbox.MailboxController', { extend: 'Ext.app.ViewController', alias: 'controller.interaction-mailbox-mailbox', // 回复 ReplyClick: function () { Ext.MessageBox.show({ title: '回复处理', msg: '回复对象:'+rec.data.code, width:500, height:600, buttons: Ext.MessageBox.OKCANCEL, multiline: true, scope: this, fn: this.showResultText,//处理输入的文字 }); }, // 导出 exportClick: function () { Ext.Msg.alert('导出', '我是导出'); }, //删除 deleteClick: function (o) { let gird = o.ownerCt.ownerCt; let data = gird.getSelectionModel().getSelection(); if(data.length == 0){ Ext.Msg.alert("提示","您最少要选择一条数据"); }else{ //1.先得到ID的数据(name) let st = gird.getStore(); let ids = []; Ext.Array.each(data,function(record){ ids.push(record.get('name')); }) Ext.MessageBox.confirm('删除邮件','你确定要删除吗?',function(btn){ if (btn == 'yes') { //2.后台操作(delet) // Ext.Ajax.request({ // url:'/extjs/extjs!deleteData.action', // params:{ids:ids.join(",")}, // method:'POST', // timeout:2000, // success:function(response,opts){ // Ext.Array.each(data,function(record){ // st.remove(record); // }) // } // }) //3.前端操作DOM进行删除(ExtJs) Ext.Array.each(data,function(record){ st.remove(record); }) } }); } }, // 批量回复 batchClick: function (o) { let gird = o.ownerCt.ownerCt; let items = gird.getStore().data.items;//所有的内容 let batch = []; for (let i = 0; i < items.length; i++) { if (items[i].data.Handle) { batch.push(items[i].data.code) Ext.MessageBox.show({ title: '回复处理', msg: '回复对象:'+batch.join(','), width:500, height:600, buttons: Ext.MessageBox.OKCANCEL, multiline: true, scope: this, fn: this.showResultText,//回调函数 }); } } }, // 回调函数 showResultText: function (btn,text) { if (btn == 'ok') { alert('点击的按钮是:'+btn+'内容是:'+text); } else { return } }, });