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.

143 lines
5.3 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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 mypk = GetQueryString("No");//方法的主键
var frmID = GetQueryString("FrmID");
var workid = GetQueryString("WorkID");
var workids = GetQueryString("WorkIDs");
var fromPage = GetQueryString("From");
fromPage = fromPage == null || fromPage == undefined ? "" : fromPage;
var methodFunc = null;
var isHaveParas = false; //执行的方法是否含有参数
var attrs = null; //参数字段集合
$(function () {
attrs = new Entities("BP.Sys.MapAttrs");
attrs.Retrieve("FK_MapData", mypk);
isHaveParas = attrs.length > 0 ? true : false;
if (isHaveParas == true) {
SetHref(GetHrefUrl().replace("DoMethod.htm", "DoMethodPara.htm"));
return;
}
//初始化页面
methodFunc = new Entity("BP.CCBill.Template.MethodFunc", mypk);
$("#Btn_Done").html("执行:" + methodFunc.Name);
//方法描述.
if (methodFunc.Mark === "" || methodFunc.Mark.length == 0)
methodFunc.Mark = "操作说明未设置...";
$("#docs").html(methodFunc.Mark);
});
/**
* 开始执行操作
*/
function Done() {
var altMsg = methodFunc.WarningMsg;
if (altMsg == "")
altMsg = "您确定要执行吗?";
layer.confirm("您确定要执行吗?", function (index) {
layer.close(index);
//如果是JS执行先加载js
if (methodFunc.MethodDocTypeOfFunc == 1) {
//加载执行方法的js
Skip.addJs('../../../DataUser/JSLibData/Method/' + mypk + '.js', document.head);
doMethod();
return;
}
doMethod();
if (fromPage == "Search") {
//执行完方法后关闭页面
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭
}
})
}
/**
* 执行方法
*/
function doMethod() {
$("#Msg").html("正在执行方法,请稍后......");
var data = "";
switch (methodFunc.MethodDocTypeOfFunc) {
case 0://执行SQL
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
handler.AddPara("MyPK", mypk);
handler.AddPara("FrmID", frmID);
handler.AddPara("WorkID", workid);
handler.AddPara("WorkIDs", workids);
data = handler.DoMethodReturnString("DoMethod_ExeSQL"); //执行SQLs
layer.alert(data);
if (data.indexOf("err@") == -1)
$("#Btn_Done").attr('disabled', true);
break;
case 1://执行JavaScript
Skip.addJs('../../../DataUser/JSLibData/Method/' + mypk + '.js');
DBAccess.RunFunctionReturnStr(methodFunc.MethodID);
break;
case 2://URL模式
// debugger
var url = methodFunc.Tag1;
if (url.indexOf('?') == -1)
url += "?1=1";
url += "&MethodName=" + methodFunc.MethodID + "&FrmID=" + frmID + "&WorkID=" + workid+"&WorkIDs="+workids;
//执行url返回数据.
var data = DBAccess.RunUrlReturnString(url);
layer.alert(data);
break;
default:
layer.alert("还没有增加" + methodFunc.MethodDocTypeOfFunc + "类型的判断");
break;
}
}
</script>
</head>
<body>
<fieldset>
<legend> 操作提示 </legend>
<div id="docs" class="cs-help">
</div>
<br />
<center>
<button type="button" id="Btn_Done" class="layui-btn layui-btn-sm layui-btn-normal" style="float: center; margin: 0px 30px 10px 0px; "
onclick="doMethod()">
执行
</button>
</center>
</fieldset>
</body>
</html>