<script> //序号 const xh_id = WfForm.convertFieldNameToId('xh', "detail_1"); WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){ //获取当前行号 const arr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); //从10开始每次 + 10 if(arr.length == 1) { WfForm.changeFieldValue(xh_id+"_"+index, {value: 10}); } else { //取到上一个行号的值 const addValue = WfForm.getFieldValue(xh_id+"_"+ (arr[arr.length - 2])); //自增 WfForm.changeFieldValue(xh_id+"_"+index, {value: parseInt(addValue, 10) + 10 }); } }); WfForm.registerAction(WfForm.ACTION_DELROW+"1", function(arg){ const arr = WfForm.getDetailAllRowIndexStr("detail_1").split(","); let value = 10; //删除时重编序号 for(var i = 0 ; i < arr.length ; i++) { WfForm.changeFieldValue(xh_id+"_"+ arr[i], {value: value}); value += 10; } }); </script>
标签:10,arr,xh,OA,id,行号,value,WfForm,泛微 From: https://www.cnblogs.com/zspwf/p/16939330.html