浏览代码

报销申请管理-报销调整

huangguoce 1 周之前
父节点
当前提交
25052fc919

+ 2 - 2
src/main/webapp/WEB-INF/tags/sys/treeselectAccessoryNoParent.tag

@@ -117,7 +117,7 @@
 													}
 												});
 											}
-											document.querySelector('.nav-btn-add').style.display = 'none';
+											document.querySelector('.add-btn').style.display = 'none';
 											$("#${id}Id").val(ids.join(",").replace(/u_/ig,""));
 											$("#${id}Name").val(names.join(","));
 											$("#${id}Name").focus();
@@ -141,7 +141,7 @@
 									setPids($("#${id}Pids").val(),id);
 								}
 							}else{
-								document.querySelector('.nav-btn-add').style.display = 'block';
+								document.querySelector('.add-btn').style.display = 'block';
 								$("#${id}Id").val(ids.join(",").replace(/u_/ig,""));
 								$("#${id}Name").val(names.join(","));
 								$("#${id}Name").focus();

文件差异内容过多而无法显示
+ 618 - 529
src/main/webapp/webpage/modules/workreimbursement/treeForm/all/workReimbursementAllFormAdd.jsp


+ 110 - 64
src/main/webapp/webpage/modules/workreimbursement/treeForm/all/workReimbursementAllModifyApply.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(处理空值后)
@@ -232,7 +232,7 @@
 
                             if(flag) {
                                 const trId = 'workAccountList' + index;
-
+                                index = index + 1
                                 $("#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 + "'/>" +
@@ -391,6 +391,7 @@
             console.log(listStr)
             if(listStr<1){
                 addRow('#workAccountList', workAccountListRowIdx, workAccountListTpl,'',true)
+                workAccountListRowIdx = workAccountListRowIdx + 1
             }
         });
 
@@ -1485,76 +1486,115 @@
 
 
         // 数电发票删除 - 隐藏行版本(保留DOM,只隐藏)
-        function delRowParentNew(obj, prefix){
-            var id = $(prefix+"_id");
+        function delRowParentNew(obj, prefix,isBatch){
+            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 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 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");
+                    }
 
 
-                // 定位外层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});
+                }
             }
         }
 
@@ -2382,9 +2422,9 @@
             </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>
                 <div class="layui-table-body layui-item layui-col-xs12 form-table-container"  style="padding:0px">
                     <table id="contentTable" class="table table-bordered table-condensed can-edit no-bottom-margin details tree_table">
                         <thead>
@@ -2683,6 +2723,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>

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

@@ -1536,7 +1536,7 @@
                                 }
                             });
                         }
-                        document.querySelector('.nav-btn-add').style.display = 'none';
+                        document.querySelector('.add-btn').style.display = 'none';
                     },
                     btn2: function(tempIndex, layero){
                         console.log("用户点击了取消");
@@ -2441,7 +2441,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">
@@ -2653,7 +2653,7 @@
         </div>
         <div class="form-group layui-row count1">
             <div class="form-group-label"><h2>专用发票信息</h2></div>
-            <div class="layui-item nav-btns">
+            <div class="layui-item nav-btns ">
                 <a class="nav-btn nav-btn-add" onclick="addRow('#reimbursementVATTaxes', reimbursementVATTaxesRowIdx, reimbursementVATTaxesTpl);reimbursementVATTaxesRowIdx = reimbursementVATTaxesRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增</a>
             </div>
             <div class="layui-item layui-col-xs12 form-table-container">
@@ -2740,9 +2740,9 @@
                         <%--workAccountListRowIdx = workAccountListRowIdx + 1;--%>
                         var tempData = ${fns:toJson(workReimbursement.workAccountList)};
                         if(tempData.length > 0 &&tempData[0].typeName == '业务差旅费'  ){
-                            document.querySelector('.nav-btn-add').style.display = 'block';
+                            document.querySelector('.add-btn').style.display = 'block';
                         }else{
-                            document.querySelector('.nav-btn-add').style.display = 'none';
+                            document.querySelector('.add-btn').style.display = 'none';
                         }
 
                     });

文件差异内容过多而无法显示
+ 603 - 514
src/main/webapp/webpage/modules/workreimbursement/treeForm/new/workReimbursementNewModifyApply.jsp