From ac0d606acaa5844bc2c6ad2242d5502b60f9be3a Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期五, 30 六月 2023 17:25:39 +0800
Subject: [PATCH] 修改页面和按钮

---
 force-app/main/default/pages/MaintenanceProductData.page                   |    7 +
 force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js    |   15 +++
 force-app/main/default/classes/lexAccountController.cls                    |   12 +++
 force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml           |   10 ++
 force-app/main/default/lwc/lexCBLBPNewLwc/__tests__/lexCBLBPNewLwc.test.js |   25 ++++++
 force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.html              |   14 +++
 force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js-meta.xml       |   11 ++
 force-app/main/default/classes/lexLightingButtonConstant.cls               |    2 
 force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html                  |   12 ++
 force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js                |   46 +++++++++++
 force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html  |   20 +++-
 force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js                    |   58 ++++++++++++++
 force-app/main/default/classes/lexPCLLostReportLwcController.cls           |    7 +
 13 files changed, 222 insertions(+), 17 deletions(-)

diff --git a/force-app/main/default/classes/lexAccountController.cls b/force-app/main/default/classes/lexAccountController.cls
index 1cc2bfe..ac41d3b 100644
--- a/force-app/main/default/classes/lexAccountController.cls
+++ b/force-app/main/default/classes/lexAccountController.cls
@@ -19,6 +19,16 @@
         }
         return res;
     }
+    @AuraEnabled
+    public static InitData initForOTHCreateButton(String recordId){
+        InitData res = new InitData();
+        try {
+           res.recordTypeId = Schema.SObjectType.Account_Number_of_case__c.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OTHER).getRecordTypeId(); 
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
     class InitData{
         @AuraEnabled
         public String hospitalSalesdepartmentHP;
@@ -26,5 +36,7 @@
         public String hospitalId;
         @AuraEnabled
         public String hospitalOCMCategory;
+        @AuraEnabled
+        public String recordTypeId;
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexLightingButtonConstant.cls b/force-app/main/default/classes/lexLightingButtonConstant.cls
index 11a380c..9520a73 100644
--- a/force-app/main/default/classes/lexLightingButtonConstant.cls
+++ b/force-app/main/default/classes/lexLightingButtonConstant.cls
@@ -89,6 +89,8 @@
       public static final String RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP = '璇环璺熻繘';
       //鎺堟潈鐢宠鐨勮褰曠被鍨嬧�樻巿鏉冪敵璇封��
       public static final String RECORD_TYPE_NAME_BY_AUTHORIZATION_REQUEST = '鎺堟潈鐢宠';
+      //瀹㈡埛-鐥呬緥鏁扮殑璁板綍绫诲瀷鈥樺叾浠栤��
+      public static final String RECORD_TYPE_NAME_BY_OTHER = '鍏朵粬';
       //52 璇环娉ㄦ畫鐗规畩瀵瑰簲鐨勮褰曠被鍨嬧�樿浠风壒娈婂搴斺��
       public static final String RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE = '璇环鐗规畩瀵瑰簲';
       //52 璇环娉ㄦ畫鐗规畩瀵瑰簲鐨勮褰曠被鍨嬧�樻敞娈嬬壒娈婂搴斺��
diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index fb16ace..7e42d0e 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -438,11 +438,14 @@
 				SELECT 
 				ProcessDefinition.Name,
 				 (
-					SELECT StepStatus,
+					SELECT 
+					Id,
+					StepStatus, 
+					IsPending,
 					Comments,
 					CreatedDate,
 					Actor.Name,  
-					OriginalActor.Name, 
+					OriginalActor.Name,
 					ProcessNode.Name FROM StepsAndWorkitems order by IsPending DESC, CreatedDate DESC 
 				)
 				FROM ProcessInstance where TargetObjectId =:reportId order by CreatedDate DESC
diff --git a/force-app/main/default/lwc/lexCBLBPNewLwc/__tests__/lexCBLBPNewLwc.test.js b/force-app/main/default/lwc/lexCBLBPNewLwc/__tests__/lexCBLBPNewLwc.test.js
new file mode 100644
index 0000000..9eb7cca
--- /dev/null
+++ b/force-app/main/default/lwc/lexCBLBPNewLwc/__tests__/lexCBLBPNewLwc.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCBLBPNewLwc from 'c/lexCBLBPNewLwc';
+
+describe('c-lex-cblbp-new-lwc', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-cblbp-new-lwc', {
+            is: LexCBLBPNewLwc
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.html b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.html
new file mode 100644
index 0000000..c753576
--- /dev/null
+++ b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.html
@@ -0,0 +1,14 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-06-30 10:57:52
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-06-30 10:58:11
+-->
+<template>
+    <div class="baseHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div> 
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js
new file mode 100644
index 0000000..ee27015
--- /dev/null
+++ b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js
@@ -0,0 +1,46 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForCancelReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+
+export default class LexCBLBPNewLwc extends LightningElement {
+    @api recordId;
+    @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.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+      this.CBLBPNewLwc();
+    }
+    CBLBPNewLwc(){
+      const defaultValues = encodeDefaultFieldValues({
+        ProductName__c: this.recordId,
+    });
+      this[NavigationMixin.Navigate]({
+          type: 'standard__objectPage',
+          attributes: {
+              objectApiName: 'LastbuyProduct__c',
+              actionName: 'new'
+          },
+          state: {
+              nooverride: '1',
+              defaultFieldValues: defaultValues
+          }
+      });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js-meta.xml b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js-meta.xml
new file mode 100644
index 0000000..709c8f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCBLBPNewLwc/lexCBLBPNewLwc.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+     <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html
index 27e0f69..0ce5634 100644
--- a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html
+++ b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html
@@ -1,3 +1,13 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-06-29 15:55:05
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-06-30 11:21:00
+-->
 <template>
-    
+    <div class="reportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
index 20aef43..5506261 100644
--- a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
+++ b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
@@ -1,3 +1,57 @@
-import { LightningElement } from 'lwc';
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-06-29 15:55:05
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-06-30 11:28:58
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/lexAccountController.initForOTHCreateButton';
 
-export default class LexOTHCreate extends LightningElement {}
\ No newline at end of file
+export default class LexOTHCreate extends LightningElement {
+    @api recordId;
+    recordTypeId;
+    @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.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.recordTypeId = result.recordTypeId;
+            this.OTHCreate();
+        });
+    }
+    OTHCreate(){
+        const defaultValues = encodeDefaultFieldValues({
+            Account__c: this.recordId
+        });
+        this[NavigationMixin.Navigate]({
+            type: 'standard__objectPage',
+            attributes: {
+                objectApiName: 'Account_Number_of_case__c',
+                actionName: 'new'
+            },
+            state: {
+                nooverride: '1',
+                defaultFieldValues: defaultValues,
+                RecordTypeId: this.recordTypeId
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml
index 3fe0e73..8b2c3d6 100644
--- a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml
+++ b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml
@@ -1,5 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>57.0</apiVersion>
-    <isExposed>false</isExposed>
+   <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
 </LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
index d922074..b980dda 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-20 17:16:48
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-06-28 17:53:19
+ * @LastEditTime: 2023-06-30 10:06:30
 -->
 <template>
     <template if:true={isInit}>
@@ -180,7 +180,9 @@
                                     <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;font-size: large">澶卞崟鎶ュ憡鏌ョ湅椤甸潰</div>
                                 </lightning-layout-item>
                                     <lightning-layout-item alignment-bump="left">
-                                        <lightning-button label="鎻愪氦" onclick={submitJs}></lightning-button>
+                                        <template if:false={submitFlag}>
+                                            <lightning-button label="鎻愪氦" onclick={submitJs}></lightning-button>
+                                        </template>
                                         <lightning-button name="缂栬緫" label="缂栬緫" onclick={editJs}></lightning-button>
                                         <lightning-button label="杩斿洖璇环" onclick={cancel}></lightning-button>
                                     </lightning-layout-item>
@@ -345,7 +347,9 @@
                                 <lightning-layout style="margin-top: 20px;">
                                     <div class="slds-align_absolute-center">
                                         <lightning-layout-item size="12">
-                                            <lightning-button label="鎻愪氦" onclick={submitJs}></lightning-button>
+                                            <template if:false={submitFlag}>
+                                                <lightning-button label="鎻愪氦" onclick={submitJs}></lightning-button>
+                                            </template>
                                             <lightning-button name="缂栬緫" label="缂栬緫" onclick={editJs}></lightning-button>
                                             <lightning-button label="杩斿洖璇环" onclick={cancel}></lightning-button>
                                         </lightning-layout-item>
@@ -360,7 +364,7 @@
                                         <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;font-size: large">鎵瑰噯鍘嗗彶</div>
                                     </lightning-layout-item>
                                     <lightning-layout-item alignment-bump="left">
-                                        <lightning-button label="鎾ゅ洖鎵瑰噯璇锋眰"></lightning-button>
+                                        <lightning-button label="鎾ゅ洖鎵瑰噯璇锋眰" onclick={onApproveChange}></lightning-button>
                                     </lightning-layout-item>
                                 </lightning-layout>
                                 <lightning-layout>
@@ -379,9 +383,11 @@
                                             <template for:each={LostReport.approvalHistorys} for:item="approvalHistory" for:index="j">
                                                 <tr class="inputRows" key={approvalHistory.Id}>
                                                     <td>
-                                                        <a onclick={test}>閲嶆柊鍒嗛厤</a>
-                                                        <label>|</label>
-                                                        <a onclick={test}>鎵瑰噯/鎷掔粷</a>
+                                                        <template if:true={approvalHistory.IsPending}>
+                                                            <a onclick={onApproveChange}>閲嶆柊鍒嗛厤</a>
+                                                            <label>|</label>
+                                                            <a onclick={onApproveChange}>鎵瑰噯/鎷掔粷</a>
+                                                        </template>
                                                     </td>
                                                     <td>
                                                         <div>{approvalHistory.CreatedDate}</div>
diff --git a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
index e9d4712..16e8c29 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-06-28 17:29:47
+ * @LastEditTime: 2023-06-30 09:55:38
  */
 const columns2=[
     { label: '--鏃�--', value: '' },
@@ -221,7 +221,7 @@
         }
         return false;
     }
-    
+
     addBrandJs() {
         getNewLostBrand({
             lineNo: this.LostReport.LostBrands.length
@@ -251,6 +251,8 @@
                 console.log(this.LostReport);
                 for(var i=0;i < result.approvalHistorys.length;i++){
                     console.log('123');
+                    var date = new Date(result.approvalHistorys[i].CreatedDate);
+                    result.approvalHistorys[i].CreatedDate = date.toLocaleString();
                     this.LostReport.approvalHistorys.push(JSON.parse(JSON.stringify(result.approvalHistorys[i])));
                     console.log('321');
                 }
@@ -263,6 +265,15 @@
             console.log(error);
         });
     }
+    onApproveChange(event){
+        this[NavigationMixin.Navigate]({
+            type: 'standard__recordPage',
+            attributes: {
+                recordId: this.LostReport.approvalHistorys[0].Id,
+                actionName: 'view'
+            }
+        });
+    }
     
 
     deleteBrandJs(event){
diff --git a/force-app/main/default/pages/MaintenanceProductData.page b/force-app/main/default/pages/MaintenanceProductData.page
index a5735b5..fbf1422 100644
--- a/force-app/main/default/pages/MaintenanceProductData.page
+++ b/force-app/main/default/pages/MaintenanceProductData.page
@@ -921,6 +921,11 @@
                 </tr>
                 </apex:outputPanel>
                 <tr>
+                    <td>
+                        <div>&nbsp;</div>
+                    </td>
+                </tr>
+                <tr>
                     <td align="right" style="width: 100px;">浜у搧鍚嶇О</td>
                     <!-- ProductDateSearch -->
                     <td><apex:inputText id="CateName" value="{!searchCateName}" style="width:100px"/></td>
@@ -1250,7 +1255,7 @@
                                         <apex:variable var="edv" value="" rendered="{!editAble}" id="edvariable">
                                             <apex:outputPanel rendered="{!(edc.size==1)}" layout="none">
                                                 <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,edc[0]))||RecordTypeName != 'GuranteeMain',true , false)}">
-                                                    <apex:InputField value="{!aa.mpded[edc[0]]}"  id="edtheValue" style="max-width: 120px;"/> 
+                                                    <apex:InputField value="{!aa.mpded[edc[0]]}"  id="edtheValue" style="max-width: 120px;min-width: 10px"/> 
                                                 </apex:outputPanel>
                                                 <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'GuranteeMain'&& !contains(GuranteeMainProductService,edc[0]))||RecordTypeName != 'GuranteeMain',false , true)}">
                                                     <apex:outputField value="{!aa.mpded[edc[0]]}"/>

--
Gitblit v1.9.1