You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
5.2 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>执行无参数的方法</title>
<link href="../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<script src="../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<script src="../../Admin/Admin.js" type="text/javascript"></script>
<script src="../../Scripts/layui/layui/layui.js" type="text/javascript"></script>
<script type="text/javascript">
var attrs = null; //参数字段集合
var enFunc = null;
$(function () {
var funcNo = GetQueryString("FuncNo");
//初始化页面.
enFunc = new Entity("BP.CCBill.Sys.Func", funcNo);
attrs = new Entities("BP.Sys.MapAttrs");
attrs.Retrieve("FK_MapData", funcNo);
var isHaveParas = attrs.length > 0 ? true : false;
if (isHaveParas == true)
SetHref(GetHrefUrl().replace("Func.htm", "FuncParas.htm"));
$("#Btn_Done").html("执行:" + enFunc.Name);
//方法描述.
if (enFunc.Docs === "" || enFunc.Docs.length == 0)
enFunc.Docs = "操作说明未设置...";
$("#docs").html(enFunc.Docs);
});
/**
* 开始执行操作
*/
function Done() {
var altMsg = enFunc.WarningMsg;
if (altMsg == "")
altMsg = "您确定要执行吗?";
layer.confirm("您确定要执行吗?", function (index) {
layer.close(index);
//如果是JS执行先加载js
if (enFunc.MethodDocTypeOfFunc == 1) {
//加载执行方法的js
Skip.addJs('../../../DataUser/JSLibData/Method/' + enFunc.No + '.js');
doMethod();
return;
}
doMethod();
})
}
/**
* 执行方法
*/
function doMethod() {
$("#Msg").html("正在执行方法,请稍后......");
var data = "";
switch (enFunc.MethodDocTypeOfFunc) {
case 0://执行SQL
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("MyPK", mypk);
handler.AddPara("FrmID", frmID);
handler.AddPara("WorkID", workid);
data = handler.DoMethodReturnString("DoMethod_ExeSQL"); //执行SQLs
layer.alert(data);
if (data.indexOf("err@") == -1)
$("#Btn_Done").attr('disabled', true);
break;
case 1://执行JavaScript
data = cceval(enFunc.MethodID + "()");
layer.alert(data);
break;
case 2://URL模式
var url = enFunc.MethodDoc_Url;
if (url.indexOf('?') == -1)
url += "?1=1";
url += "&FrmID=" + frmID + "&WorkID=" + workid;
//执行url返回数据.
var data = DBAccess.RunUrlReturnString(url);
if (enFunc.MsgSuccess == "")
enFunc.MsgSuccess = "执行成功.";
if (enFunc.MsgErr == "")
enFunc.MsgErr = "执行失败.";
if (data.indexOf('err@') != -1) {
layer.alert(enFunc.MsgErr + "#" + data);
return;
}
data = data == null || data == "" ? enFunc.MsgSuccess : data;
layer.alert(data);
break;
case 3://内置方法模式.
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("MyPK", mypk);
handler.AddPara("FrmID", frmID);
handler.AddPara("WorkID", workid);
data = handler.DoMethodReturnString("DoMethod_ExecFunc"); //执行SQLs
layer.alert(data);
if (data.indexOf("err@") == -1)
$("#Btn_Done").attr('disabled', true);
break;
default:
layer.alert("还没有增加" + enFunc.MethodDocTypeOfFunc + "类型的判断");
break;
}
}
</script>
</head>
<body>
<fieldset>
<legend> 操作提示 </legend>
<div id="docs" class="cs-help">
</div>
<button type="button" id="Btn_Done" class="layui-btn layui-btn-sm layui-btn-normal" style="float: right; margin: 0px 30px 10px 0px; " onclick="Done()">执行</button>
</fieldset>
</body>
</html>