定时查询更新进度条,如果具体的修改状态操作可以在另一个ajax请求里写
var task = {
interval: 10000, //每10秒更新
run: function () {
var msgBox = Ext.MessageBox.show({
title: '下发进度',
msg: '正在下发!',
progress: true,
width: 400,
buttons: Ext.Msg.OK,
scope: document.body
});
Ext.Ajax.request({
url: 'Door/getSendCount',
params: {},
disableCaching: true,//禁止缓存
timeout: 30000,//最大等待时间,超出则会触发超时
method: "GET",
success: function (response, opts) {
var ret = Ext.JSON.decode(response.responseText); //JSON对象化
var total = ret.total;
var count = ret.count;
if (count != total) {
//计算进度
var percentage = count / total;
//显示内容
var processText = '下发数量:' + total + ';已完成数量' + count + '; ';
//更新进度条;
msgBox.updateProgress(percentage, processText, '下发进度');
}
else {
msgBox.hide();
Ext.TaskManager.stop(task);
win.show();
}
},
failure: function (response, opts) {
}
});
}
}
Ext.TaskManager.start(task);