import { LightningElement, track, wire ,api} from 'lwc';
|
|
|
|
|
import ImportText from '@salesforce/label/c.ImportText';
|
import Tab_Text from '@salesforce/label/c.Tab_Text';
|
import Paste_IE from '@salesforce/label/c.Paste_IE';
|
import Cancel from '@salesforce/label/c.Cancel';
|
import Registration from '@salesforce/label/c.Registration';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
|
const event3 = new ShowToastEvent({
|
title: '粘贴失败',
|
message:
|
'粘贴失败,请联系管理人员',
|
});
|
|
|
|
export default class lexQuoteExcelImport extends LightningElement {
|
|
|
@api recordId;
|
mandatedActivityNotes;
|
|
|
|
|
|
Label = {
|
ImportText,
|
Tab_Text,
|
Paste_IE,
|
Cancel,
|
Registration
|
};
|
|
|
|
|
async closeMe(event){
|
console.log('closeMe');
|
top.window.close();
|
}
|
|
|
async sendText(event) {
|
console.log('sendText');
|
console.log(this);
|
this.mandatedActivityNotes = this.template.querySelector("lightning-textarea").value;
|
console.log(this.mandatedActivityNotes);
|
// top.window.opener.excelImport(str);
|
//上一个页面的方法,得找到这个页面的入口
|
top.window.opener.excelImportGateway(this.mandatedActivityNotes);
|
top.window.close();
|
}
|
|
|
|
async setCB(event) {
|
console.log('setCB');
|
var userAgent = navigator.userAgent;
|
console.log('navigator');
|
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
|
console.log('isIE='+isIE);
|
var isEdge = userAgent.indexOf("Edge") > -1 && !isIE;
|
console.log('isEdge='+isEdge);
|
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
|
console.log('isIE11'+isIE11);
|
var txt;
|
if (isIE|| isIE11 ){
|
console.log('1');
|
txt = window.clipboardData.getData("text");
|
console.log(txt);
|
console.log('2');
|
this.mandatedActivityNotes=txt;
|
// document.forms['{!$Component.mainForm}']['{!$Component.mainForm.page1.exceltext}'].value = txt;
|
}
|
else{
|
var testA;
|
await navigator.clipboard.readText().then(function(text){
|
console.log('readText');
|
console.log(text);
|
testA= text;
|
// this.mandatedActivityNotes = text;
|
// document.getElementById("textarea").innerHTML = text;
|
// this.mandatedActivityNotes = acText;
|
console.log('hhh');
|
}).catch(error => {
|
console.log("error");
|
this.dispatchEvent(event3);
|
});
|
this.mandatedActivityNotes = testA ;
|
}
|
}
|
|
}
|