From 09b83c021646c56cec56b77dc091893401563f9f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 24 四月 2023 17:39:27 +0800
Subject: [PATCH] 修改失单页面
---
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js | 226 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 183 insertions(+), 43 deletions(-)
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
index aa97526..0b3ba85 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
* @Author: chen jing wu
* @Date: 2023-04-20 15:04:03
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-20 17:15:06
+ * @LastEditTime: 2023-04-24 16:46:31
*/
/*
* @Description:
@@ -14,66 +14,182 @@
* @LastEditors: chen jing wu
* @LastEditTime: 2023-04-20 17:11:01
*/
-import { LightningElement } from 'lwc';
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
import save from '@salesforce/apex/lexPCLLostReportLwcController.save';
-import unblockui from '@sa';
+import jquery from '@salesforce/resourceUrl/jquery183minjs';
+import blockUIcss from '@salesforce/resourceUrl/blockUIcss';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
+import setbrand from '@salesforce/apex/lexPCLLostReportLwcController.setBrand';
+import init from '@salesforce/apex/lexPCLLostReportLwcController.init';
+import PleaseWaitDialog from '@salesforce/resourceUrl/PleaseWaitDialog';
+import initForApex from '@salesforce/apex/lexPCLLostReportLwcController.initForApex';
export default class LexPCLLostReportPage extends LightningElement {
- connectedCallback(){
+ @api oppId;
+ @api lostReportId;
+ @api pageStatus;
+ @api lostType;
+ @api submitFlag;
+ LostReport;
+ brandCount;
+ lostReportObj;
+ //澶卞崟绫诲瀷
+ RecordTypeOptions = [{ label: '--鏃�--', value: '' },
+ { label: '澶卞崟', value: '澶卞崟' },
+ { label: '閮ㄥ垎澶卞崟', value: '閮ㄥ垎澶卞崟' }];
+ // @wire(CurrentPageReference)
+ // getStateParameters(currentPageReference) {
+ // console.log(111);
+ // console.log(currentPageReference);
+ // if (currentPageReference) {
+ // const urlValue = currentPageReference.state.recordId;
+ // if (urlValue) {
+ // let str = `${urlValue}`;
+ // console.log("str");
+ // console.log(str);
+ // this.oppId = str;
+ // }
+ // }
+ // }
+
+ // connectedCallback(){
+ // console.log("1");
+ // initForApex({
+ // oppId1: this.oppId,
+ // lostReportId1: this.lostReportId,
+ // pageStatus1: this.pageStatus,
+ // lostType1: this.lostType,
+ // submitFlag1: this.submitFlag
+ // }).then(()=>{
+ // console.log("2");
+ // init().then(result=>{
+ // console.log("3");
+ // console.log(result);
+ // if(result.message == '鎻愪氦鎴愬姛锛�'){
+ // this.showToast(result.message,"success");
+ // this.LostReport = result.LostReport;
+ // }else{
+ // console.log("211");
+ // this.showToast(result.message,"error");
+ // console.log("985");
+ // }
+ // });
+ // });
+ // }
+
+ getParamValue(paramName) {
+ // Use the URLSearchParams API to get the value of a query parameter
+ const params = new URLSearchParams(window.location.search);
+ return params.get(paramName);
}
saveJs() {
- blockme();
- save();
+ this.blockMyself();
+ save().then(result=>{
+ if(result){
+ this.showToast(result,"success");
+ this.unblock();
+ this.clearBrandMannualName();
+ }
+ })
}
addBrandJs() {
- blockme();
- addBrand();
+ this.blockMyself();
+ addBrand().then(()=>{
+ this.unblock();
+ });
}
submitJS() {
- blockme();
- submit();
+ this.blockMyself();
+ submit().then(result=>{
+ if(result.get('error')){
+ this.showToast(result.get('error'),"error");
+ }else{
+ this[NavigationMixin.Navigate]({
+ type: 'standard__recordPage',
+ attributes: {
+ uri: result.get('uri'),
+ Id: result.get('Id'),
+ pageStatus: result.get('pageStatus'),
+ submitFlag: result.get('submitFlag')
+ }
+ });
+ this.unblock();
+ }
+ });
}
addProductJs(number) {
- blockme();
- addProduct(number);
+ this.blockMyself();
+ addProduct().then(()=>{
+ this.unblock();
+ });
}
RemoveJs(number) {
- blockme();
- Remove(number);
+ this.blockMyself();
+ Remove().then(()=>{
+ this.unblock();
+ });
}
// add tcm 20211118 start
searchJs(topNum, secondNum) {
- blockme();
- search(topNum, secondNum);
+ this.blockMyself();
+ search().then(()=>{
+ this.unblock();
+ });
}
+ blockMyself(){
+ Promise.all([
+ loadScript(this,PleaseWaitDialog),
+ loadStyle(this,blockUIcss),
+ loadScript(this, jquery)
+ //loadScript(this, jq + "/dist/jquery.min.js")
+ ]).then(() =>{
+ blockme();
+ }).catch(error => {
+ console.log("321");
+ console.log('Failed to load the JQuery : ' +error);
+ });
+ }
+ unblock(){
+ Promise.all([
+ loadScript(this,PleaseWaitDialog),
+ loadStyle(this,blockUIcss),
+ loadScript(this, jquery)
+ //loadScript(this, jq + "/dist/jquery.min.js")
+ ]).then(() =>{
+ unblockUI();
+ }).catch(error => {
+ console.log("321");
+ console.log('Failed to load the JQuery : ' +error);
+ });
+ }
+ get pageStatusIsCreateOrEdit() {
+ return this.pageStatus === 'Create' || this.pageStatus === 'Edit';
+ }
+
// add tcm 20211118 end
setLostTotalAmount() {
//console.log('setLostTotalAmount start:');
- var totalAmount = document.getElementById("allPage:allForm:allBlock:EditPage:LostReport:lstReport:LostTotalAmountOut:LostTotalAmount");
- var totalAmountHidden = document.getElementById("allPage:allForm:allBlock:LostTotalAmount");
+ var totalAmount = this.template.querySelector('[data-id="LostTotalAmount"]');
+ var totalAmountHidden = this.template.querySelector('[data-id="LostTotalAmountHidden"]');
+ var brandAmountObjects = this.template.querySelectorAll('[data-id^="BrandContent:LostPriceOut"]');
+ var brandCompanyObjects = this.template.querySelectorAll('[data-id^="BrandContent:Lost_By_CompanyOut"]');
if (!!totalAmount && !!totalAmountHidden) {
var tempLostAmount = 0.0;
- var i = 0;
- var brandCount = parseInt("{!brandCount}");
+ var brandCount = parseInt(this.brandCount);
//console.log(brandCount);
for (var i = 0; i < brandCount; i++) {
- var brandAmountObject =
- document.getElementById("allPage:allForm:allBlock:EditPage:LostBrands:" +
- i + ":LostBrand:BrandContent:LostPriceOut:LostPrice");
- var brandCompanyObject =
- document.getElementById("allPage:allForm:allBlock:EditPage:LostBrands:" +
- i + ":LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company");
-
+ var brandAmountObject = brandAmountObjects[i];
+ var brandCompanyObject = brandCompanyObjects[i];
+
if (!!brandAmountObject && !!brandCompanyObject) {
-
var brandCompanyText = brandCompanyObject.innerText;
var brandCompanyValue = brandCompanyObject.value;
-
-
- if (!!brandCompanyText && brandCompanyText != '--鏃�--' && !!brandCompanyValue) {
- var brandAmount = localParseFloat(brandAmountObject.value);
- //console.log('brandAmount:'+brandAmount);
+
+ if (!!brandCompanyText && brandCompanyText !== '--鏃�--' && !!brandCompanyValue) {
+ var brandAmount = parseFloat(brandAmountObject.value);
tempLostAmount = tempLostAmount + brandAmount;
}
}
@@ -84,21 +200,45 @@
//console.log('setLostTotalAmount end');
}
setBrandName(brandNumber) {
- blockme();
- setbrand(brandNumber);
+ this.blockMyself();
+ setbrand().then(()=>{
+ this.clearBrandMannualName();
+ this.unblock();
+ });
}
setBrandMannualName(brandNumber) {
- blockme();
- setbrandmannual(brandNumber);
+ this.blockMyself();
+ setbrandmannual().then(()=>{
+ this.unblock();
+ });
}
// 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢� thh 2022-01-13 start
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);
+ if (this.template.querySelector('[id$="Lost_By_CompanyOut"]').value === '鍏朵粬') {
+ this.template.querySelector('[id$="LostProduct"]').setAttribute('disabled', true);
+ } else {
+ this.template.querySelector('[id$="Lost_By_Company_MannualOut:Lost_By_Company_Mannual"]').value = '';
+ this.template.querySelector('[id$="Lost_By_Company_MannualOut:Lost_By_Company_Mannual"]').setAttribute('disabled', true);
}
}
- // 澶卞崟鍝佺墝涓嶇瓑浜庡叾浠栨椂,澶卞崟鍝佺墝锛堟墜鍔級娓呯┖骞朵笖涓嶅厑璁稿~鍐�,澶卞崟鍝佺墝绛変簬鍏朵粬鏃�,澶卞崟瀵规墜鍨嬪彿涓嶅彲鐢� thh 2022-01-13 end
+ cancel() {
+ // Navigate to the specified opportunity page using the NavigationMixin
+ this[NavigationMixin.Navigate]({
+ type: 'standard__recordPage',
+ attributes: {
+ recordId: this.oppId,
+ actionName: 'view'
+ }
+ });
+ }
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.1