本文主要是介绍ecology9.0 主表浏览框控制明细表必填,只读并赋值与清空,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
需求: 通过采购子类这个浏览按钮改变明细表一的IT细类,类别字段属性及字段值
当采购子类为终端类时,通过点击事件将终端类赋值给IT明细,并且类别为必填
核心JS代码: 时间不够导致代码没有抽取,有冗余。
<script type="text/javascript">
jQuery(document).ready(function() {
WfForm.bindFieldAction("onclick", "field20010", function(){ // var xm=WfForm.getBrowserShowName("field20010");//项目var xm = $("#field20010").val();if(xm=="22"){ //终端类 var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); //遍历明细表一for(var i=0; i<rowArr.length; i++){var rowIndex = rowArr[i];if(rowIndex !="undefined" ){ var fieldMark = "field20301_"+rowIndex; //遍历明细行 WfForm.changeSingleField(fieldMark, {value:"0"}, {viewAttr:"1"}); var hh = parseInt(rowIndex); //将字符串的数字转成int类型数字for(var j=hh; j<rowArr.length; j++){WfForm.changeFieldAttr("field20300_"+j, 3);//必填}}} }else if(xm=="23"){ //非终端类 var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); //遍历明细表一for(var i=0; i<rowArr.length; i++){var rowIndex = rowArr[i];if(rowIndex !="undefined" ){ var fieldMark = "field20301_"+rowIndex; //遍历明细行 WfForm.changeSingleField(fieldMark, {value:"1"}, {viewAttr:"1"}); var hh = parseInt(rowIndex); //将字符串的数字转成int类型数字for(var j=hh; j<rowArr.length; j++){WfForm.changeFieldAttr("field20300_"+j, 3); //必填 }}} }else{ //其他var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); //遍历明细表一for(var i=0; i<rowArr.length; i++){var rowIndex = rowArr[i];if(rowIndex !="undefined" ){ var fieldMark = "field20301_"+rowIndex; //遍历明细行 WfForm.changeFieldAttr(fieldMark, 1);//只读WfForm.changeSingleField(fieldMark, {value:""}, {viewAttr:"1"}); var hh = parseInt(rowIndex); //将字符串的数字转成int类型数字for(var j=hh; j<rowArr.length; j++){WfForm.changeFieldAttr("field20300_"+j, 1); //只读 }}} }
});
});
这篇关于ecology9.0 主表浏览框控制明细表必填,只读并赋值与清空的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!