From d6a096fadfe9c8f261f56a827cfceed663c36b8b Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期三, 26 四月 2023 17:23:28 +0800
Subject: [PATCH] backup0421

---
 force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js |  487 +++++++++++++++++++++++++++---------------------------
 1 files changed, 243 insertions(+), 244 deletions(-)

diff --git a/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js b/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
index dc845d8..a35eaa0 100644
--- a/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
+++ b/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
@@ -1,251 +1,250 @@
-import { LightningElement, track } from "lwc";
-import GetOppinformationcData from "@salesforce/apex/ImprovedForecastTimeController.GetOppinformationcData";
-import getReason from "@salesforce/apex/ImprovedForecastTimeController.getReason";
-import SaveData from "@salesforce/apex/ImprovedForecastTimeController.SaveData";
-import SystemModstamp from "@salesforce/schema/Account.SystemModstamp";
+import { LightningElement, track  } from 'lwc';
+import GetOppinformationcData from '@salesforce/apex/ImprovedForecastTimeController.GetOppinformationcData';
+import getReason from '@salesforce/apex/ImprovedForecastTimeController.getReason';
+import SaveData from '@salesforce/apex/ImprovedForecastTimeController.SaveData';
+import SystemModstamp from '@salesforce/schema/Account.SystemModstamp';
 
 export default class ImprovedForecastTime extends LightningElement {
-  //鏄剧ず涓庨殣钘�
-  isAdvance = false; //閫夌潃 鎻愬墠 鐨勬爣璇�
-  isDelay = false; //閫夌潃 寤跺悗 鐨勬爣璇�
 
-  RelateOption = [
-    { label: "鎻愬墠", value: "鎻愬墠" },
-    { label: "寤跺悗", value: "寤跺悗" }
-  ];
+    //鏄剧ず涓庨殣钘�
+    isAdvance = false;  //閫夌潃 鎻愬墠 鐨勬爣璇�
+    isDelay = false; //閫夌潃 寤跺悗 鐨勬爣璇�
 
-  handleRelationFn(event) {
-    var value = event.target.value;
-    this.opp.Date_InAdvance_Delay = value;
-    debugger;
-    // this.opp.Predicted_date_ChangeReason__c = '';
-    //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy start
-    this.opp.Predicted_date_ChangeReason = "";
-    this.opp.Close_Forecasted_Date = "";
-    this.opp.CloseDate = "";
-    //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy end
-    if (value == "鎻愬墠") {
-      this.isAdvance = true;
-      this.isDelay = false;
-    }
-    if (value == "寤跺悗") {
-      this.isAdvance = false;
-      this.isDelay = true;
-    }
-  }
+    RelateOption=[
+        {label:"鎻愬墠",value:"鎻愬墠"},
+        {label:"寤跺悗",value:"寤跺悗"},
+    ]
+        
+    handleRelationFn(event){
 
-  handleRelationFn1(event) {
-    var value = event.target.value;
-    this.opp.Predicted_date_ChangeReason = value;
-  }
-  flg = true;
-  handleRelationFn2(event) {
-    var value = event.target.value;
-    this.opp.Close_Forecasted_Date = value;
-    this.flg = false;
-    debugger;
-    this.CloseDateAssignment(value);
-  }
-  //缁欓娴嬪彂璐ф棩璧嬪��
-  CloseDateAssignment(value) {
-    debugger;
-    var value = this.addDay(30, value);
-    this.opp.CloseDate = value;
-    this.flg = true;
-  }
-  //鍔犲ぉ鏁�
-  addDay(dayNumber, value1) {
-    var date = new Date(value1);
-    var ms = dayNumber * (1000 * 60 * 60 * 24);
-
-    var newDate = new Date(date.getTime() + ms);
-    var value = newDate.toLocaleDateString();
-    var value2 = value.split("/");
-    if (value2[1].length == 1) {
-      value2[1] = "0" + value2[1];
-    }
-    if (value2[2].length == 1) {
-      value2[2] = "0" + value2[2];
-    }
-    value = value2[0] + "-" + value2[1] + "-" + value2[2];
-    return value;
-  }
-  handleRelationFn3(event) {
-    var value = event.target.value;
-    this.opp.CloseDate = value;
-  }
-  //浠巙rl涓婂彇寰桰D
-  getQueryVariable(variable) {
-    var query = window.location.search.substring(1);
-    var vars = query.split("&");
-    for (var i = 0; i < vars.length; i++) {
-      var pair = vars[i].split("=");
-      if (pair[0] == variable) {
-        return pair[1];
-      }
-    }
-    return false;
-  }
-
-  oppId = "";
-  opp = {};
-  Date_InAdvance_Delay = "";
-
-  AdvanceReasons = [];
-  DelayReasons = [];
-
-  //鍒濆鍖�
-  connectedCallback() {
-    this.oppId = this.getQueryVariable("id");
-
-    GetOppinformationcData({ ParamIdStr: this.oppId }).then((response) => {
-      this.opp = JSON.parse(response);
-
-      if (this.opp.Date_InAdvance_Delay == "鎻愬墠") {
-        this.isAdvance = true;
-        this.isDelay = false;
-      }
-      if (this.opp.Date_InAdvance_Delay == "寤跺悗") {
-        this.isAdvance = false;
-        this.isDelay = true;
-      }
-    });
-
-    getReason().then((response) => {
-      var options = JSON.parse(response);
-      this.AdvanceReasons = options["鎻愬墠"];
-      this.DelayReasons = options["寤跺悗"];
-    });
-  }
-
-  //鎻愮ず
-  SaveShowText = "淇濆瓨鎴愬姛"; //鎻愮ず妗嗙殑鏂囨湰
-  Tongzhishow = false; //鎻愮ず鏄剧ず鐨勬爣璇�
-  TongzhiIcon = "standard:account"; //鎻愮ず妗嗙殑鍥炬爣
-  IsLeftStyle = ""; //鎻愮ず妗嗙殑鏍峰紡
-  BgColorStyle = "";
-
-  //寮规鎻愮ず content 鍐呭 error 鏄惁鏄敊璇彁绀烘  left 鏄惁灞呭乏
-  Alert(content, error = false, left = false) {
-    this.SaveShowText = content;
-    this.Tongzhishow = true;
-
-    if (error) {
-      this.TongzhiIcon = "standard:first_non_empty";
-      this.BgColorStyle = "background-color:#f88568";
-    } else {
-      this.TongzhiIcon = "standard:account";
-      this.BgColorStyle = "background-color:#69e669";
-    }
-    if (left) {
-      this.IsLeftStyle = "left: 0.25rem";
-    } else {
-      this.IsLeftStyle = "";
-    }
-  }
-
-  //鍏抽棴鎻愮ず妗�
-  CloseAlert() {
-    this.closeOffRefresh();
-  }
-  closeOffRefresh() {
-    if (this.Tongzhishow == true) {
-      this.Tongzhishow = false;
-    }
-    if (this.SaveShowText != "") {
-      this.SaveShowText = "";
-    }
-  }
-  //鍔犺浇
-  IsLoading = false;
-  OnLoading(flag) {
-    this.IsLoading = flag;
-  }
-  //淇濆瓨鏁版嵁閫昏緫
-  saveFn() {
-    debugger;
-    var myDate = new Date(); //浠婂ぉ鏃ユ湡
-    var myDate1 = new Date(this.opp.Close_Forecasted_Check); //褰撳墠棰勬祴鏃ユ湡
-    var myDate2 = new Date(this.opp.Close_Forecasted_Date); //鏀瑰彉鐨勯娴嬫棩鏈�
-    var myDate3 = new Date(myDate.toLocaleDateString()); //浠婂ぉ鏃ユ湡          鏍煎紡鍖�
-    var myDate4 = new Date(myDate1.toLocaleDateString()); //褰撳墠棰勬祴鏃ユ湡      鏍煎紡鍖�
-    var myDate5 = new Date(myDate2.toLocaleDateString()); //鏀瑰彉鐨勯娴嬫棩鏈�    鏍煎紡鍖�
-
-    var myDate6 = new Date(this.opp.CloseDate);
-    var myDate7 = new Date(myDate6.toLocaleDateString()); //鍙戣揣鏃ユ湡
-
-    //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� start
-    var date1 = new Date();
-    var year = date1.getFullYear();
-    var month = date1.getMonth() + 1;
-    if (month > 3) {
-      year = year + 1;
-    }
-
-    var strDate = "-03-31";
-    var Odate = year + 3;
-    var Sdate = year + 4;
-    var Odate1 = Odate + strDate;
-    var Sdate1 = Sdate + strDate;
-    var Odate2 = new Date(Odate1);
-    var Sdate2 = new Date(Sdate1);
-
-    // //璁㈣揣棰勬祴鏃�
-    var OrderDate = new Date(Odate2.toLocaleDateString());
-    // //鍙戣揣棰勬祴鏃�
-    var ShipmentsDate = new Date(Sdate2.toLocaleDateString());
-
-    //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� end
-
-    console.warn("myDatevalue:=" + myDate);
-    console.warn("浠婂ぉ鏃ユ湡" + myDate3);
-    console.warn("褰撳墠棰勬祴鏃ユ湡" + myDate4);
-    console.warn("1111111111" + myDate2);
-    console.warn("鏀瑰彉鐨勯娴嬫棩鏈�" + myDate5);
-
-    //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy start
-    // if(this.opp.Date_InAdvance_Delay == undefined || this.opp.Predicted_date_ChangeReason == undefined || myDate5 == undefined){
-    // if(this.opp.Date_InAdvance_Delay == '' ||this.opp.Date_InAdvance_Delay == undefined || this.opp.Predicted_date_ChangeReason == '' ||this.opp.Predicted_date_ChangeReason == undefined|| myDate5 == '' || myDate5 == undefined){
-    if (
-      !this.opp.Date_InAdvance_Delay ||
-      !this.opp.Predicted_date_ChangeReason ||
-      !this.opp.Close_Forecasted_Date
-    ) {
-      //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy end
-      this.Alert("璇烽�夋嫨鏃ユ湡/鐞嗙敱銆�", false, true);
-    } else if (
-      this.opp.Date_InAdvance_Delay == "鎻愬墠" &&
-      (myDate5 >= myDate4 || myDate5 < myDate3)
-    ) {
-      this.Alert(
-        "璇烽�夋嫨 鈥滄彁鍓嶁�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡 涓� 涓嶆棭浜庝粖澶┿��",
-        false,
-        true
-      );
-    } else if (this.opp.Date_InAdvance_Delay == "寤跺悗" && myDate5 <= myDate4) {
-      this.Alert("璇烽�夋嫨 鈥滃欢鍚庘�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡銆�", false, true);
-    } else if (myDate7 < myDate5) {
-      this.Alert("棰勬祴鍙戣揣鏃ヤ笉鑳藉皬浜庨娴嬬绾︽棩銆�", false, true);
-    }
-
-    //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� start
-    else if (myDate5 > OrderDate) {
-      this.Alert("璁㈣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ヤ笁璐㈠勾鍐呫��", false, true);
-    } else if (myDate7 > ShipmentsDate) {
-      this.Alert("鍙戣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ュ洓璐㈠勾鍐呫��", false, true);
-    }
-    //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� end
-    else {
-      this.OnLoading(true);
-      SaveData({ JsonData: JSON.stringify(this.opp) }).then((response) => {
-        if (response == "鎴愬姛") {
-          this.OnLoading(false);
-          this.Alert("淇濆瓨鎴愬姛", false, true);
-          window.location.hash = "Refresh" + "==" + this.oppId;
-        } else {
-          this.Alert(response, true);
+        var value = event.target.value;
+        this.opp.Date_InAdvance_Delay = value;
+debugger
+        // this.opp.Predicted_date_ChangeReason__c = '';
+        //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy start
+        this.opp.Predicted_date_ChangeReason = ''
+        this.opp.Close_Forecasted_Date= '';
+        this.opp.CloseDate= '';
+        //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy end
+        if (value == "鎻愬墠") {
+            this.isAdvance = true;
+            this.isDelay = false;
+            
         }
-      });
+        if (value == "寤跺悗") {
+            this.isAdvance = false;
+            this.isDelay = true;
+        }
+
     }
-  }
-}
+
+    handleRelationFn1(event){
+        var value = event.target.value;
+        this.opp.Predicted_date_ChangeReason = value;
+    }
+    flg=true;
+    handleRelationFn2(event){
+        var value = event.target.value;
+        this.opp.Close_Forecasted_Date = value;
+        this.flg=false;
+        debugger
+        this.CloseDateAssignment(value);
+    }
+    //缁欓娴嬪彂璐ф棩璧嬪��
+    CloseDateAssignment(value){
+        debugger
+        var value=this.addDay(30,value);
+        this.opp.CloseDate = value;
+        this.flg=true;
+    }
+    //鍔犲ぉ鏁�
+    addDay(dayNumber, value1) {
+        var date = new Date(value1);
+        var ms = dayNumber * (1000 * 60 * 60 * 24)
+ 
+        var newDate = new Date(date.getTime() + ms);
+        var value=newDate.toLocaleDateString();
+        var value2=value.split('/');
+        if(value2[1].length == 1){
+            value2[1]='0'+value2[1];
+        }
+        if(value2[2].length == 1){
+            value2[2]='0'+value2[2];
+        }
+        value=value2[0]+'-'+value2[1]+'-'+value2[2];
+        return value;
+    } 
+    handleRelationFn3(event){
+        var value = event.target.value;
+        this.opp.CloseDate = value;
+    }
+    //浠巙rl涓婂彇寰桰D
+    getQueryVariable(variable)
+    {
+        var query = window.location.search.substring(1);
+        var vars = query.split("&");
+        for (var i=0;i<vars.length;i++) {
+                var pair = vars[i].split("=");
+                if(pair[0] == variable){return pair[1];}
+        }
+        return(false);
+    }
+
+    oppId = '';
+    opp = {};
+    Date_InAdvance_Delay = '';
+    
+    AdvanceReasons = [];
+    DelayReasons = [];
+
+    //鍒濆鍖�
+    connectedCallback(){
+        this.oppId = this.getQueryVariable('id');
+
+        GetOppinformationcData({ParamIdStr:this.oppId}).then(response=>{
+            this.opp=JSON.parse(response);
+
+            if(this.opp.Date_InAdvance_Delay == '鎻愬墠'){
+                this.isAdvance = true;
+                this.isDelay = false;
+            }
+            if(this.opp.Date_InAdvance_Delay == '寤跺悗'){
+                this.isAdvance = false;
+                this.isDelay = true;
+            }
+        });
+        
+        getReason().then(response=>{
+            var options = JSON.parse(response);
+            this.AdvanceReasons = options['鎻愬墠'];
+            this.DelayReasons = options['寤跺悗'];
+        });
+
+    }
+
+    //鎻愮ず
+    SaveShowText="淇濆瓨鎴愬姛";//鎻愮ず妗嗙殑鏂囨湰
+    Tongzhishow=false;  //鎻愮ず鏄剧ず鐨勬爣璇�
+    TongzhiIcon = 'standard:account' //鎻愮ず妗嗙殑鍥炬爣
+    IsLeftStyle = "" //鎻愮ず妗嗙殑鏍峰紡
+    BgColorStyle = ""
+
+    //寮规鎻愮ず content 鍐呭 error 鏄惁鏄敊璇彁绀烘  left 鏄惁灞呭乏
+    Alert(content,error = false,left = false){
+        this.SaveShowText = content;
+        this.Tongzhishow = true;
+
+        if (error) {
+            this.TongzhiIcon = "standard:first_non_empty";
+            this.BgColorStyle = "background-color:#f88568";
+        }else{
+            this.TongzhiIcon = "standard:account";
+            this.BgColorStyle = "background-color:#69e669";
+        }
+        if (left) {
+            this.IsLeftStyle = "left: 0.25rem"
+        }else{
+            this.IsLeftStyle = ""
+        }
+    }
+
+    //鍏抽棴鎻愮ず妗�
+    CloseAlert(){
+        this.closeOffRefresh();
+    }
+    closeOffRefresh(){
+        if (this.Tongzhishow == true) {
+            this.Tongzhishow = false;
+        }
+        if (this.SaveShowText != "") {
+            this.SaveShowText = "";
+        }
+    }
+    //鍔犺浇
+    IsLoading = false;
+    OnLoading(flag) {
+        this.IsLoading = flag;
+    }
+    //淇濆瓨鏁版嵁閫昏緫
+    saveFn(){
+        debugger
+        var myDate = new Date();                                        //浠婂ぉ鏃ユ湡
+        var myDate1 = new Date(this.opp.Close_Forecasted_Check);        //褰撳墠棰勬祴鏃ユ湡
+        var myDate2 = new Date(this.opp.Close_Forecasted_Date);  //鏀瑰彉鐨勯娴嬫棩鏈�
+        var myDate3 = new Date(myDate.toLocaleDateString());            //浠婂ぉ鏃ユ湡          鏍煎紡鍖�
+        var myDate4 = new Date(myDate1.toLocaleDateString());           //褰撳墠棰勬祴鏃ユ湡      鏍煎紡鍖�
+        var myDate5 = new Date(myDate2.toLocaleDateString());           //鏀瑰彉鐨勯娴嬫棩鏈�    鏍煎紡鍖�
+
+        var myDate6 = new Date(this.opp.CloseDate);
+        var myDate7 = new Date(myDate6.toLocaleDateString());    //鍙戣揣鏃ユ湡
+
+        //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� start 
+        var date1 = new Date();
+        var year = date1.getFullYear();
+        var month = date1.getMonth() + 1;
+        if(month > 3){
+            year = year + 1;
+        }
+
+        var strDate = "-03-31";
+        var Odate = year + 3;
+        var Sdate = year + 4;
+        var Odate1 = Odate + strDate;
+        var Sdate1 = Sdate + strDate;
+        var Odate2 = new Date(Odate1);
+        var Sdate2 = new Date(Sdate1);
+
+        // //璁㈣揣棰勬祴鏃�
+        var OrderDate = new Date(Odate2.toLocaleDateString());
+        // //鍙戣揣棰勬祴鏃�
+        var ShipmentsDate = new Date(Sdate2.toLocaleDateString());
+
+        //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� end
+        
+        console.warn('myDatevalue:='+myDate);
+        console.warn('浠婂ぉ鏃ユ湡'+myDate3);
+        console.warn('褰撳墠棰勬祴鏃ユ湡'+myDate4);
+        console.warn('1111111111'+myDate2);
+        console.warn('鏀瑰彉鐨勯娴嬫棩鏈�'+myDate5);
+        
+        //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy start
+        // if(this.opp.Date_InAdvance_Delay == undefined || this.opp.Predicted_date_ChangeReason == undefined || myDate5 == undefined){
+        // if(this.opp.Date_InAdvance_Delay == '' ||this.opp.Date_InAdvance_Delay == undefined || this.opp.Predicted_date_ChangeReason == '' ||this.opp.Predicted_date_ChangeReason == undefined|| myDate5 == '' || myDate5 == undefined){
+        if(!this.opp.Date_InAdvance_Delay || !this.opp.Predicted_date_ChangeReason ||  !this.opp.Close_Forecasted_Date){
+        //SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy end
+            this.Alert("璇烽�夋嫨鏃ユ湡/鐞嗙敱銆�",false,true);
+        }
+        else if(this.opp.Date_InAdvance_Delay == '鎻愬墠' && (myDate5 >= myDate4 || myDate5 < myDate3)){
+            this.Alert("璇烽�夋嫨 鈥滄彁鍓嶁�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡 涓� 涓嶆棭浜庝粖澶┿��",false,true);
+        }
+        else if(this.opp.Date_InAdvance_Delay == '寤跺悗' && myDate5 <= myDate4){
+            this.Alert("璇烽�夋嫨 鈥滃欢鍚庘�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡銆�",false,true);
+        }
+        else if(myDate7 < myDate5){
+            this.Alert("棰勬祴鍙戣揣鏃ヤ笉鑳藉皬浜庨娴嬬绾︽棩銆�",false,true);
+        }
+
+        //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� start
+        else if(myDate5 > OrderDate){
+            this.Alert("璁㈣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ヤ笁璐㈠勾鍐呫��",false,true);
+        }
+        else if(myDate7 > ShipmentsDate){
+            this.Alert("鍙戣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ュ洓璐㈠勾鍐呫��",false,true);
+        }
+        //20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� end
+
+        else{
+            this.OnLoading(true);
+            SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
+                if (response == '鎴愬姛') {
+                    this.OnLoading(false);
+                    this.Alert("淇濆瓨鎴愬姛",false,true); 
+                    window.location.hash = "Refresh"+"=="+this.oppId;
+                }else{
+                    this.Alert(response,true);
+                }
+            });
+        }
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.1