From 25f056535350a0b80bad50d2cc45311998e5d1cd Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 09 十月 2023 18:28:00 +0800
Subject: [PATCH] 近期修改
---
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js | 144 +++++++++++++++++++++++++++++-------------------
1 files changed, 87 insertions(+), 57 deletions(-)
diff --git a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
index a4576e1..beb62d9 100644
--- a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
@@ -1,20 +1,37 @@
+/*
+ * @Author: zhangchunxu
+ * @Date: 2023-08-13 18:57:20
+ * @LastEditors: zhangchunxu
+ * @LastEditTime: 2023-09-14 10:58:50
+ *
+ */
import { LightningElement,wire,track,api} from 'lwc';
-import { CurrentPageReference } from "lightning/navigation";
+import { CurrentPageReference ,NavigationMixin} from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import init from '@salesforce/apex/TenderingButtonController.initTenderingController';
import sqlResult from '@salesforce/apex/TenderingButtonController.sqlResult';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-export default class lexTenderingLostButton extends LightningElement {
+import LightningConfirm from 'lightning/confirm';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader'
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+export default class lexTenderingLostButton extends NavigationMixin(LightningElement) {
@api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
- id;//杩斿洖鍊肩殑id Tender_information__c鎷涙爣椤圭洰鐨刬d
+ @api url;
status;//鐘舵��
profileId;//profileId id
+ systemProfileId;
+ TwoS1_Sales_Hospital;
+ TwoS4_Sales_Manager;
IsLoading = true;
-
+ @track
+ flag = false;
+
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
if (currentPageReference) {
- const urlValue = currentPageReference.state.recordId;
+ this.url = currentPageReference.state.backgroundContext;
+ const urlValue = currentPageReference.state.recordId;
if (urlValue) {
let str = `${urlValue}`;
this.recordId = str;
@@ -24,45 +41,90 @@
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
init({
recordId: this.recordId
}).then(result => {
this.IsLoading = false;
- this.id = result.Id;
this.status = result.status;
- this.profileId = result.profileId.slice(0,15);
+ this.profileId = result.profileId;
+ this.systemProfileId = result.systemProfileId;
+ this.TwoS1_Sales_Hospital = result.TwoS1_Sales_Hospital;
+ this.TwoS4_Sales_Manager = result.TwoS4_Sales_Manager;
this.LoseButton();
- this.dispatchEvent(new CloseActionScreenEvent());
- }).catch(error => {
- console.log("error"+error);
- }).finally(() => {
-
- });
+ })
}
- //澶卞崟
+ //鎷涙爣椤圭洰 澶卞崟
LoseButton(){
- sqlResult({id: this.id}).then(result=>{
+ console.log(this.url,'xxx')
+ sqlResult({id: this.recordId}).then(result=>{
//绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
- if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') {
+ if (this.profileId != this.TwoS1_Sales_Hospital && this.profileId != this.TwoS4_Sales_Manager && this.profileId != this.systemProfileId) {
this.showToast("鎮ㄦ病鏈夋潈闄愶紝鏃犳硶鍒涘缓璇环鎻愪氦澶卞崟銆�","error");
return;
}
// 鍒ゆ柇鍐呴儴纭鐘舵��
if(this.status == '01.寰呯‘璁�'|| this.status == '02.涓嶇浉鍏�'){
- console.log('娌¤蛋鍚�');
this.showToast("鐘舵�佷负寰呯‘璁ゆ垨涓嶇浉鍏筹紝涓嶅彲浠ュ仛澶卞崟銆�","error");
return;
}
// 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
if(this.status == '05.璇环涓�'|| this.status == '06.鎴愪氦' || this.status == '07.閮ㄥ垎鎴愪氦' || this.status == '08.澶卞崟' || result.length > 0){
- if(confirm('姝ら」鐩凡鍏宠仈璇环锛岃纭疄鏄惁鏂板缓璇环鎻愪氦澶卞崟銆�')) {
-
- }else{
- return;
- }
+ LightningConfirm.open({
+ message: '姝ら」鐩凡鍏宠仈璇环锛岃纭疄鏄惁鏂板缓璇环鎻愪氦澶卞崟銆�',
+ variant: 'headerless',
+ label: 'this is the aria-label value',
+ }).then(res=>{
+ if(res) {
+ this.flag = true
+ // window.open(`/apex/TenderLostPage?id=${this.recordId}`,'','height=500,width=800,top=200,left=250,location=no');
+ // const defaultValues = encodeDefaultFieldValues({
+ // oppId :this.id,
+ // pageStatus:'',
+ // lostType :"",
+
+ // });
+ // this[NavigationMixin.Navigate]({
+ // type: 'standard__objectPage',
+ // attributes: {
+ // objectApiName: 'Tender_information__c',
+ // actionName: 'new'
+ // },
+ // state:{
+ // defaultFieldValues: defaultValues
+ // }
+ // });
+ // this.dispatchEvent(new CloseActionScreenEvent());
+ }else{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ });
}
- window.open(`/apex/TenderLostPage?id=${this.id}`,'','height=500,width=800,top=200,left=250,location=no');
+ if(this.status == "04.寰呭叧鑱旇浠�" || this.status == "03.涓嶅簲鏍�" || this.status == "09.缁堟"){
+ this.flag = true
+ // window.open(`/apex/TenderLostPage?id=${this.recordId}`,'','height=500,width=800,top=200,left=250,location=no');
+ // const defaultValues = encodeDefaultFieldValues({
+ // oppId :this.id,
+ // pageStatus:'',
+ // lostType :"",
+
+ // });
+ // this[NavigationMixin.Navigate]({
+ // type: 'standard__objectPage',
+ // attributes: {
+ // objectApiName: 'Tender_information__c',
+ // actionName: 'new'
+ // },
+ // state:{
+ // defaultFieldValues: defaultValues
+ // }
+ // });
+ // this.dispatchEvent(new CloseActionScreenEvent());
+ }
})
}
showToast(msg,type) {
@@ -71,38 +133,6 @@
variant: type
});
this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
}
-}
-
-
-// var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
-// var sqlResult = sforce.connection.query(sql);
-
-
-// //绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
-// if ('{!$Profile.Id}' != '00e10000000xnp2' && '{!$Profile.Id}' != '00e10000000xnpH' && '{!$Profile.Id}' != '00e10000000Y3o5') {
-// alert("鎮ㄦ病鏈夋潈闄愶紝鏃犳硶鍒涘缓璇环鎻愪氦澶卞崟銆�");
-// return;
-// }
-
-// // 鍒ゆ柇鍐呴儴纭鐘舵��
-// if({!Tender_information__c.status__c == '01.寰呯‘璁�'|| Tender_information__c.status__c == '02.涓嶇浉鍏�'}){
-// alert('鐘舵�佷负寰呯‘璁ゆ垨涓嶇浉鍏筹紝涓嶅彲浠ュ仛澶卞崟銆�');
-// return;
-// }
-
-// // 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
-// if({!Tender_information__c.status__c == '05.璇环涓�'|| Tender_information__c.status__c == '06.鎴愪氦' || Tender_information__c.status__c == '07.閮ㄥ垎鎴愪氦' || Tender_information__c.status__c == '08.澶卞崟'} || sqlResult.size > 0){
-// if(!confirm('姝ら」鐩凡鍏宠仈璇环锛岃纭疄鏄惁鏂板缓璇环鎻愪氦澶卞崟銆�')) {
-// return;
-// }
-// }
-
-// // 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
-// //if(sqlResult.size > 0){
-// //if(!confirm('宸叉湁鍏宠仈璇环锛屾槸鍚﹀垱寤烘柊鐨勮浠枫��')) {
-// //return;
-// //}
-// //}
-
-// window.open('/apex/TenderLostPage?id={!Tender_information__c.Id}','','height=500,width=800,top=200,left=250,location=no');
\ No newline at end of file
+}
\ No newline at end of file
--
Gitblit v1.9.1