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.

326 lines
11 KiB
Plaintext

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>功能执行</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<!-- 引入mui -->
<script src="../js/jquery.js" type="text/javascript"></script>
<script src="../js/mui/js/mui.min.js" type="text/javascript"></script>
<link href="../js/mui/css/mui.css" rel="stylesheet" type="text/css" />
<link href="../js/mui/css/mui.picker.min.css" rel="stylesheet" type="text/css" />
<link href="../js/mui/css/mui.dtpicker.css" rel="stylesheet" />
<script src="../js/mui/js/mui.dtpicker.js" type="text/javascript"></script>
<script src="../js/mui/js/mui.picker.min.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="./JScript.js" type="text/javascript"></script>
<script src="../Scripts/commonYangYH.js" type="text/javascript"></script>
<script src="../MapAttr.js" type="text/javascript"></script>
<style type="text/css">
.ccformdate{
float:left !important;
}
</style>
<script type="text/javascript">
//页面启动函数.
$(function () {
InitPage();
});
//初始化数据.
function InitPage() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
handler.AddPara("Index", GetQueryString("Index"));
handler.AddPara("PKVal", GetPKVal());
handler.AddPara("PK", GetPKVal());
handler.AddPara("EnsName", GetQueryString("EnsName"));
var data = handler.DoMethodReturnString("Refmethod_Init");
//如果错误,就提示.
if (data.indexOf('err@') == 0) {
mui.alert(data);
$('#content').html(data);
return;
}
//转到Url..
if (data.indexOf('url@') == 0) {
data = data.replace('url@', '');
window.location.href = filterXSS(data);
return;
}
//弹出信息并关闭.
if (data == "close@info") {
$(".mui-action-back").clcik();
return;
}
//关闭.
if (data.indexOf('close@') == 0) {
//alert(data);
$('#content').html('');
data = data.replace('close@', '');
var title = GetQueryString("title")
if (title == "轨迹") {
window.location.href = filterXSS(data);
return;
}
var html = "<fieldset>";
html += "<legend> 执行信息</legend>";
html += data;
html += "</fieldset>";
$('#content').html(html);
$("#Btn_Done").hide();
$(".mui-action-back").clcik();
return;
}
//提示信息.
if (data.indexOf('info@')!=-1) {
data = data.replace('info@', '');
mui.alert(data);
return;
}
if (data.indexOf('url@') != -1) {
data = data.replace('url@', '');
SetHref(data);
return;
}
//转化成json.
data = JSON.parse(data);
var rm = data["RM"][0];
warning = rm.Warning;
$("#Btn_Done").html(rm.Title);
GenerFoolFrm(data, rm);
//日期控件
mui(".mui-input-row").off("tap").on("tap", ".ccformdate", function () {
var dDate = new Date();
var _self = this;
var optionsJson = this.getAttribute('data-options') || '{}';
var ctrID = this.getAttribute('id');
var options = JSON.parse(optionsJson);
_self.picker = new mui.DtPicker(options);
_self.picker.show(function (rs) {
var timestr = rs.text;
$("#" + ctrID).html(timestr);
$("#TB_" + ctrID.substr(4)).val(timestr);
_self.picker.dispose();
_self.picker = null;
});
});
mui(".mui-switch").switch();
//监听开关事件
var SW = $('.mui-switch');
$.each(SW, function (i, obj) {
var KeyOfEn = $(obj).attr("id");
document.getElementById(KeyOfEn).addEventListener("toggle", function (event) {
KeyOfEn = KeyOfEn.substring(3);
if (event.detail.isActive) {
$("#CB_" + KeyOfEn).val("1");
} else {
$("#CB_" + KeyOfEn).val("0");
}
})
})
}
var warning = "";
function GenerFoolFrm(json, rm) {
var attrs = json["Sys_MapAttrs"];
$('#CCForm').html('');
var pkval = GetQueryString("PKVal");
var pks = [];
if (pkval != null && pkval != "")
pks = pkval.split(',');
//循环显示数据
var html = InitDtlMapAttr(attrs, 0, json, false, "refmethod");
$('#CCForm').html(html);
//为控件赋值.
for (var i = 0; i < attrs.length; i++) {
var mapAttr = attrs[i];
$('#TB_' + mapAttr.KeyOfEn).attr("name", "TB_" + mapAttr.KeyOfEn);
$('#DDL_' + mapAttr.KeyOfEn).attr("name", "DDL_" + mapAttr.KeyOfEn);
$('#CB_' + mapAttr.KeyOfEn).attr("name", "CB_" + mapAttr.KeyOfEn);
//if (mapAttr.DefVal.indexOf("@") != -1)
// continue;
var val = ConvertDefVal(json["MainTable"][0], mapAttr.DefVal, mapAttr.KeyOfEn);
$('#TB_' + mapAttr.KeyOfEn).val(val);
if ($("#LAB_" + mapAttr.KeyOfEn).length == 1)
$("#LAB_" + mapAttr.KeyOfEn).html(val);
//文本框.
if (mapAttr.UIContralType == 0) {
if (mapAttr.AtPara && mapAttr.AtPara.indexOf("@IsRichText=1") >= 0) {
$('#editor').val(val);
} else {
$('#TB_' + mapAttr.KeyOfEn).val(val);
}
}
//枚举下拉框.
if (mapAttr.UIContralType == 1) {
$('#DDL_' + mapAttr.KeyOfEn).val(val);
}
//checkbox.
if ($('#CB_' + mapAttr.KeyOfEn).length == 1) {
if (defValue == "1") {
$('#CB_' + mapAttr.KeyOfEn).attr("checked", true);
//判断是否存在mui-active这个类
if ($("#SW_" + mapAttr.KeyOfEn).hasClass("mui-active") == false)
$("#SW_" + mapAttr.KeyOfEn).addClass("mui-active");
} else {
$('#CB_' + mapAttr.KeyOfEn).attr("checked", false);
//判断是否存在mui-active这个类
if ($("#SW_" + mapAttr.KeyOfEn).hasClass("mui-active") == true)
$("#SW_" + mapAttr.KeyOfEn).removeClass("mui-active");
}
}
}
}
//填充默认数据
function ConvertDefVal(MainTable, defVal, keyOfEn) {
//计算URL传过来的表单参数@TXB_Title=事件测试
var pageParams = getQueryString();
var pageParamObj = {};
$.each(pageParams, function (i, pageParam) {
if (pageParam.indexOf('@') == 0) {
var pageParamArr = pageParam.split('=');
pageParamObj[pageParamArr[0].substring(1, pageParamArr[0].length)] = pageParamArr[1];
}
});
var result = defVal;
//通过MAINTABLE返回的参数
for (var ele in MainTable) {
if (keyOfEn == ele) {
result = MainTable[ele];
break;
}
}
return result = unescape(result);
}
function Done() {
if (warning != "" && warning != null) {
if (confirm(warning) == false)
return;
}
$("#Btn_Done").attr("disabled", "disabled");
$("#Btn_Done").val("正在执行....");
var frmData = $("#cc").serialize();
frmData = frmData.replace('=on', '=1');
var pk = GetQueryString("No");
if (pk == null || pk == undefined)
pk = GetQueryString("MyPK");
if (pk == null || pk == undefined)
pk = GetQueryString("OID");
if (pk == null || pk == undefined)
pk = GetQueryString("PK");
if (pk == null || pk == undefined)
pk = GetQueryString("WorkID");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
handler.AddUrlData();
handler.AddFormData();
var data = handler.DoMethodReturnString("Refmethod_Done");
//如果错误,就提示.
if (data.indexOf('err@') == 0) {
$("#content").html(data);
return;
}
//转到Url..
if (data.indexOf('url@') == 0) {
data = data.replace('url@', '');
window.location.href = filterXSS(data);
return;
}
//关闭.
if (data == "close@info") {
window.close();
return;
}
//提示信息.
if (data == "info@") {
data = data.replace('info@', '');
$("#content").html(data);
return;
}
mui.alert(data);
document.getElementById("Btn_Done").disabled = true;
}
</script>
<style>
.mui-bar-tab .mui-tab-item {
color: #000;
}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 id="title" class="mui-title">功能执行</h1>
</header>
<div class="mui-content" style="margin-top: 15px;">
<form id="cc" class="mui-input-group">
<div id="CCForm"></div>
<div id="content"></div>
<div style="right:30px; position:absolute; z-index:100;margin-top:10px ">
<button type="button" class="mui-btn mui-btn-primary" id="Btn_Done" name="Btn_Done" onclick="Done()">执行</button>
</div>
</form>
</div>
</body>
</html>