From fd0bea6d4ad22f61b323ff5cf32e2b1104bb5492 Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期四, 20 四月 2023 14:16:42 +0800
Subject: [PATCH] 失单报告增加限制

---
 force-app/main/default/pages/PCLLostReportPage.page |   75 ++++++++++++++++++++++++++++++-------
 1 files changed, 61 insertions(+), 14 deletions(-)

diff --git a/force-app/main/default/pages/PCLLostReportPage.page b/force-app/main/default/pages/PCLLostReportPage.page
index bc89ad4..458eba3 100644
--- a/force-app/main/default/pages/PCLLostReportPage.page
+++ b/force-app/main/default/pages/PCLLostReportPage.page
@@ -5,6 +5,11 @@
     <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
     <apex:form id="allForm">
         <script>
+            // 20230418 ljh DB202304320022 start
+            window.onload = function init(){
+                clearBrandMannualName();
+            }
+            // 20230418 ljh DB202304320022 end
             function saveJs() {
                 blockme();
                 save();
@@ -31,6 +36,12 @@
                 search(topNum, secondNum);
             }
             // add tcm 20211118 end
+            // 20230418 ljh DB202304320022 start
+            function edit2JS() {
+                blockme();
+                edit2();
+            }
+            // 20230418 ljh DB202304320022 end
             function setLostTotalAmount() {
                 //console.log('setLostTotalAmount start:');
                 var totalAmount = document.getElementById("allPage:allForm:allBlock:EditPage:LostReport:lstReport:LostTotalAmountOut:LostTotalAmount");
@@ -76,14 +87,32 @@
                 setbrandmannual(brandNumber);
             }
             // 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢�  thh 2022-01-13 start
-            function clearBrandMannualName(){
-                if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '鍏朵粬'){
-                    j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:productTable:0:LostProduct')).attr("disabled", true);
-                } else{
-                    document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
-                    j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
+            // function clearBrandMannualName(){
+            //     if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '鍏朵粬'){
+            //         j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:productTable:0:LostProduct')).attr("disabled", true);
+            //     } else{
+            //         document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
+            //         j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
+            //     }
+            // }
+            // 20230418 ljh DB202304320022 start
+            function clearBrandMannualName(){ 
+                var pageStatus = "{!pageStatus}";
+                if(pageStatus == 'Create'|| pageStatus == 'Edit'){
+                    var brandCount = parseInt("{!brandCount}");
+                    for(var i = 0;i<brandCount;i++){
+                        if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '鍏朵粬'){
+                            if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value == '' || document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value == null){
+                                j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:productTable:0:LostProduct')).attr("disabled", true);
+                            }
+                        } else{
+                            document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
+                            j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
+                        }
+                    }
                 }
             }
+            // 20230418 ljh DB202304320022 end
             // 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢�  thh 2022-01-13 end
         </script>
         <apex:actionFunction name="save" action="{!save}" oncomplete="unblockUI();clearBrandMannualName();" rerender="allForm,EditButton2"></apex:actionFunction>
@@ -93,22 +122,35 @@
         </apex:actionFunction>
         <!-- 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢�  thh 2022-01-13 end -->
 
-        <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="unblockUI();" rerender="allForm">
+        <!-- 20230418 ljh DB202304320022 start -->
+        <!-- <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="unblockUI();" rerender="allForm"> -->
+        <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm">
+        <!-- 20230418 ljh DB202304320022 end -->
             <apex:param assignTo="{!setBrandNo}" name="setBrandNo" value="" />
         </apex:actionFunction>
 
         <apex:actionFunction name="submit" action="{!submit}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
-
-
-        <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
-        <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="unblockUI();">
+        <!-- 20230418 ljh DB202304320022 start -->
+        <apex:actionFunction name="edit2" action="{!edit2}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
+        <!-- <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction> -->
+        <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
+        
+        <!-- <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="unblockUI();"> -->
+        <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
+        <!-- 20230418 ljh DB202304320022 end -->
             <apex:param assignTo="{!brandNo}" name="brandNo" value="" />
         </apex:actionFunction>
-        <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="unblockUI();">
+        <!-- 20230418 ljh DB202304320022 start -->
+        <!-- <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="unblockUI();"> -->
+        <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
+        <!-- 20230418 ljh DB202304320022 end -->
             <apex:param assignTo="{!RemoveBrandNo}" name="RemoveBrandNo" value="" />
         </apex:actionFunction>
         <!-- add tcm 20211118 start -->
-        <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="unblockUI();">
+        <!-- 20230418 ljh DB202304320022 start -->
+        <!-- <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="unblockUI();"> -->
+        <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
+        <!-- 20230418 ljh DB202304320022 end -->
             <apex:param assignTo="{!topNum}" name="topNum" value="" />
             <apex:param assignTo="{!secondNum}" name="secondNum" value="" />
         </apex:actionFunction>
@@ -403,9 +445,14 @@
 
                         <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '鑽夋', 'true', 'false')}" id="SubmitButton" onclick="submitJS();return false;"
                             value="鎻愪氦" style="width: 150px;margin-left: 50px;" />
-                        <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '鑽夋' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
+                        <!-- 20230418 ljh DB202304320022 start -->
+                        <!-- <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '鑽夋' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
                             id="EditButton" reRender="allForm" action="{!edit2}" value="缂栬緫" style="width: 150px;margin-left: 50px;"
+                        /> -->
+                        <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '鑽夋' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
+                            id="EditButton" reRender="allForm"  onclick="edit2JS();return false;" value="缂栬緫" style="width: 150px;margin-left: 50px;"
                         />
+                        <!-- 20230418 ljh DB202304320022 end -->
                         <apex:commandButton id="CancelButton" action="{!cancel}" value="杩斿洖璇环" style="width: 150px;margin-left: 50px;" />
 
                     </apex:pageBlockButtons>

--
Gitblit v1.9.1