From 8c8f51f10bb9e158cb8b89cb8d58e4ce7d467583 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 11:29:01 +0800
Subject: [PATCH] backup0626

---
 force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js |  270 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 141 insertions(+), 129 deletions(-)

diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
index 8687cd2..2b81ce8 100644
--- a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
@@ -14,34 +14,40 @@
         fieldName: "NameUrl",
         hideDefaultActions: true,
         wrapText: true,
-        initialWidth: 345,
+        initialWidth: 200,
         sortable: true,
         type: "url",
         typeAttributes: {
             label: {
                 fieldName: "Name",
             },
+            target:"_blank"
         },
     },
+    // {
+    //     label: "鐪�",
+    //     fieldName: "StateMasterUrl",
+    //     hideDefaultActions: true,
+    //     wrapText: true,
+    //     sortable: true,
+    //     type: "url",
+    //     typeAttributes: {
+    //         label: {
+    //             fieldName: "StateMasterName",
+    //         },
+    //         target: "_blank",
+    //     },
+    // },
     {
         label: "鐪�",
-        fieldName: "StateMasterUrl",
+        fieldName: "StateMasterName",
         hideDefaultActions: true,
-        initialWidth: 80,
         wrapText: true,
         sortable: true,
-        type: "url",
-        typeAttributes: {
-            label: {
-                fieldName: "StateMasterName",
-            },
-            target: "_blank",
-        },
     },
     {
         label: "閿�鍞湰閮ㄥ尰闄�",
         fieldName: "Salesdepartment_HP__c",
-        initialWidth: 115,
         hideDefaultActions: true,
         sortable: true,
         wrapText: true,
@@ -59,7 +65,6 @@
             month: "numeric",
             year: "numeric",
         },
-        initialWidth: 100,
     },
     {
         label: "鏈夋晥/鏃犳晥",
@@ -67,45 +72,49 @@
         hideDefaultActions: true,
         sortable: true,
         wrapText: true,
-        initialWidth: 91,
     },
-    {
-        label: "瀹㈡埛璁板綍绫诲瀷",
-        fieldName: "RecordTypeName",
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true,
-        initialWidth: 130,
-    },
+    // {
+    //     label: "瀹㈡埛璁板綍绫诲瀷",
+    //     fieldName: "RecordTypeName",
+    //     hideDefaultActions: true,
+    //     sortable: true,
+    //     wrapText: true,
+    //     initialWidth: 130,
+    // },
     {
         label: "鏀垮簻绛夌骇",
         fieldName: "Grade__c",
         hideDefaultActions: true,
         sortable: true,
         wrapText: true,
-        initialWidth: 86,
     },
-    {
-        label: "OCSM鍒嗙被(鍖婚櫌)",
-        fieldName: "OCM_Category__c",
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true,
-        initialWidth: 150,
-    },
+    // {
+    //     label: "OCSM鍒嗙被(鍖婚櫌)",
+    //     fieldName: "OCM_Category__c",
+    //     hideDefaultActions: true,
+    //     sortable: true,
+    //     wrapText: true,
+    // },
+    // {
+    //     label: "甯�",
+    //     fieldName: "CityMasterNameUrl",
+    //     hideDefaultActions: true,
+    //     sortable: true,
+    //     wrapText: true,
+    //     type: "url",
+    //     typeAttributes: {
+    //         label: {
+    //             fieldName: "CityMasterName",
+    //         },
+    //         target: "_blank",
+    //     },
+    // },
     {
         label: "甯�",
-        fieldName: "CityMasterNameUrl",
+        fieldName: "CityMasterName",
         hideDefaultActions: true,
         sortable: true,
         wrapText: true,
-        type: "url",
-        typeAttributes: {
-            label: {
-                fieldName: "CityMasterName",
-            },
-            target: "_blank",
-        },
     },
     {
         label: "鍘�/鍖�",
@@ -126,28 +135,33 @@
 const topColumns = [
     {
         label: "瀹㈡埛鍚�",
-        fieldName: "NameUrl",
         hideDefaultActions: true,
+        fieldName : "accountName",
         wrapText: true,
-        type: "url",
+        type: "customShowAccountUrl",
         typeAttributes: {
-            label: {
-                fieldName: "Name",
-            },
+            accountName: { fieldName: "accountName" },
+            accountUrl: { fieldName: "accountUrl" },
+            isDisable: { fieldName: "isDisable" },
         },
     },
+    // {
+    //     label: "甯�",
+    //     fieldName: "CityMasterName",
+    //     hideDefaultActions: true,
+    //     wrapText: true,
+    //     type: "customShowAccountUrl",
+    //     typeAttributes: {
+    //         accountName: { fieldName: "CityMasterName" },
+    //         accountUrl: { fieldName: "CityMasterNameUrl" },
+    //         isDisable: { fieldName: "isDisable" },
+    //     },
+    // },
     {
         label: "甯�",
-        fieldName: "CityMasterNameUrl",
+        fieldName: "CityMasterName",
         hideDefaultActions: true,
         wrapText: true,
-        type: "url",
-        typeAttributes: {
-            label: {
-                fieldName: "CityMasterName",
-            },
-            target: "_blank",
-        },
     },
     {
         label: "鍘�/鍖�",
@@ -179,7 +193,7 @@
 export default class LexConsumableAccount extends LightningElement {
     columns = columns;
     topColumns = topColumns;
-    @track isShowSpinner = true;
+    @track isShowSpinner = false;
     @track pageRecords = [];
     @track accountId = "";
     @track agencyProType = "";
@@ -189,14 +203,14 @@
             label: "01. 鍖婚櫌_Hospital",
             value: "01. 鍖婚櫌_Hospital",
         },
-        {
-            label: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
-            value: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
-        },
-        {
-            label: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
-            value: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
-        },
+        // {
+        //     label: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+        //     value: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+        // },
+        // {
+        //     label: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+        //     value: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+        // },
         {
             label: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�",
             value: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�",
@@ -291,6 +305,7 @@
     }
 
     connectedCallback() {
+        this.isShowSpinner = true;
         this.AccId = this.getQueryString("AccId");
         this.AccId = this.AccId == null ? "" : this.AccId;
         if (this.AccId != "") {
@@ -301,41 +316,29 @@
                 r = JSON.parse(JSON.stringify(r));
                 console.log("r = " + JSON.stringify(r));
                 if (r.status == "Success") {
+                    console.log('r.entity.obj = ' + JSON.stringify(r.entity.obj))
                     this.accountDataInfo.name = r.entity.obj.Name;
-                    this.accountDataInfo.ownerName =
-                        r.entity.obj.Owner == null ? "" : r.entity.obj.Owner.Name;
+                    this.accountDataInfo.ownerName = r.entity.obj.Owner == null ? "" : r.entity.obj.Owner.Name;
                     this.accountDataInfo.site = r.entity.obj.site;
                     this.accountDataInfo.isActive = r.entity.obj.Is_Active__c;
                     this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c;
-                    this.accountDataInfo.banOnUseReason =
-                        r.entity.obj.Ban_On_Use_Reason__c;
+                    this.accountDataInfo.banOnUseReason = r.entity.obj.Ban_On_Use_Reason__c;
                     this.accountDataInfo.grade = r.entity.obj.Grade__c;
                     this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c;
                     this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c;
-                    this.accountDataInfo.specialityType =
-                        r.entity.obj.Speciality_Type__c;
-                    this.accountDataInfo.stateMasterName =
-                        r.entity.obj.State_Master__r == null
-                            ? ""
-                            : r.entity.obj.State_Master__r.Name;
+                    this.accountDataInfo.specialityType = r.entity.obj.Speciality_Type__c;
+                    this.accountDataInfo.stateMasterName = r.entity.obj.State_Master__r == null ? "" : r.entity.obj.State_Master__r.Name;
                     this.accountDataInfo.phone = r.entity.obj.Phone;
-                    this.accountDataInfo.cityMasterName =
-                        r.entity.obj.City_Master__r == null
-                            ? ""
-                            : r.entity.obj.City_Master__r.Name;
+                    this.accountDataInfo.cityMasterName = r.entity.obj.City_Master__r == null ? "" : r.entity.obj.City_Master__r.Name;
                     this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c;
                     this.accountDataInfo.town = r.entity.obj.Town__c;
                     this.accountDataInfo.fax = r.entity.obj.Fax;
                     this.accountDataInfo.street = r.entity.obj.Street__c;
                     this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c;
                     this.accountDataInfo.address = r.entity.obj.Address__c;
-                    this.accountDataInfo.parentName =
-                        r.entity.obj.Parent == null ? "" : r.entity.obj.Parent.Name;
-                    console.log(
-                        "this.accountDataInfo = " + JSON.stringify(this.accountDataInfo)
-                    );
-                    this.printUrl =
-                        "/lexconsumableaccountinfoprint?AccId=" + this.AccId;
+                    this.accountDataInfo.parentName = r.entity.obj.Parent == null ? "" : r.entity.obj.Parent.Name;
+                    console.log('this.accountDataInfo = ' + JSON.stringify(this.accountDataInfo))
+                    this.printUrl = "/lexconsumableaccountinfoprint?AccId=" + this.AccId;
                     this.isShowAccountInfo = true;
                     this.isShowSpinner = false;
                 } else {
@@ -372,7 +375,8 @@
                     this.agencyProTypestr = r.entity.agencyProTypestr;
                     console.log("this.agencyProTypestr = " + this.agencyProTypestr);
                     for (var i in this.pageRecords) {
-                        this.pageRecords[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+                        this.pageRecords[i]["Is_Active__c"] = this.pageRecords[i].Is_Active__c.replace('鍔�','鏁�');
+                        this.pageRecords[i]["NameUrl"] = "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
                         this.pageRecords[i]["StateMasterName"] = this.pageRecords[i].State_Master__r.Name;
                         this.pageRecords[i]["StateMasterUrl"] = "/" + this.pageRecords[i].State_Master__c;
                         this.pageRecords[i]["CityMasterName"] = this.pageRecords[i].City_Master__r.Name;
@@ -393,40 +397,50 @@
                     );
                     console.log('9/3 = ' + this.keepTwoDecimalStr(this.amend(9, 3, '/').toFixed(2)));
                     let total = 100;
-                    for (var i in this.topAccountData) {
-                        console.log('i = ' + i);
-                        this.topAccountData[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
-                        this.topAccountData[i]["StateMasterName"] = this.topAccountData[i].State_Master__r.Name;
-                        this.topAccountData[i]["StateMasterUrl"] = "/" + this.topAccountData[i].State_Master__c;
-                        this.topAccountData[i]["CityMasterName"] = this.topAccountData[i].City_Master__r.Name;
-                        this.topAccountData[i]["CityMasterNameUrl"] = "/" + this.topAccountData[i].City_Master__c;
-                        this.topAccountData[i]["RecordTypeName"] = this.topAccountData[i].RecordType.Name;
-                        this.topAccountData[i]["isShowButton"] = true;
-                        let number = this.keepTwoDecimalStr((this.amend(this.topInfo.deList[i], this.topInfo.saleAmount, '/') * 100).toFixed(2));
-                        total -= number;
-                        this.topAccountData[i]["proportion"] = number + '%';
+                    try {
+                        for (var i in this.topAccountData) {
+                            console.log('i = ' + i);
+                            this.topAccountData[i]["accountName"] = this.topAccountData[i].Name;
+                            this.topAccountData[i]["accountUrl"] = "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+                            this.topAccountData[i]["isDisable"] = false;
+                            this.topAccountData[i]["StateMasterName"] = this.topAccountData[i].State_Master__r.Name;
+                            this.topAccountData[i]["StateMasterUrl"] = "/" + this.topAccountData[i].State_Master__c;
+                            this.topAccountData[i]["CityMasterName"] = this.topAccountData[i].City_Master__r.Name;
+                            this.topAccountData[i]["CityMasterNameUrl"] = "/" + this.topAccountData[i].City_Master__c;
+                            this.topAccountData[i]["RecordTypeName"] = this.topAccountData[i].RecordType.Name;
+                            this.topAccountData[i]["isShowButton"] = true;
+                            let number = this.keepTwoDecimalStr((this.amend(this.topInfo.deList[i], this.topInfo.saleAmount, '/') * 100).toFixed(2));
+                            total -= number;
+                            this.topAccountData[i]["proportion"] = number + '%';
+                        }
+
+                        console.log('this.topAccountData = ' + JSON.stringify(this.topAccountData));
+
+                        //鍏朵粬
+                        if (total != 100) {
+                            this.topAccountData.push({
+                                accountName: '...',
+                                accountUrl: '/s/lexconsumableaccount',
+                                isDisable: true,
+                                proportion: total.toFixed(2) + '%',
+                                CityMasterName: '...',
+                                CityMasterNameUrl: '/lexconsumableaccount',
+                                Town__c: '...',
+                                isShowButton: false
+                            })
+                        } else {
+                            let title = '';
+                            for (var key in this.fiscalYearOptions) {
+                                if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
+                                    title = this.fiscalYearOptions[key].label;
+                            }
+                            this.showMyToast(title, '鏃犳暟鎹�', 'Error');
+                        }
+                        this.isShowSpinner = false;
+                    } catch (error) {
+                        console.log('error = ' + error.message)
                     }
 
-                    // //鍏朵粬
-                    if (total != 100) {
-                        this.topAccountData.push({
-                            Name: '...',
-                            NameUrl: '/lexconsumableaccount',
-                            proportion: total.toFixed(2) + '%',
-                            CityMasterName: '...',
-                            CityMasterNameUrl: '/lexconsumableaccount',
-                            Town__c: '...',
-                            isShowButton: false
-                        })
-                    } else {
-                        let title = '';
-                        for (var key in this.fiscalYearOptions) {
-                            if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
-                                title = this.fiscalYearOptions[key].label;
-                        }
-                        this.showMyToast(title, '鏃犳暟鎹�', 'Error');
-                    }
-                    this.isShowSpinner = false;
                 } else {
                     console.log("r = " + JSON.stringify(r));
                     this.showMyToast('Error', r.msg, 'Error');
@@ -525,7 +539,9 @@
                 let total = 100;
                 for (var i in this.topAccountData) {
                     console.log('i = ' + i);
-                    this.topAccountData[i]["NameUrl"] = "/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+                    this.topAccountData[i]["accountName"] = this.topAccountData[i].Name;
+                    this.topAccountData[i]["accountUrl"] = "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+                    this.topAccountData[i]["isDisable"] = false;
                     this.topAccountData[i]["StateMasterName"] = this.topAccountData[i].State_Master__r.Name;
                     this.topAccountData[i]["StateMasterUrl"] = "/" + this.topAccountData[i].State_Master__c;
                     this.topAccountData[i]["CityMasterName"] = this.topAccountData[i].City_Master__r.Name;
@@ -540,8 +556,9 @@
                 // //鍏朵粬
                 if (total != 100) {
                     this.topAccountData.push({
-                        Name: '...',
-                        NameUrl: '/lexconsumableaccount',
+                        accountName: '...',
+                        accountUrl: '/s/lexconsumableaccount',
+                        isDisable: true,
                         proportion: total.toFixed(2) + '%',
                         CityMasterName: '...',
                         CityMasterNameUrl: '/lexconsumableaccount',
@@ -597,18 +614,13 @@
                     this.pageRecords = r.entity.pageRecords;
                     console.log("this.pageRecords = " + JSON.stringify(this.pageRecords));
                     for (var i in this.pageRecords) {
-                        this.pageRecords[i]["NameUrl"] =
-                            "/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
-                        this.pageRecords[i]["StateMasterName"] =
-                            this.pageRecords[i].State_Master__r.Name;
-                        this.pageRecords[i]["StateMasterUrl"] =
-                            "/" + this.pageRecords[i].State_Master__c;
-                        this.pageRecords[i]["CityMasterName"] =
-                            this.pageRecords[i].City_Master__r.Name;
-                        this.pageRecords[i]["CityMasterNameUrl"] =
-                            "/" + this.pageRecords[i].City_Master__c;
-                        this.pageRecords[i]["RecordTypeName"] =
-                            this.pageRecords[i].RecordType.Name;
+                        this.pageRecords[i]["Is_Active__c"] = this.pageRecords[i].Is_Active__c.replace('鍔�','鏁�');
+                        this.pageRecords[i]["NameUrl"] = "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+                        this.pageRecords[i]["StateMasterName"] = this.pageRecords[i].State_Master__r.Name;
+                        this.pageRecords[i]["StateMasterUrl"] = "/" + this.pageRecords[i].State_Master__c;
+                        this.pageRecords[i]["CityMasterName"] = this.pageRecords[i].City_Master__r.Name;
+                        this.pageRecords[i]["CityMasterNameUrl"] = "/" + this.pageRecords[i].City_Master__c;
+                        this.pageRecords[i]["RecordTypeName"] = this.pageRecords[i].RecordType.Name;
                     }
                     this.isShowSpinner = false;
                 } else {

--
Gitblit v1.9.1