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.

392 lines
15 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>
<title>创建表单</title>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/jquery.min.js"></script>
<script src="../../WF/Scripts/QueryString.js" type="text/javascript"></script>
<link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../../WF/Scripts/config.js"></script>
<script type="text/javascript" src="../../WF/Comm/Gener.js"></script>
<script type="text/javascript" language="javascript">
var entityType = 0;
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
var frmType = GetQueryString("FrmType");
if (frmType == null || frmType == "")
frmType = 0;
//{
// alert("FrmType参数没有传递过来.");
// return;
//}
//实体类型.
entityType = GetQueryString("EntityType");
if (entityType == null || entityType == undefined)
entityType = 0;
//创建表单类型.
if (entityType == 0) {
// GenerBindEnumKey("DDL_FrmType", "FrmType", frmType);
}
if (entityType == 1 || entityType == 2) {
var select = $('#DDL_FrmType');
select.length = 0;
// while (select.childNodes.length) {
// select.removeChild(select.childNodes[0]);
// }
//先创建好select里面的option元素
var option = document.createElement("option");
$(option).val('0');
$(option).text('傻瓜表单');
$('#DDL_FrmType').append(option);
var option1 = document.createElement("option");
$(option1).val('1');
$(option1).text('自由表单');
$('#DDL_FrmType').append(option1);
var option2 = document.createElement("option");
$(option2).val('8');
$(option2).text('开发者表单');
$('#DDL_FrmType').append(option2);
//$("#DDL_FrmType").it;
}
var caption = "";
var caption = document.getElementById('Table').createCaption();
if (entityType == 1) {
caption.innerHTML = "创建单据: 比如:请假单、出库单、入库单、带有流水性质的数据.";
}
if (entityType == 2) {
caption.innerHTML = "创建实体台账: 比如:学生台账、供应商、销售网点等,具有编号名称类型的数据.";
}
// http://localhost:2207/WF/Admin/CCFormDesigner/NewFrmGuide.htm?Step=0&EntityType=2&FK_FrmSort=1133
//创建数据源.
// GenerBindEntities("DDL_DBSrc", "BP.Sys.SFDBSrcs", "local");
// var sort = GetQueryString("FK_FrmSort");
// $("#HD_FK_FormTree").val(sort);
//创建表单树.
// GenerBindEntities("DDL_FrmTree", "BP.WF.Template.SysFormTrees", sort);
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_CCFormDesigner");
var data = handler.DoMethodReturnString("NewFrmGuide_Init");
$("#Msg").html("");
if (data.indexOf('err@') >= 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
data = JSON.parse(data);
var tables = data["Tables"];
GenerBindDDL("DDL_PTable", tables, "No", "Name", null);
return;
});
function FrmTypeChange() {
var frmType = $("#DDL_FrmType").val();
$("#DDL_PTableModel").show();
$("#Idx_6").show();
$("#Idx_8").show();
$("#idx_td_7").html("7");
$("#OtherTd").html("9");
document.getElementById("PTableName").innerHTML = "存储表";
document.getElementById("PTableDesc").innerHTML = "数据要存储到那个表里?<br>默认与表单编号一致,指定的表名,必须是下划线或者字母开头,不能包含特殊字符,否则创建表失败。";
if (frmType == "7") {
document.getElementById("PTableName").innerHTML = "请输入实体类名";
document.getElementById("PTableDesc").innerHTML = "该实体必须是以BP.开头的并且从实体BP.En.Entities上继承下来的. <br>比如:BP.Demo.Resumes";
$("#Idx_6").hide();
$("#Idx_8").hide();
$("#idx_td_7").html("6");
$("#OtherTd").html("7");
}
if (frmType == "3") {
document.getElementById("PTableName").innerHTML = "请输入URL";
document.getElementById("PTableDesc").innerHTML = "请输入嵌入式表单的URL.";
$("#Idx_6").hide();
$("#Idx_8").hide();
$("#idx_td_7").html("6");
$("#OtherTd").html("7");
//隐藏TR
}
}
//选择一个表.
function DDL_PTable_Change(ddl) {
var aa = document.getElementById(ddl);
document.getElementById("TB_PTable").value = aa.value;
}
</script>
</head>
<body>
<form id="cc">
<table style="width: 95%;" id="Table">
<caption>
创建独立表单
</caption>
<tr>
<td class="Idx">
1
</td>
<td>
创建的表单类型
</td>
<td>
<select name="DDL_FrmType" id="DDL_FrmType" onchange="FrmTypeChange()">
<option value=null disabled='disabled'>+内置表单</option>
<option value=0>&nbsp;&nbsp;傻瓜表单</option>
<option value=1 disabled='disabled'>&nbsp;&nbsp;自由表单</option>
<option value=3 disabled='disabled'>&nbsp;&nbsp;嵌入式表单</option>
<option value=4 disabled='disabled'>&nbsp;&nbsp;Word表单</option>
<option value=5 disabled='disabled'>&nbsp;&nbsp;在线编辑模式Excel表单</option>
<option value=6 disabled='disabled'>&nbsp;&nbsp;VSTO模式Excel表单</option>
<option value=7 disabled='disabled'>&nbsp;&nbsp;实体类组件</option>
<option value=8>&nbsp;&nbsp;开发者表单</option>
</select>
</td>
<td>
根据自己的业务场景需要选择相应的表单类型.
</td>
</tr>
</tr>-->
<tr>
<td class="Idx">
4
</td>
<td>
表单名称
</td>
<td>
<input type="text" id="TB_Name" name="TB_Name" onblur="GenerPinYin()" style="width: 100%;" />
</td>
<td>
表单的名称,允许重复,允许多个表单映射到一张表上。
</td>
</tr>
<tr>
<td class="Idx">
5
</td>
<td>
表单编号(必须是字母或者下划线组合)
</td>
<td>
<input type="text" id="TB_No" name="TB_No" style="width: 100%;" />
<input type="text" id="TB_No_Org" name="TB_No_Org" style="width: 100%;" hidden=hidden />
</td>
<td>
<input id="RB_ZZMM_0" type="radio" name="RB_ZZMM" value="0" checked="true" onclick="GenerPinYin()" /><label for="RB_ZZMM_0" onclick="GenerPinYin()">全拼</label>
<input id="RB_ZZMM_1" type="radio" name="RB_ZZMM" value="1" onclick="GenerPinYin()" /><label for="RB_ZZMM_1" onclick="GenerPinYin()">简拼</label>
</td>
</tr>
<tr id="Idx_7">
<td class="Idx" id="idx_td_7">
7
</td>
<td>
<div id="PTableName">
自定义存储表
</div>
</td>
<td>
<input type="text" id="TB_PTable" name="TB_PTable" style="width: 100%;" />
<input type="text" id="TB_PTable_Org" name="TB_PTable_Org" style="width: 100%;" hidden=hidden />
</td>
<td>
<div id="PTableDesc">
数据要存储到那个表里?
</div>
</td>
</tr>
<tr>
<td class="Idx" id="OtherTd">
9
</td>
<td></td>
<td colspan="2">
<input type="button" value="创建 - Create" onclick="Save()" id="Btn_Save" />
<script type="text/javascript">
function GenerPinYin() {
//是否是全拼.
var isQuanPin = 0;
if (document.getElementById("RB_ZZMM_0").checked == true)
isQuanPin = 1;
// var name = $('#TB_Nam').val();
var name = document.getElementById("TB_Name").value;
if (name == "")
return;
var handler = new HttpHandler("BP.WF.HttpHandler.Admin_CCFormDesigner");
handler.AddPara("IsQuanPin", isQuanPin);
handler.AddPara("EntityType", entityType);
handler.AddPara("TB_Name", encodeURIComponent(name));
var data = handler.DoMethodReturnString("NewFrmGuide_GenerPinYin");
$("#Msg").html("");
if (data.indexOf('err@') >= 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
var webUser = new WebUser();
var keyOrg = webUser.FK_Dept + "_CCFrm_" + data;
var key = "CCFrm_" + data;
var frmType = $("#DDL_FrmType").val();
if (frmType != "3" && frmType != "7") {
if (entityType == 0)
key = "Frm_" + data;
keyOrg = webUser.FK_Dept + "_Frm_" + data;
if (entityType == 1)
key = "Bill_" + data;
keyOrg = webUser.FK_Dept + "_Bill_" + data;
if (entityType == 2)
key = "Dict_" + data;
keyOrg = webUser.FK_Dept + "_Dict_" + data;
}
$('#TB_No').val(key);
$('#TB_PTable').val(key);
$('#TB_No_Org').val(keyOrg);
$('#TB_PTable_Org').val(keyOrg);
return;
}
function Save() {
$("#Msg").html("正在创建,请稍后......");
var name = document.getElementById("TB_Name").value;
var no = document.getElementById("TB_No").value;
var noOrg = document.getElementById("TB_No_Org").value;
var pTable = document.getElementById("TB_PTable").value;
if (name == "" || no == "" || pTable == "") {
$("#Msg").html("");
alert('@请输入必填的字段.');
return;
}
var handler = new HttpHandler("BP.Cloud.HttpHandler.Admin_CCFormDesigner");
handler.AddFormData();
handler.AddUrlData();
var data = handler.DoMethodReturnString("NewFrmGuide_Create");
if (data.indexOf('err@') >= 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
$("#Msg").html("<font color=green>" + data + "</font>");
data = data.replace('url@', '');
try {
//表单库增加表单节点
if (typeof window.parent.AppendFrmToFormTree != "undefined") {
// var sort = $("#HD_FK_FormTree").val();
var sort = GetQueryString("FK_FrmSort"); // $("#HD_FK_FormTree").val();
window.parent.AppendFrmToFormTree(sort, noOrg, name);
}
if (typeof window.parent.TabCloseByTitle != "undefined") {
//需要延时关闭,不可立即关闭。
setTimeout("window.parent.TabCloseByTitle('新建表单')", 1000);
}
} catch (e) {
}
//切换页面
SetHref(data);
// SetHref(data);
return;
}
</script>
</td>
</tr>
</table>
<div id="Msg">
</div>
<input type="hidden" id="HD_FK_FormTree" name="HD_FK_FormTree" />
<!--
<fieldset>
<legend> 帮助</legend>
1. 如果普通类型的字段:身高(float),年龄(int),地址(string),电话(string),就不用配置。
2. 金额类型 费用@DType=Money
3, 枚举类型. 性别@0=女@1=男
4, 外键类型. 岗位@Table=Port_Station@No=BianHao@Name=MingCheng
5, Boolen. 是否符合要求@DType=Boolen
6. 日期类型: 出生日期@DType=Date 2017-11-12
7. 日期时间类型: 发生时间@DType=DateTime 2017-11-12 12:01
4, 外键扩展类型. 人员$SELECT No,Name from mytable where xxx='@WebUser.FK_Dept' and myfiel='@MainTableField'
自由表单的数据存储格式:
<br />
枚举值:
性别@XB;@0=女@1=男
<br />
外键:
岗位@Table=Port_Station@No=BianHao@Name=MingCheng
<br />
日期:
出生日期@DType=Date
<br />
日期时间:
发生时间@DType=DateTime
<br />
金额:
费用@DType=Money
<br />
Boolen类型:
是否符合要求@DType=Boolen
</fieldset>-->
</form>
</body>
</html>