Forráskód Böngészése

报销申请管理-报销金额错误调整

huangguoce 1 hete
szülő
commit
4d5a7220cf

+ 4 - 4
src/main/webapp/webpage/modules/workreimbursement/treeForm/all/workReimbursementAllFormAdd.jsp

@@ -666,7 +666,7 @@
                     var $sumInput = $(this);
                     var $currentTr = $sumInput.closest("tr");
                     var isHidden = $currentTr.hasClass("hidden");
-                    var $delFlagInput = $currentTr.find("td:first-child input:eq(1)");
+                    var $delFlagInput = $currentTr.find("td:first-child input:eq(3)");
                     var isDeleted = $delFlagInput.val() === "1";
 
                     // 1. 获取当前行的第五个td(索引从0开始,第五个td的索引是4)
@@ -1626,7 +1626,7 @@
             var idValue = $idInput.val() || "";
 
             // 标记删除(通过修改第一个td中第二个input的值为1)
-            var $targetInput = $currentRow.find("td:first-child input:eq(1)");
+            var $targetInput = $currentRow.find("td:first-child input:eq(3)");
             if ($targetInput.length > 0) {
                 $targetInput.val("1");
             }
@@ -2826,7 +2826,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
@@ -2945,7 +2945,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行

+ 12 - 8
src/main/webapp/webpage/modules/workreimbursement/treeForm/all/workReimbursementAllModifyApply.jsp

@@ -669,7 +669,7 @@
                 var $sumInput = $(this);
                 var $currentTr = $sumInput.closest("tr");
                 var isHidden = $currentTr.hasClass("hidden");
-                var $delFlagInput = $currentTr.find("td:first-child input:eq(1)");
+                var $delFlagInput = $currentTr.find("td:first-child input:eq(3)");
                 var isDeleted = $delFlagInput.val() === "1";
 
                 // 1. 获取当前行的第五个td(索引从0开始,第五个td的索引是4)
@@ -1523,12 +1523,12 @@
                     }
                 });
             } else {
-
-
                 var id = $(prefix + "_id");
 
                 var workAccountmoney = $(prefix + "_money").val();
+
                 var money = $("#moneys").val();
+
                 if (isNumber(workAccountmoney)) {
                     if (money == "") {
                         money = parseFloat(workAccountmoney).toFixed(2);
@@ -1536,14 +1536,19 @@
                         money = (parseFloat(money) - parseFloat(workAccountmoney)).toFixed(2);
                     }
                 }
+
                 if (money >= 0) {
                     count++;
                     $("#moneys").val(money);
                     var delFlag = $(prefix + "_delFlag");
+
                     if (id.val() == "") {
                         delFlag.val("1");
                         $(obj).parent().parent().remove();
                     } else if (delFlag.val() == "0") {
+                        console.log( delFlag)
+                        console.log( delFlag)
+                        console.log( delFlag)
                         delFlag.val("1");
                         $(obj).html("÷").attr("title", "撤回删除");
                         $(obj).parent().parent().addClass("error");
@@ -1609,7 +1614,7 @@
             var idValue = $idInput.val() || "";
 
             // 标记删除(通过修改第一个td中第二个input的值为1)
-            var $targetInput = $currentRow.find("td:first-child input:eq(1)");
+            var $targetInput = $currentRow.find("td:first-child input:eq(3)");
             if ($targetInput.length > 0) {
                 $targetInput.val("1");
             }
@@ -2769,7 +2774,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
@@ -2888,8 +2893,9 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
+
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
             }
@@ -2912,10 +2918,8 @@
                 console.warn("第九个td中的值不是有效的数字:", amountValue, ",行:", $tr);
             }
         });
-
         // 加上所有行的非数电票总金额
         total += parseFloat(invoiceTotal || 0);
-
         // 设置总金额
         $("#moneys").val(total.toFixed(2));
     }

+ 6 - 5
src/main/webapp/webpage/modules/workreimbursement/treeForm/new/workReimbursementNewFormAdd.jsp

@@ -352,6 +352,7 @@
                                 var $tr = $('#' + trId);
                                 // 2. 模拟点击tr,触发onclick绑定的listTr
                                 var $targetTd = $tr.find('td:eq(1)');
+
                                 // 3. 触发td的click事件(如果找到该td)
                                 if ($targetTd.length > 0) {
 
@@ -675,7 +676,7 @@
                     var $sumInput = $(this);
                     var $currentTr = $sumInput.closest("tr");
                     var isHidden = $currentTr.hasClass("hidden");
-                    var $delFlagInput = $currentTr.find("td:first-child input:eq(1)");
+                    var $delFlagInput = $currentTr.find("td:first-child input:eq(3)");
                     var isDeleted = $delFlagInput.val() === "1";
 
                     // 1. 获取当前行的第五个td(索引从0开始,第五个td的索引是4)
@@ -1633,7 +1634,7 @@
             var idValue = $idInput.val() || "";
 
             // 标记删除(通过修改第一个td中第二个input的值为1)
-            var $targetInput = $currentRow.find("td:first-child input:eq(1)");
+            var $targetInput = $currentRow.find("td:first-child input:eq(3)");
             if ($targetInput.length > 0) {
                 $targetInput.val("1");
             }
@@ -2258,7 +2259,7 @@
         function setParentInfo(parentId){
             return ;
         }
-        function (pIds,id){
+        function setPids(pIds,id){
             $.ajax({
                 url:"${ctx}/reimbursementType/reimbursementType/projectCharge",
                 dataType:"json",
@@ -2786,7 +2787,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
@@ -2905,7 +2906,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行

+ 4 - 4
src/main/webapp/webpage/modules/workreimbursement/treeForm/new/workReimbursementNewModifyApply.jsp

@@ -663,7 +663,7 @@
                 var $sumInput = $(this);
                 var $currentTr = $sumInput.closest("tr");
                 var isHidden = $currentTr.hasClass("hidden");
-                var $delFlagInput = $currentTr.find("td:first-child input:eq(1)");
+                var $delFlagInput = $currentTr.find("td:first-child input:eq(3)");
                 var isDeleted = $delFlagInput.val() === "1";
 
                 // 1. 获取当前行的第五个td(索引从0开始,第五个td的索引是4)
@@ -1606,7 +1606,7 @@
             var idValue = $idInput.val() || "";
 
             // 标记删除(通过修改第一个td中第二个input的值为1)
-            var $targetInput = $currentRow.find("td:first-child input:eq(1)");
+            var $targetInput = $currentRow.find("td:first-child input:eq(3)");
             if ($targetInput.length > 0) {
                 $targetInput.val("1");
             }
@@ -2810,7 +2810,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
@@ -2928,7 +2928,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行

+ 109 - 66
src/main/webapp/webpage/modules/workreimbursement/treeForm/specific/workReimbursementSpecificModifyApply.jsp

@@ -183,7 +183,7 @@
 
                             // 3. 替换模板中的所有占位符(关键步骤)
                             var parsedTagHtml = templateHtml
-                                .replace(/__INDEX__/g, index) // 替换索引占位符
+                                .replace(/__INDEX__/g, index+1) // 替换索引占位符
                                 .replace(/__LEADER_IDS__/g, leaderIds) // 替换leaderIds
                                 .replace(/__REIMBURSEMENT_NAME__/g, reimbursementName); // 替换报销人名称
 
@@ -196,7 +196,7 @@
 
                             // 3. 替换模板中的所有占位符
                             var accessoryNoParentParsedTagHtml = accessoryNoParentTemplateHtml
-                                .replace(/__INDEX__/g, index) // 替换索引
+                                .replace(/__INDEX__/g, index+1) // 替换索引
                                 .replace(/__TYPE__/g, typeValue) // 替换type值(处理空值后)
                                 .replace(/__TYPE_NAME__/g, typeNameValue); // 替换typeName值(处理空值后)
 
@@ -210,7 +210,7 @@
 
                             // 3. 替换模板中的所有占位符
                             var reprojectParsedTagHtml = reprojectTemplateHtml
-                                .replace(/__INDEX__/g, index) // 替换行索引
+                                .replace(/__INDEX__/g, index+1) // 替换行索引
                                 .replace(/__PROJECT_ID__/g, projectId) // 替换项目ID(处理空值后)
                                 .replace(/__PROJECT_NAME__/g, projectName) // 替换项目名称(处理空值后)
                                 .replace(/__PROJECT_RADIO__/g, projectRadio); // 替换projectRadio(处理空值后)
@@ -231,8 +231,8 @@
                             var serialNumber = index + 1
 
                             if(flag) {
+                                index = index+1
                                 const trId = 'workAccountList' + index;
-
                                 $("#workAccountList").append("<tr id='workAccountList" + index + "' class='rowSize'>" +
                                     "<td class='hide'>" +
                                     "<input id='workAccountList" + index + "_id' name='workAccountList[" + index + "].id' type='hidden' value='" + obj.id + "'/>" +
@@ -661,7 +661,7 @@
                 var $sumInput = $(this);
                 var $currentTr = $sumInput.closest("tr");
                 var isHidden = $currentTr.hasClass("hidden");
-                var $delFlagInput = $currentTr.find("td:first-child input:eq(1)");
+                var $delFlagInput = $currentTr.find("td:first-child input:eq(3)");
                 var isDeleted = $delFlagInput.val() === "1";
 
                 // 1. 获取当前行的第五个td(索引从0开始,第五个td的索引是4)
@@ -1490,75 +1490,112 @@
 
         // 数电发票删除 - 隐藏行版本(保留DOM,只隐藏)
         function delRowParentNew(obj, prefix){
-            var id = $(prefix+"_id");
+            if (prefix == '#workAccountList1' && !isBatch) {
+                top.layer.open({
+                    title: '提示',
+                    content: '是否确认删除第1张报销单?(所有报销单数据也将同步删除)',
+                    icon: 3,
+                    btn: ['确定', '取消'],
+                    yes: function (tempIndex, layero) {
+                        // 关闭弹窗
+                        top.layer.close(tempIndex);
+                        // 获取所有 td
+                        var tds = $('#workAccountList .op-td');
+                        for (var i = tds.length - 1; i >= 0; i--) {
+                            var td = tds.eq(i); // 当前 td
+                            var deleteBtn = td.find('.op-btn-delete');
+                            deleteBtn.each(function (eleIndex, ele) {
+                                if (i == 0) {
+                                    delRowParentNew(ele, "#workAccountList1", true)
+                                } else {
+                                    if (this.onclick) {
+                                        this.onclick();
+                                    } else {
+                                        $(this).trigger('click');
+                                    }
+                                }
+                            });
+                        }
+                        document.querySelector('.add-btn').style.display = 'none';
+                    },
+                    btn2: function (tempIndex, layero) {
+                        console.log("用户点击了取消");
+                    },
+                    cancel: function (tempIndex, layero) {
+                        console.log("用户关闭了弹窗");
+                    }
+                });
+            } else {
+                var id = $(prefix + "_id");
 
-            var workAccountmoney= $(prefix+"_money").val();
-            var money = $("#moneys").val();
-            if (isNumber(workAccountmoney)){
-                if(money==""){
-                    money = parseFloat(workAccountmoney).toFixed(2);
-                }else {
-                    money = (parseFloat(money) - parseFloat(workAccountmoney)).toFixed(2);
-                }
-            }
-            if(money>=0){
-                count++;
-                $("#moneys").val(money);
-                var delFlag = $(prefix+"_delFlag");
-                if (id.val() == ""){
-                    delFlag.val("1");
-                    $(obj).parent().parent().remove();
-                }else if(delFlag.val() == "0"){
-                    delFlag.val("1");
-                    $(obj).html("&divide;").attr("title", "撤回删除");
-                    $(obj).parent().parent().addClass("error");
-                    $(obj).parent().parent().addClass("hide");
-                }else if(delFlag.val() == "1"){
-                    delFlag.val("0");
-                    $(obj).html("&times;").attr("title", "删除");
-                    $(obj).parent().parent().removeClass("error");
+                var workAccountmoney = $(prefix + "_money").val();
+                var money = $("#moneys").val();
+                if (isNumber(workAccountmoney)) {
+                    if (money == "") {
+                        money = parseFloat(workAccountmoney).toFixed(2);
+                    } else {
+                        money = (parseFloat(money) - parseFloat(workAccountmoney)).toFixed(2);
+                    }
                 }
+                if (money >= 0) {
+                    count++;
+                    $("#moneys").val(money);
+                    var delFlag = $(prefix + "_delFlag");
+                    if (id.val() == "") {
+                        delFlag.val("1");
+                        $(obj).parent().parent().remove();
+                    } else if (delFlag.val() == "0") {
+                        delFlag.val("1");
+                        $(obj).html("&divide;").attr("title", "撤回删除");
+                        $(obj).parent().parent().addClass("error");
+                        $(obj).parent().parent().addClass("hide");
+                    } else if (delFlag.val() == "1") {
+                        delFlag.val("0");
+                        $(obj).html("&times;").attr("title", "删除");
+                        $(obj).parent().parent().removeClass("error");
+                    }
 
 
-                // 定位外层tr(class为c7f4ef4720924167b2520f620918e1eb)
-                var $outerTr = $("tr." + id.val());
+                    // 定位外层tr(class为c7f4ef4720924167b2520f620918e1eb)
+                    var $outerTr = $("tr." + id.val());
 
-                // 检查外层tr是否存在
-                if ($outerTr.length === 0) {
+                    // 检查外层tr是否存在
+                    if ($outerTr.length === 0) {
 
-                } else {
-                    // 查找外层tr下的所有子tr(包括嵌套在tbody中的)
-                    $outerTr.find("tr").each(function(index, tr) {
-                        var $tr = $(tr);
-
-                        // 找到当前tr的第一个td(索引0)
-                        var $firstTd = $tr.find("td").eq(0);
-                        if ($firstTd.length === 0) {
-                            return true; // 继续下一个tr
-                        }
+                    } else {
+                        // 查找外层tr下的所有子tr(包括嵌套在tbody中的)
+                        $outerTr.find("tr").each(function (index, tr) {
+                            var $tr = $(tr);
+
+                            // 找到当前tr的第一个td(索引0)
+                            var $firstTd = $tr.find("td").eq(0);
+                            if ($firstTd.length === 0) {
+                                return true; // 继续下一个tr
+                            }
 
-                        // 找到第一个td中的第二个input(索引1)
-                        var $targetInput = $firstTd.find("input").eq(1);
-                        if ($targetInput.length === 0) {
-                            return true; // 继续下一个tr
-                        }
+                            // 找到第一个td中的第二个input(索引1)
+                            var $targetInput = $firstTd.find("input").eq(1);
+                            if ($targetInput.length === 0) {
+                                return true; // 继续下一个tr
+                            }
 
-                        // 设置input的值为1
-                        $targetInput.val("1");
-                    });
-                }
+                            // 设置input的值为1
+                            $targetInput.val("1");
+                        });
+                    }
 
-                // 隐藏外层tr(核心新增逻辑)
-                $outerTr.hide();
+                    // 隐藏外层tr(核心新增逻辑)
+                    $outerTr.hide();
 
-                var $currentRow = $(obj).closest("tr"); // 当前行
-                var $parentTable = $currentRow.closest("table"); // 父表格
+                    var $currentRow = $(obj).closest("tr"); // 当前行
+                    var $parentTable = $currentRow.closest("table"); // 父表格
 
-                // 重新排序行号
-                reorderParentRowNumbers($parentTable);
+                    // 重新排序行号
+                    reorderParentRowNumbers($parentTable);
 
-            }else{
-                parent.layer.msg('删除失败',{icon:2});
+                } else {
+                    parent.layer.msg('删除失败', {icon: 2});
+                }
             }
         }
 
@@ -1573,7 +1610,7 @@
             var idValue = $idInput.val() || "";
 
             // 标记删除(通过修改第一个td中第二个input的值为1)
-            var $targetInput = $currentRow.find("td:first-child input:eq(1)");
+            var $targetInput = $currentRow.find("td:first-child input:eq(3)");
             if ($targetInput.length > 0) {
                 $targetInput.val("1");
             }
@@ -2386,7 +2423,7 @@
             </div>
             <div class="form-group layui-row">
                 <div class="form-group-label"><h2>报销详情<span style="color: red;font-size: 14px"> (可在报销单后新增数电发票xml格式的附件获取发票信息)</span></h2></div>
-                <div class="layui-item nav-btns">
+                <div class="layui-item nav-btns add-btn">
                     <a class="nav-btn nav-btn-add" onclick="addRow('#workAccountList', workAccountListRowIdx, workAccountListTpl,'',true);workAccountListRowIdx = workAccountListRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增报销单</a>
                 </div>
                 <div class="layui-table-body layui-item layui-col-xs12 form-table-container"  style="padding:0px">
@@ -2687,6 +2724,12 @@
                         addRow('#reimbursementVATTaxes', reimbursementVATTaxesRowIdx, reimbursementVATTaxesTpl, data[i]);
                         reimbursementVATTaxesRowIdx = reimbursementVATTaxesRowIdx + 1;
                     }*/
+                            var tempData = ${fns:toJson(workReimbursement.workAccountList)};
+                            if (tempData.length > 0 && tempData[0].typeName == '业务差旅费') {
+                                document.querySelector('.add-btn').style.display = 'block';
+                            } else {
+                                document.querySelector('.add-btn').style.display = 'none';
+                            }
                         });
                     </script>
                 </div>
@@ -2727,7 +2770,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行
@@ -2846,7 +2889,7 @@
 
             // 2. 排除已删除的行(隐藏或标记删除)
             var isHidden = $row.hasClass("hidden");
-            var $delFlagInput = $row.find("td:first-child input:eq(1)");
+            var $delFlagInput = $row.find("td:first-child input:eq(3)");
             var isDeleted = $delFlagInput.val() === "1";
             if (isHidden || isDeleted) {
                 return true; // 继续下一行