Files
OMS/app/erpapi/view/admin/api/retry_view.html
2025-12-28 23:13:25 +08:00

120 lines
3.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Copyright © ShopeX http://www.shopex.cn. All rights reserved.
See LICENSE file for license details.
-->
<style>
.processBarBg {border:1px solid #999999; width:98%; margin:5px; height:25px;line-height:25px;padding:1px; background:#EEEEEE;}
.processBar {background:#3366cc; width:0px; padding-bottom:1px;overflow:hidden;}
</style>
<div class="tableform">
<div class="division" id="express_tools_main">
<form method='post' action='index.php?app=erpapi&ctl=admin_api_fail&act=retry' id="form-order" name="form-order" isCloseDialog>
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" >
<tbody>
<tr>
<td align="left">
<div class="division" style="display:none;" id="information">
本次处理 <span id="iTotal" style="color:#083E96"></span> 条记录,
<span id="iSucc" style="color:green"></span> 个成功,
<span id="iFail" style="color:red"></span> 个失败,<span id="title">请稍候……</span>
</div>
<div id="processBarBg" class="processBarBg">
<div id="processBar" class="processBar">
&nbsp;
</div>
</div>
<div id="addlogino"></div>
</td>
</tr>
<tr>
<td align="center">
<{button label="开始执行" type="button" class="btn-primary" id="sync"}>
<{button label="关闭窗口" type="button" class="btn-primary" id="closeWicket"}>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<script>
var itemData = <{$postIds}>;
var request_uri = "<{$request_uri}>";
var doTotal = 0;
var doSucc = 0;
var doFail = 0;
function ajaxget(idx) {
if (idx >= getTotal()) {
$('processBar').setStyle('width', '100%');
$('title').set('html', '处理完成。');
$('sync').hide();
$('closeWicket').show();
$('closeWicket').addEvent('click', function() {
dosubmit();
});
}
else {
var id = itemData[idx];
var _data = {'id':id};
new Request({
url : "index.php?app=erpapi&ctl=admin_api_fail&act=retry_do",
method : "post",
data: _data,
onComplete:function(result){
if(!result) return;
ret = JSON.decode(result);
if (ret['rsp'] == 'succ') {
doSucc++;
}
else {
doFail++;
}
doTotal++;
displayProcessInfo();
$('processBar').setStyle('width', (doTotal*100/(getTotal())) + '%');
ajaxget(idx+1);
}
}).send();
}
}
function doRun() {
//禁用开始按钮
doTotal = 0;
doSucc = 0;
doFail = 0;
displayProcessInfo();
$('information').style.display ='';
$('processBarBg').style.display ='';
$('sync').disabled = true;
$('sync').set('html', '<span><span>数据处理中,请稍候!</span></span>');
ajaxget(0);
}
function getTotal() {
var total = <{$count}>;
return total;
}
/* 显示信息进度 */
function displayProcessInfo() {
$('iTotal').set('html', getTotal());
$('iSucc').set('html', doSucc);
$('iFail').set('html', doFail);
}
doRun();
$('closeWicket').hide();
function dosubmit(){
$("form-order").fireEvent('submit',{stop:function(){}});
}
</script>