From 85f6fb6227a84936e192936ba480b4e03834df03 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 07 七月 2023 14:23:58 +0800
Subject: [PATCH] BackupLEXCommunity

---
 force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js |  115 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 70 insertions(+), 45 deletions(-)

diff --git a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
index 0c4122c..032f8fc 100644
--- a/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
+++ b/force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -13,7 +13,7 @@
 import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
 import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init";
 import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save";
-import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
+import deleteAtt from '@salesforce/apex/LexSummonsCreatController.deleteAtt';
 import { NavigationMixin } from "lightning/navigation";
 //table css 
 import { loadStyle } from "lightning/platformResourceLoader";
@@ -22,21 +22,10 @@
 
 const hospitalColumns = [
     {
-        label: "鍖婚櫌鍚嶇О",
-        fieldName: "Name",
-        initialWidth: 400,
-        hideDefaultActions: true,
-        wrapText: true,
-    },
-    {
-        label: "鐪佷唤",
-        fieldName: "stateMasterName",
-        hideDefaultActions: true,
-    },
-    {
-        label: "閫夋嫨",
+        label: "",
         fieldName: "Id1",
         type: "button",
+        initialWidth: 90,
         hideDefaultActions: true,
         typeAttributes: {
             label: "閫夋嫨",
@@ -44,6 +33,17 @@
             size: 1,
         },
     },
+    {
+        label: "鍖婚櫌鍚嶇О",
+        fieldName: "Name",
+        hideDefaultActions: true,
+        wrapText: true,
+    },
+    {
+        label: "鐪佷唤",
+        fieldName: "stateMasterName",
+        hideDefaultActions: true,
+    }
 ];
 const invoiceDetailsColumns = [
     {
@@ -96,6 +96,7 @@
         hideDefaultActions: true,
         wrapText: true,
         cellAttributes: { alignment: 'right' },
+        initialWidth:145,
         type: "number",
         typeAttributes: {
             minimumFractionDigits: 2,
@@ -160,6 +161,7 @@
         label: "浜у搧鍨嬪彿",
         fieldName: "esdAssetModelNo",
         hideDefaultActions: true,
+        initialWidth: 200,
         wrapText: true,
     },
     {
@@ -240,6 +242,8 @@
         typeAttributes: {
             recordId: { fieldName: "recordId" },
             shipmentNumber: { fieldName: "shipmentNumber" },
+            isConinvoice: { fieldName: "isConinvoice" },
+            esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" },
         },
     },
     {
@@ -248,6 +252,7 @@
         fieldName: "invoiceAllprice",
         hideDefaultActions: true,
         type: "number",
+        initialWidth: 150,
         typeAttributes: {
             minimumFractionDigits: 2,
         },
@@ -258,7 +263,7 @@
 }
 export default class LexConInvoiceView extends NavigationMixin(LightningElement) {
 
-    @track label=customLabel;
+    @track label = customLabel;
     invoiceColumns = invoiceColumns;
     detailsColumns = detailsColumns;
     @track outboundColumns = [
@@ -369,6 +374,7 @@
 
     //鏂囦欢涓婁紶
     @track showLoadingSpinner = false;
+    @track showPopSpinner = false;
     @track UploadFile = "Upload File";
     @track fileName = "";
     @track fileData = [];
@@ -517,6 +523,7 @@
                         this.detailsData[i]['esdInvoiceUnitprice'] = this.detailsData[i].esd.Invoice_Unitprice__c;
                         //鍙戠エ鏁伴噺
                         this.detailsData[i]['shipmentNumber'] = this.detailsData[i].invoiceCount;
+                        this.detailsData[i]['isConinvoice'] = true;
                         this.detailsData[i]['invoiceAllprice'] = this.detailsData[i].invoiceAllprice;
 
                         if (this.detailsData[i].check) {
@@ -552,7 +559,7 @@
                     this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
 
                     this.ConInvoiceListAgencyProType = r.entity.agencyProType;
-                    if (this.ConInvoiceListAgencyProType != 'ET')
+                    //if (this.ConInvoiceListAgencyProType != 'ET')
                         this.isOpenReportDisabled = false;
                     this.invoiceData = r.entity.raesList;
                     for (var i in this.invoiceData) {
@@ -660,7 +667,7 @@
                     this.HospitalName = r.entity.HospitalName;
                     this.HospitalInfo = r.entity.HospitalInfo;
                     this.agencyProType = r.entity.agencyProType;
-                    if (this.agencyProType != 'ET')
+                    //if (this.agencyProType != 'ET')
                         this.isOpenReportDisabled = false;
                     //绉戝
                     this.ForCustomerText = this.coc.Order_ForCustomerText__c;
@@ -681,6 +688,7 @@
                             label: '瀹㈡埛鍚�',
                             fieldName: "hospitalName",
                             hideDefaultActions: true,
+                            wrapText: true,
                         };
                         let object2 = {
                             label: '鍑鸿揣閲戦(鍏�)',
@@ -829,6 +837,15 @@
         this.fileName = '';
     }
 
+    //鏄惁鏄剧ず闄勪欢绉婚櫎
+    get attDelBtn() {
+        if (this.fileName != '' && this.fileName != null && this.fileName != '閫夋嫨涓�涓枃浠朵笂浼�') {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     keepTwoDecimalStr(num) {
         const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
         let s = result.toString();
@@ -970,7 +987,7 @@
                     cloneData[i].check = true;
                 }
             }
-            if(!b){
+            if (!b) {
                 cloneData[i].check = false;
             }
             delete cloneData[i].esdOutboundDate;
@@ -1034,22 +1051,21 @@
         console.log("handleFilesChange");
         this.handleSave();
         // if (event.target.files.length > 0) {
-        //     this.filesUploaded = event.target.files;
-        //     this.fileName = event.target.files[0].name;
-        //     this.handleSave();
-        // }
-    }
-
-    handleSave() {
-        this.isShowSpinner = true;
+            //     this.filesUploaded = event.target.files;
+            //     this.fileName = event.target.files[0].name;
+            //     this.handleSave();
+            // }
+        }
+        
+        handleSave() {
         console.log("saveFile");
         if (this.filesUploaded.length > 0) {
+            this.showPopSpinner = true;
             this.file = this.filesUploaded[0];
             if (this.file.size > this.MAX_FILE_SIZE) {
                 this.showMyToast('淇濆瓨澶辫触', '鏂囦欢杩囧ぇ', 'Error');
                 return;
             }
-            this.showLoadingSpinner = true;
             this.fileReader = new FileReader();
 
             this.fileReader.onloadend = () => {
@@ -1078,8 +1094,8 @@
             r = JSON.parse(JSON.stringify(r));
             console.log("r = " + JSON.stringify(r));
             if (r != '') {
-                this.showLoadingSpinner = false;
-                this.showMyToast('闄勪欢涓婁紶鎴愬姛', '', 'Success');
+                this.showPopSpinner = false;
+                this.showMyToast('涓婁紶鎴愬姛', '', 'Success');
                 this.closePop();
                 this.init();
             } else {
@@ -1117,8 +1133,9 @@
     }
 
     saveAttachmentJs() {
+        debugger
         this.showLoadingSpinner = true;
-        let cloneData = this.fileData
+        let cloneData = this.deepClone(this.fileData)
         for (var i in cloneData) {
             delete cloneData[i].Id;
             delete cloneData[i].recordId;
@@ -1245,7 +1262,7 @@
                     cloneData[i].check = true;
                 }
             }
-            if(!b){
+            if (!b) {
                 cloneData[i].check = false;
             }
             delete cloneData[i].esdOutboundDate;
@@ -1286,8 +1303,8 @@
                 let index = 0;
                 this.selectedRows = [];
                 for (var i in this.outboundData) {
-                    
-                    if(this.outboundData[i].check)
+
+                    if (this.outboundData[i].check)
                         this.selectedRows.push(this.outboundData[i].esd.Id)
                     this.outboundData[i].Id = this.outboundData[i].esd.Id;
                     this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
@@ -1435,13 +1452,15 @@
         let reportUrl = this.label.LexConInvoiceViewReport;
         let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]';
         console.log('reportUrl = ' + reportUrl);
-        let url = "/report/"+ reportUrl +"?reportFilters=" + encodeURIComponent(reportFilters);
-        this[NavigationMixin.Navigate]({
-            type: "standard__webPage",
-            attributes: {
-                url: url,
-            },
-        });
+        let url = "/s/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
+        window.open(url);
+        // this[NavigationMixin.Navigate]({
+        //     type: "standard__webPage",
+        //     attributes: {
+        //         url: url,
+        //         target: '_blank'
+        //     },
+        // });
     }
 
     reopenJs() {
@@ -1461,6 +1480,7 @@
     showMyToast(title, message, variant) {
         this.isShowSpinner = false;
         this.showLoadingSpinner = false;
+        this.showPopSpinner = false;
         this.showAttPop = false;
         this.filesUploaded = [];
         this.fileName = null;
@@ -1645,9 +1665,13 @@
         console.log("this.data = " + JSON.stringify(this.data));
     }
 
+    deepClone(obj) {
+        return JSON.parse(JSON.stringify(obj));
+    }
+
     detailsSaveJs() {
         this.isShowSpinner = true;
-        let cloneData = this.detailsData;
+        let cloneData = this.deepClone(this.detailsData);
 
         let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
         console.log('selectedRows = ' + JSON.stringify(selectedRows));
@@ -1747,18 +1771,19 @@
         console.log('attid:' + recordId);
         deleteAtt({
             contentVersionId: recordId
-        }).then(result => {
-            if (result.result == 'Success') {
+        }).then(r => {
+            r = JSON.parse(JSON.stringify(r));
+            if (r.status == "Success") {
                 this.showMyToast('鍒犻櫎鎴愬姛', '', 'Success');
                 if (this.fileData.length == 1)
                     window.location.reload();
                 else
                     this.init();
             } else {
-                this.showMyToast('鍒犻櫎澶辫触', result.errorMsg, 'Error');
+                this.showMyToast('鍒犻櫎澶辫触', r.msg, 'Error');
             }
         }).catch(error => {
-            this.showMyToast('閿欒', '鍒犻櫎澶辫触', 'Error');
+            this.showMyToast('閿欒', error.message, 'Error');
         })
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1