123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- /*
- * 批量加班单拓展
- * 202412
- * 匡原志_coyle
- */
-
- shr.defineClass(
- "shr.ats.AtsOverTimeBillBatchEditEx", shr.ats.AtsOverTimeBillBatchEdit,
- {
- filter: {},
- OTContrlParams: {},
- initalizeDOM: function () {
- shr.ats.AtsOverTimeBillBatchEdit.superClass.initalizeDOM.call(this);
- var that = this;
- that.remoteCall({
- type: "post",
- method: "getDecimalPlace",
- //handler:
- // "com.kingdee.shr.ats.web.handler.AtsBillBaseEditHandler",
- success: function (res) {
- fixedNum = res;
- }
- });
- // that.getOTContrlParams();
- //按组织填充按钮
- $(
- '<button type="button" style="margin-left:4px;margin-right:4px" class="shrshrbtn-primary shrbtn" id="orgfill">' +
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_17 +
- "</button>"
- ).insertAfter($("#addRow_entries"));
- var classfullNameService =
- "com.kingdee.shr.ats.web.formEditImport.AtsOverTimeBillFileEditFormService";
- //导入 按钮
- $(
- '<button type="button" style="margin-left:4px;margin-right:4px;display: none" class="shrshrbtn-primary shrbtn" id="import">' +
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_3 +
- "</button>"
- ).insertAfter($("#addRow_entries"));
- $("#import").click(function () {
- that.importAction(null, classfullNameService);
- });
- $(".editGrid-toolbar").append(
- '<div style="display: inline;padding-left: 20px;">' +
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_32 +
- '<div><div id="hasNum"></div>'
- );
- var serviceId = shr.getUrlRequestParam("serviceId");
- var url =
- shr.getContextPath() +
- "/dynamic.do?checkLicense=true&uipk=com.kingdee.eas.hr.ats.app.OverTimeOrgFillForm";
- url += "&serviceId=" + encodeURIComponent(serviceId);
- $("#orgfill").click(function () {
- $("#orgFillDiv").attr("src", url);
- var gridNum = $("#entries").getGridParam("reccount");
- $("#hasNum").val(gridNum);
- $("#orgFillDiv").dialog({
- title:
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_17,
- width: 1020,
- height: 450,
- modal: true,
- resizable: false,
- position: {
- my: "center",
- at: "top+20%",
- of: window
- },
- open: function (event, ui) {},
- buttons: [
- {
- text:
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_19,
- click: function () {
- //校验F7数据
- if (that.checkF7Data()) {
- var oldRowIds = $("#entries").getDataIDs();
- that.fillGrid();
- var newRowIds = $("#entries").getDataIDs();
- rowIds = that.getFillRowId(
- oldRowIds,
- newRowIds
- );
- $.each(rowIds, function (n, value) {
- //that.calRestTimeLen(value); 2015-11-03:组织填充不用自动计算时长
- that.changOtTimeTipInfo(value);
- });
- //检查不超过100条记录
- //that.checkRowIsOver();
- $(this).dialog("close");
- } else {
- return;
- }
- }
- },
- {
- text:
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_5,
- click: function () {
- $(this).dialog("close");
- }
- }
- ]
- });
- $("#orgFillDiv").attr("style", "width:1020px;height:550px;");
- });
- var entries_cont = waf("#entries");
- entries_cont.jqGrid("option", {
- onChange: function (rowid, cellname, value, iRow, iCol) {
- console.log(rowid, cellname, value, iRow, iCol, 123123);
- },
- beforeSaveCell: function (
- rowid,
- cellname,
- value,
- iRow,
- iCol
- ) {},
- afterSaveCell: function (rowid, cellname, value, iRow, iCol) {
- if (value["adminOrgUnit.id"]) {
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "adminOrgUnit.id",
- value["adminOrgUnit.id"]
- );
- }
- that.removePreShowError(rowid);
- if (cellname == "otDate") {
- var val = value;
- if (val.length <= 10) {
- val = val + " 00:00:00";
- }
- val &&
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "startTime",
- val
- );
- val &&
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "endTime",
- val
- );
- that.changeOverTimeType(rowid);
- that.calRestTimeLen(rowid);
- that.getOTContrlParams(rowid);
- }
- if (cellname == "otType") {
- that.changeOTCompens(rowid);
- }
- // 添加 开始时间 结束时间 休息时长(分钟) 响应时间
- if (
- cellname == "startTime" ||
- cellname == "endTime" ||
- cellname == "restTime"
- ) {
- if (cellname != "restTime") {
- that.calRestTimeLen(rowid);
- }
- that.calculateOTtimes(rowid);
- }
- if (cellname == "person") {
- that.calRestTimeLen(rowid);
- that.getOTContrlParams(rowid);
- }
- if (cellname == "applyOTTime") {
- // 加班小时数 发生改变就给予提示
- that.changOtTimeTipInfo(rowid);
- }
- if (
- cellname == "restStartTime" ||
- cellname == "restStartTime2" ||
- cellname == "restEndTime" ||
- cellname == "restEndTime2"
- ) {
- //计算休息时间,加班时间
- var startTime = $("#entries").jqGrid(
- "getCell",
- rowid,
- "startTime"
- );
- var endTime = $("#entries").jqGrid(
- "getCell",
- rowid,
- "endTime"
- );
- var restStartTime = $("#entries").jqGrid(
- "getCell",
- rowid,
- "restStartTime"
- );
- var restEndTime = $("#entries").jqGrid(
- "getCell",
- rowid,
- "restEndTime"
- );
- var restStartTime2 = $("#entries").jqGrid(
- "getCell",
- rowid,
- "restStartTime2"
- );
- var restEndTime2 = $("#entries").jqGrid(
- "getCell",
- rowid,
- "restEndTime2"
- );
- if (startTime == "" || endTime == "") {
- return;
- }
-
- var totalRestTime = 0;
- var totalRestTimeLong = 0;
- var restStartTimeOfDate;
- var restEndTimeOfDate;
- if(shr.getBowserInfo().browser === 'IE' || shr.getBowserInfo().browser === 'Safari'){
- restStartTime = restStartTime.replace(/-/g,'/');
- restEndTime = restEndTime.replace(/-/g,'/');
- restStartTime2 = restStartTime2.replace(/-/g,'/');
- restEndTime2 = restEndTime2.replace(/-/g,'/');
- }
- if (restStartTime != "" && restEndTime != "") {
- restStartTimeOfDate = new Date(restStartTime);
- restEndTimeOfDate = new Date(restEndTime);
- var times =
- restEndTimeOfDate.getTime() -
- restStartTimeOfDate.getTime();
- if (times < 0) {
- times = 0;
- }
- totalRestTimeLong += times;
- times = times / 1000 / 60;
- totalRestTime += times;
- }
- if (restStartTime2 != "" && restEndTime2 != "") {
- var restStartTime2OfDate = new Date(restStartTime2);
- var restEndTime2OfDate = new Date(restEndTime2);
- if (
- (restStartTime != "" &&
- restEndTime2OfDate.getTime() >
- restStartTimeOfDate.getTime() &&
- restStartTimeOfDate.getTime() >=
- restStartTime2OfDate.getTime()) ||
- (restEndTime != "" &&
- restEndTimeOfDate.getTime() <=
- restEndTime2OfDate.getTime() &&
- restStartTime2OfDate.getTime() <
- restEndTimeOfDate.getTime()) ||
- (restStartTime != "" &&
- restEndTime != "" &&
- restEndTimeOfDate.getTime() >=
- restEndTime2OfDate.getTime() &&
- restStartTime2OfDate.getTime() >=
- restStartTimeOfDate.getTime())
- ) {
- //时间有交叉
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "restEndTime2",
- restStartTime2
- );
- } else {
- var times =
- restEndTime2OfDate.getTime() -
- restStartTime2OfDate.getTime();
- if (times < 0) {
- times = 0;
- }
- totalRestTimeLong += times;
- times = times / 1000 / 60;
- totalRestTime += times;
- }
- }
- var t1 = totalRestTime.toFixed(
- atsMlUtile.getSysDecimalPlace()
- );
- $("#entries").jqGrid("setCell", rowid, "restTime", t1);
- var startTime = NewDate(startTime + ":00");
- var endTime = NewDate(endTime + ":00");
- var se =
- endTime.getTime() -
- startTime.getTime() -
- totalRestTimeLong; // 毫秒
- // var tfl = se / (3600 * 1000);
- var tfl = Math.floor(se / (3600 * 1000)); // 向下取整
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "applyOTTime",
- tfl
- );
- that.getOTContrlParams(rowid);
- }
- },
- afterEditCell: function (rowid, cellname, value, iRow, iCol) {
- if (
- cellname == "otType" &&
- that.OTContrlParams[rowid] &&
- that.OTContrlParams[rowid].isOtrolByDateType
- ) {
- $("#" + iRow + "_otType").shrPromptBox("disable");
- }
- if (cellname == "otCompens") {
- if (that.filter[rowid] == undefined) {
- // R20221006-0542 修复选择加班费后 再点击“补偿方式”F7就变成了调休的问题
- // that.changeOTCompens(rowid);
- }
- if (that.filter[rowid]) {
- // $("#"+rowid+"_otCompens").shrPromptBox("setFilter",that.filter[rowid]);
- $(
- "#" +
- $("#entries").jqGrid(
- "getCell",
- rowid,
- "rn"
- ) +
- "_otCompens"
- ).shrPromptBox("setFilter", that.filter[rowid]);
- }
- }
- if (cellname == "person") {
- var hrOrgUnitId = $("#hrOrgUnit_el").val();
- $("#" + rowid + "_person")
- .shrPromptBox()
- .attr("data-params", hrOrgUnitId);
- $("#" + iRow + "_person").shrPromptBox("option", {
- onchange: function (e, value) {
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "person.number",
- value.current
- ? value.current["person.number"]
- : ""
- );
- }
- });
- }
- if(cellname == "attAdminOrgUnit"){
- var personId = $("#entries").jqGrid("getCell", rowid, "person").id;
- var attendanceDate = $("#entries").jqGrid("getCell", rowid, "otDate");
- if(!(personId && attendanceDate)){
- shr.showInfo({message: jsBizMultLan.atsManager_atsOverTimeBillEdit_YM_999});
- return false;
- }else{
- //$("#"+rowid+"_attPosition").shrPromptBox().attr("data-params", adminOrg);
- $("#"+iRow+"_attAdminOrgUnit").shrPromptBox("setOtherParams", {
- personId: personId,
- attendanceDate: attendanceDate
- });
- }
- }
- }
- });
- that.setButtonVisible(); //初始化页面安装状态,如果是已经提交的或者审批通过的单据编辑按钮不显示
- //隐藏提交生效按钮
- if (that.getOperateState() == "EDIT") {
- if (that.isFromWF()) {
- // 来自流程中心
- $("#submitEffect").hide();
- $("#submit").text(
- jsBizMultLan.atsManager_atsOverTimeBillBatchEdit_i18n_25
- );
- }
- }
- //审核编辑界面
- if (
- that.isFromWF() &&
- that.getOperateState() == "EDIT" &&
- $("#billState").val() != 0
- ) {
- $("#deleteRow_entries")
- .unbind("click")
- .attr("onclick", "")
- .css("cursor", "default");
- $("#addRow_entries")
- .unbind("click")
- .attr("onclick", "")
- .css("cursor", "default");
- $(".editGrid-toolbar").hide();
- $("#submit").hide();
- var lastRowNum = $("#entries").getGridParam("reccount");
- for (var i = 1; i <= lastRowNum; i++) {
- var temp_id = $("#entries tr:eq(" + i + ")").attr("id");
- $("#entries").jqGrid(
- "setCell",
- temp_id,
- "person",
- "",
- "not-editable-cell"
- );
- }
- }
- //考勤计算--已计算页签--明细显示模式--请假按钮进来,只显示提交生效按钮
- if (
- shr.getUrlParam("fromCalDetail") != null &&
- shr.getUrlParam("fromCalDetail") == "1"
- ) {
- $("#save").hide();
- $("#submit").hide();
- $("#cancelAll").hide();
- $("#import").hide();
- $("#orgfill").hide();
- $(".view_manager_header > div > div").eq(0).remove();
- $("#submitEffect").addClass("shrbtn-primary");
- $('#workAreaDiv .ui-jqgrid-bdiv').css('max-height','253px') // 当页面作为弹框时 表格过长则隐藏滑动
- }
- //增加业务组织处理
- that.processF7ChangeEventHrOrgUnit();
- var hrOrgUnitId = $("#hrOrgUnit_el").val();
- that.initCurrentHrOrgUnit(hrOrgUnitId);
- that.initCcPersonPrompt();
- },
- calculateOTtimes: function (rowid) {
- var startTime = $("#entries").jqGrid("getCell", rowid, "startTime");
- var endTime = $("#entries").jqGrid("getCell", rowid, "endTime");
- var restTime = $("#entries").jqGrid("getCell", rowid, "restTime");
- if (startTime == "[object Object]") {
- $("#" + rowid)
- .find("td")
- .eq("5")
- .text("");
- $("#" + rowid)
- .find("td")
- .eq("5")
- .attr("title", "");
- }
- if (endTime == "[object Object]") {
- $("#" + rowid)
- .find("td")
- .eq("6")
- .text("");
- $("#" + rowid)
- .find("td")
- .eq("6")
- .attr("title", "");
- }
- if (startTime != "" && endTime != "") {
- var restVal = 0;
- if (restTime != "" && /^[0-9]*$/.test(restTime)) {
- restVal = restTime; // 分钟数
- }
- var startTime = NewDate(startTime + ":00");
- var endTime = NewDate(endTime + ":00");
- var se =
- endTime.getTime() -
- startTime.getTime() -
- restVal * 1000 * 60; // 毫秒
- // var tfl = se / (3600 * 1000);
- var tfl = Math.floor(se / (3600 * 1000)); // 向下取整
- $("#entries").jqGrid(
- "setCell",
- rowid,
- "applyOTTime",
- tfl.toFixed(fixedNum)
- );
- }
- },
-
- }
- );
-
|