<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ page contentType = "text/html; charset=UTF-8" %>
<s:form action="dailyDutyListStore" method="post" name="operation" theme="simple">
<table id="DataList">
<tr>
<th nowrap style="text-align:center;">日期</th>
<th nowrap style="text-align:center;">值班领导</th>
<th nowrap style="text-align:center;">当值值班长</th>
<th nowrap style="text-align:center;">值班警员</th>
<th nowrap style="text-align:center;">值班警力</th>
</tr>
<s:iterator value="dailyDutys" status="status">
<tr>
<td nowrap align="center">
<input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].key" value="<s:property value='key'/>"/>
<input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].dutyDate" value="<s:date name='dutyDate' format='yyyy-MM-dd'/>"/>
<input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].deptName" value="<s:property value='deptName'/>"/>
<input type="hidden" name="dailyDutys[<s:property value='#status.index'/>].deptType" value="<s:property value='deptType'/>"/>
<s:date name="dutyDate" format="yyyy/MM/dd"/>
</td>
<td nowrap align="center">
<input type="text" name="dailyDutys[<s:property value='#status.index'/>].people1" value="<s:property value='people1'/>"/>
</td>
<td nowrap align="center">
<input type="text" name="dailyDutys[<s:property value='#status.index'/>].people2" value="<s:property value='people2'/>"/>
</td>
<td nowrap align="center">
<input type="text" name="dailyDutys[<s:property value='#status.index'/>].people3" value="<s:property value='people3'/>" style="width:400px;"/>
</td>
<td nowrap align="center">
<input type="text" name="dailyDutys[<s:property value='#status.index'/>].dutyNum" value="<fmt:formatNumber value='${dutyNum}' pattern="#" type="number"/>"/>
</td>
</tr>
</s:iterator>
</table>
</s:form>
<tiles:insertTemplate template="../../tiles/bars/submitbar.jsp" flush="true"/>
<style>
.checkboxLabel {
vertical-align:top;
width:180px;
display:inline-block;
}
.selectBox {
border:none;
}
</style>
/**
* 保存值班基本信息。根据保存的value对应的key值来区分是创建create还是修改edit
* 如果key值为空,那就创建;如果key值不为空,那就保存
* @return forward
* @throws ParseException
*/
public String store()
throws NamingException, ParseException
{
if(this._dailyDutys == null || this._dailyDutys.size() == 0)
{
super.addActionError("未找到内容!");
return ERROR;
}
DailyDutyLocal dailyDutyDao = EjbUtil.getDailyDutyLocal();
for(DailyDuty value : this._dailyDutys)
{
if(value == null)
{
continue;
}
if(StringFactory.isNotNull(value.getKey()))//修改
{
DailyDuty theDailyDuty = dailyDutyDao.findDailyDuty(value.getKey());
theDailyDuty.setValue(value);
dailyDutyDao.doMerge(theDailyDuty);
}
else//新建
{
value.setCreateBy(super.getCurrentUser().getName());
dailyDutyDao.createDailyDuty(value);
}
}
return SUCCESS;
}