springstrustspringbootisp前后端那些事儿-前端

一. 调用后台方法

1.grid里gridTriggerConfirm ----- ajax

 action="gridTriggerConfirm('float', '_parent', 
 {projectNo: '#projectNo#',busiNode: '#busiNode#', _title:'请确认'}, 
 null, undefined, '您确定要提交该条施工信息吗?', submitRepairInfo)"/>
	function submitRepairInfo(param) {
		var projectNo = param.projectNo;
		var busiNode = param.busiNode;
		var nodeStatus = param.nodeStatus;
		showProgress();
		$.ajax({
			type: 'post',
			url: 'submitRepairInfo.bv',
			data: {'projectNo': projectNo,'busiNode':busiNode,'nodeStatus':nodeStatus},
			success: function(jsonData) {
				if (!$.isEmpty(jsonData.promptInfo.showType)) {
					showPrompt(jsonData.promptInfo.showType, jsonData.promptInfo.showMsg);
				} else {
					showPrompt("操作成功!");
				}
				hideProgress();
				gridRefresh();
			}
		});
	}

2.grid里gridTriggerFrame点击出现弹窗

直接进入jsp

     action="gridTriggerFrame('float', '_self', 
     {projectNo: '#projectNo#',flag: 'repair', _title:'冻结项目'}, 
     'modules/rfis/core/send/project/freezeProject.jsp', 500, 180,false,window)" />

先调用后端再进入jsp(有初始化回显得值)

	action="gridTriggerFrame('float', '_self', 
	{projectNo: '#projectNo#',CorpName: '#CorpName#',regionName: '#regionName#',
	bldName: '#bldName#',address:'#address#',roomNo:'#showName#',corpNo:'#corpNo#',
	_title:'施工回单维护'}, 'queryProMessMainById.bv?flag=sg', 1300, 900)" />
弹窗中含有表单情况就是看下面form表单介绍

3.form表单

<form id="freezeForm" method="post" action="freezeProject.bv">
    <div class="operateDiv">
        <bv:button name="save" id="save" value="确认冻结"/>
        <bv:button id="cancel" name="cancel" cssClass="closeModal" value="取消"/>
    </div>
</form>    
<head>
    <%@include file="/modules/common/head.jsp" %>
    <bv:define extra="date,auto" close="true" focusId="false"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#save").click(function () {
                $.submit($(this), $(this).parents("form"), "false", {success: beforeSubmitSuccess});
            });

        });
        function beforeSubmitSuccess(data){
            showPrompt("操作成功!");
            top.frameContent.gridAjax(undefined, true); // 刷新父页面
            top.uiDialog("close", "iframe", window); // 关闭当前页面
        };
    </script>
</head>

二. 点击调用后端接口校验

在原本bv方法中,添加校验如果失败就提示错误信息(框架自带),如果校验成功就继续往下走

		function submitProjectApplication(param) {
			var projectNo = param.projectNo;
			showProgress();
			$.ajax({
				type: 'post',
				url: 'submitProjectApplication.bv',
				data: {'projectNo': projectNo},
				success: function(jsonData) {
					if (!$.isEmpty(jsonData.promptInfo.showType)) {
						showPrompt(jsonData.promptInfo.showType, jsonData.promptInfo.showMsg);
					} else {
						showPrompt("操作成功!");
					}
					hideProgress();
					gridRefresh();
				}
			});
		}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void submitProjectApplication(String projectNo, PromptInfo promptInfo, FlowProgress flowProgress) {
    //判断必填文档是否上传
    boolean isUploadFile = true;
    List<DicDocType> docTypeList = sendMapper.listRequiredDocTypeByBusiType("1201");
    for (DicDocType dicDocType : docTypeList) {
        List<ArcUploadFile> uploadFileList = sendMapper.listUploadFilesByDocTypeAndKeyId(projectNo, dicDocType.getDocType());
        if (uploadFileList.isEmpty()) {
            isUploadFile = false;
            promptInfo.setShowType("error");
            promptInfo.setShowMsg("存在相关必填图档未维护,无法提交");
            break;
        }
    }
上一篇:AI ASIC 芯片与 GPU 的优劣对比:


下一篇:leetCode 15.三数之和(超简单讲解)-解题思路