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.
381 lines
14 KiB
Plaintext
381 lines
14 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>相关功能</title>
|
|
<link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
|
|
<script src="../Scripts/jquery-1.7.2.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="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
|
|
<link href="../Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
|
|
<script src="Gener.js" type="text/javascript"></script>
|
|
<base target="_self" />
|
|
<script language="javascript" type="text/javascript" >
|
|
|
|
closeWhileEscUp();
|
|
|
|
//页面启动函数.
|
|
$(function () {
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
|
|
handler.AddUrlData();
|
|
var data = handler.DoMethodReturnString("Method_Init");
|
|
|
|
promptGener()
|
|
|
|
//如果错误,就提示.
|
|
if (data.indexOf('err@') == 0) {
|
|
alert(data);
|
|
return;
|
|
}
|
|
|
|
//转化成json.
|
|
data = JSON.parse(data);
|
|
method = data;
|
|
|
|
var html = "<fieldset>";
|
|
html += "<legend>" + data.Title + " </legend>";
|
|
html += "<font color=green>" + data.Help + " </font>";
|
|
html += "</fieldset>";
|
|
|
|
$("#CCForm").html(html);
|
|
document.getElementById("Btn_Done").value = data.Title;
|
|
return;
|
|
|
|
//带有参数的方法,没有翻译.
|
|
if (1 == 2) {
|
|
var rm = data["RM"][0];
|
|
warning = rm.Warning;
|
|
document.getElementById("Btn_Done").value = rm.Title;
|
|
GenerFoolFrm(data);
|
|
}
|
|
|
|
});
|
|
|
|
var method = null;
|
|
|
|
function GenerFoolFrmSimple(json) {
|
|
|
|
|
|
$('#CCForm').html('');
|
|
var html = "<table style='width:100%' >";
|
|
|
|
html += "<tr>";
|
|
html += "<td colspan=4 >ssss</td>";
|
|
// html += "<td colspan=2 ></td>";
|
|
html += "</tr>";
|
|
|
|
// html += InitMapAttr(attrs, json);
|
|
|
|
html += "</table>";
|
|
|
|
$('#CCForm').html(html);
|
|
|
|
}
|
|
|
|
var warning = "";
|
|
|
|
function GenerFoolFrm(json) {
|
|
|
|
var attrs = json["Sys_MapAttrs"];
|
|
|
|
$('#CCForm').html('');
|
|
var html = "<table style='width:100%' >";
|
|
|
|
html += "<tr>";
|
|
html += "<td colspan=4 ></td>";
|
|
// html += "<td colspan=2 ></td>";
|
|
html += "</tr>";
|
|
|
|
html += InitMapAttr(attrs, json);
|
|
|
|
html += "</table>";
|
|
|
|
$('#CCForm').html(html);
|
|
}
|
|
|
|
//解析表单字段 MapAttr.
|
|
function InitMapAttr(Sys_MapAttrs, frmData) {
|
|
|
|
var html = "";
|
|
var isDropTR = true;
|
|
for (var i = 0; i < Sys_MapAttrs.length; i++) {
|
|
|
|
var attr = Sys_MapAttrs[i];
|
|
|
|
var enable = attr.UIIsEnable == "1" ? "" : " ui-state-disabled";
|
|
var defval = attr.DefVal;
|
|
|
|
var lab = "";
|
|
if (attr.UIContralType == 0)
|
|
lab = "<label for='TB_" + attr.KeyOfEn + "' >" + attr.Name + "</label>";
|
|
|
|
if (attr.UIContralType == 1)
|
|
lab = "<label for='DDL_" + attr.KeyOfEn + "' >" + attr.Name + "</label>";
|
|
|
|
if (attr.UIIsInput == 1 && attr.UIIsEnable == 1) {
|
|
lab += " <span style='color:red' class='mustInput' data-keyofen='" + attr.KeyOfEn + "' >*</span>";
|
|
}
|
|
|
|
//线性展示并且colspan=3
|
|
if (attr.ColSpan == 3) {
|
|
isDropTR = true;
|
|
html += "<tr>";
|
|
html += "<td class='FoolFrmFieldCtrl' style='width:120px;'>" + lab + "</td>";
|
|
html += "<td ColSpan=3>";
|
|
html += InitMapAttrOfCtrlFool(frmData, attr);
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
continue;
|
|
}
|
|
|
|
//线性展示并且colspan=4
|
|
if (attr.ColSpan == 4) {
|
|
isDropTR = true;
|
|
html += "<tr>";
|
|
html += "<td ColSpan='4'>" + lab + "</br>";
|
|
html += InitMapAttrOfCtrlFool(frmData, attr);
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
continue;
|
|
}
|
|
|
|
if (isDropTR == true) {
|
|
html += "<tr>";
|
|
html += "<td class='FoolFrmFieldCtrl' style='width:120px;'>" + lab + "</td>";
|
|
html += "<td class='FContext' >";
|
|
html += InitMapAttrOfCtrlFool(frmData, attr);
|
|
html += "</td>";
|
|
isDropTR = !isDropTR;
|
|
continue;
|
|
}
|
|
|
|
if (isDropTR == false) {
|
|
html += "<td class='FoolFrmFieldCtrl' style='width:120px;'>" + lab + "</td>";
|
|
html += "<td class='FContext'>";
|
|
html += InitMapAttrOfCtrlFool(frmData, attr);
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
isDropTR = !isDropTR;
|
|
continue;
|
|
}
|
|
}
|
|
return html;
|
|
}
|
|
|
|
function InitMapAttrOfCtrlFool(frmData, mapAttr) {
|
|
|
|
var str = '';
|
|
var defValue = mapAttr.DefVal;
|
|
|
|
var isInOneRow = false; //是否占一整行
|
|
var islabelIsInEle = false; //
|
|
|
|
var eleHtml = '';
|
|
|
|
//添加文本框 ,日期控件等.
|
|
//AppString
|
|
if (mapAttr.MyDataType == "1") { //不是外键
|
|
|
|
if (mapAttr.UIBindKey != "") {
|
|
var data = frmData[mapAttr.UIBindKey];
|
|
//枚举类型.
|
|
if (mapAttr.UIIsEnable == 1)
|
|
enableAttr = "";
|
|
else
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
return "<select name='DDL_" + mapAttr.KeyOfEn + "' >" + InitDDLOperation(frmData, mapAttr, defValue) + "</select>";
|
|
}
|
|
|
|
if (mapAttr.UIHeight <= 40) //普通的文本框.
|
|
{
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable == 0)
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
return "<input maxlength=" + mapAttr.MaxLen + " name='TB_" + mapAttr.KeyOfEn + "' style='width:100%;height:23px;' type='text' " + enableAttr + " />";
|
|
}
|
|
|
|
|
|
//普通的大块文本.
|
|
return "<textarea maxlength=" + mapAttr.MaxLen + " style='height:" + mapAttr.UIHeight + "px;width:100%;' name='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable == 1 ? '' : ' disabled="disabled"') + " />"
|
|
}
|
|
|
|
//日期类型.
|
|
if (mapAttr.MyDataType == 6) {
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable == 1)
|
|
enableAttr = 'onfocus="WdatePicker({dateFmt:' + "'yyyy-MM-dd'})" + '";';
|
|
else
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
return "<input type='text' " + enableAttr + " style='width:120px;' name='TB_" + mapAttr.KeyOfEn + "' />";
|
|
}
|
|
|
|
//时期时间类型.
|
|
if (mapAttr.MyDataType == 7) {
|
|
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable == 1)
|
|
enableAttr = 'onfocus="WdatePicker({dateFmt:' + "'yyyy-MM-dd HH:mm'})" + '";';
|
|
else
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
return "<input type='text' style='width:140px;' " + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "' />";
|
|
}
|
|
|
|
// boolen 类型.
|
|
if (mapAttr.MyDataType == 4) { // AppBoolean = 7
|
|
|
|
if (mapAttr.UIIsEnable == 1)
|
|
enableAttr = "";
|
|
else
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
//CHECKBOX 默认值
|
|
var checkedStr = '';
|
|
if (checkedStr != "true" && checkedStr != '1') {
|
|
checkedStr = ' checked="checked" ';
|
|
}
|
|
|
|
// checkedStr = ConvertDefVal(frmData, '', mapAttr.KeyOfEn);
|
|
|
|
return "<input " + enableAttr + " " + (defValue == 1 ? "checked='checked'" : "") + " type='checkbox' id='CB_" + mapAttr.KeyOfEn + "' name='CB_" + mapAttr.KeyOfEn + "' " + checkedStr + " /><label for='CB_" + mapAttr.KeyOfEn + "' >" + mapAttr.Name + "</label>";
|
|
}
|
|
|
|
//枚举类型.
|
|
if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) { //AppInt Enum
|
|
if (mapAttr.UIIsEnable == 1)
|
|
enableAttr = "";
|
|
else
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
return "<select name='DDL_" + mapAttr.KeyOfEn + "' " + (mapAttr.UIIsEnable == 1 ? '' : 'disabled="disabled"') + ">" + InitDDLOperation(frmData, mapAttr, defValue) + "</select>";
|
|
}
|
|
|
|
// AppDouble AppFloat
|
|
if (mapAttr.MyDataType == 5 || mapAttr.MyDataType == 3) {
|
|
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable != 1)
|
|
enableAttr = "disabled='disabled'";
|
|
|
|
// alert(mapAttr.KeyOfEn);
|
|
return "<input style='text-align:right;width:80px;' onkeyup=" + '"' + "if(isNaN(value)) execCommand('undo')" + '"' + " onafterpaste=" + '"' + "if(isNaN(value))execCommand('undo')" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "'/>";
|
|
}
|
|
|
|
if ((mapAttr.MyDataType == 2)) { //AppInt
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable != 1) {
|
|
enableAttr = "disabled='disabled'";
|
|
}
|
|
|
|
return "<input style='text-align:right;width:80px;' onkeyup=" + '"' + "if(isNaN(value) || (value%1 !== 0))execCommand('undo')" + '"' + " onafterpaste=" + '"' + "if(isNaN(value) || (value%1 !== 0))execCommand('undo')" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "'/>";
|
|
}
|
|
|
|
//AppMoney AppRate
|
|
if (mapAttr.MyDataType == 8) {
|
|
var enableAttr = '';
|
|
if (mapAttr.UIIsEnable == 1) {
|
|
|
|
} else {
|
|
enableAttr = "disabled='disabled'";
|
|
}
|
|
return "<input style='text-align:right;width:80px;' onkeyup=" + '"' + "if(isNaN(value))execCommand('undo')" + '"' + " onafterpaste=" + '"' + "if(isNaN(value))execCommand('undo')" + '"' + " maxlength=" + mapAttr.MaxLen / 2 + " type='text'" + enableAttr + " name='TB_" + mapAttr.KeyOfEn + "'/>";
|
|
}
|
|
|
|
alert(mapAttr.Name + "的类型没有判断.");
|
|
return;
|
|
}
|
|
|
|
|
|
//初始化下拉列表框的OPERATION
|
|
function InitDDLOperation(frmData, mapAttr, defVal) {
|
|
|
|
var operations = '';
|
|
//外键类型
|
|
if (mapAttr.LGType == 2) {
|
|
if (frmData[mapAttr.KeyOfEn] != undefined) {
|
|
$.each(frmData[mapAttr.KeyOfEn], function (i, obj) {
|
|
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
|
|
});
|
|
}
|
|
else if (frmData[mapAttr.UIBindKey] != undefined) {
|
|
$.each(frmData[mapAttr.UIBindKey], function (i, obj) {
|
|
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
|
|
});
|
|
}
|
|
} else {
|
|
var enums = frmData.Sys_Enum;
|
|
enums = $.grep(enums, function (value) {
|
|
return value.EnumKey == mapAttr.UIBindKey;
|
|
});
|
|
|
|
|
|
$.each(enums, function (i, obj) {
|
|
operations += "<option " + (obj.IntKey == defVal ? " selected='selected' " : "") + " value='" + obj.IntKey + "'>" + obj.Lab + "</option>";
|
|
});
|
|
|
|
}
|
|
return operations;
|
|
}
|
|
|
|
function CloseIt() {
|
|
//window.close();
|
|
//return;
|
|
if (parent && typeof parent.doCloseDialog === 'function') {
|
|
parent.doCloseDialog.call();
|
|
} else {
|
|
window.close();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<form id="cc">
|
|
<div id="CCForm">
|
|
</div>
|
|
|
|
<center>
|
|
<input type="button" id="Btn_Done" name="Btn_Done" value="执行" onclick="Done()" />
|
|
<input type="button" id="Btn_Close" name="Btn_Close" value="关闭" onclick="CloseIt()" />
|
|
</center>
|
|
|
|
<div id="Msg"></div>
|
|
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function Done() {
|
|
|
|
if (method.Warning != "") {
|
|
|
|
if (confirm(method.Warning) == false)
|
|
return;
|
|
|
|
} else {
|
|
if (confirm('您确定要执行吗?') == false)
|
|
return;
|
|
}
|
|
|
|
document.getElementById("Btn_Done").disabled=true;
|
|
|
|
//初始化数据.
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Comm");
|
|
handler.AddPara("M", GetQueryString("M"));
|
|
handler.AddPara("inlayer", GetQueryString("inlayer"));
|
|
var data = handler.DoMethodReturnString("Method_Done");
|
|
$('#CCForm').html(data);
|
|
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|