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.

898 lines
35 KiB
Plaintext

11 months ago
<!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>
<meta charset="UTF-8" />
<base target="_self" />
<script language="JavaScript" src="../Comm/JScript.js" type="text/javascript"></script>
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<link href="../../DataUser/Style/Dtl.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../Scripts/easyUI145/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../Scripts/easyUI145/themes/icon.css" />
<link href="../Scripts/easyUI145/demo/demo.css" rel="stylesheet" />
<script type="text/javascript" src="../Scripts/easyUI145/jquery.min.js"></script>
<script type="text/javascript" src="../Scripts/easyUI145/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../Scripts/easyUI145/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/commonYangYH.js"></script>
<script type="text/javascript" src="MapExt2016.js"></script>
<script src="../Comm/JS/TBHelpDiv.js" type="text/javascript"></script>
<script src="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/config.js"></script>
<script src="../Comm/Gener.js" type="text/javascript"></script>
<!--<script src="../Comm/JS/DtlUIControl.js"></script>-->
<script language="javascript" type="text/javascript">
//页面启动函数.
$(function () {
//加载JS文件
try {
//var s = document.createElement('script');
//s.type = 'text/javascript';
//s.src = "../../DataUser/JSLibData/" + ensName + ".js";
//var tmp = document.getElementsByTagName('script')[0];
//tmp.parentNode.insertBefore(s, tmp);
}
catch (err) {
}
//初始化页面
loadDtlTable();
});
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) {
return true;
}
var b = $('#dtlTable').datagrid('validateRow', editIndex);
if (b) {
$('#dtlTable').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
var sys_MapDtlObj;
function onDblClickRow(index) {
if (sys_MapDtlObj.IsUpdate == "1") {
var selectedRow = $('#dtlTable').datagrid('getSelected');
if (selectedRow == null) {
alert("没有选中要保存的数据行");
return;
}
var EditModel = sys_MapDtlObj.EditModel;
if (window.parent) {
var ensName = GetQueryString("EnsName");
var refPKVal = GetQueryString("RefPKVal");
var FK_MapData = GetQueryString("FK_MapData");
var fid = GetQueryString("FID");
if (fid == "" || fid == undefined)
fid = 0
var FK_Node = GetQueryString("FK_Node");
window.parent.DtlFrm(ensName, refPKVal, selectedRow.OID, EditModel, loadDtlTable, FK_MapData, FK_Node, fid, true);
}
}
return;
//alert(sys_MapDtl.IsUpdate);
if (sys_MapDtl.IsUpdate == "1") {
//判断插入行的模式 =0行模式. 1=自由表单卡片模式 2=傻瓜表单卡片模式.
if (EditModel != 0 && window.parent) {
var ensName = GetQueryString("EnsName");
var refPKVal = GetQueryString("RefPKVal");
var FK_MapData = GetQueryString("FK_MapData");
var FID = GetQueryString("FID");
var FK_Node = GetQueryString("FK_Node");
window.parent.DtlFrm(ensName, refPKVal, '0', EditModel, loadDtlTable, FK_MapData, FK_Node, FID, false);
return;
}
}
//if (editIndex != index) {
// if (endEditing()) {
// $('#dtlTable').datagrid('selectRow', index).datagrid('beginEdit', index);
// editIndex = index;
// } else {
// $('#dtlTable').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
// alert("注意必填项");
// }
//}
}
var mapExts; //mapExts扩展
var isEditable;
var ensName = GetQueryString("EnsName");
//打开附件.
function OpAth(RefPK, OID) {
SaveRow();
var dtlName = GetQueryString("EnsName");
var fk_node = GetQueryString("FK_Node");
var fk_flow = GetQueryString("FK_Flow");
var parentUrl = parent.location.href;
var url = "CCForm/Ath.htm?IsBTitle=1&PKVal=" + OID + "&Ath=AthMDtl&FK_MapData=" + GetQueryString("EnsName") + "&FK_FrmAttachment=" + dtlName + "_AthMDtl&WorkID=" + RefPK + "&FK_Node=" + fk_node + "&FK_Flow=" + fk_flow;
if (parentUrl.indexOf("CCForm") != -1) {
url = "Ath.htm?IsBTitle=1&PKVal=" + OID + "&Ath=AthMDtl&FK_MapData=" + GetQueryString("EnsName") + "&FK_FrmAttachment=" + dtlName + "_AthMDtl&WorkID=" + RefPK + "&FK_Node=" + fk_node + "&FK_Flow=" + fk_flow;
WinOpen(url);
} else {
parent.OpenEasyUiDialogExt(url, '附件上传', 800, 500, false);
}
}
function unitformatter(value, row, index) {
try {
if (this.field == "AthNum") {
return '<a id="btn" href="javascript:OpAth(' + (row.RefPK == undefined ? 0 : row.RefPK) + ',' + (row.OID == undefined ? 0 : row.OID) + ');" class="easyui-linkbutton" data-options="iconCls:\'icon-search\'">' + (value == undefined ? 0 : value) + '</a>';
}
var editerType = this.editor.type;
var dataObj = this.editor.options.data;
var keyOfEn = this.field;
if (editerType == "combobox") {
for (var i = 0; i < dataObj.length; i++) {
if (dataObj[i][keyOfEn] == value) {
var v = dataObj[i].Name;
if (v == undefined)
return dataObj[i][keyOfEn + "T"];
else
return dataObj[i].Name;
}
}
}
if (editerType == "textarea" || editerType == "text") {
return value;
}
if (editerType == "checkbox") {
if (value == "0") {
return "否";
} else {
return "是";
}
}
}
catch (Exception) {
return value;
}
return value;
}
function loadDtlTable() {
//调用Gener.js 的方法,处理当前页面传来的参数, 并把参数传入到dtl.htm里面去。
var urlParam = DearUrlParas();
//初始化表格.
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddUrlData(urlParam);
var data = handler.DoMethodReturnString("Dtl_Init");
// 检查是否有错误.
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
//解析.
data = JSON.parse(data);
//主表数据,用于变量替换.
var mainTable = data["MainTable"]; //主表数据.
//从表信息.
var sys_MapDtl = data["Sys_MapDtl"][0]; //从表描述.
var sys_mapAttr = data["Sys_MapAttr"]; //从表字段.
var sys_mapExtDtl = data["Sys_MapExt"]; //扩展信息.
mapExts = sys_mapExtDtl;
workNodeData = data;
var sys_MapDtl = data["Sys_MapDtl"][0]; //从表描述.
//默认为空,全部显示,如果配置了就按照配置的计算,格式为:field1,field2
if (sys_MapDtl.ShowCols) {
var ShowCols = sys_MapDtl.ShowCols.split(",");
$.each(sys_mapAttr, function (i, o) {
if (ShowCols.indexOf(o.KeyOfEn) == -1) {
o.UIVisible = 0;
}
});
}
var titleArr = new Array();
var item = new Object();
var athNumitem = new Object();
item.field = 'OID';
item.checkbox = true;
titleArr.push(item);
var sumClos = new Array();
$.each(sys_mapAttr, function (i, mapAttrObj) {
if (mapAttrObj.UIVisible == 1) {
item = new Object();
item.field = mapAttrObj.KeyOfEn;
item.title = mapAttrObj.Name;
item.width = mapAttrObj.UIWidth;
item.align = 'center';
var eriterObj = figure_MapAttr_Template(mapAttrObj);
item.editor = eriterObj;
item.formatter = unitformatter;
titleArr.push(item);
if (mapAttrObj.ExtIsSum == 1) {
var sumClo = new Object();
sumClo.No = mapAttrObj.KeyOfEn;
sumClo.Name = mapAttrObj.Name;
sumClo.Val =
sumClos.push(sumClo);
}
}
if (mapAttrObj.KeyOfEn == "AthNum")
if (sys_MapDtl.IsEnableAthM == 1) {
athNumitem.field = mapAttrObj.KeyOfEn;
athNumitem.title = "附件";//mapAttrObj.Name;
athNumitem.width = mapAttrObj.UIWidth;
athNumitem.align = 'center';
var eriterObj = figure_MapAttr_Template(mapAttrObj);
athNumitem.editor = eriterObj;
athNumitem.formatter = unitformatter;
//titleArr.push(athNumitem);
}
if (mapAttrObj.KeyOfEn == "RefPK") {
item = new Object();
item.field = mapAttrObj.KeyOfEn;
item.title = mapAttrObj.Name;
item.width = mapAttrObj.UIWidth;
item.align = 'center';
item.hidden = true;
titleArr.push(item);
}
});
if (athNumitem.field != undefined) {
titleArr.push(athNumitem);
}
//从表数据.
var dbDtl = data["DBDtl"];
var dgData = new Object();
dgData.total = dbDtl.length;
dgData.rows = new Array();
$.each(dbDtl, function (t, dtlData) {
var o = new Object();
$.each(titleArr, function (i, titleItem) {
o[titleItem.field] = dtlData[titleItem.field];
});
o.OID = dtlData.OID;
dgData.rows.push(o);
});
$('#dtlTable').datagrid({
columns: [titleArr],
showFooter: true,
selectOnCheck: false,
checkOnSelect: false,
singleSelect: true,
idField: "OID",
data: dgData,
width: 'auto',
height: '290',
striped: true,
rownumbers: true,
remoteSort: false,
fitColumns: false,
onDblClickRow: onDblClickRow ,
onLoadSuccess: function (data) {
sys_MapDtlObj = sys_MapDtl;
if (sumClos.length != 0) {
dgData.footer = new Array();
dgData.footer.push({});
$.each(sumClos, function (t, sumCol) {
dgData.footer[0][sumCol.No] = "<span style=\"color:blue;\">[" + sumCol.Name + "]</span>合计:" + compute(sumCol.No);
});
}
}
});
$("#dtlTable").datagrid("clearSelections");
$("#dtlTable").datagrid("clearChecked");
InitToolBars(data);
}
//指定列求和
function compute(colName) {
var rows = $('#dtlTable').datagrid('getRows');
var total = 0;
for (var i = 0; i < rows.length; i++) {
total += parseFloat(rows[i][colName]);
}
return total;
}
function InitToolBars(obj) {
var sys_MapDtl = obj["Sys_MapDtl"][0]; //从表描述.
var toolbar = new Array();
var barItem;
//是否可以插行
if (sys_MapDtl.IsInsert == "1") {
//新增显示方式? =0行模式, 1=自由表单模式 2=傻瓜表单模式.
// ==1,==2 是打开父窗口出现卡片.
var EditModel = sys_MapDtl.EditModel;
window.EditModel = EditModel;
barItem = new Object();
barItem.id = 'IsInsert';
barItem.text = '新增';
barItem.iconCls = 'icon-add';
barItem.handler = function () { insertRow(EditModel); };
toolbar.push(barItem);
}
//是否可以删除行
if (sys_MapDtl.IsDelete == "1") {
barItem = new Object();
barItem.id = 'IsDelete';
barItem.text = '删除';
barItem.iconCls = 'icon-remove';
barItem.handler = function () { deleteRow(); };
toolbar.push(barItem);
}
//是否可以更新行
//if (sys_MapDtl.IsUpdate == "1") {
// barItem = new Object();
// barItem.id = 'IsUpdate';
// barItem.text = '保存';
// barItem.iconCls = 'icon-save';
// barItem.handler = function () {
// SaveRow();
// };
// toolbar.push(barItem);
//}
//明细表导入模式
var impModel = sys_MapDtl.ImpModel;
if (impModel != 0) {
barItem = new Object();
barItem.id = 'ImpModel';
barItem.text = '导入';
barItem.iconCls = 'icon-back';
barItem.handler = function () { Option(impModel); };
toolbar.push(barItem);
}
$('#dtlTable').datagrid({
toolbar: toolbar
});
//$('div.datagrid-toolbar a').eq(0).hide();
}
//初始化下拉列表框的OPERATION
function InitDDLOperation(workNodeData, mapAttr, defVal) {
var operations = '';
var ddlData = new Array();
var ddlItem = new Object();
//外键类型
if (mapAttr.LGType == 2 || mapAttr.LGType == 1) {
if (workNodeData[mapAttr.KeyOfEn] != undefined) {
$.each(workNodeData[mapAttr.KeyOfEn], function (i, obj) {
//operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
ddlItem = new Object();
ddlItem[mapAttr.KeyOfEn] = obj.No
ddlItem.Name = obj.Name;
ddlData.push(ddlItem);
});
return ddlData;
}
else if (workNodeData[mapAttr.UIBindKey] != undefined) {
$.each(workNodeData[mapAttr.UIBindKey], function (i, obj) {
ddlItem = new Object();
ddlItem[mapAttr.KeyOfEn] = obj.No
ddlItem.Name = obj.Name;
ddlData.push(ddlItem);
});
return ddlData;
}
} else if (mapAttr.LGType == 0 && mapAttr.UIContralType == 1 && mapAttr.MyDataType == 1) {
if (workNodeData[mapAttr.KeyOfEn] != undefined) {
$.each(workNodeData[mapAttr.UIBindKey], function (i, obj) {
ddlItem = new Object();
ddlItem[mapAttr.KeyOfEn] = obj.No
ddlItem[mapAttr.KeyOfEn + "T"] = obj.Name;
ddlData.push(ddlItem);
});
} else if (workNodeData[mapAttr.UIBindKey] != undefined) {
$.each(workNodeData[mapAttr.UIBindKey], function (i, obj) {
ddlItem = new Object();
ddlItem[mapAttr.KeyOfEn] = obj.No
ddlItem[mapAttr.KeyOfEn + "T"] = obj.Name;
ddlData.push(ddlItem);
});
}
alert(ddlData);
return ddlData;
} else {
var enums = workNodeData.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 figure_MapAttr_Template(mapAttr) {
var editorAttr = new Object();
editorAttr.options = {};
if (mapAttr.UIIsInput == 1) {
editorAttr.options.required = true;
} else {
editorAttr.options.required = false;
}
if (mapAttr.UIIsEnable == 1) {
editorAttr.options.readonly = false;
} else {
editorAttr.options.readonly = true;
}
if (mapAttr.KeyOfEn == "AthNum") {
editorAttr.type = 'linkbutton';
//editorAttr.options.multiline = false;
//editorAttr.options.readonly = true;
return editorAttr;
}
if (mapAttr.UIVisible == 1) {//是否显示
var defValue = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn);
if (mapAttr.UIContralType != 6) {
//外键类型
if (mapAttr.LGType == 2) {
editorAttr.type = 'combobox';
//editorAttr.options.required = true;
editorAttr.options.valueField = mapAttr.KeyOfEn;
editorAttr.options.textField = 'Name';
editorAttr.options.data = InitDDLOperation(workNodeData, mapAttr, defValue);
//editorAttr.options.editable = false;
return editorAttr;
} else {
//添加文本框 ,日期控件等
//AppString
if (mapAttr.MyDataType == "1" && mapAttr.LGType != "2") {
//不是外键
if (mapAttr.UIContralType == "1") {
editorAttr.type = 'combobox';
//editorAttr.options.required = true;
editorAttr.options.valueField = mapAttr.KeyOfEn;
editorAttr.options.textField = mapAttr.KeyOfEn + "T";
editorAttr.options.data = InitDDLOperation(workNodeData, mapAttr, defValue);
//editorAttr.options.editable = false;
return editorAttr;
alert("错误的控件类型");
} else {
//文本区域 、富文本
if (mapAttr.IsRichText == "1") {
editorAttr.type = 'textbox';
editorAttr.options.height = '80px';
editorAttr.options.multiline = true;
return editorAttr;
}
else {
//text
editorAttr.type = 'textbox';
editorAttr.options.multiline = false;
return editorAttr;
}
}
}
else if (mapAttr.MyDataType == 6) {//AppDate
editorAttr.type = 'datebox';
//editorAttr.options.value = '2018-12-10';
editorAttr.options.editable = false;
return editorAttr;
}
else if (mapAttr.MyDataType == 7) {// AppDateTime = 7
editorAttr.type = 'datetimebox';
editorAttr.options.editable = false;
return editorAttr;
}
else if (mapAttr.MyDataType == 4) {// AppBoolean = 4
editorAttr.type = 'checkbox';
editorAttr.options.on = '1';
editorAttr.options.off = '0';
return editorAttr;
}
if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) { //AppInt Enum
if (mapAttr.UIContralType == 1) {//DDL
editorAttr.type = 'combobox';
//editorAttr.options.required = true;
editorAttr.options.valueField = mapAttr.KeyOfEn;
editorAttr.options.textField = 'Name';
editorAttr.options.data = InitDDLOperation(workNodeData, mapAttr, defValue);
//editorAttr.options.editable = false;
return editorAttr;
}
}
// AppDouble AppFloat
if (mapAttr.MyDataType == 5 || mapAttr.MyDataType == 3) {
editorAttr.type = 'numberbox';
editorAttr.options.value = 0;
editorAttr.options.precision = 2;
return editorAttr;
}
if ((mapAttr.MyDataType == 2 && mapAttr.LGType != 1)) {//AppInt
editorAttr.type = 'numberbox';
editorAttr.options.value = 777;
//alert(editorAttr.options.value);
return editorAttr;
}
//AppMoney AppRate
if (mapAttr.MyDataType == 8) {
editorAttr.type = 'numberbox';
editorAttr.options.value = 0;
editorAttr.options.precision = 2;
editorAttr.options.prefix = '¥';
return editorAttr;
}
//单选按钮
//if (mapAttr.MyDataType == 2) {
// editorAttr.type = 'numberbox';
// editorAttr.options.value = 0;
// editorAttr.options.precision = 2;
// editorAttr.options.prefix = '¥';
// return editorAttr;
//}
}
}
} else {
alert("待处理");
}
}
//选项 导入导出功能.
function Option(impModel) {
if (impModel == 0) {
alert("请配置导入方式。");
}
//SQL\JSON导入方式
if (impModel == 1) {
var url = GetHrefUrl();
//url = url.replace('Dtl.htm', 'DtlOpt.htm');
url = url.replace('Dtl.htm', 'DtlImp.htm');
}
//excel模式导入方式
if (impModel == 2) {
var url = GetHrefUrl();
url = url.replace('Dtl.htm', 'DtlImpByExcel.htm');
// url = url.replace('Dtl.htm', 'DtlOpt.htm');
}
// alert(impModel);
//SQL\JSON导入方式
if (impModel == 3) {
var url = GetHrefUrl();
//url = url.replace('Dtl.htm', 'DtlOpt.htm');
url = url.replace('Dtl.htm', 'DtlImpByExcel.htm');
}
if (window.parent && window.parent.OpenBootStrapModal) {
var dtl_ImpMapExt = $.grep(mapExts, function (ext) { return ext.ExtType == "DtlImp" });
var title = "导入数据";
var digWidth = 900;
var digHeight = 450;
if (dtl_ImpMapExt.length > 0) {
digWidth = dtl_ImpMapExt[0].W;
digHeight = dtl_ImpMapExt[0].H;
var atPara = dtl_ImpMapExt[0].AtPara;
var reg = new RegExp("(^|@)Title=([^@]*)(@|$)");
var results = atPara.match(reg);
if (results != null) {
title = unescape(results[2]);
}
}
window.parent.OpenBootStrapModal(url, "eudlgframe", title, digWidth, digHeight, "icon-edit", false, function () { }, null, function () {
location = location;
});
return;
}
SetHref(url);
}
</script>
<style type="text/css">
/*.table thead {
display: block;
}
.table tbody {
display: block;
overflow-x: hidden;
overflow-y: hidden;
}
.table thead, .tbody tr {
display: table;
width: 100%;
table-layout: fixed;
}
.table thead {
width: calc(100% - 1em);
}*/
</style>
</head>
<body>
<form>
<input type="hidden" id="formExt" />
<div id="Msg" style="text-align: center;display:none;"><img src="../Scripts/bootstrap/fonts/loading.gif" /></div>
<div id="ContentDtlDiv">
<div id="" class="portlet portlet-sortable light bg-inverse" style="padding: 0px; margin: 0px;">
<div class="portlet-body " id="">
<div class="tab-content" style="margin: 1px 0px;">
<div class="tab-pane active portlet_tab flowLists" style="overflow-x: auto; overflow-y: hidden;" id="dtlDiv">
<table class="easyui-datagrid" id="dtlTable"></table>
<!--<div id="pp" style="background:#efefef;border:1px solid #ccc;"></div>-->
<!--<div class="loadDate" style="text-align: center;">
<img src="../Scripts/bootstrap/fonts/loading.gif" />加载中...
</div>-->
</div>
</div>
</div>
</div>
</div>
</form>
<script type="text/javascript">
//插入行.
function AddRow(EditModel) {
if (endEditing()) {
$('#dtlTable').datagrid('appendRow', {});
editIndex = $('#dtlTable').datagrid('getRows').length - 1;
$('#dtlTable').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
//setDefaultVal();
} else {
alert("注意必填项");
}
}
function setDefaultVal() {
var ed = $("#dtlTable").datagrid('getEditor', { index: 0, field: "SchoolLength" });
//var editRow = $('#dtlTable').datagrid('getEditor', { index: index, field: '你的下拉框列' });
$(ed.target).numberbox('setValue', "2121");
var ed = $(this).datagrid('getEditor', { index: index, field: field });
var ooo = $(ed.target);
}
//保存行数据
function SaveRow() {
var selectedRow = $('#dtlTable').datagrid('getSelected');
if (selectedRow == null) {
alert("没有选中要保存的数据行");
return;
}
var selectedIndex = $('#dtlTable').datagrid('getRowIndex', selectedRow);
var b = $('#dtlTable').datagrid('validateRow', selectedIndex);
if (b) {
$('#dtlTable').datagrid('endEdit', editIndex);
editIndex = undefined;
var rowData = $('#dtlTable').datagrid('getSelected');
var athNum;
if (rowData.AthNum != undefined) {
athNum = rowData["AthNum"];
delete rowData["AthNum"];//删除附件数量属性
}
rowData.DoType = "Dtl_SaveRow";
rowData.FK_MapDtl = GetQueryString("EnsName");
rowData.RefPKVal = GetQueryString("RefPKVal");
rowData.FK_Node = GetQueryString("FK_Node");
rowData.FK_MapData = GetQueryString("FK_MapData");
rowData.FID = GetQueryString("FID");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FK_MapDtl", rowData.FK_MapDtl);
handler.AddPara("RefPKVal", rowData.RefPKVal);
handler.AddPara("FK_Node", rowData.FK_Node);
handler.AddPara("FK_MapData", rowData.FK_MapData);
handler.AddPara("FID", rowData.FID);
var data = handler.DoMethodReturnString("Dtl_SaveRow");
loadDtlTable();
} else {
alert("第" + (selectedIndex + 1) + "行数据验证无效。请重新填写");
}
}
function deleteRow() {
$('#dtlTable').datagrid('endEdit', editIndex);
editIndex = undefined;
var checkedRows = $('#dtlTable').datagrid('getChecked');
if (checkedRows.length == 0) {
alert("没有选中要删除的数据");
return;
}
else {
$.messager.confirm('确认', '确定删除所选数据吗?', function (r) {
if (r) {
//$('#dtlTable').datagrid('deleteRow', $('#dtlTable').datagrid('getRowIndex', checkedRows[0]));
var rowData = checkedRows[0];
if (rowData.OID > 0) {
rowData.DoType = "Dtl_DeleteRow";
rowData.FK_MapDtl = GetQueryString("EnsName");
rowData.RefPKVal = GetQueryString("RefPKVal");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm");
handler.AddPara("FK_MapDtl", rowData.FK_MapDtl);
handler.AddPara("RefPKVal", rowData.RefPKVal);
var data = handler.DoMethodReturnString("Dtl_DeleteRow");
loadDtlTable();
}
}
});
}
}
function insertRow(EditModel) {
//新增显示方式? =0行模式, 1=自由表单模式 2=傻瓜表单模式.
// ==1,==2 是打开父窗口出现卡片.
//var EditModel = sys_MapDtl.EditModel;
//window.EditModel = EditModel;
//判断插入行的模式 =0行模式. 1=自由表单卡片模式 2=傻瓜表单卡片模式.
if (EditModel != 0 && window.parent) {
var ensName = GetQueryString("EnsName");
var refPKVal = GetQueryString("RefPKVal");
var FK_MapData = GetQueryString("FK_MapData");
var FID = GetQueryString("FID");
var FK_Node = GetQueryString("FK_Node");
window.parent.DtlFrm(ensName, refPKVal, '0', EditModel, loadDtlTable, FK_MapData, FK_Node, FID, false);
return;
}
}
</script>
<script type="text/javascript">
function ShowPopValOnParentForm(ctrl, fk_mapExt, refEnPK, width, height, title) {
isChange = false;
//主表字段数据
var formData = parent.window.getFormData(false, false);
//明细表当前行数据
parent.window.ReturnValCCFormPopValGoogle(ctrl, fk_mapExt, refEnPK, width, height, title, formData, workNodeData.Sys_MapDtl[0].No);
}
//填充默认数据
function ConvertDefVal(workNodeData, defVal, keyOfEn, myDataType) {
//计算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 workNodeData.DBDtl[0]) {
if (keyOfEn == ele && workNodeData.DBDtl[0][ele] != '') {
result = workNodeData.DBDtl[0][ele];
break;
}
}
//通过URL参数传过来的参数
for (var pageParam in pageParamObj) {
if (pageParam == keyOfEn) {
result = pageParamObj[pageParam];
break;
}
}
if (result != undefined && typeof (result) == 'string') {
//result = result.replace(//g, "{").replace(//g, "}").replace(//g, ":").replace(//g, ",").replace(/【/g, "[").replace(/】/g, "]").replace(//g, ";").replace(/~/g, "'").replace(//g, "'").replace(//g, "'");
}
if (myDataType == 8)
if (!/\./.test(result))
result += '.00';
return result = unescape(result);
}
var workNodeData = {};
</script>
<!--DIVINFO-->
<div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none; cursor: pointer; text-align: left; border-color:Black'></div>
</body>
</html>