atsShiftInfoEdit.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <%--
  2. time:2015-05-18 17:21:46
  3. desc:edit the 班次设置
  4. --%>
  5. <%@page language="java" pageEncoding="UTF-8"%>
  6. <%@include file="/commons/include/html_doctype.html"%>
  7. <html>
  8. <head>
  9. <title>编辑 班次设置</title>
  10. <%@include file="/commons/include/form.jsp" %>
  11. <f:link href="listEdit.css"></f:link>
  12. <script type="text/javascript" src="${ctx}/js/hotent/CustomValid.js"></script>
  13. <script type="text/javascript" src="${ctx}/js/hotent/platform/ats/AtsDialog.js"></script>
  14. <script type="text/javascript" src="${ctx}/js/hotent/platform/system/SysDialog.js"></script>
  15. <script type="text/javascript">
  16. $(function() {
  17. $("a.save").click(function() {
  18. $("#atsShiftInfoForm").attr("action","save.ht");
  19. submitForm();
  20. });
  21. initDetailList();
  22. });
  23. //提交表单
  24. function submitForm(){
  25. var options={};
  26. if(showResponse){
  27. options.success=showResponse;
  28. }
  29. var frm=$('#atsShiftInfoForm').form();
  30. var sub=$('#trContainer').form();
  31. frm.ajaxForm(options);
  32. if(frm.valid()&&sub.valid()){
  33. $('#detailList').val(getDetailList());
  34. frm.submit();
  35. }
  36. }
  37. function showResponse(responseText) {
  38. var obj = new com.hotent.form.ResultMessage(responseText);
  39. if (obj.isSuccess()) {
  40. $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  41. if(rtn){
  42. window.location.href = window.location.href;
  43. }else{
  44. window.location.href = "${ctx}/platform/ats/atsShiftInfo/list.ht";
  45. }
  46. });
  47. } else {
  48. $.ligerDialog.err("提示信息","班次设置保存失败!",obj.getMessage());
  49. }
  50. }
  51. function getDetailList(){
  52. var json = [];
  53. $("#trContainer tr[var='templTr']").each(function(){
  54. var me = $(this),obj={};
  55. obj.segment =$("select[var='segment']",me).val();
  56. obj.attendanceType =$("select[var='attendanceType']",me).val();
  57. obj.onType =$("select[var='onType']",me).val();
  58. obj.onTime =$("input[var='onTime']",me).val();
  59. obj.onPunchCard =$("select[var='onPunchCard']",me).val();
  60. obj.onFloatAdjust =$("input[var='onFloatAdjust']",me).val();
  61. obj.segmentRest =$("input[var='segmentRest']",me).val();
  62. obj.offType =$("select[var='offType']",me).val();
  63. obj.offTime =$("input[var='offTime']",me).val();
  64. obj.offPunchCard =$("select[var='offPunchCard']",me).val();
  65. obj.offFloatAdjust =$("input[var='offFloatAdjust']",me).val();
  66. json.push(obj);
  67. });
  68. return JSON2.stringify(json)
  69. }
  70. function initDetailList() {
  71. var detailList = $('#detailList').val();
  72. if ($.isEmpty(detailList))
  73. return;
  74. var detailLists = $.parseJSON(detailList),
  75. temp = $($("#templ .table-detail tr")[0]);
  76. for (var i = 0, c; c = detailLists[i++];) {
  77. var tr = temp.clone(true, true);
  78. $("select[var='segment']", tr).val(c.segment);
  79. $("select[var='attendanceType']", tr).val(c.attendanceType);
  80. $("select[var='onType']", tr).val(c.onType);
  81. $("input[var='onTime']", tr).val(c.onTime);
  82. $("select[var='onPunchCard']", tr).val(c.onPunchCard);
  83. $("input[var='onFloatAdjust']", tr).val(c.onFloatAdjust);
  84. $("input[var='segmentRest']", tr).val(c.segmentRest);
  85. $("select[var='offType']", tr).val(c.offType);
  86. $("input[var='offTime']", tr).val(c.offTime);
  87. $("select[var='offPunchCard']", tr).val(c.offPunchCard);
  88. $("input[var='offFloatAdjust']", tr).val(c.offFloatAdjust);
  89. $("#trContainer").append(tr);
  90. }
  91. }
  92. function addRow(i){
  93. var tr = $($("#templ .table-detail tr")[0]).clone(true, true);
  94. $('[var="segment"]' ,tr).val(i);
  95. $("#trContainer").append(tr);
  96. }
  97. function delAllRow(){
  98. $("#trContainer").empty();
  99. }
  100. function delTr(obj) {
  101. $(obj).closest("tr").remove();
  102. }
  103. function selectOrg(){
  104. OrgDialog({isSingle:true,callback:function(orgId,orgName){
  105. $('#orgId').val(orgId);
  106. $('#orgName').val(orgName);
  107. }});
  108. }
  109. function selectCardRule(){
  110. AtsCardRuleDialog({callback:function(rtn){
  111. $('#cardRule').val(rtn.id);
  112. $('#cardRuleName').val(rtn.name);
  113. delAllRow();
  114. if(rtn.segmentNum == '1'){
  115. addRow(1);
  116. }
  117. if(rtn.segmentNum == '2'){
  118. addRow(1);
  119. addRow(2);
  120. }
  121. if(rtn.segmentNum == '3'){
  122. addRow(1);
  123. addRow(2);
  124. addRow(3);
  125. }
  126. }});
  127. }
  128. </script>
  129. </head>
  130. <body>
  131. <div class="panel">
  132. <div class="panel-top">
  133. <div class="tbar-title">
  134. <c:choose>
  135. <c:when test="${atsShiftInfo.id !=null}">
  136. <span class="tbar-label"><span></span>编辑班次设置</span>
  137. </c:when>
  138. <c:otherwise>
  139. <span class="tbar-label"><span></span>添加班次设置</span>
  140. </c:otherwise>
  141. </c:choose>
  142. </div>
  143. <div class="panel-toolbar">
  144. <div class="toolBar">
  145. <div class="group"><a class="link save" id="dataFormSave" href="javaScript:void(0)"><span></span>保存</a></div>
  146. <div class="l-bar-separator"></div>
  147. <div class="group"><a class="link back" href="list.ht"><span></span>返回</a></div>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="panel-body">
  152. <form id="atsShiftInfoForm" method="post" action="save.ht">
  153. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
  154. <tr>
  155. <th width="20%">编码: </th>
  156. <td><input type="text" id="code" name="code" value="${atsShiftInfo.code}" class="inputText" validate="{required:true,maxlength:384}" /></td>
  157. <th width="20%">名称: </th>
  158. <td><input type="text" id="name" name="name" value="${atsShiftInfo.name}" class="inputText" validate="{required:true,maxlength:384}" /></td>
  159. </tr>
  160. <tr>
  161. <th width="20%">班次类型: </th>
  162. <td>
  163. <select id="shiftType" name="shiftType">
  164. <option value="">--请选择--</option>
  165. <c:forEach items="${shiftTypeList}" var="shiftType">
  166. <option value="${shiftType.id}" <c:if test="${shiftType.id==atsShiftInfo.shiftType}">selected="selected" </c:if>>${shiftType.name}</option>
  167. </c:forEach>
  168. </select>
  169. </td>
  170. <th width="20%">加班补偿方式: </th>
  171. <td><input type="text" id="otCompens" name="otCompens" value="${atsShiftInfo.otCompens}" class="inputText" validate="{number:true,maxIntLen:19}" readonly="readonly" /></td>
  172. </tr>
  173. <tr>
  174. <th width="20%">所属组织: </th>
  175. <td>
  176. <input type="hidden" id="orgId" name="orgId" value="${atsShiftInfo.orgId}" />
  177. <input type="text" id="orgName" validate="{required:true}" value="${atsShiftInfo.orgName}" readonly="readonly"/>
  178. <a href="javascript:;" onclick="selectOrg()" class="button"><span>选 择...</span></a>
  179. </td>
  180. <th width="20%">取卡规则: </th>
  181. <td>
  182. <input type="hidden" id="cardRule" name="cardRule" value="${atsShiftInfo.cardRule}" />
  183. <input type="text" id="cardRuleName" value="${atsShiftInfo.cardRuleName}" readonly="readonly" />
  184. <a href="javascript:;" onclick="selectCardRule()" class="button"><span>选 择...</span></a>
  185. </td>
  186. </tr>
  187. <tr>
  188. <th width="20%">标准工时: </th>
  189. <td><input type="text" id="standardHour" name="standardHour" value="${atsShiftInfo.standardHour}" class="inputText" validate="{required:true}" /></td>
  190. <th width="20%">默认班次: </th>
  191. <td>
  192. <input type="checkbox" id="isDefault" name="isDefault" value="1" <c:if test="${atsShiftInfo.isDefault ==1}"> checked="checked"</c:if> />
  193. </td>
  194. </tr>
  195. <tr>
  196. <th width="20%">描述: </th>
  197. <td colspan="3">
  198. <textarea rows="3" cols="5" id="memo" name="memo" class="inputText">${atsShiftInfo.memo}</textarea>
  199. </td>
  200. </tr>
  201. </table>
  202. <input type="hidden" name="id" value="${atsShiftInfo.id}" />
  203. <input type="hidden" id="status" name="status" value="${atsShiftInfo.status}" />
  204. <textarea style="display: none" id="detailList" name="detailList">${fn:escapeXml(atsShiftInfo.detailList)}</textarea>
  205. </form>
  206. <div class="panel-body" >
  207. <table cellpadding="1" cellspacing="1" class="table-grid">
  208. <tr>
  209. <th align="center">段次</th>
  210. <th align="center">出勤类型</th>
  211. <th align="center">上班时间</th>
  212. <th align="center">上班是否打卡</th>
  213. <th align="center">浮动调整值(分)</th>
  214. <th align="center">段内休息(分)</th>
  215. <th align="center">下班时间</th>
  216. <th align="center">下班是否打卡</th>
  217. <th align="center">浮动调整值(分)</th>
  218. </tr>
  219. <tbody id="trContainer">
  220. </tbody>
  221. </table>
  222. </div>
  223. </div>
  224. <div id="templ" style="display: none;">
  225. <table cellpadding="1" cellspacing="1" class="table-detail">
  226. <tbody>
  227. <tr var="templTr">
  228. <td><select var="segment" disabled="disabled">
  229. <option value="1">第一段</option>
  230. <option value="2">第二段</option>
  231. <option value="3">第三段</option>
  232. </select>
  233. </td>
  234. <td>
  235. <select var="attendanceType" >
  236. <option value="0">正常出勤</option>
  237. <option value="1">固定加班</option>
  238. <option value="2">正常出勤不计异常</option>
  239. <option value="3">固定加班不计异常</option>
  240. </select>
  241. </td>
  242. <td>
  243. <select var="onType" >
  244. <option value="2">今天</option>
  245. <option value="1">昨天</option>
  246. </select>
  247. <input type="text" var="onTime" class="wdateTime" datefmt="HH:mm" style="width: 80px;" validate="{required:true}">
  248. </td>
  249. <td>
  250. <select var="onPunchCard">
  251. <option value="1">是</option>
  252. <option value="0">否</option>
  253. </select>
  254. </td>
  255. <td>
  256. <input type="text" var="onFloatAdjust" style="width: 80px;">
  257. </td>
  258. <td>
  259. <input type="text" var="segmentRest" style="width: 80px;">
  260. </td>
  261. <td>
  262. <select var="offType" >
  263. <option value="2">今天</option>
  264. <option value="3">明天</option>
  265. </select>
  266. <input type="text" var="offTime" class="wdateTime" datefmt="HH:mm" style="width: 80px;" validate="{required:true}">
  267. </td>
  268. <td>
  269. <select var="offPunchCard">
  270. <option value="1">是</option>
  271. <option value="0">否</option>
  272. </select>
  273. </td>
  274. <td>
  275. <input type="text" var="offFloatAdjust" style="width: 80px;">
  276. </td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. </div>
  281. </div>
  282. </div>
  283. </body>
  284. </html>