From d6a096fadfe9c8f261f56a827cfceed663c36b8b Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期三, 26 四月 2023 17:23:28 +0800
Subject: [PATCH] backup0421

---
 force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js |  335 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 262 insertions(+), 73 deletions(-)

diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
index 861ade4..faa4f1e 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -169,6 +169,7 @@
             fieldName: "Name__c",
             hideDefaultActions: true,
             initialWidth: 250,
+            wrapText: true,
         },
         {
             label: "瑙勬牸",
@@ -230,6 +231,10 @@
         {
             label: "鍑鸿揣鍗曚环(鍏�)",
             fieldName: "Shipment_amount__c",
+            type: "number",
+            typeAttributes: {
+                minimumFractionDigits: 2,
+            },
             initialWidth: 150,
             hideDefaultActions: true,
         },
@@ -315,6 +320,7 @@
             },
             hideDefaultActions: true,
             wrapText: true,
+            initialWidth: 240
         },
         {
             label: "鍗曚綅",
@@ -339,6 +345,7 @@
             fieldName: "Bar_Code__c",
             hideDefaultActions: true,
             wrapText: true,
+            initialWidth: 500
         },
         {
             label: "浣跨敤鏈熼檺",
@@ -422,6 +429,8 @@
     @track isBarcode = true;
     @track isShowInformation = true;
     @track isShowOutboundProductDetails = false;
+    @track showAttPop = false;
+    @track showPopSpinner = false;
 
     //disable鎸夐挳
     @track isEditDisabled = false;
@@ -520,10 +529,6 @@
     content;
     MAX_FILE_SIZE = 1500000;
 
-    get acceptedFormats() {
-        return [".xlsx"];
-    }
-
     //InvoiceProNotLabel    RrturnProLabel  InvoicedLabel
     @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT })
     oppInfo({ data, error }) {
@@ -568,6 +573,7 @@
             console.log("r = " + JSON.stringify(r));
 
             if (r.status == "Success") {
+
                 this.OECId = r.entity.HospitalInfo == null ? '' : r.entity.HospitalInfo;
                 console.log("this.OECId = " + this.OECId);
                 this.ConsumableOut_report = r.entity.ConsumableOut_report;
@@ -657,6 +663,8 @@
                     }
                     // this.data[i]["shipmentNumber"] = 0;
                     // this.data[i]["shippingUnitPrice"] = 0.0;
+                    //this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"] == 0 ? '' : this.data[i].orderdetails1["Shipment_Count__c"];
+                    //this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == 0 ? '' : this.data[i].orderdetails1["Delivery_List_RMB__c"];
                     this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"];
                     this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"];
 
@@ -801,10 +809,18 @@
                     }
                 }
                 //濡傛灉EditAble==false锛屽垹闄� 鍑鸿揣閲戦(鍏�) 鏈夋晥鏈熷唴搴撳瓨(鐩�) 鏈夋晥鏈熷唴搴撳瓨(涓�) 3鍒� 灞曠ず 杩樻病鍙戠エ鏁伴噺 杩斿搧鏁伴噺 宸插彂绁ㄦ暟閲�
+                //type : "number",
+                // typeAttributes:{
+                //     minimumFractionDigits:2,
+                // },
                 if (!this.EditAble) {
                     let object1 = {
                         label: this.InvoiceProNotLabel,
                         fieldName: "InvoiceProNot_count__c",
+                        type: "number",
+                        typeAttributes: {
+                            minimumFractionDigits: 2,
+                        },
                         hideDefaultActions: true,
                     };
                     let object2 = {
@@ -815,6 +831,10 @@
                     let object3 = {
                         label: this.InvoicedLabel,
                         fieldName: "Invoiced_Procount__c",
+                        type: "number",
+                        typeAttributes: {
+                            minimumFractionDigits: 2,
+                        },
                         hideDefaultActions: true,
                     };
                     this.editColumns.push(object1);
@@ -895,7 +915,7 @@
                     JSON.stringify(this.secondaryDistributorOptions)
                 );
                 this.HospitalName = r.entity.HospitalName;
-                this.sumPrice = r.entity.sumPrice + "鍏�";
+                this.sumPrice = r.entity.sumPrice.toFixed(2) + "鍏�";
                 this.isShowSpinner = false;
                 this.showTable = true;
                 console.log("ESetid = " + this.ESetid);
@@ -903,6 +923,8 @@
                 console.log("r = " + JSON.stringify(r));
                 this.showToast("Error", r.msg);
             }
+        }).catch((error) => {
+            console.log("error = " + JSON.stringify(error));
         });
     }
 
@@ -919,6 +941,7 @@
                 this.ForDealerText = "";
                 this.isDisabledForDealerText = true;
                 this.isDisabledSecondaryDistributor = true;
+                this.isMutualTransferGoods = false;
                 break;
             case "鍖婚櫌璇曠敤":
                 this.isDisabledHospitalName = false;
@@ -973,7 +996,7 @@
                 this.ForCustomerText = value;
                 break;
             case "sumPrice":
-                this.sumPrice = value;
+                this.sumPrice = value.toFixed(2);
                 break;
             case "NoConfirmedPrice":
                 this.NoConfirmedPrice = !this.NoConfirmedPrice;
@@ -987,7 +1010,7 @@
                 this.Category3 = value;
                 //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫�
                 this.showAllCate();
-                if(this.Category3 == ''){
+                if (this.Category3 == '') {
                     this.Category4 = '';
                     this.Category5 = '';
                 }
@@ -996,7 +1019,7 @@
                 this.Category4 = value;
                 //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被
                 this.showCate();
-                if(this.Category4 == ''){
+                if (this.Category4 == '') {
                     this.Category5 = '';
                 }
                 break;
@@ -1012,10 +1035,10 @@
         }
     }
 
-    showAllCate(){
+    showAllCate() {
         console.log('showAllCate')
         categoryAllload({
-            category3Lwc : this.Category3
+            category3Lwc: this.Category3
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
             console.log("r = " + JSON.stringify(r));
@@ -1037,7 +1060,7 @@
                     object["value"] = key;
                     this.category5Options.push(object);
                 }
-            }else {
+            } else {
                 console.log("r = " + JSON.stringify(r));
                 this.showToast("Error", r.msg);
             }
@@ -1046,11 +1069,11 @@
         });
     }
 
-    showCate(){
+    showCate() {
         console.log('showAllCate')
         categoryload({
-            category3Lwc : this.Category3,
-            category4Lwc : this.Category4
+            category3Lwc: this.Category3,
+            category4Lwc: this.Category4
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
             console.log("r = " + JSON.stringify(r));
@@ -1072,7 +1095,7 @@
                     object["value"] = key;
                     this.category5Options.push(object);
                 }
-            }else {
+            } else {
                 console.log("r = " + JSON.stringify(r));
                 this.showToast("Error", r.msg);
             }
@@ -1100,6 +1123,19 @@
     searchProductJs() {
         this.isShowSpinner = true;
         //this.showTable = false;
+        //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        console.log('selectedRows = ' + selectedRows);
+        for (var i in this.data) {
+            this.data[i]["check"] = false;
+        }
+        for (var i in this.data) {
+            for (var j in selectedRows) {
+                if (this.data[i].Id == selectedRows[j].Id) {
+                    this.data[i]["check"] = true;
+                }
+            }
+        }
 
         let cloneData = this.data;
         for (var i in cloneData) {
@@ -1145,7 +1181,22 @@
                         unitOptions.push(unitOption);
                     }
                     tempData[i]["unitOptions"] = unitOptions;
-                    tempData[i]["unitValue"] = unitOptions[0].value;
+                    tempData[i]["unitValue"] = tempData[i]["unitValue"] == null ? unitOptions[0].value : tempData[i]["unitValue"];
+                    if (this.EditAble) {
+                        tempData[i].orderdetails1["Box_Piece__c"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
+                        tempData[i].orderdetails1["Shipment_Count__c"] = tempData[i].orderdetails1["Shipment_Count__c"] == null ? 0 : tempData[i].orderdetails1["Shipment_Count__c"];
+                        tempData[i].orderdetails1["Delivery_List_RMB__c"] = tempData[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : tempData[i].orderdetails1["Delivery_List_RMB__c"];
+                    } else {
+                        tempData[i]["InvoiceProNot_count__c"] =
+                            tempData[i].orderdetails1.InvoiceProNot_count__c;
+                        tempData[i]["RrturnPro_count__c"] =
+                            tempData[i].orderdetails1.RrturnPro_count__c;
+                        tempData[i]["Invoiced_Procount__c"] =
+                            tempData[i].orderdetails1.Invoiced_Procount__c;
+                    }
+                    tempData[i]["shipmentNumber"] = tempData[i].orderdetails1["Shipment_Count__c"];
+                    tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1["Delivery_List_RMB__c"];
+
                     tempData[i]["recordId"] = tempData[i].Prod.Id;
                     tempData[i]["Id"] = tempData[i].Prod.Id;
                     tempData[i]["Name__c"] = tempData[i].Prod.Name__c;
@@ -1154,23 +1205,57 @@
                     tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c;
                     tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c;
                     tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c;
-                    tempData[i]["shipmentNumber"] = tempData[i].orderdetails1.Shipment_Count__c;
-                    tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1.Delivery_List_RMB__c;
-                    console.log(
-                        "shippingUnitPrice = " + tempData[i]["shippingUnitPrice"]
-                    );
+                    tempData[i]["shipmentAmount"] = tempData[i].orderdetails1.Shipment_amount__c;
+                    tempData[i]["Shipment_amount__c"] = tempData[i].orderdetails1.Shipment_amount__c;
+                    tempData[i]["Shipment_Count__c"] = tempData[i].orderdetails1.Shipment_Count__c;
+
                     if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"])
                         tempData[i]["shipmentAmount"] = this.amend(
                             tempData[i]["shipmentNumber"],
                             tempData[i]["shippingUnitPrice"],
                             "*"
                         );
+
+                    if (tempData[i]['check']) {
+                        this.selectedRows.push(tempData[i].Id);
+                    }
+
                 }
+                // for (var i in tempData) {
+                //     let unitOptions = [];
+                //     for (var key in tempData[i].boxorpieceMap) {
+                //         let unitOption = {};
+                //         unitOption["label"] = tempData[i].boxorpieceMap[key];
+                //         unitOption["value"] = key;
+                //         unitOptions.push(unitOption);
+                //     }
+                //     tempData[i]["unitOptions"] = unitOptions;
+                //     tempData[i]["unitValue"] = unitOptions[0].value;
+                //     tempData[i]["recordId"] = tempData[i].Prod.Id;
+                //     tempData[i]["Id"] = tempData[i].Prod.Id;
+                //     tempData[i]["Name__c"] = tempData[i].Prod.Name__c;
+                //     tempData[i]["SFDA_Status__c"] = tempData[i].Prod.SFDA_Status__c;
+                //     tempData[i]["Category3__c"] = tempData[i].Prod.Category3__c;
+                //     tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c;
+                //     tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c;
+                //     tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c;
+                //     tempData[i]["shipmentNumber"] = tempData[i].orderdetails1.Shipment_Count__c;
+                //     tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1.Delivery_List_RMB__c;
+                //     console.log(
+                //         "shippingUnitPrice = " + tempData[i]["shippingUnitPrice"]
+                //     );
+                // if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"])
+                //     tempData[i]["shipmentAmount"] = this.amend(
+                //         tempData[i]["shipmentNumber"],
+                //         tempData[i]["shippingUnitPrice"],
+                //         "*"
+                //     );
+                // }
                 this.data = tempData;
                 console.log("this.data = " + JSON.stringify(this.data));
                 //this.showTable = true;
                 this.isShowSpinner = false;
-            }else {
+            } else {
                 console.log("r = " + JSON.stringify(r));
                 this.showToast("Error", r.msg);
             }
@@ -1284,9 +1369,6 @@
                 this.data[i].orderdetails1["Shipment_Count__c"] = Number(
                     numberDetail.data.shipmentnumber
                 );
-                console.log(
-                    "this.data[i].shipmentNumber = " + this.data[i].shipmentNumber
-                );
             }
         }
         this.ComputePrice(
@@ -1309,9 +1391,6 @@
                 this.data[i].orderdetails1["Delivery_List_RMB__c"] = Number(
                     priceDetail.data.shipmentunitprice
                 );
-                console.log(
-                    "this.data[i].shippingUnitPrice = " + this.data[i].shippingUnitPrice
-                );
             }
         }
         this.ComputePrice(
@@ -1332,15 +1411,18 @@
         for (var i in this.data) {
             if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
         }
-        this.sumPrice = sumPrice + "鍏�";
+        this.sumPrice = sumPrice.toFixed(2) + "鍏�";
         //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
-        this.selectedRows = [];
-        for (var i in this.data) {
-            if (this.data[i].check) {
-                this.selectedRows.push(this.data[i].Id);
-            }
-        }
+        if (this.selectedRows.indexOf(this.data[index].Id) == -1)
+            this.selectedRows.push(this.data[index].Id);
+        // this.selectedRows = [];
+        // for (var i in this.data) {
+        //     if (this.data[i].check) {
+        //         this.selectedRows.push(this.data[i].Id);
+        //     }
+        // }
         this.data = [...this.data];
+        this.selectedRows = [...this.selectedRows]
         console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
         console.log("this.data = " + JSON.stringify(this.data));
     }
@@ -1386,18 +1468,23 @@
     }
 
     getSelectedRows(event) {
-        const selectedRows = event.detail.selectedRows;
-        console.log("this.selectedRows = " + this.selectedRows);
-        for (var i in this.data) {
-            this.data[i]["check"] = false;
+        let selectedRowsEvent = event.detail.selectedRows;
+        this.selectedRows = [];
+        for (var i in selectedRowsEvent) {
+            this.selectedRows.push(selectedRowsEvent[i].Id)
         }
-        for (var i in this.data) {
-            for (var j in selectedRows) {
-                if (this.data[i].Id == selectedRows[j].Id) {
-                    this.data[i]["check"] = true;
-                }
-            }
-        }
+        // const selectedRows = event.detail.selectedRows;
+        // console.log("this.selectedRows = " + this.selectedRows);
+        // for (var i in this.data) {
+        //     this.data[i]["check"] = false;
+        // }
+        // for (var i in this.data) {
+        //     for (var j in selectedRows) {
+        //         if (this.data[i].Id == selectedRows[j].Id) {
+        //             this.data[i]["check"] = true;
+        //         }
+        //     }
+        // }
     }
 
     saveConfirmJs() {
@@ -1413,6 +1500,21 @@
 
     saveConfirm() {
         this.isShowSpinner = true;
+
+        //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        console.log('selectedRows = ' + selectedRows);
+        for (var i in this.data) {
+            this.data[i]["check"] = false;
+        }
+        for (var i in this.data) {
+            for (var j in selectedRows) {
+                if (this.data[i].Id == selectedRows[j].Id) {
+                    this.data[i]["check"] = true;
+                }
+            }
+        }
+
         let cloneData = this.data;
         for (var i in cloneData) {
             cloneData[i]["Name"] = cloneData[i].Name__c;
@@ -1441,32 +1543,32 @@
             cocLwc: this.cocLwc,
             hospitalInfoLwc: this.OECId,
             hospitalNameLwc: this.HospitalName,
-            secondaryDistributor: this.secondaryDistributor,
+            secondaryDistributorLwc: this.secondaryDistributor,
             pageRecordsLwc: cloneData,
-            accountid: this.accountid,
-            ESetId: this.ESetid,
+            accountidLwc: this.accountid,
+            ESetIdLwc: this.ESetid,
             consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords,
-        })
-            .then((r) => {
-                r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-
-                if (r.status == "Success") {
-                    let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
-                    this[NavigationMixin.Navigate]({
-                        type: "standard__webPage",
-                        attributes: {
-                            url: url,
-                        },
-                    });
-                } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
-                }
-            })
-            .catch((error) => {
-                console.log("error = " + JSON.stringify(error));
-            });
+            agencyProTypeLwc: this.agencyProType,
+            userWorkLocationLwc: this.userWorkLocation
+        }).then((r) => {
+            r = JSON.parse(JSON.stringify(r));
+            console.log("r = " + JSON.stringify(r));
+            debugger
+            if (r.status == "Success") {
+                let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
+                this[NavigationMixin.Navigate]({
+                    type: "standard__webPage",
+                    attributes: {
+                        url: url,
+                    },
+                });
+            } else {
+                console.log("r.msg = " + r.msg);
+                this.showToast("Error", r.msg);
+            }
+        }).catch((error) => {
+            console.log("error = " + JSON.stringify(error));
+        });
     }
 
     //鎵撳嵃鎸囩ず鍗�
@@ -1493,7 +1595,8 @@
         console.log("openReportJs");
         var reportId = this.ESetid;
         reportId = reportId.substring(0, 15);
-        let url = "/report/00O100000058VzB?fv1=" + reportId;
+        let reportFilters = '[{"operator":"equals","value":"' + reportId + '","column":"FK_CUSTENT_ID"}]';
+        let url = "/report/00O0l000000zZtpEAE?reportFilters=" + encodeURIComponent(reportFilters);
         console.log("url = " + url);
         this[NavigationMixin.Navigate]({
             type: "standard__webPage",
@@ -1561,7 +1664,7 @@
                 this.showToast("Error", "鏂囦欢杩囧ぇ");
                 return;
             }
-            this.showLoadingSpinner = true;
+            this.showPopSpinner = true;
             this.fileReader = new FileReader();
 
             this.fileReader.onloadend = () => {
@@ -1586,13 +1689,15 @@
             base64Data: encodeURIComponent(this.fileContents),
         })
             .then((r) => {
+                this.showPopSpinner = false;
                 r = JSON.parse(JSON.stringify(r));
                 console.log("r = " + JSON.stringify(r));
-                this.showLoadingSpinner = false;
+                this.closePop();
                 this.showToast("Success", "涓婁紶鎴愬姛");
                 this.getFiles();
             })
             .catch((error) => {
+                this.showPopSpinner = false;
                 console.log("error = " + error.message);
                 this.showToast("Error", "涓婁紶澶辫触");
             });
@@ -1623,6 +1728,21 @@
 
     GoodsDeliveryJs() {
         this.isShowSpinner = true;
+
+        //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
+        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        console.log('selectedRows = ' + selectedRows);
+        for (var i in this.data) {
+            this.data[i]["check"] = false;
+        }
+        for (var i in this.data) {
+            for (var j in selectedRows) {
+                if (this.data[i].Id == selectedRows[j].Id) {
+                    this.data[i]["check"] = true;
+                }
+            }
+        }
+
         let cloneData = this.data;
         for (var i in cloneData) {
             cloneData[i]["Name"] = cloneData[i].Name__c;
@@ -1896,6 +2016,31 @@
         });
     }
 
+    handleLoad() {
+        console.log('handleLoad')
+        try {
+            const style = document.createElement('style');
+            style.innerText = '.slds-button__icon {display: none;}';
+            this.template.querySelector('.hideHelpText').appendChild(style);
+        } catch (error) {
+            console.log(error);
+        }
+    }
+
+    handleLoad2() {
+        console.log('handleLoad2')
+        try {
+            const style = document.createElement('style');
+            style.innerText = '.slds-button__icon {display: none;}';
+            this.template.querySelector('.hideHelpText').appendChild(style);
+
+            const style2 = document.createElement('style');
+            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
+            this.template.querySelector('.hideHelpText').appendChild(style2);
+        } catch (error) {
+            console.log(error);
+        }
+    }
     //缂栬緫鍑哄簱鍗�
     EditConsumable() {
         let url = "/lexsummonscreat?ESetid=" + this.ESetid + "&KeyWords=Redirect";
@@ -1906,4 +2051,48 @@
             },
         });
     }
+
+    //鏄剧ず涓婁紶闄勪欢
+    uploadOrder(event) {
+        this.showAttPop = true;
+    }
+
+    //闄勪欢change浜嬩欢
+    attChange(event) {
+        if (event.target.files.length > 0) {
+            this.filesUploaded = event.target.files;
+            this.fileName = event.target.files[0].name;
+            console.log('this.fileName:' + this.fileName);
+        }
+    }
+
+    //鏄惁鏄剧ず闄勪欢绉婚櫎
+    get attDelBtn() {
+        if (this.fileName != '' && this.fileName != null && this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�') {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //鍏抽棴闄勪欢寮圭獥
+    closePop() {
+        this.showAttPop = false;
+        this.filesUploaded = [];
+        this.fileName = null;
+    }
+
+    //绉婚櫎闄勪欢
+    removeAtt() {
+        this.filesUploaded = [];
+        this.fileName = '';
+    }
+
+    ClearJs() {
+        this.consumableName = '';
+        this.Category3 = '';
+        this.Category4 = '';
+        this.Category5 = '';
+        this.searchProductJs();
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1