|
(function($){
|
//加载
|
$.loading=function(options){
|
var set = $.extend({
|
'dbid' : '-1',
|
'isAppend' : false,
|
'hostUrl' :'',
|
'wxQuery' : '',
|
'RequestURL' : '',
|
'data_base_id': 'data_base_id'
|
}, options);
|
$('a').click(function(){//按钮点击进入
|
var _this=this;
|
switch(this.id) {
|
case 'restart'://重启服务
|
$(this).linkbutton('disable');
|
$.post('/setXml.do?chqi=1',function(date){
|
$(this).linkbutton('enable');
|
Tips(date);
|
$.post("/500.jsp",function(data){});
|
window.location.reload();
|
});
|
break;
|
case 'synchronization'://同步数据源
|
$.post('/SyncDataSource.do','',function(date){
|
Tips(date);
|
});
|
break;
|
|
case 'getSystemAccessKey'://获取代理商编码
|
getSystemAccesskey();
|
break;
|
|
case 'getInvitationCode'://获取邀请码
|
getInvitationCode();
|
break;
|
case 'test'://测试连接,生成(xml),保存
|
case 'generate':
|
case 'save':
|
case 'logodel':
|
ajaxLoading();
|
//注释原因:用easyUi的 form表单提交在谷歌版本: 83.0.4103.97(正式版本)提交不了。-xin 2020-6-11 09:41:23
|
// $('#submit').form('submit', {
|
// url: '/setXml.do?testConn='+(this.id=='test'?1:0)+'&logodel='+(this.id=='logodel'?1:0),
|
// onSubmit: function(param){
|
// param.id=set.dbid;
|
// var bol=data(param,set.isAppend);
|
// if(bol){
|
// ajaxLoadEnd();
|
// return false;
|
// }//验证
|
// },
|
var param={};
|
param.id=set.dbid;
|
var bol=data(param,set.isAppend);
|
if(bol){
|
ajaxLoadEnd();
|
return false;
|
}//验证
|
var formdata=new FormData($("#submit")[0]);
|
for(var f in param){
|
formdata.append(f,param[f]);
|
}
|
$.ajax({url:'/setXml.do?testConn='+(this.id=='test'?1:0)+'&logodel='+(this.id=='logodel'?1:0),type: "POST"
|
,data:formdata,processData:false,contentType:'multipart/form-data',
|
success: function(data){
|
try{
|
var json=eval('('+data+')');
|
Tips(json.info);
|
if(_this.id=='generate' && json.state!=2){
|
window.location.href='/demo/update1.jsp?id=-1';
|
}else if(_this.id=='logodel' || _this.id=='save'){//保存后刷新界面
|
setTimeout(function(){
|
window.location.reload();
|
},2000 );
|
}
|
ajaxLoadEnd();
|
}catch(e){
|
|
}
|
},error:function(e1,e2){
|
Tips(e1.responseText);
|
}
|
});
|
break;
|
case 'modify'://页面跳转
|
if(parent.addTab){
|
parent.addTab(this.title,'','','',this.type,'');
|
}else{
|
window.open(this.type);
|
}
|
break;
|
case 'doExit'://生成配置文件
|
$.post("/setXml.do",'',function(date){
|
Tips(date);
|
});
|
break;
|
case 'reload'://刷新
|
window.location.reload();
|
break;
|
case 'refreshDataSourceDataSize'://刷新数据库使用情况
|
getrefreshDataSourceDataSize(set);
|
break;
|
case 'doStopAction'://(启用/禁止)系统
|
var action=this.title;
|
var id=this.type;
|
if(action == "stop"){
|
$.messager.confirm('提示', '是否真的停止系统,如果选【确定】,则系统将立即停止访问?', function(r){
|
if(r){
|
getStopAndStart(action,id,set);
|
}
|
});
|
}else{
|
getStopAndStart(action,id,set);
|
}
|
// if (action == "stop" && ! confirm("是否真的停止系统,如果选【确定】,则系统将立即停止访问!")) {
|
// return ;
|
// }
|
// getStopAndStart(action,id,set);
|
break;
|
case 'doDel'://删除一个数据库
|
var op=this.type;
|
$.messager.confirm('删除', '确认删除【'+this.name+'】数据库吗?', function(r){
|
if (r){
|
$.post("/doDelDemo.do",{"op":op},function(json){
|
if (json['hint']) {
|
alert(json['hint']);
|
}
|
if (json['error']) {
|
Tips(json['error']) ;
|
ajaxLoadEnd();
|
return ;
|
}
|
|
window.location.reload(true);
|
});
|
}
|
});
|
break;
|
default:
|
break;
|
}
|
});
|
//获取邀请码
|
if(set.dbid <= 0 && set.isAppend){
|
getInvitationCode();
|
}
|
|
//复选框的单击事件
|
$('.checkbox').click(function(){
|
if($(this).is(':checked')){
|
$(this).val(1);
|
}else{
|
$(this).val(0);
|
}
|
});
|
}
|
|
//刷新数据库使用情况
|
function getrefreshDataSourceDataSize(set){
|
$.ajax({
|
url: set.hostUrl+'/shopping/maintaince/maintaince.do?m=refreshdsdatasize'+(set.wxQuery==null || set.wxQuery==''?'':'&'+set.wxQuery),//<%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString) %>',
|
type: 'post',
|
data: '',//$('input[type=\'text\'],input[type=\'radio\']:checked,input[type=\'checkbox\']:checked,select,textarea'),
|
dataType: 'json',
|
beforeSend:ajaxLoading,
|
// complete: function() {
|
// $('#button-submit').button('reset');
|
// },
|
success: function(json) {
|
if (json['hint']) {
|
Tips(json['hint']);
|
}
|
if (json['error']) {
|
Tips(json['error']) ;
|
ajaxLoadEnd();
|
return ;
|
}
|
setTimeout(function() {
|
ajaxLoadEnd();
|
location = set.RequestURL;//"<%= request.getRequestURL() %>"
|
}, 1000);
|
},
|
error: function(xhr, ajaxOptions, thrownError) {
|
Tips(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
}
|
});
|
}
|
//(启用/禁止)系统
|
function getStopAndStart(action,id,set){
|
$.ajax({
|
url: set.hostUrl+'/shopping/maintaince/maintaince.do?m=StopAndStart&action='+action +'&'+set.data_base_id+'='+ id + (set.wxQuery==null || set.wxQuery==''?'':'&'+set.wxQuery),// '<%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString) %>',
|
type: 'post',
|
data: '',//$('input[type=\'text\'],input[type=\'radio\']:checked,input[type=\'checkbox\']:checked,select,textarea'),
|
dataType: 'json',
|
beforeSend:ajaxLoading,
|
// beforeSend: function() {
|
// $('#button-submit').button('loading');
|
// },
|
// complete: function() {
|
// $('#button-submit').button('reset');
|
// },
|
success: function(json) {
|
if (json['hint']) {
|
Tips(json['hint']);
|
}
|
|
if (json['error']) {
|
Tips(json['error']) ;
|
}
|
setTimeout(function() {
|
ajaxLoadEnd();
|
location = set.RequestURL;//"<%= request.getRequestURL() %>"
|
}, 1000);
|
},
|
error: function(xhr, ajaxOptions, thrownError) {
|
Tips(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
}
|
});
|
}
|
|
//获取邀请码
|
function getInvitationCode() {
|
$.post('/getInvitationCode.do','',function(data){
|
$("#InvitationCode").textbox('setValue', data); //赋值
|
});
|
}
|
//获取代理商编码
|
function getSystemAccesskey(){
|
var DockingSystem=setcombobox('DockingSystem');
|
if(DockingSystem == ""){
|
Tips('请先选择所对接的第三方系统');
|
return;
|
}
|
top.addTab("代理商列表",9801,1,"type='"+DockingSystem+"'");
|
}
|
//集合取值
|
function data(map,isAppend){
|
//必录
|
map.host=settextbox('host');
|
map.port=settextbox('port');
|
map.db=settextbox('db');
|
map.userid=settextbox('userid');
|
map.password=settextbox('password');
|
if(isAppend){//附加 必录
|
map.Protocol=setcombobox("Protocol");
|
map.domain=settextbox("domain");
|
map.systemtype=setcombobox("systemtype");
|
map.systemID=settextbox('systemID');
|
map.systemDescribe=settextbox('systemDescribe');
|
map.password==''?delete map.password:map.password;
|
}
|
var bol=(remind(map)? true:false);//必录输入验证
|
if(isAppend){//附加
|
map.LimitUserNumber=settextbox("LimitUserNumber");
|
map.LimitDepartmentNumber=settextbox("LimitDepartmentNumber");
|
map.expiredDate=settextbox("expiredDate");
|
map.smsUid=settextbox("smsUid");
|
map.smsKey=settextbox("smsKey");
|
map.isAutoGenerateFormId=setchecked("isAutoGenerateFormId");
|
map.Remarks=settextbox("Remarks");
|
map.DataCheckPageNum=settextbox("DataCheckPageNum");
|
map.CorpURL=settextbox("CorpURL");
|
map.CorpId=settextbox("CorpId");
|
map.MpAppId=settextbox("MpAppId");
|
map.MpSecret=settextbox("MpSecret");
|
map.MpToken=settextbox("MpToken");
|
map.MpAesKey=settextbox("MpAesKey");
|
map.MiniAppId=settextbox("MiniAppId");
|
map.MiniAppSecret=settextbox("MiniAppSecret");
|
map.MiniAppToken=settextbox("MiniAppToken");
|
map.MiniAppAesKey=settextbox("MiniAppAesKey");
|
map.MiniAppOrgId=settextbox("MiniAppOrgId");
|
map.MpOrgId=settextbox("MpOrgId");
|
map.MpMchId=settextbox("MpMchId");
|
map.MpMchName=settextbox("MpMchName");
|
map.MpMchKey=settextbox("MpMchKey");
|
map.GeoWebApiKey=settextbox("GeoWebApiKey");
|
map.InvitationCode=settextbox("InvitationCode");
|
map.SystemAccessKey=settextbox("SystemAccessKey");
|
map.SystemSecretKey=settextbox("SystemSecretKey");
|
map.DockingSystem=setcombobox("DockingSystem");
|
map.isShowAttendanceButton=setchecked("isShowAttendanceButton");
|
map.isDisabledOpenNextPeriodId=setchecked("isDisabledOpenNextPeriodId");
|
map.isUseAPP=setchecked("isUseAPP");
|
map.isShowInLoginPage=setchecked("isShowInLoginPage");
|
map.TengXunMapLocationServiceKey=settextbox("TengXunMapLocationServiceKey");
|
}
|
map.actived=setchecked('actived'); //是否启用
|
return bol;
|
}
|
//取值 textbox
|
function settextbox(id){
|
return $('#'+id).textbox('getValue');
|
}
|
//取值 combobox
|
function setcombobox(id){
|
return $('#'+id).combobox('getValue');
|
}
|
//取值checked
|
function setchecked(id){
|
return ($('#'+id).is(':checked')?1:0);
|
}
|
//配置输入验证。
|
function remind(map){
|
for(var m in map){
|
if(map[m]=='' && m != 'id'){
|
$.messager.show({
|
height:60,
|
msg:'<div class=\"lu\"><span style=\"color:red;\"><b>'+$('#'+m).parent().parent().find("td")[0].innerText+'不能为空</b></div>',
|
showType:'fade',
|
timeout:2000,
|
style:{}
|
});
|
return true;
|
}
|
}
|
return false;
|
}
|
//提示
|
function Tips(data){
|
$.messager.alert('操作提示','<div class=\"lu\">'+data+'</div>');
|
}
|
//请稍候。。。启用
|
function ajaxLoading(){
|
$("<div class=\"datagrid-mask\"></div>").css({display:"block",width:"100%",height:$(window).height()}).appendTo("body");
|
$("<div class=\"datagrid-mask-msg\"></div>").html("正在处理,请稍候。。。").appendTo("body").css({height:"50px",display:"block",left:($(document.body).outerWidth(true) - 190) / 2,top:($(window).height()) / 2});
|
document.documentElement.style.overflow='hidden';
|
document.body.style.position='fixed';
|
document.body.style.top='0px';
|
document.body.style.width='100%';
|
}
|
//请稍候。。。结束
|
function ajaxLoadEnd(){
|
$(".datagrid-mask").remove();
|
$(".datagrid-mask-msg").remove();
|
document.documentElement.style.overflow='scroll';
|
document.body.style.position='static';
|
}
|
})(jQuery);
|