| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- <%@include file="/context/mytags.jsp"%>
- <!DOCTYPE html>
- <html>
- <head>
- <title>休假申请表</title>
- <t:base type="jquery,easyui,tools,DatePicker"></t:base>
- <script src="plug-in/layer/layer.js"></script>
- <script>
- function btn_ok(){
- var userid = $("#userid").val();
- var holidayType = $(".holidayType").val();
- var stime = $("#holidayStime2").val();
- var etime = $("#holidayEtime2").val();
- var stime1 = $("#holidayStime1").val();
- var etime1 = $("#holidayEtime1").val();
-
- var holidayDuration = $('#holidayDuration').val();
- if(holidayType == '' || userid == ''){
- $("#btnsub").click();
- return;
- }
-
- if(holidayType == 0 || holidayType == 1){
- if(stime == ''){
- layer.alert("请选择休假开始时间!");
- return;
- }
- if(etime == ''){
- layer.alert("请选择休假结束时间!");
- return;
- }
- }else{
- if(stime1 == ''){
- layer.alert("请选择休假开始时间!");
- return;
- }
- if(etime1 == ''){
- layer.alert("请选择休假结束时间!");
- return;
- }
- }
- var temp = '';
- if(holidayType == 0 || holidayType == 1){
- if(holidayDuration == '' || holidayDuration == 0){
- layer.alert("请假类型为事假或病假时,休假总时长为必输入项!");
- return;
- }
- temp = '0';
- }else{
- temp = '1';
- stime = stime1;
- etime = etime1;
- }
-
- $.ajax({
- url:"holidayController.do?isRepeat",
- data:{userid:userid,stime:stime,etime:etime,holidayType:temp},
- dataType:"json",
- type:"POST",
- success:function(result){
- if(result.success){
- $("#btnsub").click();
- }else{
- layer.alert(result.msg);
- }
- }
- });
- }
- function callback(data){
- if(data.success){
- layer.alert(data.msg, { icon: 0 , closeBtn: 0 } ,function(index){
- window.location.href="holidayController.do?list";
- layer.close(index);
- });
- }
- else{
- layer.alert(data.msg);
- }
- }
-
- function updateholidayType(){
- if($(".holidayType").val() == '0' || $(".holidayType").val() == '1'){
- $("#holidayStime2").val("");
- $("#holidayEtime2").val("");
- $(".otherthing").hide();
- $(".thting").show();
- }else{
- $("#holidayStime1").val("");
- $("#holidayEtime1").val("");
- $("#holidayDuration").val("");
- $(".thting").hide();
- $(".otherthing").show();
- }
- }
-
- function num(obj){
- obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
- obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
- obj.value = obj.value.replace(/\.{1,}/g,"."); //只保留第一个, 清除多余的
- obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
- obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d).*$/,'$1$2.5'); //只能输入两个小数
- }
-
- $(function() {
- $("#userid").next("input").next("a").next("a").attr("icon","icon-clean");
- $("#userid").next("input").next("a").next("a").children("span").children("span").attr("class","l-btn-text icon-clean l-btn-icon-left");
-
- /* $("#holidayStime2").val(show2());
- $("#holidayEtime2").val(show2()); */
- });
-
-
- function randomDate(){
- var holidayEtime2 = $("#holidayEtime2").val();
- if(holidayEtime2 != ''){
- var birthday = new Date(holidayEtime2.replace("-", "/").replace("-", "/"));
- var day = birthday.getDate();
- var month=birthday.getMonth() + 1;
- var year=birthday.getFullYear();
- if(day > 1){
- return year+"-"+month+"-01"+" 00:00";
- }else{
- return year+"-"+(month-1)+"-01"+" 00:00";
- }
- }
- }
-
- function randomDate1(){
- var holidayStime2 = $("#holidayStime2").val();
- if(holidayStime2 != ''){
- var birthday = new Date(holidayStime2.replace("-", "/").replace("-", "/"));
- var day = birthday.getDate();
- var month=birthday.getMonth() + 2;
- var year=birthday.getFullYear();
- if(day > 1){
- return year+"-"+month+"-01"+" 23:59";
- }else{
- return year+"-"+month+"-01 23:59";
- }
- }
- }
-
- function show1(){
- var mydate = new Date();
- var str = "" + mydate.getFullYear() + "-";
- var ss = (mydate.getMonth()+1);
- if((mydate.getMonth()+1) < 10){
- ss = "0"+(mydate.getMonth()+1);
- }
- str += ss + "-";
- var s1 = mydate.getDate();
- if(s1 < 10){
- s1 = "0"+(mydate.getDate());
- }
- str += s1;
- return str;
- }
-
- function show2(){
- var mydate = new Date();
- var str = "" + mydate.getFullYear() + "-";
- var ss = (mydate.getMonth()+1);
- if((mydate.getMonth()+1) < 10){
- ss = "0"+(mydate.getMonth()+1);
- }
- str += ss + "-";
- var s1 = mydate.getDate();
- if(s1 < 10){
- s1 = "0"+(mydate.getDate());
- }
- str += s1+ " ";
- var s2 = mydate.getHours();
- if(s2 < 10){
- s2 = "0"+mydate.getHours();
- }
- str += s2 + ":";
- var s3 = mydate.getMinutes();
- if(s3 < 10){
- s3 = "0"+mydate.getMinutes();
- }
- str += s3+ "";
- return str;
- }
- </script>
- <script type="text/javascript">
- //编写自定义JS代码
- function cal(){
- window.location.href="holidayController.do?list";
- }
-
- </script>
- <style type="text/css">
- .fixed-h{
- float:left;
- width:100%;
- min-height:630px;
- overflow:auto;
- background:#ffffff;
- }
- </style>
-
- </head>
- <body>
- <t:formvalid formid="formobj" dialog="false" tipSweep="true" usePlugin="password" layout="table" action="holidayController.do?doAdd" tiptype="1" callback="callback">
- <input id="id" name="id" type="hidden" value="${holidayPage.id }"/>
- <div class="fixed-h">
- <table style="width: 100%;" cellpadding="0" cellspacing="1" class="formtable">
- <tr>
- <td align="right"><label class="Validform_label"><span color="red" class="requiredIcon">*</span>休假员工:</label></td>
- <td class="value">
- <input id="userid" name="userid" type="hidden" value="" />
- <input name="realName" class="inputxt" value="" id="realName" readonly="readonly" datatype="*" />
- <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>
- <span class="Validform_checktip"></span>
- </td>
- </tr>
-
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假类型:
- </label>
- </td>
- <td class="value">
- <t:dictSelect field="holidayType" type="list" extendJson="{onchange:updateholidayType(),class:holidayType}" typeGroupCode="rest_type" datatype="*" defaultVal="${holidayPage.holidayType}" hasLabel="false" title="休假类型"></t:dictSelect>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">休假类型</label>
- </td>
- </tr>
- <tr class="thting">
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假开始时间:
- </label>
- </td>
- <td class="value">
- <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"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">休假开始时间</label>
- </td>
- </tr>
- <tr class="thting">
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假结束时间:
- </label>
- </td>
- <td class="value">
- <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"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">休假结束时间</label>
- </td>
- </tr>
- <tr class="otherthing" style="display:none;">
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假开始时间:
- </label>
- </td>
- <td class="value">
- <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"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">休假开始时间</label>
- </td>
- </tr>
- <tr class="otherthing" style="display:none;">
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假结束时间:
- </label>
- </td>
- <td class="value">
- <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"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">休假结束时间</label>
- </td>
- </tr>
- <tr>
- <td align="right"><label class="Validform_label"></label></td>
- <td class="value">
- (事假病假:整月内申请有效,跨月请假需分开提交)
- <span class="Validform_checktip"></span>
- </td>
- </tr>
- <tr class="thting">
- <td align="right"><label class="Validform_label">休假总时长:</label></td>
- <td class="value">
- <input name="holidayDuration" id="holidayDuration" type="text" style="width: 150px" class="inputxt" maxlength="5" onkeyup="num(this)" />小时(最小单位0.5小时)
- <span class="Validform_checktip"></span>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- <span color="red" class="requiredIcon">*</span>
- 休假原因:
- </label>
- </td>
- <td class="value" colspan="2" >
- <textarea style="width:600px;height: 80px;" class="inputxt" rows="6" id="holidayReason" maxlength="200" name="holidayReason" datatype="*" placeholder="请输入休假原因(最多输入文字数200)"></textarea>
- <label class="Validform_label" style="display: none;">休假原因</label>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">
- 附件:
- </label>
- </td>
- <td class="value" colspan="2" >
- <t:webUploader auto="true"
- busiTable="t_bus_holiday"
- bizType="t_bus_holiday"
- extensions="png,jpg,jpeg,bmp"
- name="attachment" duplicate="true"
- nullMsg="附件不可为空"></t:webUploader>
- </td>
- </tr>
- <tr>
- <td height="100px" align="center" colspan="2">
- </td>
- </tr>
- <tr>
- <td height="50px" align="center" colspan="2">
- <a href="#" class="easyui-linkbutton l-btn" iconcls="icon-confirm" onclick="btn_ok()">确定</a>
- <div style="display:none"><input type="submit" id ="btnsub" value=""/></div>
- <a style="margin-left:0px" href="#" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-return" onclick="cal();">返回</a>
- </td>
- </tr>
- </table>
- </div>
- </t:formvalid>
- </body>
- <script src = "webpage/cn/com/lzt/holiday/holiday.js"></script>
|