holiday-add.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>休假申请表</title>
  7. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  8. <script src="plug-in/layer/layer.js"></script>
  9. <script>
  10. function btn_ok(){
  11. var userid = $("#userid").val();
  12. var holidayType = $(".holidayType").val();
  13. var stime = $("#holidayStime2").val();
  14. var etime = $("#holidayEtime2").val();
  15. var stime1 = $("#holidayStime1").val();
  16. var etime1 = $("#holidayEtime1").val();
  17. var holidayDuration = $('#holidayDuration').val();
  18. if(holidayType == '' || userid == ''){
  19. $("#btnsub").click();
  20. return;
  21. }
  22. if(holidayType == 0 || holidayType == 1){
  23. if(stime == ''){
  24. layer.alert("请选择休假开始时间!");
  25. return;
  26. }
  27. if(etime == ''){
  28. layer.alert("请选择休假结束时间!");
  29. return;
  30. }
  31. }else{
  32. if(stime1 == ''){
  33. layer.alert("请选择休假开始时间!");
  34. return;
  35. }
  36. if(etime1 == ''){
  37. layer.alert("请选择休假结束时间!");
  38. return;
  39. }
  40. }
  41. var temp = '';
  42. if(holidayType == 0 || holidayType == 1){
  43. if(holidayDuration == '' || holidayDuration == 0){
  44. layer.alert("请假类型为事假或病假时,休假总时长为必输入项!");
  45. return;
  46. }
  47. temp = '0';
  48. }else{
  49. temp = '1';
  50. stime = stime1;
  51. etime = etime1;
  52. }
  53. $.ajax({
  54. url:"holidayController.do?isRepeat",
  55. data:{userid:userid,stime:stime,etime:etime,holidayType:temp},
  56. dataType:"json",
  57. type:"POST",
  58. success:function(result){
  59. if(result.success){
  60. $("#btnsub").click();
  61. }else{
  62. layer.alert(result.msg);
  63. }
  64. }
  65. });
  66. }
  67. function callback(data){
  68. if(data.success){
  69. layer.alert(data.msg, { icon: 0 , closeBtn: 0 } ,function(index){
  70. window.location.href="holidayController.do?list";
  71. layer.close(index);
  72. });
  73. }
  74. else{
  75. layer.alert(data.msg);
  76. }
  77. }
  78. function updateholidayType(){
  79. if($(".holidayType").val() == '0' || $(".holidayType").val() == '1'){
  80. $("#holidayStime2").val("");
  81. $("#holidayEtime2").val("");
  82. $(".otherthing").hide();
  83. $(".thting").show();
  84. }else{
  85. $("#holidayStime1").val("");
  86. $("#holidayEtime1").val("");
  87. $("#holidayDuration").val("");
  88. $(".thting").hide();
  89. $(".otherthing").show();
  90. }
  91. }
  92. function num(obj){
  93. obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
  94. obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
  95. obj.value = obj.value.replace(/\.{1,}/g,"."); //只保留第一个, 清除多余的
  96. obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
  97. obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d).*$/,'$1$2.5'); //只能输入两个小数
  98. }
  99. $(function() {
  100. $("#userid").next("input").next("a").next("a").attr("icon","icon-clean");
  101. $("#userid").next("input").next("a").next("a").children("span").children("span").attr("class","l-btn-text icon-clean l-btn-icon-left");
  102. /* $("#holidayStime2").val(show2());
  103. $("#holidayEtime2").val(show2()); */
  104. });
  105. function randomDate(){
  106. var holidayEtime2 = $("#holidayEtime2").val();
  107. if(holidayEtime2 != ''){
  108. var birthday = new Date(holidayEtime2.replace("-", "/").replace("-", "/"));
  109. var day = birthday.getDate();
  110. var month=birthday.getMonth() + 1;
  111. var year=birthday.getFullYear();
  112. if(day > 1){
  113. return year+"-"+month+"-01"+" 00:00";
  114. }else{
  115. return year+"-"+(month-1)+"-01"+" 00:00";
  116. }
  117. }
  118. }
  119. function randomDate1(){
  120. var holidayStime2 = $("#holidayStime2").val();
  121. if(holidayStime2 != ''){
  122. var birthday = new Date(holidayStime2.replace("-", "/").replace("-", "/"));
  123. var day = birthday.getDate();
  124. var month=birthday.getMonth() + 2;
  125. var year=birthday.getFullYear();
  126. if(day > 1){
  127. return year+"-"+month+"-01"+" 23:59";
  128. }else{
  129. return year+"-"+month+"-01 23:59";
  130. }
  131. }
  132. }
  133. function show1(){
  134. var mydate = new Date();
  135. var str = "" + mydate.getFullYear() + "-";
  136. var ss = (mydate.getMonth()+1);
  137. if((mydate.getMonth()+1) < 10){
  138. ss = "0"+(mydate.getMonth()+1);
  139. }
  140. str += ss + "-";
  141. var s1 = mydate.getDate();
  142. if(s1 < 10){
  143. s1 = "0"+(mydate.getDate());
  144. }
  145. str += s1;
  146. return str;
  147. }
  148. function show2(){
  149. var mydate = new Date();
  150. var str = "" + mydate.getFullYear() + "-";
  151. var ss = (mydate.getMonth()+1);
  152. if((mydate.getMonth()+1) < 10){
  153. ss = "0"+(mydate.getMonth()+1);
  154. }
  155. str += ss + "-";
  156. var s1 = mydate.getDate();
  157. if(s1 < 10){
  158. s1 = "0"+(mydate.getDate());
  159. }
  160. str += s1+ " ";
  161. var s2 = mydate.getHours();
  162. if(s2 < 10){
  163. s2 = "0"+mydate.getHours();
  164. }
  165. str += s2 + ":";
  166. var s3 = mydate.getMinutes();
  167. if(s3 < 10){
  168. s3 = "0"+mydate.getMinutes();
  169. }
  170. str += s3+ "";
  171. return str;
  172. }
  173. </script>
  174. <script type="text/javascript">
  175. //编写自定义JS代码
  176. function cal(){
  177. window.location.href="holidayController.do?list";
  178. }
  179. </script>
  180. <style type="text/css">
  181. .fixed-h{
  182. float:left;
  183. width:100%;
  184. min-height:630px;
  185. overflow:auto;
  186. background:#ffffff;
  187. }
  188. </style>
  189. </head>
  190. <body>
  191. <t:formvalid formid="formobj" dialog="false" tipSweep="true" usePlugin="password" layout="table" action="holidayController.do?doAdd" tiptype="1" callback="callback">
  192. <input id="id" name="id" type="hidden" value="${holidayPage.id }"/>
  193. <div class="fixed-h">
  194. <table style="width: 100%;" cellpadding="0" cellspacing="1" class="formtable">
  195. <tr>
  196. <td align="right"><label class="Validform_label"><span color="red" class="requiredIcon">*</span>休假员工:</label></td>
  197. <td class="value">
  198. <input id="userid" name="userid" type="hidden" value="" />
  199. <input name="realName" class="inputxt" value="" id="realName" readonly="readonly" datatype="*" />
  200. <t:choose hiddenName="userid" hiddenid="id" left="50%" width="670" height="450" url="correctionController.do?userWorkflow&type=holiday" name="userList1" icon="icon-select" title="选择休假员工" textname="realName" isclear="true" isInit="true"></t:choose>
  201. <span class="Validform_checktip"></span>
  202. </td>
  203. </tr>
  204. <tr>
  205. <td align="right">
  206. <label class="Validform_label">
  207. <span color="red" class="requiredIcon">*</span>
  208. 休假类型:
  209. </label>
  210. </td>
  211. <td class="value">
  212. <t:dictSelect field="holidayType" type="list" extendJson="{onchange:updateholidayType(),class:holidayType}" typeGroupCode="rest_type" datatype="*" defaultVal="${holidayPage.holidayType}" hasLabel="false" title="休假类型"></t:dictSelect>
  213. <span class="Validform_checktip"></span>
  214. <label class="Validform_label" style="display: none;">休假类型</label>
  215. </td>
  216. </tr>
  217. <tr class="thting">
  218. <td align="right">
  219. <label class="Validform_label">
  220. <span color="red" class="requiredIcon">*</span>
  221. 休假开始时间:
  222. </label>
  223. </td>
  224. <td class="value">
  225. <input id="holidayStime2" name="holidayStime2" readonly="readonly" type="text" style="width: 150px" class="Wdate" onClick="var date=randomDate();WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:date,maxDate:'#F{$dp.$D(\'holidayEtime2\')}'})" placeholder="yyyy-MM-dd HH:mm"/>
  226. <span class="Validform_checktip"></span>
  227. <label class="Validform_label" style="display: none;">休假开始时间</label>
  228. </td>
  229. </tr>
  230. <tr class="thting">
  231. <td align="right">
  232. <label class="Validform_label">
  233. <span color="red" class="requiredIcon">*</span>
  234. 休假结束时间:
  235. </label>
  236. </td>
  237. <td class="value">
  238. <input id="holidayEtime2" name="holidayEtime2" type="text" style="width: 150px" readonly="readonly" class="Wdate" onClick="var date1=randomDate1();WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'#F{$dp.$D(\'holidayStime2\')}',maxDate:date1})" placeholder="yyyy-MM-dd HH:mm"/>
  239. <span class="Validform_checktip"></span>
  240. <label class="Validform_label" style="display: none;">休假结束时间</label>
  241. </td>
  242. </tr>
  243. <tr class="otherthing" style="display:none;">
  244. <td align="right">
  245. <label class="Validform_label">
  246. <span color="red" class="requiredIcon">*</span>
  247. 休假开始时间:
  248. </label>
  249. </td>
  250. <td class="value">
  251. <input id="holidayStime1" name="holidayStime1" readonly="readonly" type="text" style="width: 150px" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'holidayEtime1\')}'})" placeholder="yyyy-MM-dd"/>
  252. <span class="Validform_checktip"></span>
  253. <label class="Validform_label" style="display: none;">休假开始时间</label>
  254. </td>
  255. </tr>
  256. <tr class="otherthing" style="display:none;">
  257. <td align="right">
  258. <label class="Validform_label">
  259. <span color="red" class="requiredIcon">*</span>
  260. 休假结束时间:
  261. </label>
  262. </td>
  263. <td class="value">
  264. <input id="holidayEtime1" name="holidayEtime1" type="text" style="width: 150px" readonly="readonly" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'holidayStime1\')}'})" placeholder="yyyy-MM-dd"/>
  265. <span class="Validform_checktip"></span>
  266. <label class="Validform_label" style="display: none;">休假结束时间</label>
  267. </td>
  268. </tr>
  269. <tr>
  270. <td align="right"><label class="Validform_label"></label></td>
  271. <td class="value">
  272. (事假病假:整月内申请有效,跨月请假需分开提交)
  273. <span class="Validform_checktip"></span>
  274. </td>
  275. </tr>
  276. <tr class="thting">
  277. <td align="right"><label class="Validform_label">休假总时长:</label></td>
  278. <td class="value">
  279. <input name="holidayDuration" id="holidayDuration" type="text" style="width: 150px" class="inputxt" maxlength="5" onkeyup="num(this)" />小时(最小单位0.5小时)
  280. <span class="Validform_checktip"></span>
  281. </td>
  282. </tr>
  283. <tr>
  284. <td align="right">
  285. <label class="Validform_label">
  286. <span color="red" class="requiredIcon">*</span>
  287. 休假原因:
  288. </label>
  289. </td>
  290. <td class="value" colspan="2" >
  291. <textarea style="width:600px;height: 80px;" class="inputxt" rows="6" id="holidayReason" maxlength="200" name="holidayReason" datatype="*" placeholder="请输入休假原因(最多输入文字数200)"></textarea>
  292. <label class="Validform_label" style="display: none;">休假原因</label>
  293. </td>
  294. </tr>
  295. <tr>
  296. <td align="right">
  297. <label class="Validform_label">
  298. 附件:
  299. </label>
  300. </td>
  301. <td class="value" colspan="2" >
  302. <t:webUploader auto="true"
  303. busiTable="t_bus_holiday"
  304. bizType="t_bus_holiday"
  305. extensions="png,jpg,jpeg,bmp"
  306. name="attachment" duplicate="true"
  307. nullMsg="附件不可为空"></t:webUploader>
  308. </td>
  309. </tr>
  310. <tr>
  311. <td height="100px" align="center" colspan="2">
  312. </td>
  313. </tr>
  314. <tr>
  315. <td height="50px" align="center" colspan="2">
  316. <a href="#" class="easyui-linkbutton l-btn" iconcls="icon-confirm" onclick="btn_ok()">确定</a>
  317. <div style="display:none"><input type="submit" id ="btnsub" value=""/></div>
  318. <a style="margin-left:0px" href="#" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-return" onclick="cal();">返回</a>
  319. </td>
  320. </tr>
  321. </table>
  322. </div>
  323. </t:formvalid>
  324. </body>
  325. <script src = "webpage/cn/com/lzt/holiday/holiday.js"></script>