The control form of the oa process form of PWC is visible and hidden and the control is required

<script type="text/javascript">
 //类型字段ID,根据具体实际情况进行修改
		var type = "field6304";
		var textValue = "<IMG align=absMiddle src='/images/BacoError_wev8.gif' />";
		//b字段对应的字段ID,根据实际情况修改
		var field_b = "field6305";
		//c字段对应的字段ID,根据实际情况修改
		var field_c = "field6306";
		//d字段对应的字段ID,根据实际情况修改
		var field_d = "field6307";
		//页面加载事件
		jQuery(document).ready(function() {
    
    
			//集体/个人绑定事件
			btzd = jQuery("input[name='needcheck']").val();
			jQuery("#" + type).bind('change', function() {
    
    
				trDisplay();
			});

			trDisplay();
		});

		//TR显隐事件
		function trDisplay() {
    
    
			var type_v = jQuery("#" + type).val();
			var fieldIds = "";
			if(type_v == '0') {
    
     //集体
				jQuery("TR[ID=tr_dept]").show();
				jQuery("TR[ID=tr_head]").hide();
				jQuery("TR[ID=tr_subsection]").hide();

				//添加必填
				jQuery("#" + field_b + "span").html(textValue);
				jQuery("#" + field_b).attr('viewtype', '1');

				//取消必填
				jQuery("#" + field_c + "span").html('');
				jQuery("#" + field_c).attr('viewtype', '0');
				jQuery("#" + field_d + "span").html('');
				jQuery("#" + field_d).attr('viewtype', '0');

				//必填字段id
				fieldIds = btzd + "," + field_b;
				jQuery("input[name='needcheck']").val(fieldIds);
			} else if(type_v == '1') {
    
     //个人
				jQuery("TR[ID=tr_dept]").hide();
				jQuery("TR[ID=tr_head]").show();
				jQuery("TR[ID=tr_subsection]").hide();

				jQuery("#" + field_c + "span").html(textValue);
				jQuery("#" + field_c).attr('viewtype', '1');

				//取消必填
				jQuery("#" + field_b + "span").html('');
				jQuery("#" + field_b).attr('viewtype', '0');
				jQuery("#" + field_d + "span").html('');
				jQuery("#" + field_d).attr('viewtype', '0');

				//必填字段id
				fieldIds = btzd + "," + field_c;
				jQuery("input[name='needcheck']").val(fieldIds);
			} else if(type_v == '2') {
    
    
				jQuery("TR[ID=tr_dept]").hide();
				jQuery("TR[ID=tr_head]").hide();
				jQuery("TR[ID=tr_subsection]").show();

				//添加必填
				jQuery("#" + field_d + "span").html(textValue);
				jQuery("#" + field_d).attr('viewtype', '1');

				//取消必填
				jQuery("#" + field_b + "span").html('');
				jQuery("#" + field_b).attr('viewtype', '0');
				jQuery("#" + field_c + "span").html('');
				jQuery("#" + field_c).attr('viewtype', '0');

				//必填字段id
				fieldIds = btzd + "," + field_d;
				jQuery("input[name='needcheck']").val(fieldIds);
			} else {
    
    
				jQuery("TR[ID=tr_dept]").hide();
				jQuery("TR[ID=tr_head]").hide();
				jQuery("TR[ID=tr_subsection]").hide();
				jQuery("#" + field_b + "span").html('');
				jQuery("#" + field_c + "span").html('');
				jQuery("#" + field_d + "span").html('');
			}
		}
</script> 

Please leave a message in the comment area and discuss together~~~

If necessary, please contact WeChat: hdygzh2019 At the same time, please explain your intention and make progress together! ! !

Guess you like

Origin blog.csdn.net/Y_6155/article/details/109019241