Selaa lähdekoodia

修改津补贴申报中不同类型补贴显示不同的考勤输入方式,工作津贴输入月份,交通补贴输入月份对应天数

sugangqiang 1 vuosi sitten
vanhempi
commit
51eac54dca

+ 7 - 0
app/enterprise/view/talent_allowance/apply.html

@@ -24,6 +24,13 @@
         float:left;
         margin:0 3px 0 0;
     }
+    .day-selector ul li{
+        list-style: none;
+        display:inline-block;
+        float:left;
+        margin:0 3px 0 0;
+    }
+    .day-selector input{width:70px;}
     #jjAttendanceForm ul li{
         width:16%;
         padding-top: 10px;

+ 31 - 7
public/static/modular/gate/talentAllowance/common/talentAllowance_info.js

@@ -281,7 +281,7 @@ TalentAllowanceInfoDlg.initContract = function () {
                 columns: TalentAllowanceInfoDlg.initProjectColumns(),
                 onLoadSuccess: function (data) {
                     //TalentAllowanceInfoDlg.initICheck();
-                    layer.tips('请勾选个税缴纳情况', '.tips', {tips: [1, "#1ab394"], time: 0, closeBtn: 2});
+                    //layer.tips('请勾选个税缴纳情况', '.tips', {tips: [1, "#1ab394"], time: 0, closeBtn: 2});
                 },
             });
         }
@@ -336,14 +336,38 @@ TalentAllowanceInfoDlg.editContract = function () {
     ajax.start();
 }
 
-TalentAllowanceInfoDlg.saveProjectData = function (id) {
+TalentAllowanceInfoDlg.saveProjectData = function (id, project, allowanceType) {
     var description = $("#d" + id).val();
     var months = [];
-    $("#m" + id + " input[name=month]").each(function () {
-        if (this.checked) {
-            months.push($(this).val());
-        }
-    })
+    var error = "";
+    if (project == 4 && allowanceType == 2) {
+        $("#m" + id + " input[name=day]").each(function () {
+            var days = $(this).val();
+            var max = $(this).attr("max");
+            var num = $(this).attr("num");
+            if (isNaN(days)) {
+                error = error + num + "月的考勤天数不是数字;";
+            } else {
+                if (days < 0 || days > max) {
+                    error = error + num + "月的考勤天数不在范围内(1-" + max + ");";
+                }
+            }
+            if (days == null || days == '') {
+                days = 0;
+            }
+            months.push(num + "=" + days);
+        })
+    } else {
+        $("#m" + id + " input[name=month]").each(function () {
+            if (this.checked) {
+                months.push($(this).val());
+            }
+        })
+    }
+    if (error != "") {
+        Feng.error(error);
+        return;
+    }
     var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/editProject", function (data) {
         if (data.code == 200) {
             Feng.success(data.msg);

+ 29 - 5
public/static/modular/gate/talentAllowance/common/talentAllowance_info_supple.js

@@ -100,9 +100,12 @@ TalentAllowanceInfoDlg.initProjectColumns = function () {
         {title: '核查项目名称', field: 'projectName', visible: true, align: 'center', valign: 'middle', width: "15%", 'class': 'uitd_showTip'},
         {title: '详情', field: 'months', visible: true, align: 'center', valign: 'middle', width: "45%",
             formatter: function (value, row, index) {
-                var html = TalentAllowanceInfoDlg.createMonthSelector(row.project, row.id, row.enterpriseId, value);
-                if (row.days != null && row.days != '') {
-
+                var allowanceType = $("#allowanceType").val();
+                var html = "";
+                if (row.project == 4 && allowanceType == 2) {
+                    html = TalentAllowanceInfoDlg.createDaySelector(row.id, value);
+                } else {
+                    html = TalentAllowanceInfoDlg.createMonthSelector(row.id, value);
                 }
                 return html;
             }
@@ -115,11 +118,12 @@ TalentAllowanceInfoDlg.initProjectColumns = function () {
         },
         {title: '操作', field: 'project', visible: true, align: 'left', valign: 'middle', width: "15%",
             formatter: function (value, row, index) {
+                var allowanceType = $("#allowanceType").val();
                 var butHtml = "";
                 if (row.isEdit == 1) {
                     /*butHtml = butHtml + "<button type='button' data-value='" + (row.description ? row.description : "") + "' onclick=\"TalentAllowanceInfoDlg.showEditProjectModal('" + row.project + "','" + row.id + "','" + row.enterpriseId + "','" + row.months + "','" + row.days + "',this)\" style='margin-left: 5px' class=\"btn btn-xs btn-danger tips\">" +
                      "<i class=\"fa fa-edit\"></i>修改</button>";*/
-                    butHtml = butHtml + "<button type='button' onclick=\"TalentAllowanceInfoDlg.saveProjectData('" + row.id + "')\" style='margin-left: 5px' class=\"btn btn-xs btn-danger tips\">" +
+                    butHtml = butHtml + "<button type='button' onclick=\"TalentAllowanceInfoDlg.saveProjectData('" + row.id + "','" + row.project + "','" + allowanceType + "')\" style='margin-left: 5px' class=\"btn btn-xs btn-danger tips\">" +
                             "<i class=\"fa fa-edit\"></i>保存</button>";
                 }
                 butHtml = butHtml + "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-left: 5px' class='btn btn-xs btn-success'><i class=\"fa fa-book\"></i>日志</button>";
@@ -128,7 +132,27 @@ TalentAllowanceInfoDlg.initProjectColumns = function () {
         }
     ];
 }
-TalentAllowanceInfoDlg.createMonthSelector = function (project, id, enterpriseId, selectMonths) {
+
+TalentAllowanceInfoDlg.createDaySelector = function (id, selectDays) {
+    var dayArr = selectDays ? selectDays.split(",") : [];
+    var tmpKv = {};
+    for (var d = 0; d < dayArr.length; d++) {
+        var kv = dayArr[d].split("=");
+        tmpKv["m" + kv[0]] = kv[1];
+    }
+    var html = '<div id="m' + id + '" class="day-selector"><span style="color:red;">*填写对应月份打卡天数,没有填写则记为0天</span><ul>';
+    var bigMonths = [1, 3, 5, 7, 8, 10, 12];
+    for (var m = 1; m <= 12; m++) {
+        var month = m < 10 ? "0" + m : m;
+        var day = tmpKv["m" + month] ? tmpKv["m" + month] : "";
+        var maxDay = bigMonths.indexOf(m) > -1 ? 31 : (m != 2 ? 30 : 29);
+        html += '<li><label>' + m + '月</label><input type="number" name="day" class="form-control" max="' + maxDay + '" min="0" num="' + month + '" value="' + day + '"></li>';
+    }
+    html += '</ul></div>'
+    return html;
+}
+
+TalentAllowanceInfoDlg.createMonthSelector = function (id, selectMonths) {
     var monthArr = selectMonths ? selectMonths.split(",") : [];
     var html = '<div id="m' + id + '" class="month-selector"><ul><li><input type="checkbox" onchange="TalentAllowanceInfoDlg.newCheckAll(' + id + ',this)">全选</li>';
     for (var m = 1; m <= 12; m++) {