JSP页面内容
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/lib/include/taglibs.jsp" %>
<html>
<head>
<title>站点信息审核</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<%@ include file="/lib/include/jquery.jsp" %>
<%@ include file="/lib/include/ligerUI.jsp" %>
<link href="${themectx}/css/custom.css" rel="stylesheet"/>
</head>
<body>
<div style="padding-left: 10px; float: left; " id="usergrid">
<div class="l-toolbar" style="width: 780px">
<div class="l-toolbar-item l-panel-btn" id="btnSave">
<span>
<i class="fa fa-save"></i>
<span>保存</span>
</span>
</div>
<div id="loader" style="height: 46px; width: 40px; right: 10px; top: 1px; position: absolute;"></div>
</div>
<div id="mainContain" class="right_tabs_content" style="width: 765px">
<div class="basic-grey" id="divbaseinfContain">
<label>
<span>资源系统站址编码 :</span>
<input id="baseStationCode" type="text" value="" />
</label>
<label>
<span>站点名称 :</span>
<input id="baseStationName" type="text" value=""/>
</label>
<label>
<span>审核人 :</span>
<input id="examineName" type="text" value=""/>
</label>
<label>
<span>审核时间 :</span>
<input id="examineTime" class="form-control-inline Wdate useTag" οnfοcus="WdatePicker({startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})" type="text" placeholder="" value="">
</label>
<label>
<span>审核是否通过 :</span>
<input name="chkState" type="radio" id="chkPass" style="width: 18px;height: 18px;position: relative" value="审核通过">
<span style="float: none;margin-top: 10px;position: relative">审核通过</span>
<input name="chkState" type="radio" id="chkNoPass" style="width: 18px;height: 18px;position: relative" value="审核不通过">
<span style="float: none;margin-top: 10px;position: relative">审核不通过</span>
</label>
<br style="clear:both">
<label>
<span>审核意见 :</span>
<textarea id="examineRemark"></textarea>
</label>
</div>
</div>
</div>
<script src="/lib/leshan/js/stationInfo/stationInfo_stationCheck.js" type="text/javascript"></script>
</body>
</html>
$(function () {
$("#btnSave").click(function () {//按钮id是btnSave,这里改下
saveData();
});
});
//保存数据
function saveData() {
if (!dataValidation()) {
DialogUtil.showInfo("输入的表单数据有误!");
return false;
}
var data = getData();
$.ajax({
url: "/leshan/stationInfo_addStationCheckMessage.do",//对应到站点信息审核的获取方法
type: "post",
async: false,
data: {"jsondata": $.toJSON(data)},
dataType: "json",
contentType: "application/x-www-form-urlencoded",
success: function (response, textStatus, jqXHR) {
if (!!response) {
if (response.isSuccess) {
DialogUtil.showInfo("保存数据成功");
}
else {
if (!!response.msg) {
DialogUtil.showErrorWithInfo("保存数据失败", response.msg);
} else {
DialogUtil.showError("保存数据失败");
}
}
}
}
});
}
//验证数据,看下是否需要验证数据
function dataValidation() {
return true;
}
//获取表单数据
function getData() {
var data = {
baseStationCode: $("#baseStationCode").val(),//资源系统站址编码
baseStationName: $("#baseStationName").val(),//站点名称
examineName: $("#examineName").val(),//审核人
examineTime: $("#examineTime").val(),//审核时间
chkPass: $('input:radio:checked').val(),//获取审核通过的按钮值
examineRemark: $("#examineRemark").val()//审核意见
}
return data;
}
package com.gcidesign.erp.platform.leshan.action;
import com.alibaba.fastjson.JSON;
import com.gcidesign.erp.core.web.action.BaseAction;
import com.gcidesign.erp.platform.leshan.service.StationInfoManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import java.util.Map;
/**
* Created on 2017/8/14.
*/
@Controller(value = "stationInfoAction")
@Scope(value = "prototype")
public class StationInfoAction extends BaseAction {
private final static Logger logger = LoggerFactory.getLogger(StationInfoAction.class);
@Autowired
private StationInfoManager stationInfoManager;
/**
* 站点信息审核
*/
public String stationCheck() {
return SUCCESS;
}
/**
* 站点审核信息的获取
*/
public void addStationCheckMessage(){
String jsondata = request.getParameter("jsondata");
Object succesResponse = JSON.parse(jsondata);
Map<String,String> data = (Map<String,String>)succesResponse;
String baseStationCode = data.get("baseStationCode");
String baseStationName = data.get("baseStationName");
String examineName = data.get("examineName");
String examineTime = data.get("examineTime");
String chkPass = data.get("chkPass");
String examineRemark = data.get("examineRemark");
System.out.println("资源站址编码为:"+baseStationCode+";站点名称为:"+baseStationName+";审核人为:"+examineName);
System.out.println("审核时间为:"+examineTime+";审核结果为:"+chkPass+";审核意见为:"+examineRemark);
result.setEntity(data);
renderJsonToResponse(result);
}
}