tBusActivitiOvertimeWorkingHours-add.jsp 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  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>按工时结算add页面</title>
  7. <style>
  8. .ui-button {
  9. display: inline-block;
  10. padding: 2px 2px;
  11. margin-bottom: 0;
  12. font-size: 8px;
  13. font-weight: normal;
  14. line-height: 1.42857143;
  15. text-align: center;
  16. white-space: nowrap;
  17. vertical-align: middle;
  18. -ms-touch-action: manipulation;
  19. touch-action: manipulation;
  20. cursor: pointer;
  21. -webkit-user-select: none;
  22. -moz-user-select: none;
  23. -ms-user-select: none;
  24. user-select: none;
  25. background-image: none;
  26. border: 1px solid transparent;
  27. border-radius: 4px;
  28. }
  29. .click_btu {
  30. cursor: pointer;
  31. }
  32. .unclick_btu {
  33. /*cursor: no-drop;*/
  34. }
  35. .disabled_box {
  36. background-color: #00000000 !important;
  37. color: #393937 !important;
  38. border: none !important;
  39. /*cursor: no-drop;*/
  40. }
  41. select:hover {
  42. cursor: pointer;
  43. }
  44. select[disabled] {
  45. background-color: #00000000 !important;
  46. border: none !important;
  47. color: #393937 !important;
  48. cursor: no-drop;
  49. }
  50. #tBusActivitiOvertimeDetail {
  51. overflow-x: scroll !important;
  52. }
  53. .formtable {
  54. display: flex;
  55. }
  56. .formtable tr {
  57. display: flex;
  58. flex-wrap: wrap;
  59. align-content: center;
  60. align-items: center;
  61. }
  62. </style>
  63. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  64. <script src="webpage/cn/com/lzt/useractiviti/select_user_tools.js"></script>
  65. <script type="text/javascript">
  66. $(document).ready(function () {
  67. $(".tabs-wrap").css('width', '100%');
  68. $.Datatype.checkHour = function (val, obj, frm) {
  69. var msg = true;
  70. return msg;
  71. }
  72. });
  73. //获取页面类型
  74. var pageType = '${pageType}';
  75. //文件暂存对象
  76. var fileListInfo = []
  77. // add-刘梦祥-2021年11月10日18:09:56-数据渲染逻辑优化,文件渲染获取逻辑
  78. $(() => {
  79. if (pageType === 'Update' || pageType === 'Detail') {
  80. if ('${tBusActivitiOvertimePage.attachment}' != null && '${tBusActivitiOvertimePage.attachment}' != '') {
  81. fileListInfo = JSON.parse(JSON.stringify(${tBusActivitiOvertimePage.attachment}))
  82. changeFileListDom()
  83. } else {
  84. changeFileListDom()
  85. }
  86. }
  87. if (pageType === 'Detail') {
  88. $('select').attr('disabled', 'disabled');
  89. $('input').attr('disabled', 'disabled');
  90. }
  91. })
  92. // add-刘梦祥-2021年11月10日18:10:04-自定义上传文件回调函数
  93. function uploadSuccess(response) {
  94. if (response.success) {
  95. var fileList = $('#attachment')
  96. var fileListVar = fileList.val()
  97. //去重
  98. if (fileListVar.indexOf(response.attributes.name) !== -1) {
  99. //重复的话直接return
  100. return;
  101. } else {
  102. //得到返回的文件名和请求路径
  103. var fileInfo = {name: response.attributes.name, url: response.attributes.url}
  104. //总集合加入元素
  105. fileListInfo.push(fileInfo)
  106. //更新提示文件列表
  107. changeFileListDom()
  108. }
  109. }
  110. }
  111. //add-刘梦祥-2021年11月10日18:10:21-根据fileListInfo对象更新input绑定框中的值
  112. function changeAttachment() {
  113. $('#attachment').val(JSON.stringify(fileListInfo))
  114. }
  115. //add-刘梦祥-2021年11月10日18:10:28-更新提示文件列表
  116. function changeFileListDom() {
  117. //首先清空提示文件列表
  118. $('#fileListInfoDom').empty();
  119. //值不为空的话
  120. if (fileListInfo.length > 0) {
  121. fileListInfo.forEach((item, index) => {
  122. //生成临时标签
  123. var jspDomStr = `<div class="fileInfoItemBox"><div class="fileName">` + item.name + `</div>--文件上传成功--`
  124. if (pageType === 'Detail') {
  125. jspDomStr += `<a class="down" href="${webRoot}/` + item.url + `" download="` + item.name + `">下载</a>`;
  126. } else {
  127. jspDomStr += `<span class="del" onclick="deleteFile(` + index + `)">删除</span>`;
  128. }
  129. jspDomStr += `</div>`;
  130. //追加到显示的dom元素中
  131. $('#fileListInfoDom').append(jspDomStr)
  132. })
  133. }
  134. // 根据fileListInfo对象更新input绑定框中的值
  135. changeAttachment()
  136. }
  137. //add-刘梦祥-2021年11月10日18:10:40-删除文件操作
  138. function deleteFile(index) {
  139. fileListInfo.splice(index, 1)
  140. changeFileListDom()
  141. }
  142. var _t;
  143. function overTimeopenSameDepartUserSelect() {
  144. _t = $(this);
  145. //获取用户的科室id信息
  146. var departId = $('#departId').val();
  147. selectUserByDepart(departId, '选择加班员工', callbacSameDepartUserSelect);
  148. }
  149. function callbacSameDepartUserSelect(selectedRows) {
  150. var one = selectedRows[0];
  151. var userid = one.id;
  152. var realName = one.realName;
  153. // 获取员工时,同时获取科室信息
  154. var orgCode = one.orgIds;
  155. _t.val(realName);
  156. _t.parent().find('[name$="userid"]').val(userid);
  157. var index = getIndex(_t.attr('name'));
  158. $('#departId' + index).val(orgCode);
  159. $('#compensate' + index).change();
  160. }
  161. function moneySelectChange() {
  162. var val = $(this).find(':selected').val();
  163. var name = $(this).attr('name');
  164. var index = getIndex(name);
  165. var money = $('#money' + index);
  166. if (val == 'exchange') {//调休
  167. money.val(0);
  168. money.attr('readonly', 'readonly');
  169. changeTotalMoney();
  170. //显示用户调休账户余额
  171. var userId = $('#userid' + index).val();
  172. if (userId) {
  173. var month = $('#month').val();
  174. $.post('tBExchangeAccountController.do?getAccountBalance', {
  175. userId: userId,
  176. year: month
  177. }, function (d) {
  178. $('#exchangeAccountLeft' + index).val(d);
  179. });
  180. }
  181. } else {//加班费
  182. money.removeAttr('readonly');
  183. $('#exchangeAccountLeft' + index).val('');
  184. // changeMoney(index);
  185. }
  186. }
  187. function getIndex(name) {
  188. var indexStart = name.indexOf('[');
  189. var indexEnd = name.indexOf(']');
  190. var index = name.substr(indexStart + 1, (indexEnd - indexStart - 1));
  191. return index;
  192. }
  193. function overTimeBindStartTimeClick() {
  194. WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});
  195. }
  196. function overTimeBindEndTimeClick() {
  197. WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});
  198. }
  199. function changeMonth() {
  200. $('#add_tBusActivitiOvertimeDetail_table').html('');
  201. changeTotalMoney();
  202. changeTotalTime();
  203. }
  204. </script>
  205. </head>
  206. <body style="overflow-x: hidden;">
  207. <%--处理回调--%>
  208. <c:set var="_callback">
  209. <c:choose>
  210. <c:when test="${in_process}">@Overridecallback</c:when>
  211. <c:otherwise>callback</c:otherwise>
  212. </c:choose>
  213. </c:set>
  214. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1"
  215. action="tBusActivitiOvertimeController.do?doAdd"
  216. callback="${_callback}" beforeSubmit="beforeSubmit">
  217. <input id="id" name="id" type="hidden" value="${tBusActivitiOvertimePage.id }"/>
  218. <input id="pagePath" name="pagePath" type="hidden" value="${pagePath}"/>
  219. <input id="overtimeSettlementType" name="overtimeSettlementType" type="hidden" value="${overtimeSettlementType}"/>
  220. <%-- 部门id--%>
  221. <input name="departId" id="departId" type="hidden"
  222. value="${empty tBusActivitiOvertimePage.departId?param.departId:tBusActivitiOvertimePage.departId}"/>
  223. <input type="hidden" name="depName" id="depName"
  224. value="${empty tBusActivitiOvertimePage.depName?param.depName:tBusActivitiOvertimePage.depName}"/>
  225. <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
  226. <t:tab href="tBusActivitiOvertimeController.do?tBusActivitiOvertimeDetailList&id=${tBusActivitiOvertimePage.id}&in_process=${in_process}&pagePath=${empty pagePath ? '' : pagePath}&flag=${param.flag}&overtimeSettlementType=${overtimeSettlementType}"
  227. icon="icon-search" title="加班明细" id="tBusActivitiOvertimeDetail"></t:tab>
  228. </t:tabs>
  229. <%-- 下部附加信息--%>
  230. <table cellpadding="0" cellspacing="1" class="formtable">
  231. <tr>
  232. <c:if test="${in_process}">
  233. <td align="right">
  234. <label class="Validform_label">申请人:</label>
  235. </td>
  236. <td class="value">
  237. ${tBusActivitiOvertimePage.createName}
  238. </td>
  239. </c:if>
  240. <td align="right">
  241. <label class="Validform_label">科室:</label>
  242. </td>
  243. <td class="value">
  244. <t:dictSelect field="departId" type="list"
  245. id="departId" dictTable="t_s_depart" dictField="id" dictText="departname" dictCondition=" where org_type != '1' "
  246. defaultVal="${empty tBusActivitiOvertimePage.departId?param.departId:tBusActivitiOvertimePage.departId}"
  247. hasLabel="false"
  248. readonly="readonly"
  249. datatype="*" title="科室"></t:dictSelect>
  250. </td>
  251. <td align="right">
  252. <label class="Validform_label">加班人数合计:</label>
  253. </td>
  254. <td class="value">
  255. <input id="userCount" name="userCount" type="number" style="width: 70px" class="inputxt disabled_box"
  256. datatype="*"
  257. readonly="readonly"
  258. value="${empty tBusActivitiOvertimePage.userCount ? 0 : tBusActivitiOvertimePage.userCount}"
  259. />
  260. <span class="Validform_checktip"></span>
  261. <label class="Validform_label" style="display: none;">加班人数合计</label>
  262. </td>
  263. <c:if test="${overtimeSettlementType == '1'}">
  264. <td align="right">
  265. <label class="Validform_label">加班时长总计:</label>
  266. </td>
  267. <td class="value">
  268. <input id="totalHour" name="totalHour" type="text" style="width: 70px" class="inputxt disabled_box"
  269. readonly="readonly"
  270. value="${empty tBusActivitiOvertimePage.totalHour ? 0 :tBusActivitiOvertimePage.totalHour}"/>
  271. <span class="Validform_checktip"></span>
  272. <label class="Validform_label" style="display: none;">加班时长总计</label>
  273. </td>
  274. </c:if>
  275. <c:if test="${overtimeSettlementType == '2'}">
  276. <td align="right">
  277. <label class="Validform_label">加班吨数总计:</label>
  278. </td>
  279. <td class="value">
  280. <input id="totalTons" name="totalTons" type="text" style="width: 70px" class="inputxt disabled_box"
  281. readonly="readonly"
  282. value="${empty tBusActivitiOvertimePage.totalTons? 0 :tBusActivitiOvertimePage.totalTons}"/>
  283. <span class="Validform_checktip"></span>
  284. <label class="Validform_label" style="display: none;">加班吨数总计</label>
  285. </td>
  286. </c:if>
  287. <%--<td align="right" style="display: none;">
  288. <label class="Validform_label">加班费总计:</label>
  289. </td>
  290. <td class="value" style="display: none;">
  291. <input id="totalMoney" name="totalMoney" type="text" style="width: 70px" class="inputxt disabled_box"
  292. readonly="readonly" ignore="ignore"
  293. value="${empty tBusActivitiOvertimePage.totalMoney?0:tBusActivitiOvertimePage.totalMoney}"/>
  294. <span class="Validform_checktip"></span>
  295. <label class="Validform_label" style="display: none;">总金额</label>
  296. </td>--%>
  297. <td align="right">
  298. <label class="Validform_label">加班结算方式:</label>
  299. </td>
  300. <td class="value">
  301. <t:dictSelect field="overtimeSettlementType" type="list"
  302. typeGroupCode="overtime_settlement_type" defaultVal="${overtimeSettlementType}"
  303. hasLabel="false" divClass="disabled_box"
  304. readonly="readonly"
  305. datatype="*" title="加班结算方式"></t:dictSelect>
  306. <span class="Validform_checktip"></span>
  307. <label class="Validform_label" style="display: none;">加班结算方式</label>
  308. </td>
  309. </tr>
  310. <tr>
  311. <td align="right">
  312. <label class="Validform_label">附件:</label>
  313. </td>
  314. <td class="value" align="left" colspan="3">
  315. <%-- 暂存文件信息--%>
  316. <textarea name="attachment" id="attachment" style="width:200px;height: 70px;display: none;"
  317. class="inputxt">${tBusActivitiOvertimePage.attachment}</textarea>
  318. <%-- 上传按钮--%>
  319. <t:webUploader auto="true"
  320. url="cgUploadController.do?ajaxSaveFile"
  321. extensions="xls,xlsx,doc,docx,png,jpg,jpeg,pdf"
  322. duplicate="true"
  323. name="requestSummary"
  324. callback="uploadSuccess"
  325. showHis="false"
  326. fileNumLimit="10"
  327. displayTxt="false"
  328. nullMsg="附件不可为空"></t:webUploader>
  329. <%--自定义显示文件列表--%>
  330. <div id="fileListInfoDom">
  331. <p>支持xls,xlsx,doc,docx,png,jpg,jpeg,pdf格式的文件,文件不超过10Mb!</p>
  332. </div>
  333. </td>
  334. <td align="right">
  335. <span color="red" class="requiredIcon">*</span>
  336. <label class="Validform_label">加班原因:</label>
  337. </td>
  338. <td class="value" colspan="10">
  339. <textarea id="reason" class="inputxt" style="width:100%;height:60px" name="reason"
  340. datatype="*">${tBusActivitiOvertimePage.reason }</textarea>
  341. <span class="Validform_checktip"></span>
  342. <label class="Validform_label" style="display: none;">加班原因</label>
  343. </td>
  344. </tr>
  345. </table>
  346. </t:formvalid>
  347. <!-- 添加 附表明细 模版 -->
  348. <table style="display:none">
  349. <tbody id="add_tBusActivitiOvertimeDetail_table_template">
  350. <tr>
  351. <td align="center">
  352. <div style="width: 25px;" name="xh"></div>
  353. </td>
  354. <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
  355. <td align="left">
  356. <input name="tBusActivitiOvertimeDetailList[#index#].userid" id="userid#index#" maxlength="32" type="hidden"
  357. class="inputxt" datatype="*"/>
  358. <input name="tBusActivitiOvertimeDetailList[#index#].realName" id="realName#index#" placeholder="点击选择加班员工"
  359. maxlength="32" type="text" readonly="readonly" class="inputxt click_btu"/>
  360. <label class="Validform_label" style="display: none;">加班员工</label>
  361. </td>
  362. <td align="left">
  363. <t:dictSelect field="tBusActivitiOvertimeDetailList[#index#].departId" type="list"
  364. id="departId#index#"
  365. readonly="readonly"
  366. dictTable="t_s_depart" dictField="id" dictText="departname" dictCondition=" where org_type != '1' " defaultVal="${poVal.departId }" hasLabel="false"
  367. datatype="*" title="科室"></t:dictSelect>
  368. <label class="Validform_label" style="display: none;">科室</label>
  369. </td>
  370. <td align="left">
  371. <t:dictSelect field="tBusActivitiOvertimeDetailList[#index#].overtimeType" type="list"
  372. id="overtimeType#index#"
  373. typeGroupCode="overtime_type" defaultVal="${poVal.overtimeType }" hasLabel="false"
  374. onchange="changeOvertimeType(this)"
  375. datatype="*" title="加班类型"></t:dictSelect>
  376. <label class="Validform_label" style="display: none;">加班类型</label>
  377. </td>
  378. <td align="left">
  379. <input name="tBusActivitiOvertimeDetailList[#index#].startTime" id="startTime#index#" maxlength="32"
  380. type="text" class="Wdate click_btu" style="width:150px;" readonly placeholder="请选择加班开始时间"
  381. onchange="datejisuanOnOverTime(this)"
  382. />
  383. <label class="Validform_label" style="display: none;">加班开始时间</label>
  384. </td>
  385. <td align="left">
  386. <input name="tBusActivitiOvertimeDetailList[#index#].endTime" id="endTime#index#" maxlength="32" type="text"
  387. class="Wdate click_btu" style="width:150px;" placeholder="请选择加班结束时间" readonly
  388. onchange="datejisuanOnOverTime(this)"
  389. />
  390. <label class="Validform_label" style="display: none;">加班结束时间</label>
  391. </td>
  392. <c:if test="${overtimeSettlementType == '1'}">
  393. <td align="left">
  394. <input name="tBusActivitiOvertimeDetailList[#index#].hour" id="hour#index#" maxlength="32" type="text"
  395. placeholder="0" value="${poVal.hour}"
  396. class="inputxt unclick_btu disabled_box" style="width:120px;" datatype="d"/>
  397. <%--<span>0小时</span>--%>
  398. <label class="Validform_label" style="display: none;">加班时长</label>
  399. </td>
  400. <td align="left">
  401. <t:dictSelect field="tBusActivitiOvertimeDetailList[#index#].compensate" type="list"
  402. id="compensate#index#"
  403. typeGroupCode="overtime_compensate" hasLabel="false" title="补偿方式"
  404. onchange="changeCompensate2(this)"
  405. defaultVal="${empty poVal.compensate ? 'money' : poVal.compensate}"
  406. datatype="*"></t:dictSelect>
  407. <label class="Validform_label" style="display: none;">补偿方式</label>
  408. </td>
  409. </c:if>
  410. <c:if test="${overtimeSettlementType == '2'}">
  411. <td align="left">
  412. <input name="tBusActivitiOvertimeDetailList[#index#].pickupTruckNumber" id="pickupTruckNumber#index#"
  413. maxlength="32" type="text"
  414. class="inputxt" style="width:120px;" datatype="d" onchange="setTotalMoney(this)" value="0"/>
  415. <label class="Validform_label" style="display: none;">清运车数</label>
  416. </td>
  417. <td align="left">
  418. <input name="tBusActivitiOvertimeDetailList[#index#].keepUpTonNumber" id="keepUpTonNumber#index#"
  419. maxlength="32" type="text"
  420. class="inputxt" style="width:120px;" datatype="d" onchange="setTotalMoney(this)" value="0"/>
  421. <label class="Validform_label" style="display: none;">清运吨数</label>
  422. </td>
  423. <%--<td align="left">
  424. <input name="tBusActivitiOvertimeDetailList[#index#].unitPrice" id="unitPrice#index#" maxlength="32"
  425. type="text"
  426. class="inputxt" style="width:120px;" datatype="d" onchange="setTotalMoney(this)" value="0"/>
  427. <label class="Validform_label" style="display: none;">单价</label>
  428. </td>--%>
  429. </c:if>
  430. <%--<td align="left">
  431. <input name="tBusActivitiOvertimeDetailList[#index#].money" id="money#index#" maxlength="32" type="text"
  432. class="inputxt" style="width:120px;" datatype="d,fix2"
  433. value="0"
  434. <c:if test="${overtimeSettlementType == '2'}">readonly="readonly"</c:if>
  435. onchange="changeTotalMoney()"
  436. />
  437. <label class="Validform_label" style="display: none;">加班费</label>
  438. </td>--%>
  439. <td align="left">
  440. <input name="tBusActivitiOvertimeDetailList[#index#].remark" maxlength="255" id="remake#index#" type="text"
  441. class="inputxt"
  442. style="width:300px;"/>
  443. <label class="Validform_label" style="display: none;">备注</label>
  444. </td>
  445. </tr>
  446. </tbody>
  447. </table>
  448. <table style="width: 100%">
  449. <tr>
  450. <td style="text-align:center;">
  451. <%@include file="../view_submit_buttons.jsp" %>
  452. </td>
  453. </tr>
  454. </table>
  455. </body>
  456. <script src="webpage/cn/com/lzt/useractiviti/overtime/tBusActivitiOvertime.js"></script>
  457. <script>
  458. function datejisuanOnOverTime(obj) {
  459. var index = getIndex($(obj).attr('name'));
  460. var startTime = $("#startTime" + index).val();
  461. var endTime = $("#endTime" + index).val();
  462. if (startTime && endTime) {
  463. var hours = diffTime(startTime, endTime);
  464. var hourInput = $('#hour' + index);
  465. hourInput.val(hours);
  466. changeTotalTime();
  467. }
  468. }
  469. //add-刘梦祥-2021年11月28日15:25:20-(添加事件:当用户选择加班类型后触发事件)
  470. function changeOvertimeType(obj) {
  471. var index = getIndex($(obj).attr('name'));
  472. var value = $(obj).val()
  473. var compensate = $('#compensate' + index);
  474. if (value !== "weekend_on_duty") {
  475. compensate.attr('disabled', 'disabled');
  476. compensate.val("money");
  477. } else {
  478. compensate.removeAttr('disabled');
  479. }
  480. changeCompensateByValue(index, value);
  481. }
  482. //add-刘梦祥-2021年11月28日15:52:43-(添加事件:当用户选择调休时,加班费为0)
  483. function changeCompensate2(obj) {
  484. var index = getIndex($(obj).attr('name'));
  485. var value = $(obj).val()
  486. var money = $('#money' + index)
  487. if (value === "exchange") {
  488. money.val(0);
  489. money.attr('value', 0);
  490. money.attr('disabled', 'disabled');
  491. money.addClass('disabled_box');
  492. } else {
  493. money.removeAttr('disabled');
  494. money.removeClass('disabled_box');
  495. }
  496. }
  497. function changeCompensateByValue(index, value) {
  498. var money = $('#money' + index)
  499. if (value === "exchange") {
  500. money.attr('disabled', 'disabled');
  501. money.addClass('disabled_box')
  502. money.val("0");
  503. } else {
  504. money.removeAttr('disabled');
  505. money.removeClass('disabled_box')
  506. }
  507. }
  508. //add-刘梦祥-2021年11月11日09:37:16-(添加方法当按吨数计算的时候根据清运车数、清运吨数、单价计算加班费)
  509. function setTotalMoney(obj) {
  510. var index = getIndex($(obj).attr('name'));
  511. var pickupTruckNumber = Number($("#pickupTruckNumber" + index).val());
  512. var keepUpTonNumber = Number($("#keepUpTonNumber" + index).val());
  513. var unitPrice = Number($("#unitPrice" + index).val());
  514. //计算加班总吨数
  515. var totalTons = 0;
  516. $('input[name$="keepUpTonNumber"]').each(function () {
  517. var keepUpTonNumber = $(this).val();
  518. if (keepUpTonNumber) {
  519. totalTons += parseFloat(keepUpTonNumber);
  520. }
  521. });
  522. totalTons = totalTons.toFixed(1);
  523. $('#totalTons').val(totalTons);
  524. //计算当前员工的加班费和总加班费
  525. if (pickupTruckNumber && keepUpTonNumber && unitPrice) {
  526. var moneyItem = $('#money' + index);
  527. moneyItem.val(pickupTruckNumber * keepUpTonNumber * unitPrice);
  528. changeTotalMoney()
  529. }
  530. }
  531. function changeTotalTime() {
  532. var totalHour = 0;
  533. $('input[name$="hour"]').each(function () {
  534. var hour = $(this).val();
  535. if (hour) {
  536. totalHour += parseFloat(hour);
  537. }
  538. })
  539. $('#totalHour').val(totalHour);
  540. }
  541. // delete-刘梦祥-2021年11月10日17:04:00-(注释补偿方式为调休时的请求)
  542. // function changeMoney(index) {
  543. // var select = $('#compensate' + index);
  544. // var selectVal = select.find(":selected").val();
  545. // if (selectVal == 'money') {//加班费
  546. // var hour = $('#hour' + index).val();
  547. // var userId = $('#userid' + index).val();
  548. // if (hour) {
  549. // $.post('tBusActivitiOvertimeController.do?getBaseHourWage', {userId: userId}, function (d) {
  550. // var money = parseFloat(hour) * d * 1.5;
  551. // $('#money' + index).val(money.toFixed(1));
  552. // changeTotalMoney();
  553. // });
  554. // }
  555. // }
  556. // }
  557. function changeTotalMoney() {
  558. var totalMoney = 0;
  559. $('input[name$="money"]').each(function () {
  560. var money = $(this).val();
  561. if (money) {
  562. totalMoney += parseFloat(money);
  563. }
  564. });
  565. totalMoney = totalMoney.toFixed(1);
  566. $('#totalMoney').val(totalMoney);
  567. $('#totalMoneyText').html(totalMoney + "元");
  568. }
  569. function diffmm(startDate, endDate) {
  570. var diff = Date.parse(endDate.replace(/-/g, "/")) - Date.parse(startDate.replace(/-/g, "/"));//时间差的毫秒数
  571. return Math.round(diff / (60 * 1000));
  572. }
  573. function diffTime(startDate, endDate) {
  574. var diff = Date.parse(endDate.replace(/-/g, "/")) - Date.parse(startDate.replace(/-/g, "/"));//时间差的毫秒数
  575. //计算出相差天数
  576. var days = Math.floor(diff / (24 * 3600 * 1000));
  577. //计算出小时数
  578. var leftHour = diff % (3600 * 1000) / 3600 / 1000; //计算小时后剩余的毫秒数
  579. if (leftHour >= 0.5) {
  580. leftHour = 0.5;
  581. } else {
  582. leftHour = 0;
  583. }
  584. var hours = Math.floor(diff / (3600 * 1000)) + leftHour;
  585. if (hours < 0) {
  586. hours = 0;
  587. }
  588. return hours;
  589. }
  590. function beforeSubmit() {
  591. var length = $('#tt').find('input[name$="userid"]').length;
  592. if (length == 0) {
  593. tip('请添加加班用户');
  594. return false;
  595. }
  596. changeTotalTime();
  597. changeTotalMoney();
  598. return true;
  599. }
  600. </script>
  601. <style>
  602. table {
  603. width: calc(100% - 10px) !important;
  604. }
  605. /*文件列表文字样式*/
  606. .fileInfoItemBox {
  607. display: flex;
  608. align-items: center;
  609. width: 300px;
  610. color: #67C23A;
  611. }
  612. /*文件列表文字样式*/
  613. .fileName {
  614. width: 100px;
  615. overflow: hidden;
  616. text-overflow: ellipsis;
  617. white-space: nowrap;
  618. color: #999;
  619. text-decoration: underline;
  620. }
  621. /*文件列表下载按钮样式*/
  622. .down {
  623. cursor: pointer;
  624. color: #67C23A;
  625. }
  626. .down:hover {
  627. cursor: pointer;
  628. color: #67C23A;
  629. }
  630. .down:active {
  631. cursor: pointer;
  632. color: #67C23A;
  633. }
  634. /*文件列表删除按钮样式*/
  635. .del {
  636. cursor: pointer;
  637. color: #F56C6C;
  638. }
  639. .del:hover {
  640. cursor: pointer;
  641. color: #F56C6C;
  642. }
  643. .del:active {
  644. cursor: pointer;
  645. color: #F56C6C;
  646. }
  647. </style>