ouyj 1 неделя назад
Родитель
Сommit
3810450188

+ 20 - 23
src/main/webapp/yw/contract/contractFlowCustom/js/contract.js

@@ -412,9 +412,10 @@ function f_importCancelMaterial(item, dialog) {
 }
 
 function addPayInfo() { 
-	// 检查是否有物料信息
-    if ($(".startTr1:not(.hide)").length === 0) {
-        $.ligerDialog.warn("请先添加物料信息再填写付款信息!");
+	// 检查是否有合同金额
+    var contractMoney = parseFloat($("#contract_money").val()) || parseFloat($("#totalPrice").val()) || 0;
+    if (contractMoney <= 0) {
+        $.ligerDialog.warn("请先输入合同金额再填写付款信息!");
         return;
     }
 	var cloneObj = $("#template_2").clone().removeClass("hide").removeAttr("id");
@@ -585,7 +586,7 @@ function calculateTotalPrice() {
             // 保留用户手动输入的较大值
             // 不更新合同金额
         } else {
-            // 自动更新为物料总额
+            // 自动更新为物料总额(包括非手动输入,或手动输入但物料总额更大的情况)
             $("#contract_money").val(total.toFixed(2));
             // 重置手动输入标记
             $("#contract_money").removeData("manual-input");
@@ -594,6 +595,8 @@ function calculateTotalPrice() {
         // 没有物料时,只有非手动输入才清空
         if (!manualInput) {
             $("#contract_money").val("");
+            // 合同金额被清空时,删除所有付款信息
+            clearAllPaymentInfo();
         }
         // 注意:如果是手动输入,即使没有物料也保留用户输入
     }
@@ -610,17 +613,8 @@ function calculateTotalPrice() {
 }
 
 function checkMaterialFilled() {
-    var hasMaterial = $(".startTr1:not(.hide)").length > 0;
-    $("#addPayInfo").prop("disabled", !hasMaterial);
-    $(".startTr2:not(.hide) input, .startTr2:not(.hide) select").prop("disabled", !hasMaterial);
-    
-    // 添加视觉提示
-    if (!hasMaterial) {
-        $("#secondDiv").addClass("disabled-section");
-        $("#contract_money").val(""); // 清空合同金额
-    } else {
-        $("#secondDiv").removeClass("disabled-section");
-    }
+    // 不再根据物料状态禁用付款信息
+    // 该函数保留用于其他可能的用途
 }
 
 //计算付款信息中的金额(根据比例自动计算)
@@ -662,15 +656,18 @@ function hideInlineError(element) {
     element.next('.inline-error').remove();
 }
 
-//检查是否需要删除合同付款信息
+//检查是否需要删除合同付款信息(已废弃,保留用于兼容)
 function checkAndRemovePaymentInfo() {
-    var hasMaterial = $(".startTr1:not(.hide)").length > 0; 
-    // 如果没有物料,则删除所有付款信息
-    if (!hasMaterial ) {
-    	$(".startTr2:not(.hide)").each(function() {
-            $(this).remove();
-        }); 
-    }
+    // 不再自动删除付款信息,允许在没有物料的情况下保留付款信息
+    // 该函数保留用于其他可能的用途
+}
+
+// 清空所有付款信息
+function clearAllPaymentInfo() {
+    $(".startTr2:not(.hide)").each(function() {
+        $(this).remove();
+    });
+    addPayIdAndName(); // 重新编号
 }
 
 function initPriceForProcess() { 

+ 5 - 6
src/main/webapp/yw/contract/contractFlowCustom/processContract.jsp

@@ -138,12 +138,11 @@
          // 监听合同金额手动输入
             $("#contract_money").on('input', function() {
             	var contractMoney = parseFloat($("#contract_money").val());
-            	if(contractMoney){
+            	if(contractMoney && contractMoney > 0){
             		// 标记为用户手动输入
                     $(this).data("manual-input", true);
-            	}else{
-            		$(this).removeData("manual-input");
-            	}  
+            	}
+                // 注意:不在这里清除标记,防止初始化设置的标记被意外清除
                 //calculatePaymentAmount();
             });
             
@@ -381,7 +380,7 @@
 		}
 		
 		.disabled-section::after {
-		    content: "请先填写物料信息";
+		    content: "请先输入合同金额";
 		    position: absolute;
 		    top: 50%;
 		    left: 50%;
@@ -417,7 +416,7 @@
 	    }
 	    
 	    .disabled-section::after {
-	        content: "请先填写物料信息";
+	        content: "请先输入合同金额";
 	        position: absolute;
 	        top: 50%;
 	        left: 50%;

+ 6 - 8
src/main/webapp/yw/contract/contractFlowCustom/startContract.jsp

@@ -88,12 +88,11 @@
         	// 监听合同金额手动输入
             $("#contract_money").on('input', function() {
             	var contractMoney = parseFloat($("#contract_money").val());
-            	if(contractMoney){
+            	if(contractMoney && contractMoney > 0){
             		// 标记为用户手动输入
                     $(this).data("manual-input", true);
-            	}else{
-            		$(this).removeData("manual-input");
-            	}  
+            	}
+                // 注意:不在这里清除标记,防止初始化设置的标记被意外清除
                 //calculatePaymentAmount();
             });
             
@@ -311,7 +310,7 @@
 		}
 		
 		.disabled-section::after {
-		    content: "请先填写物料信息";
+		    content: "请先输入合同金额";
 		    position: absolute;
 		    top: 50%;
 		    left: 50%;
@@ -345,9 +344,9 @@
 	        pointer-events: none;
 	        position: relative;
 	    }
-	    
+	    	    
 	    .disabled-section::after {
-	        content: "请先填写物料信息";
+	        content: "请先输入合同金额";
 	        position: absolute;
 	        top: 50%;
 	        left: 50%;
@@ -508,7 +507,6 @@
                     <span style="font-size: 20px;">付款信息</span>
                     <img align="bottom" id="addPayInfo" style="cursor: pointer" class="add"
                          src="${pageContext.request.contextPath}/liger/lib/ligerUI/skins/${sessionScope.css}/images/index/jia.png">
-                     <!-- <span style="color: red; font-size: 12px;">(请先填写物料信息)</span> -->
                 </td>
             </tr>
         </table>