twysparks
2023-06-26 a8628cfe2640797ba9265e9be46c42430d9e7eba
force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js
@@ -1,5 +1,7 @@
import getStaticResource from "@salesforce/apex/ButtonJsUtility.getStaticResource";
import init from "@salesforce/apex/otherButtonRepairController.init";
import initSelectProfile from '@salesforce/apex/otherButtonRepairController.initSelectProfile';
import initUserName from '@salesforce/apex/otherButtonRepairController.initUserName';
import queryForEquipments from "@salesforce/apex/otherButtonRepairController.queryForEquipments";
import queryForFindInvalidLicense from "@salesforce/apex/otherButtonRepairController.queryForFindInvalidLicense";
import queryForRds from "@salesforce/apex/otherButtonRepairController.queryForRds";
@@ -36,10 +38,11 @@
  api,
  wire
} from "lwc";
import LightningConfirm from 'lightning/confirm';
export default class LexSendNFM103 extends LightningElement {
  @api recordId;
  detailedAddress;
  dealer;
  numberofEffectiveContract;
  newProductGuaranteTxt;
@@ -75,10 +78,18 @@
  profileId;
  userId;
  AWSDataId;
  userName;
  profileName;
  Id;
  DetailedAddress;
  surplusCount = 0;
  url;
  HPActiveC;
  @wire(CurrentPageReference)
  getStateParameters(currentPageReference) {
    if (currentPageReference) {
      this.url = currentPageReference.state.backgroundContext;
      const urlValue = currentPageReference.state.recordId;
      if (urlValue) {
        let str = `${urlValue}`;
@@ -98,21 +109,22 @@
        btns[i].disabled = true;
        btns[i].className = 'btnDisabled';
      }
      this.detailedAddress = result.detailedAddress;
      this.dealer = result.dealer;
      this.Id = result.Id;
      this.HPActiveC = result.HPActiveC;
      this.DetailedAddress = result.detailedAddress;
      this.dealer = result.DealerC;
      this.numberofEffectiveContract = result.numberofEffectiveContract;
      this.newProductGuaranteTxt = result.newProductGuaranteTxt;
      this.onSiteRepair = result.onSiteRepair;
      this.onSiteRepair = result.OnSiteRepairC;
      this.maintenanceContract = result.maintenanceContract;
      this.VMMaintenanceContract = result.VMMaintenanceContract;
      this.FSEState = result.FSEState;
      this.dateReceiptQuestions = result.dateReceiptQuestions;
      this.delayReportReason = result.delayReportReason;
      this.dateReceiptQuestions = result.DateReceiptQuestionsC;
      this.delayReportReason = result.DelayReportReasonC;
      this.repairSource = result.repairSource;
      this.quickRepairSign = result.quickRepairSign;
      this.RCCD = result.RCCD;
      this.returnsProductway = result.returnsProductway;
      this.returnsProductway = result.ReturnsProductWayC;
      this.salesDeptHP = result.salesDeptHP;
      this.isAohuiProduct = result.isAohuiProduct;
      this.stateHospital = result.stateHospital;
@@ -123,7 +135,7 @@
      this.URFLimitSerial = result.URFLimitSerial;
      this.status = result.status;
      this.dealerId = result.dealerId;
      this.ifDeadHurt = result.ifDeadHurt;
      this.ifDeadHurt = result.ifDeadHurtC;
      this.dayLater30 = result.dayLater30;
      this.recallCorrespondence = result.recallCorrespondence;
      this.URFReapir = result.URFReapir;
@@ -131,296 +143,59 @@
      this.DWSign = result.DWSign;
      this.DOJStatus = result.DOJStatus;
      this.SAPcondition = result.SAPcondition;
      this.salesOfficeCodeSelection = result.salesOfficeCodeSelection;
      this.salesOfficeCodeSelection = result.SalesOfficeCodeSelectionC;
      this.profileId = result.profileId;
      this.userId = result.userId;
      this.userId = result.userID;
      this.AWSDataId = result.AWSDataId;
      this.logicalJudgmentA();
      initUserName({
        userId: this.userId
      }).then(result => {
        if (result != null) {
          this.IsLoading = false;
          this.userName = result[0].Name;
        }
      })
      initSelectProfile({
        profileId: this.profileId
      }).then(result => {
        if (result != null) {
          this.IsLoading = false;
          this.profileName = result[0].Name;
          this.foo();
        }
      })
    }).catch(error => {
      console.log("error");
      console.log(error);
    });
  }
  showToast(msg, type) {
    const event = new ShowToastEvent({
      title: '',
      message: msg,
      variant: type
    });
    this.dispatchEvent(event);
  }
  updateRecordView(recordId) {
    updateRecord({
      fields: {
        Id: recordId
      }
    });
  }
  logicalJudgmentA() {
    try {
      if (
        this.numberofEffectiveContract == "无" &&
        this.newProductGuaranteTxt != "2: 多年保修" &&
        this.newProductGuaranteTxt != "2: 服务多年保修" &&
        this.newProductGuaranteTxt != "8: 市场多年保修" &&
        this.onSiteRepair == "直送SORC修理"
      ) {
        if (
          !confirm("设备为非维修合同且非多年保修对象品,请确认是否直送SORC修理?")
        ) {
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
          return;
        }
      }
      console.log("11");
      if (
        (this.maintenanceContract != undefined ||
          this.VMMaintenanceContract != undefined) &&
        this.onSiteRepair == "RC修理" &&
        this.FSEState == "山东省"
      ) {
        if (
          !confirm("该设备为维修合同或多年保修对象品,请确认是否送至RC修理?")
        ) {
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
          return;
        }
      }
      var today = Date.now();
      var dateReceiptQuestions = Date.parse(this.dateReceiptQuestions);
      var dates = (today - dateReceiptQuestions) / (24 * 60 * 60 * 1000);
      if (
        this.profileId != "00e10000000Y3o5" &&
        this.userId != "0051000000AKgzv" &&
        this.userId != "0051000000AKh05" &&
        this.userId != "00510000004q1ed" &&
        this.delayReportReason == "" &&
        dates > "1" &&
        this.repairSource != "QIS转修理"
      ) {
        this.showToast("申请修理时SAP修理申请日超过问题联络收到日1天,必须填写问超时报告的理由", "error");
        this.updateRecordView(this.recordId);
        this.dispatchEvent(new CloseActionScreenEvent());
        return;
      }
      if (
        this.quickRepairSign == true &&
        (this.numberofEffectiveContract == "有" ||
          this.newProductGuaranteTxt == "2: 多年保修" ||
          this.newProductGuaranteTxt == "2: 服务多年保修" ||
          this.newProductGuaranteTxt == "8: 市场多年保修") &&
        (this.onSiteRepair == "RC修理" ||
          this.onSiteRepair == "办事处修理" ||
          this.onSiteRepair == "现场修理")
      ) {
        if (this.RCCD == "2.东北" || this.RCCD == "3.西北") {
          if (
            !confirm(
              "该型号对应为合同或多年保对象品。如确认为大修理故障,需要选择直送SORC修理,请确认是否继续。"
            )
          ) {
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        } else if (
          this.RCCD == "1.华北" ||
          this.RCCD == "6.华南" ||
          this.RCCD == "4.西南"
        ) {
          if (
            !confirm(
              "该型号对应为合同或多年保对象品。如确认为大修理故障,需要选择直送OGZ修理,请确认是否继续。"
            )
          ) {
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        }
      }
      var returnsProductWay = this.returnsProductway;
      var falg = true;
      if (returnsProductWay == undefined) {
        if (!confirm("返品方式为空,是否继续申请修理!")) {
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
          return;
        }
      }
      if (this.assetOwner == "Olympus") {} else {
        console.log(this.detailedAddress);
        if (this.detailedAddress != undefined) {
          var prompt =
            "当前直返收货地址为:" + this.detailedAddress + ",您确认不修改了吗?";
          if (!confirm(prompt)) {
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        } else {
          this.showToast("当前修理没有录入直返收货的详细地址,不能申请修理!", "error");
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
          return;
        }
      }
      queryForEquipments({
        deliveredProductId: this.deliveredProductId,
      }).then((result) => {
        var equipments = result;
        if (equipments != null && equipments.length > 0) {
          var equipment = equipments[0];
          if (equipment.Status == "廃棄") {
            this.showToast("设备废弃,不能提交申请!", "error");
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        }
      });
      if (this.FSEApplyForRepairTime != undefined) {
        this.showToast("已修理申请,不再修理申请了", "error");
        this.updateRecordView(this.recordId);
        this.dispatchEvent(new CloseActionScreenEvent());
        return;
      }
      var surplusCount = 0;
      if (this.URFReapir == true) {
        var urfAsset = null;
        queryForUrfAsset({
          maintenanceContractId: this.maintenanceContractId,
          deliveredProductId: this.deliveredProductId,
        }).then((result) => {
          urfAsset = result;
          var seriesMaxRepairCount = 0;
          var seriesRepairCount = 0;
          if (urfAsset != null && urfAsset.length > 0) {
            seriesMaxRepairCount = urfAsset[0].Series_MaxRepairCount_F__c;
            seriesRepairCount = urfAsset[0].Series_RepairCount_F__c;
            surplusCount = seriesMaxRepairCount - seriesRepairCount;
          }
        });
        var urfSeriesInfo = null;
        queryForUrfSeriesInfo({
          URFLimitSerial: this.URFLimitSerial,
        }).then((result) => {
          urfSeriesInfo = result;
          var urfSeries = "";
          if (urfSeriesInfo != null && urfSeriesInfo.length > 0) {
            urfSeries = urfSeriesInfo[0].URFLimitSerial__c;
          }
          var repairCount = null;
          queryForRepairCount({
            maintenanceContractId: this.maintenanceContractId,
            status1: "1.受理完毕",
            URFLimitSerial: urfSeries,
          }).then((result) => {
            repairCount = result;
          });
          if (repairCount.length > 0 && surplusCount == 1) {
            this.showToast("该设备关联限次合同,目前剩余次数小于送修设备。请等待进行中修理完成后再进行申请", "error");
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        });
      }
      if (
        this.status != "草案中" &&
        this.status != "1.受理完毕(SAP待发送)" &&
        this.status != "4.修理品返送阶段"
      ) {
        this.showToast("不是草案中不能申请", "error");
        this.updateRecordView(this.recordId);
        this.dispatchEvent(new CloseActionScreenEvent());
      } else {
        if (this.dealer != undefined) {
          var findInvalidLicense = null;
          queryForFindInvalidLicense({
            isValidity: false,
            dealerId: this.dealerId,
          }).then((result) => {
            findInvalidLicense = result;
            if (findInvalidLicense.size > 0) {
              this.showToast("经销商三证不在有效期,无法送修", "error");
              this.updateRecordView(this.recordId);
              this.dispatchEvent(new CloseActionScreenEvent());
              return;
            }
          });
        }
        if (this.ifDeadHurt == "有") {
          if (!confirm("是否确认AE要提交?")) {
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        }
        if (this.dayLater30 == "是") {
          this.showToast("创建后超过30天,不能申请了", "error");
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
          return;
        }
        var prompt11 = "合同内大修次数已用完,当前修理为合同外的修理,是否继续?";
        if (this.URFReapir == true && surplusCount == 0) {
          var resultTmp = null;
          if (!confirm(prompt11)) {
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
          updateForRepair1({
            recordId: this.recordId,
          }).then((result) => {
            resultTmp = result;
            console.log("1111");
            var messagesTmp = "";
            if (resultTmp) {
              messagesTmp = this.getConnectDMLErrorMessages(resultTmp);
            }
            if (messagesTmp.length > 0) {
              this.showToast(messagesTmp.join("\n"), "error");
              this.updateRecordView(this.recordId);
              this.dispatchEvent(new CloseActionScreenEvent());
              return;
            }
          });
        }
        var records = null;
        queryForReocrds({
          inchargeStaffId: this.inchargeStaffId,
        }).then((result) => {
          records = result;
          console.log(result);
          this.logicalJudgmentB(records);
        });
      }
    } catch (error) {
      console(error);
  foo() {
    if (this.HPActiveC == '無効') {
      this.ShowToastEvent("本医院已无效,无法进行申请。", "error");
      this.dispatchEvent(new CloseActionScreenEvent());
      return;
    }
    var staticResource = null;
    queryForrecords3({
      dealer: this.dealer
    }).then(result => {
      if (result.length > 0 && result[0].FirstParagraph__c == true) {
        this.handleConfirmClick01("该经销商为先款对象,是否继续申请修理?");
      } else {
        this.ll01();
      }
    });
    var staticResource;
    getStaticResource({
      sobj: "Repair__c"
    }).then(result => {
      console.log(result);
      staticResource = JSON.parse(result);
      Promise.all([
        loadScript(this, AWSService + '/AWSService.js'),
        loadScript(this, jqueryurl),
@@ -434,137 +209,385 @@
          function (data) {
            console.log(data);
            if (data && data.object) {
              var DetailedAddress = data.object.detailedAddress;
              this.DetailedAddress = data.object.detailedAddress;
            }
            this.foo();
          },
          staticResource.token).then(result => {
          this.updateRecordView(this.recordId);
          this.dispatchEvent(new CloseActionScreenEvent());
        });
      }).catch(error => {
        console.log('Failed to load the JQuery : ' + error);
          staticResource.token);
      });
    }).catch(error => {
      console.log('Failed to load the JQuery : ' + error);
    });
    console.log('load correctly');
    })
  }
  foo() {
    console.log("end");
    var records3 = null;
    queryForrecords3({
      recordId: this.recordId,
    }).then((result) => {
      records3 = result;
    });
    var FirstParagraph__c = "";
    if (records3.length >= 1) {
      FirstParagraph__c = records3[0].FirstParagraph__c;
  ll01() {
    console.log(1);
    if (this.numberofEffectiveContract == "无" && this.newProductGuaranteTxt != "2: 多年保修" &&
      this.newProductGuaranteTxt != "2: 服务多年保修" && this.newProductGuaranteTxt != "8: 市场多年保修" &&
      this.onSiteRepair == "直送SORC修理") {
      this.handleConfirmClick02("设备为非维修合同且非多年保修对象品,请确认是否直送SORC修理?");
    } else {
      this.ll02();
    }
    if (FirstParagraph__c == "true") {
      if (!confirm("该经销商为先款对象,是否继续申请修理?")) {
        this.updateRecordView(this.recordId);
  }
  ll02() {
    console.log(2);
    if ((this.maintenanceContract != undefined || this.VMMaintenanceContract != undefined) &&
      this.onSiteRepair == "RC修理" && this.FSEState == "山东省"
    ) {
      this.handleConfirmClick03("该设备为维修合同或多年保修对象品,请确认是否送至RC修理?");
    } else {
      this.ll03();
    }
  }
  ll03() {
    console.log(3);
    var today = Date.now();
    var dateReceiptQuestions = Date.parse(this.dateReceiptQuestions);
    var dates = (today - dateReceiptQuestions) / (24 * 60 * 60 * 1000);
    if (this.profileName != "系统管理员" && this.userName != "胡 玉成" && this.userName != "李 琪清" &&
      this.userName != "郭 洋" &&
      this.delayReportReason == undefined && dates > "1" &&
      this.repairSource != "QIS转修理") {
      this.ShowToastEvent("申请修理时SAP修理申请日超过问题联络收到日1天,必须填写问超时报告的理由", "error");
      this.dispatchEvent(new CloseActionScreenEvent());
      return;
    }
    if (this.quickRepairSign == true && (this.numberofEffectiveContract == "有" || this.newProductGuaranteTxt == "2: 多年保修" ||
        this.newProductGuaranteTxt == "2: 服务多年保修" || this.newProductGuaranteTxt == "8: 市场多年保修") &&
      (this.onSiteRepair == "RC修理" || this.onSiteRepair == "办事处修理" || this.onSiteRepair == "现场修理")) {
      if (this.RCCD == "2.东北" || this.RCCD == "3.西北") {
        this.handleConfirmClick04("该型号对应为合同或多年保对象品。如确认为大修理故障,需要选择直送SORC修理,请确认是否继续。");
      } else if (this.RCCD == "1.华北" || this.RCCD == "6.华南" || this.RCCD == "4.西南") {
        this.handleConfirmClick04("该型号对应为合同或多年保对象品。如确认为大修理故障,需要选择直送OGZ修理,请确认是否继续。");
      } else {
        if (this.returnsProductway == undefined) {
          this.handleConfirmClick06("返品方式为空,是否继续申请修理!");
        } else {
          this.ll06();
        }
      }
    } else {
      if (this.returnsProductway == undefined) {
        this.handleConfirmClick06("返品方式为空,是否继续申请修理!");
      } else {
        this.ll06();
      }
    }
  }
  ll06() {
    console.log(6);
    if (this.assetOwner != "Olympus") {
      if (this.DetailedAddress != undefined) {
        this.handleConfirmClick07('当前直返收货地址为:' + this.DetailedAddress + ',您确认不修改了吗?');
      } else {
        this.ShowToastEvent('当前修理没有录入直返收货的详细地址,不能申请修理!', "error");
        this.dispatchEvent(new CloseActionScreenEvent());
        return;
      }
    } else {
      this.ll07();
    }
    console.log("endend");
  }
  logicalJudgmentB(records) {
    if (records != null && records.length > 0) {
      var staff = records[0];
      var res = null;
      updateRepair2({
        recordId: this.recordId,
        staff: staff,
        DWSign: this.DWSign,
        statusc: "1.受理完毕",
        DOJStatus: this.DOJStatus,
        SAPcondition: this.SAPcondition,
      }).then((result) => {
        console.log(result + "result");
        res = result;
        console.log("start3");
        var messages = "";
        if (res) {
          messages = this.getConnectDMLErrorMessages(res);
        }
        if (messages.length > 0) {
          this.showToast(messages.join("\n"), "error");
          this.updateRecordView(this.recordId);
  ll07() {
    console.log(7);
    queryForEquipments({
      deliveredProductId: this.deliveredProductId,
    }).then(equipments => {
      if (equipments != null && equipments.length > 0) {
        var equipment = equipments[0];
        if (equipment.Status == "廃棄") {
          this.ShowToastEvent("设备废弃,不能提交申请!", "error");
          this.dispatchEvent(new CloseActionScreenEvent());
        } else {
          if (this.salesOfficeCodeSelection == "成都RC") {
            this.showToast("现阶段,成都RC仅受理四川(西藏)内镜、西南全域CV/CLV,其余实物请发至广州RC。", "error");
            this.updateRecordView(this.recordId);
            this.dispatchEvent(new CloseActionScreenEvent());
          }
          return;
        }
        var rds = null;
        queryForRds({
          recordId: this.recordId,
        }).then((result) => {
          rds = result;
          if (rds != null && rds.length > 0) {
            var repairAft = rds[0];
            if (
              repairAft.NewProductGuarante_Formula__c !=
              repairAft.ProductGuarante_Create__c
            ) {
              this.showToast("该设备保修信息已发生变化,请了解", "error");
            }
      }
    });
    console.log(701);
    if (this.FSEApplyForRepairTime != undefined) {
      this.ShowToastEvent("已修理申请,不再修理申请了", "error");
      this.dispatchEvent(new CloseActionScreenEvent());
      return;
    }
    console.log(702);
    if (this.URFReapir == false) {
      queryForUrfAsset({
        maintenanceContractId: this.maintenanceContractId,
        deliveredProductId: this.deliveredProductId,
      }).then(urfAsset => {
        var seriesMaxRepairCount = 0;
        var seriesRepairCount = 0;
        if (urfAsset != null && urfAsset.length > 0) {
          seriesMaxRepairCount = urfAsset[0].Series_MaxRepairCount_F__c;
          seriesRepairCount = urfAsset[0].Series_RepairCount_F__c;
          this.surplusCount = seriesMaxRepairCount - seriesRepairCount;
        }
      });
      console.log(703);
      queryForUrfSeriesInfo({
        URFLimitSerial: this.URFLimitSerial,
      }).then(urfSeriesInfo => {
        var urfSeries = "";
        if (urfSeriesInfo != null && urfSeriesInfo.length > 0) {
          urfSeries = urfSeriesInfo[0].URFLimitSerial__c;
        }
        console.log(704);
        queryForRepairCount({
          maintenanceContractId: this.maintenanceContractId,
          status1: "1.受理完毕",
          URFLimitSerial: urfSeries,
        }).then(repairCount => {
          if (repairCount.length > 0 && this.surplusCount == 1) {
            this.ShowToastEvent("该设备关联限次合同,目前剩余次数小于送修设备。请等待进行中修理完成后再进行申请", "error");
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        });
      });
    }
    console.log(705);
    if (this.status != "草案中" && this.status != "1.受理完毕(SAP待发送)" && this.status != "4.修理品返送阶段") {
      this.ShowToastEvent("不是草案中不能申请", "error");
      this.dispatchEvent(new CloseActionScreenEvent());
      return;
    } else {
      this.showToast("没有找到 修理委托者", "error");
      this.updateRecordView(this.recordId);
      if (this.dealer != undefined) {
        queryForFindInvalidLicense({
          dealerId: this.dealerId,
        }).then(findInvalidLicense => {
          console.log(findInvalidLicense);
          if (findInvalidLicense.length > 0) {
            this.ShowToastEvent("经销商三证不在有效期,无法送修", "error");
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        });
      }
    }
    if (this.ifDeadHurt == "有") {
      this.handleConfirmClick08("是否确认AE要提交?");
    } else {
      this.ll08();
    }
  }
  ll08() {
    console.log(8);
    if (this.dayLater30 == "是") {
      this.ShowToastEvent("创建后超过30天,不能申请了", "error");
      this.dispatchEvent(new CloseActionScreenEvent());
      return;
    }
    if (this.URFReapir == true && this.surplusCount == 0) {
      this.handleConfirmClick09("合同内大修次数已用完,当前修理为合同外的修理,是否继续?");
    } else {
      this.ll09();
    }
  }
  ll09() {
    console.log(9);
    updateForRepair1({
      recordId: this.Id
    }).then(result => {
      if (result != null && result.length > 0) {
        var split = result.split(", ");
        this.ShowToastEvent(split[1], "error");
        this.dispatchEvent(new CloseActionScreenEvent());
        return;
      } else {
        console.log(901);
        queryForReocrds({
          inchargeStaffId: this.inchargeStaffId,
        }).then(records => {
          if (records != null && records.length > 0) {
            var staff = records[0];
            console.log(staff);
            console.log(902);
            updateRepair2({
              recordId: this.Id,
              staff: staff,
              DWSign: this.DWSign,
              statusc: "1.受理完毕",
              DOJStatus: this.DOJStatus,
              SAPcondition: this.SAPcondition,
            }).then(result => {
              console.log(result);
              console.log(903);
              if (result != null && result.length > 0) {
                var split = result.split(", ");
                this.ShowToastEvent(split[1], "error");
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
              } else {
                if (this.salesOfficeCodeSelection == "成都RC") {
                  this.ShowToastEvent("现阶段,成都RC仅受理四川(西藏)内镜、西南全域CV/CLV,其余实物请发至广州RC。", "error");
                  this.dispatchEvent(new CloseActionScreenEvent());
                  return;
                }
              }
              console.log(904);
              queryForRds({
                recordId: this.Id,
              }).then(rds => {
                console.log(rds);
                if (rds != null && rds.length > 0) {
                  var repairAft = rds[0];
                  if (repairAft.NewProductGuarante_Formula__c != repairAft.ProductGuarante_Create__c) {
                    this.ShowToastEvent("该设备保修信息已发生变化,请了解", "error");
                    this.dispatchEvent(new CloseActionScreenEvent());
                    return;
                  }
                }
              });
              window.open(this.url, "_self");
            });
          } else {
            this.ShowToastEvent("没有找到 修理委托者", "error");
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
          }
        });
      }
    });
  }
  ShowToastEvent(msg, type) {
    const event = new ShowToastEvent({
      title: '',
      message: msg,
      variant: type
    });
    this.dispatchEvent(event);
  }
  async handleConfirmClick01(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll01();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  getConnectDMLErrorMessages(results) {
    console.log(results);
    var messages = [],
      i = 0,
      len = results.length,
      r;
    console.log("sos");
    for (; i < len; i++) {
      r = results[i];
      if (!r.getBoolean("success")) {
        messages = messages.concat(getConnectDMLMessagesOfAResult(r));
      }
    }
    return messages;
  }
  getConnectDMLMessagesOfAResult(res) {
    var messages = [],
      errors = res.getArray("errors"),
      i = 0,
      len = errors.length,
      e;
    for (; i < len; i++) {
      e = errors[i];
      messages.push(e.message + " " + getConnectDMLErrorFields(e));
    }
    return messages;
  }
  getConnectDMLErrorFields(error) {
    var fields = error.getArray("fields");
    if (fields.length > 0) {
      return "[" + fields.join(",") + "]";
  async handleConfirmClick02(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll02();
    } else {
      return "";
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick03(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll03();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick04(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      if (this.returnsProductway == undefined) {
        this.handleConfirmClick06("返品方式为空,是否继续申请修理!");
      } else {
        this.ll06();
      }
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick05(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      if (this.returnsProductway == undefined) {
        this.handleConfirmClick06("返品方式为空,是否继续申请修理!");
      } else {
        this.ll06();
      }
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick06(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll06();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick07(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll07();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick08(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll08();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
  async handleConfirmClick09(msg) {
    const result = await LightningConfirm.open({
      message: msg,
      variant: 'headerless',
      label: 'this is the aria-label value'
    });
    if (result) {
      this.ll09();
    } else {
      this.dispatchEvent(new CloseActionScreenEvent());
    }
  }
}