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.

368 lines
18 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>
<title></title>
<link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" />
<link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" />
<script src="../../Scripts/easyUI145/jquery.min.js"></script>
<script src="../../Scripts/easyUI145/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("table tr:gt(0)").hover(
function () { $(this).addClass("tr_hover"); },
function () { $(this).removeClass("tr_hover"); });
});
//上移,暂时不用
function up(obj, idxTBColumnIdx) {
var objParentTR = $(obj).parent().parent();
var prevTR = objParentTR.prev();
var currTrId;
var prevTrId;
if (prevTR.length > 0 && !isNaN(prevTR.children(":eq(0)").text())) {
prevTR.insertAfter(objParentTR);
currTrId = Number(objParentTR.children(":eq(0)").text());
prevTrId = Number(prevTR.children(":eq(0)").text());
objParentTR.children(":eq(0)").text(prevTrId);
prevTR.children(":eq(0)").text(currTrId);
objParentTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(prevTrId);
prevTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(currTrId);
} else {
return;
}
}
//下移,暂时不用
function down(obj, idxTBColumnIdx) {
var objParentTR = $(obj).parent().parent();
var nextTR = objParentTR.next();
var currTrId;
var nextTrId;
if (nextTR.length > 0 && !isNaN(nextTR.children(":eq(0)").text())) {
nextTR.insertBefore(objParentTR);
currTrId = Number(objParentTR.children(":eq(0)").text());
nextTrId = Number(nextTR.children(":eq(0)").text());
objParentTR.children(":eq(0)").text(nextTrId);
nextTR.children(":eq(0)").text(currTrId);
objParentTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(nextTrId);
nextTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(currTrId);
} else {
return;
}
}
</script>
<script language="javascript" type="text/javascript">
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitPage();
$("#Msg").html("");
});
var fk_MapData = GetQueryString("FK_MapData");
var idx = 0;
function InitPage() {
var mapAttrs = new Entities("BP.Sys.MapAttrs");
mapAttrs.Retrieve("FK_MapData", fk_MapData, "Idx");
////输出列.
for (var i = 0; i < mapAttrs.length; i++) {
var attr = mapAttrs[i];
if (attr.KeyOfEn == "Title" || attr.KeyOfEn == "OID" || attr.KeyOfEn == "RDT" || attr.KeyOfEn == "FID"
|| attr.KeyOfEn == "CDT" || attr.KeyOfEn == "Rec" || attr.KeyOfEn == "Emps" || attr.KeyOfEn == "FK_Dept" || attr.KeyOfEn == "BillNo"
|| attr.KeyOfEn == "FK_NY" || attr.KeyOfEn == "MyNum"|| attr.KeyOfEn == "AtPara"|| attr.KeyOfEn == "BillState"|| attr.KeyOfEn == "Starter"|| attr.KeyOfEn == "StarterName") {
continue;
}
idx++;
var str = "<tr>";
str += TrRow(attr, idx);
str += "</tr>";
$("table").append(str);
//给select框赋值
$("#TB_MyDataType_" + (idx + 1)).val(attr.MyDataType);
$("#TB_UIIsEnable_" + (idx + 1)).val(attr.UIIsEnable);
$("#TB_UIVisible_" + (idx + 1) ).val(attr.UIVisible);
$("#TB_UIIsInput_" + (idx + 1)).val(attr.UIIsInput);
if (attr.UIIsEnable == 0) {
$("#TB_UIIsEnable_" + (idx + 1)).prop("checked", "true");
}
if (attr.UIVisible == 1) {
$("#TB_UIVisible_" + (idx + 1)).prop("checked", "true");
}
if (attr.UIIsInput == 1) {
$("#TB_UIIsInput_" + (idx + 1)).prop("checked", "true");
}
}
}
function TrRow(attr,idx) {
var str = "";
str += "<td style='text-align:center'>" + idx + "</td>";
str += "<td style='display:none'><input type='hidden' value='" + attr.MyPK + "'></input></td>";
//判断是否string
if (attr.MyDataType == 1 || attr.MyDataType == '1') {
str += "<td><a href='javascript:void(0)' onclick=setWidth('" + attr.MyPK + "')>" + attr.KeyOfEn + "</a><input type='hidden' value='" + attr.KeyOfEn + "'/></td>";
} else {
str += "<td>" + attr.KeyOfEn + "<input type='hidden' value='" + attr.KeyOfEn + "'></input></td>";
}
str += "<td ><input name=\"TB_" + attr.KeyOfEn + "\" type=\"text\" value=\"" + attr.Name + "\" id=\"TB_" + attr.KeyOfEn + "\" style='width:100px;' /></td>";
str += "<td ><select disabled='true' id=\"TB_MyDataType_" + (idx + 1) + "\" style='width:80px;'><option value ='1'>字符型</option><option value ='2'>整数型</option><option value ='3'>浮点型</option><option value ='4'>Boolean型(是/否)</option>";
str += "<option value = '5'>双精度型</option><option value='6'>日期型</option><option value='7'>日期时间型</option> <option value='8'>金额型</option></select ></td > ";
if (attr.MyDataType == '1') {
str += "<td ><input name=\"TB_" + attr.KeyOfEn + "\" type=\"text\" value=\"" + attr.MaxLen + "\" id=\"TB_" + attr.KeyOfEn + "\" style='width:60px;' /></td>";
} else {
str += "<td ><input disabled='true' name=\"TB_" + attr.KeyOfEn + "\" type=\"text\" value=\"\" id=\"TB_" + attr.KeyOfEn + "\" style='width:60px;' /></td>";
}
str += "<td><input onclick='checkclick(this," + idx + ");' class='UIIsEnable' id='TB_UIIsEnable_" + (idx + 1) + "' type='checkbox' />只读</td>";
str += "<td><input onclick='checkclick(this," + idx + ");' class='UIVisible' id='TB_UIVisible_" + (idx + 1) + "' type='checkbox' />可见</td>";
str += "<td><input onclick='checkclick(this," + idx + ");' class='UIIsInput' id='TB_UIIsInput_" + (idx + 1) + "' type='checkbox' />必填</td>";
str += "<td ><input name=\"TB_" + attr.KeyOfEn + "_Idx\" type=\"text\" value=\"" + attr.Idx + "\" id=\"TB_" + attr.KeyOfEn + "_Idx\" style='width:30px;' /></td>";
str += "<td><a class='easyui-linkbutton' data-options='iconCls:&#39;icon-delete&#39;' href=\"javascript:Delete('" + attr.MyPK + "');\" >删除</a>";
str += "<a style='padding-left:10px' class='easyui-linkbutton' data-options='iconCls:&#39;icon-delete&#39;' href=\"javascript:ReField('" + attr.MyPK + "','" + attr.KeyOfEn + "','" + attr.Name + "'," + idx + ");\" >重命名</a></td>";
return str;
}
function ReField(mypk,keyOfEn,name,idx,) {
if (window.confirm('您确定重新命名改字段吗?') == false)
return;
var newKeyOfEn = promptGener("请输入新的字段英文名称", keyOfEn);
if (newKeyOfEn.trim() == "" || newKeyOfEn == keyOfEn) {
alert("新字段名称不能为空或者未发生变化");
return;
}
var newName = promptGener("请输入新的字段中文名称", name);
if (newName.trim() == "")
newName = name;
var fk_mapData = GetQueryString("FK_MapData");
var mapFool = new Entity("BP.WF.Template.Frm.MapFrmFool", fk_mapData);
var data = mapFool.DoMethodReturnString("DoChangeFieldName",keyOfEn, newKeyOfEn, newName);
if (data.indexOf("err@") != -1) {
alert(data);
return;
}
var tr = $("#table1").find("tr").eq(idx);
//重新设置改行信息
var attr = new Entity("BP.Sys.MapAttr", fk_mapData + "_" + newKeyOfEn);
tr.html("").append(TrRow(attr, idx));
}
//已经存表的删除
function Delete(mypk) {
if (window.confirm('您确定要删除吗?') == false)
return;
var attr = new Entity("BP.Sys.MapAttr");
attr.SetPKVal(mypk);
attr.Delete();
Reload();
}
//还没存表的删除
function Remove(obj) {
if (window.confirm('您确定要删除吗?') == false)
return;
$(obj).parent().parent().remove();
}
//function upischange(index) {
// fieldsData[index].IsChange = true;
//}
//绑定是否全选或者取消全选
function checkclick(o, index) {
//upischange(index);
var ischeckedall = true;
var rowstype = o.classList;
$('.' + rowstype).each(function () {
if (this.type == 'checkbox' && !this.checked) {
ischeckedall = false;
return ischeckedall;
}
});
if (ischeckedall)
$('#KeyOfEn_' + rowstype + "_" + index)[0].checked = true;
else
$('#KeyOfEn_' + rowstype + "_" + index)[0].checked = false;
}
function Btn_Save_Click() {
//获取数据列表
var trs = $("#table1").find("tr");
$.each(trs, function (i, tr) {
if (i > 0) {
var tdArr = $(this).children();
var myPK = tdArr.eq(1).find('input').val();
if (myPK != undefined) {//mypk有值则更新
var mapAttr = new Entity("BP.Sys.MapAttr", myPK);
mapAttr.Name = tdArr.eq(3).find('input').val();
mapAttr.MyDataType = tdArr.eq(4).find('select').val();
mapAttr.MaxLen = tdArr.eq(5).find('input').val();
if (tdArr.eq(6).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIIsEnable = 1;
} else {
mapAttr.UIIsEnable = 0;
}
if (tdArr.eq(7).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIVisible = 1;
} else {
mapAttr.UIVisible = 0;
}
if (tdArr.eq(8).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIIsInput = 1;
} else {
mapAttr.UIIsInput = 0;
}
mapAttr.Idx = tdArr.eq(9).find('input').val();
mapAttr.Update();
} else {//mypk没有值则新增
var mapAttr = new Entity("BP.Sys.MapAttr");
mapAttr.MyPK = fk_MapData + "_" + tdArr.eq(1).find('input').val();
if (mapAttr.IsExits() == true) {
alert('字段[' + tdArr.eq(2).find('input').val() + "]已经存在");
return;
}
mapAttr.KeyOfEn = tdArr.eq(2).find('input').val();
mapAttr.Name = tdArr.eq(3).find('input').val();
mapAttr.MyDataType = tdArr.eq(4).find('select').val();
mapAttr.MaxLen = tdArr.eq(5).find('input').val();
if (tdArr.eq(6).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIIsEnable = 1;
} else {
mapAttr.UIIsEnable = 0;
}
if (tdArr.eq(7).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIVisible = 1;
} else {
mapAttr.UIVisible = 0;
}
if (tdArr.eq(8).find("input:checkbox:checked").prop('checked')==true) {
mapAttr.UIIsInput = 1;
} else {
mapAttr.UIIsInput = 0;
}
mapAttr.Idx = tdArr.eq(9).find('input').val();
mapAttr.FK_MapData = fk_MapData;
mapAttr.UIWidth = 100;
mapAttr.UIHeight = 23;
mapAttr.ColSpan = 1;
mapAttr.MinLen = 0;
if (mapAttr.MyDataType == 4) {
mapAttr.DefVal = "0";
mapAttr.UIContralType = 2;
} else {
mapAttr.UIContralType = 0;
}
mapAttr.Insert();
}
}
});
Reload();
}
//全选或者反选
function CheckAll(rowstype) {
$('.' + rowstype).each(function () {
if (this.type == 'checkbox') {
$('#KeyOfEn_' + rowstype)[0].checked ? this.checked = true : this.checked = false;
}
});
//upstate(true);
}
//设置字段宽度
function setWidth(url) {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&PKVal=" + url;
OpenEasyUiDialog(url, "eudlgframe", '设置字段属性', 700, 470, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function addRow() {
var str = "<tr>";
str += "<td style='display:none'></td>";
//判断是否string
str += "<td ><input type='text' ></input></td>";
str += "<td ><input name=\"TB_\" type=\"text\" value=\"\" id=\"TB_\" style='width:100px;' /></td>";
str += "<td ><select id=\"TB_MyDataType_\" style='width:80px;'><option value ='1'>字符型</option><option value ='2'>整数型</option><option value ='3'>浮点型</option><option value ='4'>Boolean型(是/否)</option>";
str +="<option value = '5' > 双精度型</option> <option value='6'>日期型</option> <option value='7'>日期时间型</option> <option value='8'>金额型</option></select ></td > ";
str += "<td ><input type=\"text\" value=\"50\" id=\"TB_\" style='width:60px;' /></td>";
str += "<td ><select style='width:60px;'><option value ='1'>是</option><option value ='0'>否</option></select></td>";
str += "<td ><select style='width:60px;'><option value ='1'>是</option><option value ='0'>否</option></select></td>";
str += "<td ><select style='width:60px;'><option value ='1'>是</option><option value ='0'>否</option></select></td>";
str += "<td ><input name=\"TB_\" type=\"text\" value=\"\" id=\"TB__Idx\" style='width:30px;' /></td>";
str += "<td><a class='easyui-linkbutton' data-options='iconCls:&#39;icon-delete&#39;' href='javascript:void(0);' onclick='Remove(this); '>删除</a></td>";
//str += "<td><a href='javascript:void(0)' onclick='up(this, 3)' class='up'>上移</a> <a href='javascript:void(0)' onclick='down(this, 3)' class='down'>下移</a> - " + del;
//str += "</td>";
str += "</tr>";
$("table").append(str);
}
</script>
<base target="_self" />
</head>
<body class="easyui-layout">
<div data-options="region:'center',border:false" style="padding:5px;height:auto">
<div style="text-align:right;margin:0px 7px 9px 0px" >
<!--<a id="Btn_addRow" class="easyui-linkbutton" data-options="iconCls:&#39;icon-add&#39;" href="javascript:addRow()">新增一行</a>-->
<a id="ContentPlaceHolder1_Btn_Save1" class="easyui-linkbutton" data-options="iconCls:&#39;icon-save&#39;" href="javascript:Btn_Save_Click()">保存</a>
<!--<a id="ContentPlaceHolder1_Btn_Cancel1" class="easyui-linkbutton" data-options="iconCls:&#39;icon-undo&#39;" href="javascript:Cancel()">取消</a>-->
</div>
<Table id="table1" class='Table' border='1' cellspacing='0' cellpadding='0' style='width:100%'>
<TR>
<th style='text-align:center;width:50px'>序</th>
<th >字段</th>
<th >中文名</th>
<th >类型</th>
<th >最大长度</th>
<th>
<input onclick="CheckAll('UIIsEnable');" id='KeyOfEn_UIIsEnable' type="checkbox" />
<label for="KeyOfEn_UIIsEnable">
是否只读
</label>
</th>
<th>
<input onclick="CheckAll('UIVisible');" id='KeyOfEn_UIVisible' type="checkbox" />
<label for="KeyOfEn_UIVisible">
是否可见
</label>
</th>
<th>
<input onclick="CheckAll('UIIsInput');" id='KeyOfEn_UIIsInput' type="checkbox" />
<label for="KeyOfEn_UIIsInput">
是否必填
</label>
</th>
<th>
顺序号
</th>
<th>操作</th>
</TR>
</Table>
</div>
</body>
</html>