| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <%@ 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>
- <style>
- .ui-button {
- display: inline-block;
- padding: 2px 2px;
- margin-bottom: 0;
- font-size: 8px;
- font-weight: normal;
- line-height: 1.42857143;
- text-align: center;
- white-space: nowrap;
- vertical-align: middle;
- -ms-touch-action: manipulation;
- touch-action: manipulation;
- cursor: pointer;
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- background-image: none;
- border: 1px solid transparent;
- border-radius: 4px;
- }
- </style>
- <t:base type="jquery,easyui,tools,DatePicker"></t:base>
- <script src="webpage/cn/com/lzt/useractiviti/select_user_tools.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $('#tt').tabs({
- onSelect:function(title){
- changeTabHeight();
- }
- });
- $(".tabs-wrap").css('width','100%');
- $.Datatype.checkHour = function (val, obj, frm) {
- var msg = true;
- return msg;
- }
- });
- function changeTabHeight(){
- var height =window.top.document.body.offsetHeight;
- height = height -181.3 - 36 - 100 -4;//去掉底部输入框table高度、title高度、弹出框小于后台页面高度、文本格式高度
- $('#tt .panel-body').css('width','auto').css('height',height+'px');
- }
- var _t;
- function openSameDepartUserSelect() {
- _t= $(this);
- var departId=$('#departId').val();
- selectUserByDepart(departId,'选择加班员工',callbacSameDepartUserSelect);
- }
- function callbacSameDepartUserSelect(selectedRows){
- var one = selectedRows[0];
- var userid = one.id;
- var realName = one.realName;
- _t.val(realName);
- _t.parent().find('[name$="userid"]').val(userid);
- var index=getIndex(_t.attr('name'));
- $('#compensate'+index).change();
- }
- function moneySelectChange() {
- var val = $(this).find(':selected').val();
- var name = $(this).attr('name');
- var index = getIndex(name);
- var money=$('#money'+index);
- if(val=='exchange'){//调休
- money.val(0);
- money.attr('readonly','readonly');
- changeTotalMoney();
- //显示用户调休账户余额
- var userId=$('#userid'+index).val();
- if(userId){
- var month = $('#month').val();
- $.post('tBExchangeAccountController.do?getAccountBalance',{userId:userId,year:month},function (d) {
- $('#exchangeAccountLeft'+index).val(d);
- });
- }
- }else {//加班费
- money.removeAttr('readonly');
- $('#exchangeAccountLeft'+index).val('');
- changeMoney(index);
- }
- }
- function getIndex(name){
- var indexStart = name.indexOf('[');
- var indexEnd=name.indexOf(']');
- var index = name.substr(indexStart+1,(indexEnd-indexStart-1));
- return index;
- }
- function bindStartTimeClick(){
- /* var index = getIndex($(this).attr('name'));
- var endTimeId = "endTime"+index
- var overtimeMonth = $('#month').val();
- var minDate =overtimeMonth+'-01 0:0:0';
- var maxDate = "#F{$dp.$D('"+endTimeId+"')||'"+overtimeMonth+"-%ld 23:59:59'}";
- WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',
- minDate:minDate,
- maxDate:maxDate
- });*/
- WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});
- }
- function bindEndTimeClick(){
- /*var index = getIndex($(this).attr('name'));
- var startTimeId = "startTime"+index;
- var overtimeMonth = $('#month').val();
- var minDate ="#F{$dp.$D('"+startTimeId+"')||'"+overtimeMonth+"-01'}";
- var maxDate = overtimeMonth+'-%ld 23:59:59';
- WdatePicker({
- dateFmt:'yyyy-MM-dd HH:mm:ss',
- minDate:minDate,
- maxDate:maxDate
- });*/
- WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});
- }
- function changeMonth() {
- $('#add_tBusActivitiOvertimeDetail_table').html('');
- changeTotalMoney();
- changeTotalTime();
- // $('#add_tBusActivitiOvertimeDetail_table').off('click','input[name$="startTime"]');
- // $('#add_tBusActivitiOvertimeDetail_table').on('click','input[name$="startTime"]',bindTimeClick);
- }
- </script>
- </head>
- <body style="overflow-x: hidden;">
- <%--处理回调--%>
- <c:set var="_callback">
- <c:choose>
- <c:when test="${in_process}">@Overridecallback</c:when>
- <c:otherwise>callback</c:otherwise>
- </c:choose>
- </c:set>
- <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1" action="tBusActivitiOvertimeController.do?doAdd"
- callback="${_callback}" beforeSubmit="beforeSubmit">
- <input id="id" name="id" type="hidden" value="${tBusActivitiOvertimePage.id }"/>
- <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
- <t:tab href="tBusActivitiOvertimeController.do?tBusActivitiOvertimeDetailList&id=${tBusActivitiOvertimePage.id}&in_process=${in_process}&flag=${param.flag}" icon="icon-search" title="加班明细" id="tBusActivitiOvertimeDetail"></t:tab>
- </t:tabs>
- <table cellpadding="0" cellspacing="1" class="formtable">
- <tr>
- <c:if test="${in_process}">
- <td align="right">
- <label class="Validform_label">申请人:</label>
- </td>
- <td class="value">
- ${tBusActivitiOvertimePage.createName}
- </td>
- </c:if>
- <td align="right">
- <label class="Validform_label">加班项目:</label>
- </td>
- <td class="value">
- <input type="hidden" name="departId" id="departId" value="${empty tBusActivitiOvertimePage.departId?param.departId:tBusActivitiOvertimePage.departId}"/>
- <input type="hidden" name="depName" id="depName" value="${empty tBusActivitiOvertimePage.depName?param.depName:tBusActivitiOvertimePage.depName}"/>
- ${empty tBusActivitiOvertimePage.depName?param.depName:tBusActivitiOvertimePage.depName}
- </td>
- <td align="right">
- <label class="Validform_label">核算工资月度:</label>
- </td>
- <td class="value">
- <input id="month" name="month" type="text" style="width: 70px" class="inputxt" datatype="*" readonly="readonly"
- value="${empty tBusActivitiOvertimePage.month?month:tBusActivitiOvertimePage.month}"
- onClick="WdatePicker({dateFmt:'yyyy-MM'})" onchange="changeMonth()"
- />
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">核算工资月度</label>
- </td>
- <td align="right">
- <label class="Validform_label">加班时长总计:</label>
- </td>
- <td class="value">
- <input id="totalHour" name="totalHour" type="text" style="width: 70px" class="inputxt" readonly="readonly" value="${empty tBusActivitiOvertimePage.totalHour?0:tBusActivitiOvertimePage.totalHour}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">加班时长总计</label>
- </td>
- <td align="right" style="display: none;">
- <label class="Validform_label">加班费总计:</label>
- </td>
- <td class="value" style="display: none;">
- <input id="totalMoney" name="totalMoney" type="text" style="width: 70px" class="inputxt" readonly="readonly" ignore="ignore" value="${empty tBusActivitiOvertimePage.totalMoney?0:tBusActivitiOvertimePage.totalMoney}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">总金额</label>
- </td>
- <td align="right">
- <label class="Validform_label">餐费补助总计:</label>
- </td>
- <td class="value">
- <input id="totalMealsSubsidy" name="totalMealsSubsidy" type="text" style="width: 70px" class="inputxt" readonly="readonly"
- value="${empty tBusActivitiOvertimePage.totalMealsSubsidy?0:tBusActivitiOvertimePage.totalMealsSubsidy}"/>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">餐费补助总计</label>
- </td>
- </tr>
- <%--<c:if test="${in_process}">
- <tr>
- <td align="right">
- <label class="Validform_label">剩余预算时长:</label>
- </td>
- <td class="value">
- ${budget}小时
- </td>
- </tr>
- </c:if>--%>
- <tr>
- <td align="right">
- <label class="Validform_label">附件:</label>
- </td>
- <td class="value" align="left" colspan="3">
- <t:webUploader auto="true" busiId="${tBusActivitiOvertimePage.id}" readOnly="${param.load=='detail' || in_process}"
- busiTable="t_bus_activiti_overtime"
- bizType="overtime"
- extensions="png,jpg,jpeg,bmp"
- name="attachment" duplicate="true" fileNumLimit="10"
- nullMsg="附件不可为空"></t:webUploader>
- <span class="Validform_checktip Validform_right" style="display: none;">文件已上传</span>
- </td>
- </tr>
- <tr>
- <td align="right">
- <label class="Validform_label">加班原因:</label>
- </td>
- <td class="value" colspan="10">
- <textarea id="reason" class="inputxt" style="width:100%;height:60px" name="reason" datatype="*" >${tBusActivitiOvertimePage.reason }</textarea>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">加班原因</label>
- </td>
- </tr>
- </table>
- </t:formvalid>
- <!-- 添加 附表明细 模版 -->
- <table style="display:none">
- <tbody id="add_tBusActivitiOvertimeDetail_table_template">
- <tr>
- <td align="center"><div style="width: 25px;" name="xh"></div></td>
- <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].userid" id="userid#index#" maxlength="32" type="hidden" class="inputxt" datatype="*" />
- <input name="tBusActivitiOvertimeDetailList[#index#].realName" id="realName#index#"
- maxlength="32" type="text" readonly="readonly" class="inputxt" />
- <label class="Validform_label" style="display: none;">加班员工</label>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].startTime" id="startTime#index#" maxlength="32" type="text" class="Wdate" style="width:150px;" readonly="readonly"
- onchange="datejisuanOnOverTime(this)"
- />
- <label class="Validform_label" style="display: none;">加班开始时间</label>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].endTime" id="endTime#index#" maxlength="32" type="text" class="Wdate" style="width:150px;" readonly="readonly"
- onchange="datejisuanOnOverTime(this)"
- />
- <label class="Validform_label" style="display: none;">加班结束时间</label>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].hour" id="hour#index#" maxlength="32" type="text" class="inputxt" style="width:120px;" datatype="d"/>
- <%--<span>0小时</span>--%>
- <label class="Validform_label" style="display: none;">加班时长</label>
- </td>
- <td align="left">
- <t:dictSelect field="tBusActivitiOvertimeDetailList[#index#].compensate" type="list" id="compensate#index#"
- typeGroupCode="overtime_compensate" defaultVal="money" hasLabel="false" title="补偿方式" datatype="*"></t:dictSelect>
- <label class="Validform_label" style="display: none;">补偿方式</label>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].money" id="money#index#" maxlength="32" type="text" class="inputxt" style="width:120px;" datatype="d,fix2"
- value="0"
- onchange="changeTotalMoney()"
- />
- <label class="Validform_label" style="display: none;">加班费</label>
- </td>
- <td align="left">
- <input type="text" id="exchangeAccountLeft#index#" class="inputxt" style="width:120px;" readonly="readonly"/>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].mealsSubsidy" type="text" class="inputxt" id="mealsSubsidy#index#" style="width:120px;" datatype="d,fix2" value="0.00"/>
- <label class="Validform_label" style="display: none;">餐费补助</label>
- </td>
-
- <td align="center">
- <input name="tBusActivitiOvertimeDetailList[#index#].confirm" type="checkbox" class="checkbox" style="width:54px;text-align: center;margin-left: 30px" />
- <label class="Validform_label" style="display: none;">大合同以外费用</label>
- </td>
- <td align="left">
- <input name="tBusActivitiOvertimeDetailList[#index#].remark" maxlength="255" type="text" class="inputxt" style="width:300px;"/>
- <label class="Validform_label" style="display: none;">备注</label>
- </td>
- </tr>
- </tbody>
- </table>
- <table style="width: 100%">
- <tr>
- <td style="text-align:center;">
- <%@include file="../view_submit_buttons.jsp"%>
- </td>
- </tr>
- </table>
- </body>
- <script src = "webpage/cn/com/lzt/useractiviti/overtime/tBusActivitiOvertime.js"></script>
- <script>
- function datejisuan(obj){
- var index = getIndex($(obj).attr('name'));
- var startTime = $("#startTime"+index).val();
- var endTime = $("#endTime"+index).val();
- // console.log(index+","+startTime+","+endTime);
- if(startTime && endTime){
- var hours = diffTime(startTime,endTime);
- var hourInput = $('#hour'+index);
- hourInput.val(hours);
- // hourInput.next().html(hours+"小时");
- changeTotalTime();
- changeMoney(index);
- }
- }
- function changeTotalTime(){
- var totalHour = 0;
- $('input[name$="hour"]').each(function(){
- var hour = $(this).val();
- if(hour) {
- totalHour += parseFloat(hour);
- }
- })
- $('#totalHour').val(totalHour);
- $('#totalHourText').html(totalHour+"小时");
- }
- function changeMoney(index){
- var select =$('#compensate'+index);
- var selectVal = select.find(":selected").val();
- if(selectVal=='money') {//加班费
- var hour = $('#hour'+index).val();
- var userId =$('#userid'+index).val();
- if(hour){
- $.post('tBusActivitiOvertimeController.do?getBaseHourWage',{userId:userId},function(d){
- var money = parseFloat(hour)*d*1.5;
- $('#money'+index).val(money.toFixed(1));
- changeTotalMoney();
- });
- }
- }
- }
- function changeTotalMoney() {
- var totalMoney = 0;
- $('input[name$="money"]').each(function(){
- var money = $(this).val();
- if(money) {
- totalMoney += parseFloat(money);
- }
- });
- totalMoney=totalMoney.toFixed(1);
- $('#totalMoney').val(totalMoney);
- $('#totalMoneyText').html(totalMoney+"元");
- }
- function diffmm(startDate,endDate){
- var diff=Date.parse(endDate.replace(/-/g,"/")) - Date.parse(startDate.replace(/-/g,"/"));//时间差的毫秒数
- return Math.round(diff/(60*1000));
- }
- function diffTime(startDate,endDate) {
- var diff= Date.parse(endDate.replace(/-/g,"/")) - Date.parse(startDate.replace(/-/g,"/"));//时间差的毫秒数
- //计算出相差天数
- var days=Math.floor(diff/(24*3600*1000));
- //计算出小时数
- var leftHour=diff%(3600*1000)/3600/1000; //计算小时后剩余的毫秒数
- if(leftHour>=0.5){
- leftHour=0.5;
- }else {
- leftHour=0;
- }
- var hours=Math.floor(diff/(3600*1000))+leftHour;
- if(hours<0){
- hours=0;
- }
- //计算相差分钟数
- /*var leave2=leave1%(3600*1000); //计算小时数后剩余的毫秒数
- var minutes=Math.floor(leave2/(60*1000));
- //计算相差秒数
- /!* var leave3=leave2%(60*1000); //计算分钟数后剩余的毫秒数
- var seconds=Math.round(leave3/1000);
- var returnStr = seconds + "秒"; *!/
- var returnStr = "";
- if(minutes>0) {
- returnStr = minutes + "分" + returnStr;
- }else{
- returnStr = "0分" + returnStr;
- }
- if(hours>0) {
- returnStr = hours + "小时" + returnStr;
- }else{
- returnStr = "0小时" + returnStr;
- }
- if(days>0) {
- returnStr = days + "天" + returnStr;
- }*/
- return hours;
- }
-
- function beforeSubmit() {
- var length = $('#tt').find('input[name$="userid"]').length;
- if(length==0){
- tip('请添加加班用户');
- return false;
- }
- changeTotalTime();
- changeTotalMoney();
- return true;
- }
- </script>
|