Files
OMS/app/erpapi/view/admin/api/retry_view.html
2026-01-04 19:08:31 +08:00

131 lines
4.1 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>