泛微OA明细赋值到主表的JavaScript代码如下:
<script type="text/javascript">
$(function(){
// 遍历明细行
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
var mess = '-1';
if(rowArr.length > 0){
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex != ''){
// 明细表字段ID field16042_这个值是将鼠标放到字段中文名后,屏幕左下角显示的值
var thisDataSourceID = WfForm.getFieldValue("field16042_" + rowIndex);
if(thisDataSourceID != ''){
// 遍历明细字段
mess = mess + ',' + thisDataSourceID;
}
}
}
}
// 主表字段ID,接收明细字段值的字段
WfForm.changeFieldValue("field16038", {value:mess});
});
WfForm.bindDetailFieldChangeEvent("field16042",function(id,rowIndex,value){
var rowArr = WfForm.getDetai