From 08080a059681cf31f23e0e49b04e1d1e8f7bb465 Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期二, 06 六月 2023 11:03:16 +0800
Subject: [PATCH] 询价excel导入 lwc重做

---
 force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js          |   99 +++++++++++++++++++++++++++++++++
 force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.html        |   31 ++++++++++
 force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.css         |    6 ++
 force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js-meta.xml |   11 +++
 4 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.css b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.css
new file mode 100644
index 0000000..dd7c5bf
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.css
@@ -0,0 +1,6 @@
+.textAreaBody {
+    --sds-c-textarea-sizing-min-height:120px;
+}
+td {  
+    width: 200px; }
+table{width:30%;}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.html b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.html
new file mode 100644
index 0000000..488aac8
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.html
@@ -0,0 +1,31 @@
+<template>
+
+            <table >
+                <tr >
+                    <td ><u><lable>{Label.ImportText}</lable></u></td>
+                    <td colspan="2">&nbsp;</td>
+                </tr>
+                <tr >
+                    <td ><lable >{Label.Tab_Text}</lable></td>
+                    <td><lightning-button  onclick={setCB}  label={Label.Paste_IE}   ></lightning-button></td>
+                </tr>
+                <tr >
+                    <td colspan="3"  width="300px">
+                        <lightning-textarea 
+                        id="textarea"
+                        class="textAreaBody"
+                        name="mandatedNotes" 
+
+                        
+                        value={mandatedActivityNotes}
+                      ></lightning-textarea></td>
+                       <td colspan="2">&nbsp;</td>
+                </tr>
+                    <td width="300px">
+                    <lightning-button  variant="brand-outline"  onclick={closeMe}   label={Label.Cancel} ></lightning-button></td>
+                    <td width="300px">
+                    <lightning-button  variant="brand-outline" label={Label.Registration}   onclick={sendText}></lightning-button></td>
+                </tr>
+            </table>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js
new file mode 100644
index 0000000..a9e6c02
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js
@@ -0,0 +1,99 @@
+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 ;
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js-meta.xml b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js-meta.xml
new file mode 100644
index 0000000..0f8e0ea
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuoteExcelImport/lexQuoteExcelImport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQuoteExcelImport">
+    <apiVersion>51.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

--
Gitblit v1.9.1