From f94d7f9cd1d2d467e7242245719192d7157e3ede Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 09 六月 2023 11:38:01 +0800 Subject: [PATCH] issfix --- .sf/config.json | 2 force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html | 338 ++++-- force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js | 385 +++--- force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js | 319 +++--- force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html | 390 +++++-- force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | 1286 ++++++++++++------------ force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html | 340 ++++-- force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css | 17 8 files changed, 1,722 insertions(+), 1,355 deletions(-) diff --git a/.sf/config.json b/.sf/config.json index 36f3790..5b4e627 100644 --- a/.sf/config.json +++ b/.sf/config.json @@ -1,3 +1,3 @@ { - "target-org": "DaikinDev" + "target-org": "OlympusDev" } diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html index 3b10fa5..26a054f 100644 --- a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html +++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html @@ -1,131 +1,211 @@ <template> - <template if:true={showSpinner}> - <lightning-spinner size="medium" variant="brand"></lightning-spinner> - </template> - <c-common-toast></c-common-toast> - <div style="border: 1px solid #D4D4D4;border-radius:5px;"> - - <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <div> - <!-- <p style="font-size: 18px;"><strong>鍙栨秷鎷嗙洅</strong></p> --> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>鍙栨秷鎷嗙洅</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - </div> - <div style="padding:10px;"> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鍙栨秷鎷嗙洅纭" title="鍙栨秷鎷嗙洅纭" onclick={saveConfirm}></lightning-button></td> --> - <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="鍙栨秷鎷嗙洅纭" onclick={saveConfirm}>鍙栨秷鎷嗙洅纭</button> - </div> - </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 16px"> - <strong>BarCode褰曞叆</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - - <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> --> - <table> - <colgroup> - <col width="160px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - <col width="10px" /> - <col width="90px" /> - <col width="100px" /> - <col width="10px" /> - <col width="85px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - </colgroup> - <tbody> - <tr> - <td></td> - <td align="right" class="searchName">BarCode</td> - <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label="" - onchange={handleChange}></lightning-textarea></td> - <td align="right"></td> - <td></td> - <td style="width: 200px;"> - <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={getDetails}>鑾峰彇鏄庣粏</button> - <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails} - ></lightning-button> --> - </td> - </tr> - </tbody> - </table> - <!-- </div> --> - </div> - - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>鍙栨秷鎷嗙洅鏄庣粏</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - <div style="padding:10px;"> - - <!-- <div style="height: 300px;"> --> - <!-- <template if:true={showTable}> --> - <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns} - onrowselection={getSelectedRows} hide-checkbox-column="true" - selected-rows={selectedRows} class="wrapped-header-datatable"> - </c-lex-custom-lightning-datatable> - <!-- </template> --> - <!-- </div> --> - - </div> - </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <table> - <tr> - <td> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>閿欒鏄庣粏</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </td> - </tr> - </table> - </div> - - <div style="padding:10px;"> - <lightning-datatable - key-field="id" data={errorDetail} columns={column} - onrowselection={getSelectedRows} hide-checkbox-column="true" - selected-rows={selectedRows} class="wrapped-header-datatable"> - </lightning-datatable> - - - </div> - </div> - </div> - - - + <template if:true={showSpinner}> + <lightning-spinner size="medium" variant="brand"></lightning-spinner> + </template> + <c-common-toast></c-common-toast> + <div style="border: 1px solid #d4d4d4; border-radius: 5px"> + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <div> + <!-- <p style="font-size: 18px;"><strong>鍙栨秷鎷嗙洅</strong></p> --> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>鍙栨秷鎷嗙洅</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> </div> - -</template> \ No newline at end of file + <div style="padding: 10px"> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鍙栨秷鎷嗙洅纭" title="鍙栨秷鎷嗙洅纭" onclick={saveConfirm}></lightning-button></td> --> + <button + class="slds-button slds-button_neutral slds-button_stretch lexBorder" + style="margin-left: 10px; margin-top: 12px; margin-bottom: 12px" + label="鍙栨秷鎷嗙洅纭" + onclick={saveConfirm} + > + 鍙栨秷鎷嗙洅纭 + </button> + </div> + </div> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 5px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 16px"> + <strong>BarCode褰曞叆</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + + <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> --> + <table> + <colgroup> + <col width="160px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + <col width="10px" /> + <col width="90px" /> + <col width="100px" /> + <col width="10px" /> + <col width="85px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + </colgroup> + <tbody> + <tr> + <td></td> + <td align="right" class="searchName">BarCode</td> + <td style="width: 600px"> + <lightning-textarea + class="inputFont" + name="BarCode" + label="" + onchange={handleChange} + ></lightning-textarea> + </td> + <td align="right"></td> + <td></td> + <td style="width: 200px"> + <button + style="margin-top: 14px" + class="slds-button slds-button_neutral slds-button_stretch lexBorder" + label="鑾峰彇鏄庣粏" + onclick={getDetails} + > + 鑾峰彇鏄庣粏 + </button> + <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails} + ></lightning-button> --> + </td> + </tr> + </tbody> + </table> + <!-- </div> --> + </div> + + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>鍙栨秷鎷嗙洅鏄庣粏</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + <div style="padding: 10px"> + <!-- <div style="height: 300px;"> --> + <!-- <template if:true={showTable}> --> + <c-lex-custom-lightning-datatable + key-field="prodid" + data={data} + columns={columns} + onrowselection={getSelectedRows} + hide-checkbox-column="true" + selected-rows={selectedRows} + class="wrapped-header-datatable" + style="word-wrap: break-word; word-break: break-all" + > + </c-lex-custom-lightning-datatable> + <!-- </template> --> + <!-- </div> --> + </div> + </div> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 10px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <table> + <tr> + <td> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>閿欒鏄庣粏</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </td> + </tr> + </table> + </div> + + <div style="padding: 10px"> + <lightning-datatable + key-field="id" + data={errorDetail} + columns={column} + onrowselection={getSelectedRows} + hide-checkbox-column="true" + selected-rows={selectedRows} + class="wrapped-header-datatable" + style="word-wrap: break-word; word-break: break-all" + > + </lightning-datatable> + </div> + </div> + </div> + </div> +</template> diff --git a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js index 52d3451..a894763 100644 --- a/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js +++ b/force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js @@ -1,135 +1,133 @@ -import { LightningElement, wire, api, track } from 'lwc'; -import { ShowToastEvent } from 'lightning/platformShowToastEvent'; +import { LightningElement, wire, api, track } from "lwc"; +import { ShowToastEvent } from "lightning/platformShowToastEvent"; import oninit from "@salesforce/apex/LexCancelRemoveBoxController.init"; -import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails" -import saveConfirm from '@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm'; +import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails"; +import saveConfirm from "@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm"; -//table css +//table css import { loadStyle } from "lightning/platformResourceLoader"; import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; const columns = [ - { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', - hideDefaultActions: true, - wrapText:true - // initialWidth: 350, - - }, - { - label: '瑙勬牸', - fieldName: 'ProductPacking_list_manual__c', - hideDefaultActions: true, - cellAttributes: { alignment: "right" }, - initialWidth: 50, - - }, - { - label: 'CFDA鐘舵��', - fieldName: 'CFDA_Status__c', - hideDefaultActions: true, - initialWidth: 200, - - }, - { - label: '娉ㄥ唽璇佺紪鐮佸彿', - fieldName: 'Report_Product_Approbation__c', - hideDefaultActions: true, - initialWidth: 200, - }, - { - label: '娉ㄥ唽璇佹晥鏈�', - fieldName: 'Report_Product_Expiration__c', - hideDefaultActions: true, - // initialWidth: 250, - }, - { - label: 'BarCode', - fieldName: 'Bar_Code__c', - hideDefaultActions: true, - initialWidth: 400, - } - ]; - - const column = [ - { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', - hideDefaultActions: true, - - }, - { - label: 'BarCode', - fieldName: 'Bar_Code__c', - hideDefaultActions: true, - - } - , - { - label: '閿欒鍘熷洜', - fieldName: 'ErrorReason', - hideDefaultActions: true, - } - ]; - + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + hideDefaultActions: true, + wrapText: true + // initialWidth: 350, + }, + { + label: "瑙勬牸", + fieldName: "ProductPacking_list_manual__c", + hideDefaultActions: true, + cellAttributes: { alignment: "right" }, + initialWidth: 50 + }, + { + label: "CFDA鐘舵��", + fieldName: "CFDA_Status__c", + hideDefaultActions: true, + initialWidth: 100, + wrapText: true + }, + { + label: "娉ㄥ唽璇佺紪鐮佸彿", + fieldName: "Report_Product_Approbation__c", + hideDefaultActions: true, + initialWidth: 200, + wrapText: true + }, + { + label: "娉ㄥ唽璇佹晥鏈�", + fieldName: "Report_Product_Expiration__c", + hideDefaultActions: true, + initialWidth: 110, + wrapText: true + }, + { + label: "BarCode", + fieldName: "Bar_Code__c", + hideDefaultActions: true, + wrapText: true + } +]; + +const column = [ + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + hideDefaultActions: true, + wrapText: true + }, + { + label: "BarCode", + fieldName: "Bar_Code__c", + wrapText: true, + hideDefaultActions: true + // initialWidth:600 + }, + { + label: "閿欒鍘熷洜", + fieldName: "ErrorReason", + hideDefaultActions: true + } +]; export default class LexCancelRemoveBox extends LightningElement { - columns = columns; - column = column; - @track selectedRows = []; - @track data = []; - @track errorDetail = []; - - // 鏄剧ず - @track showTable = false - @track showSpinner = false; + columns = columns; + column = column; + @track selectedRows = []; + @track data = []; + @track errorDetail = []; - //鏁版嵁鏋勬垚 - @track accountName - @track userWorkLocation - @track agencyProType - @track barcode = '' - @track saveFLGbln = false - @track dataSize = 0; + // 鏄剧ず + @track showTable = false; + @track showSpinner = false; - renderedCallback() { - if (!this.stylesLoaded) { - Promise.all([loadStyle(this, WrappedHeaderTable)]) - .then(() => { - console.log("Custom styles loaded"); - this.stylesLoaded = true; - }) - .catch((error) => { - console.error("Error loading custom styles"); - }); - } + //鏁版嵁鏋勬垚 + @track accountName; + @track userWorkLocation; + @track agencyProType; + @track barcode = ""; + @track saveFLGbln = false; + @track dataSize = 0; + + renderedCallback() { + if (!this.stylesLoaded) { + Promise.all([loadStyle(this, WrappedHeaderTable)]) + .then(() => { + console.log("Custom styles loaded"); + this.stylesLoaded = true; + }) + .catch((error) => { + console.error("Error loading custom styles"); + }); + } } - - - - connectedCallback() { - console.log('鍒濆鍖�'); - // this.showTable = false; - oninit().then((result) => { + connectedCallback() { + console.log("鍒濆鍖�"); + // this.showTable = false; + oninit() + .then((result) => { result = JSON.parse(JSON.stringify(result)); - console.log('result =' + JSON.stringify(result)); - if (result.status = 'Success') { - console.log('result'); + console.log("result =" + JSON.stringify(result)); + if ((result.status = "Success")) { + console.log("result"); this.agencyProType = result.entity.agencyProType; this.userWorkLocation = result.entity.userWorkLocation; this.accountName = result.entity.accountName; // this.data = JSON.parse(result.entity.codPageRecords); // this.showTable = true; } else { - this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error'); + this.showMyToast("鍒濆鍖栧け璐�", result.msg, "error"); } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)); + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); }); - } + } - //褰曞叆 + //褰曞叆 getDetails() { this.showSpinner = true; searchDeatail({ @@ -137,106 +135,111 @@ userWorkLocation: this.userWorkLocation, agencyProType: this.agencyProType, barcode: this.barcode - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log('result =' + JSON.stringify(result)); - if (result.status == 'Success') { - console.log('鎴愬姛'); - this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy); - this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror); - this.dataSize = result.entity.dataSize; - for (let i in this.data) { - this.data[i]['Name__c'] = this.data[i].Prod.Name__c; - this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c; - this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c; - this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c; - this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c; - this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c; + }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result =" + JSON.stringify(result)); + if (result.status == "Success") { + console.log("鎴愬姛"); + this.data = JSON.parse( + result.entity.ConsumableorderdetailsRecordsdummy + ); + this.errorDetail = JSON.parse( + result.entity.ConsumableorderdetailsRecordserror + ); + this.dataSize = result.entity.dataSize; + for (let i in this.data) { + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["ProductPacking_list_manual__c"] = + this.data[i].esd.ProductPacking_list_manual__c; + this.data[i]["CFDA_Status__c"] = this.data[i].esd.CFDA_Status__c; + this.data[i]["Report_Product_Approbation__c"] = + this.data[i].esd.Report_Product_Approbation__c; + this.data[i]["Report_Product_Expiration__c"] = + this.data[i].esd.Report_Product_Expiration__c; + this.data[i]["Bar_Code__c"] = this.data[i].esd.Bar_Code__c; + } + // this.showTable = true; + for (let i in this.errorDetail) { + this.errorDetail[i]["Name__c"] = this.errorDetail[i].Prod.Name__c; + this.errorDetail[i]["Bar_Code__c"] = + this.errorDetail[i].esd.Bar_Code__c; + this.errorDetail[i]["ErrorReason"] = + this.errorDetail[i].ErrorReason; + } + // this.showTables = true; + this.showSpinner = false; + } else { + this.showMyToast("鑾峰彇澶辫触", result.msg, "error"); + this.showSpinner = false; } - // this.showTable = true; - for (let i in this.errorDetail) { - this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c; - this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c; - this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason; - } - // this.showTables = true; - this.showSpinner = false; - } else{ - this.showMyToast('鑾峰彇澶辫触',result.msg,'error'); - this.showSpinner = false; - } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)); - }); - + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); } - //鑾峰彇褰撳墠杈撳叆鍊� - handleChange(event) { + //鑾峰彇褰撳墠杈撳叆鍊� + handleChange(event) { let value = event.detail.value; - console.log('value' + value); + console.log("value" + value); this.barcode = value; - console.log('this.barcode' + this.barcode); + console.log("this.barcode" + this.barcode); } - saveConfirm() { let msg = "纭鍙栨秷鎷嗙洅鍚�"; - if (this.dataSize>0) { - if (confirm(msg) == true) { - this.CancelRemoveBox(); - } - } else { + if (this.dataSize > 0) { + if (confirm(msg) == true) { this.CancelRemoveBox(); + } + } else { + this.CancelRemoveBox(); } } - CancelRemoveBox(){ - this.showSpinner = true; + CancelRemoveBox() { + this.showSpinner = true; saveConfirm({ saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data), accountName: this.accountName, userWorkLocation: this.userWorkLocation, agencyProType: this.agencyProType - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log('result淇濆瓨 = ' + JSON.stringify(result)); - if (result.status == 'Success') { - this.saveFLGbln = result.entity.saveFLGbln; - // this.showSpinner = false; - if(this.saveFLGbln){ - this.showMyToast(result.msg,'','success'); - this.showSpinner = false; - - - } - } else { - this.showMyToast('鍙栨秷鎷嗙洅澶辫触',result.msg,'error'); - this.showSpinner = false; - } }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result淇濆瓨 = " + JSON.stringify(result)); + if (result.status == "Success") { + this.saveFLGbln = result.entity.saveFLGbln; + // this.showSpinner = false; + if (this.saveFLGbln) { + this.showMyToast(result.msg, "", "success"); + this.showSpinner = false; + } + } else { + this.showMyToast("鍙栨秷鎷嗙洅澶辫触", result.msg, "error"); + this.showSpinner = false; + } + }) .catch((error) => { - console.log('error = ' + JSON.stringify(error)); + console.log("error = " + JSON.stringify(error)); }); - } showMyToast(title, message, variant) { - console.log('show custom message'); - var iconName = ''; - var content = ''; - if(variant == 'success'){ - iconName = 'utility:check'; - }else{ - iconName = 'utility:error'; + console.log("show custom message"); + var iconName = ""; + var content = ""; + if (variant == "success") { + iconName = "utility:check"; + } else { + iconName = "utility:error"; } - if(message != ''){ - content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; - }else{ - content = '<h2><strong>'+title+'<strong/></h2>'; + if (message != "") { + content = + "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>"; + } else { + content = "<h2><strong>" + title + "<strong/></h2>"; } - this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000); - } - - - - - -} \ No newline at end of file + this.template + .querySelector("c-common-toast") + .showToast(variant, content, iconName, 10000); + } +} diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html index 9e190eb..0b65e31 100644 --- a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html +++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html @@ -1,143 +1,223 @@ <template> - <template if:true={showSpinner}> - <lightning-spinner size="medium" variant="brand"></lightning-spinner> - </template> - <c-common-toast></c-common-toast> - <div style="border: 1px solid #D4D4D4;border-radius:5px;"> - - <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <div> - <!-- <p style="font-size: 18px;"><strong>鎷嗙洅</strong></p> --> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>鎷嗙洅</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> + <template if:true={showSpinner}> + <lightning-spinner size="medium" variant="brand"></lightning-spinner> + </template> + <c-common-toast></c-common-toast> + <div style="border: 1px solid #d4d4d4; border-radius: 5px"> + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <div> + <!-- <p style="font-size: 18px;"><strong>鎷嗙洅</strong></p> --> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>鎷嗙洅</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + </div> + <div style="padding: 10px"> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鎷嗙洅纭" title="鎷嗙洅纭" onclick={saveConfirm}></lightning-button>--> + <button + class="slds-button slds-button_neutral slds-button_stretch lexBorder" + style="margin-left: 10px; margin-top: 12px; margin-bottom: 12px" + label="鎷嗙洅纭" + onclick={saveConfirm} + > + 鎷嗙洅纭 + </button> </div> - <div style="padding:10px;"> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <!-- <lightning-button variant="brand" class='lexstyle' style="margin-left:10px;" label="鎷嗙洅纭" title="鎷嗙洅纭" onclick={saveConfirm}></lightning-button>--> - <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin-left:10px;margin-top:12px;margin-bottom:12px;" label="鎷嗙洅纭" onclick={saveConfirm}>鎷嗙洅纭</button> - </div> - </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:5px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 16px"> - <strong>BarCode褰曞叆</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - - <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> --> - <table> - <colgroup> - <col width="160px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - <col width="10px" /> - <col width="90px" /> - <col width="100px" /> - <col width="10px" /> - <col width="85px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - </colgroup> - <tbody> - <tr> - <td></td> - <td align="right" class="searchName">BarCode</td> - <td style="width:600px"><lightning-textarea class="inputFont" name="BarCode" label="" - onchange={handleChange}></lightning-textarea></td> - <td align="right"></td> - <td></td> - <td style="width: 200px;"> - <button style="margin-top:14px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鑾峰彇鏄庣粏" onclick={getDetails}>鑾峰彇鏄庣粏</button> - <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails} + </div> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 5px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 16px"> + <strong>BarCode褰曞叆</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + + <!-- <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> --> + <table> + <colgroup> + <col width="160px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + <col width="10px" /> + <col width="90px" /> + <col width="100px" /> + <col width="10px" /> + <col width="85px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + </colgroup> + <tbody> + <tr> + <td></td> + <td align="right" class="searchName">BarCode</td> + <td style="width: 600px"> + <lightning-textarea + class="inputFont" + name="BarCode" + label="" + onchange={handleChange} + ></lightning-textarea> + </td> + <td align="right"></td> + <td></td> + <td style="width: 200px"> + <button + style="margin-top: 14px" + class="slds-button slds-button_neutral slds-button_stretch lexBorder" + label="鑾峰彇鏄庣粏" + onclick={getDetails} + > + 鑾峰彇鏄庣粏 + </button> + <!-- <lightning-button variant="brand" class='lexstyle' label="鑾峰彇鏄庣粏" title="鑾峰彇鏄庣粏" onclick={getDetails} ></lightning-button> --> - </td> - </tr> - </tbody> - </table> - <!-- </div> --> - </div> + </td> + </tr> + </tbody> + </table> + <!-- </div> --> + </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>鎷嗙洅鏄庣粏</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - <div style="padding:10px;"> - - <!-- <div style="height: 300px;"> --> - <!-- <template if:true={showTable}> --> - <!-- <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns} + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 10px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>鎷嗙洅鏄庣粏</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + <div style="padding: 10px"> + <!-- <div style="height: 300px;"> --> + <!-- <template if:true={showTable}> --> + <!-- <c-lex-custom-lightning-datatable key-field="prodid" data={data} columns={columns} onrowselection={getSelectedRows} hide-checkbox-column="true" selected-rows={selectedRows}> </c-lex-custom-lightning-datatable> --> - <lightning-datatable - key-field="prodid" data={data} columns={columns} - onrowselection={getSelectedRows} hide-checkbox-column="true" - selected-rows={selectedRows} class="wrapped-header-datatable"> - </lightning-datatable> - <!-- </template> --> - <!-- </div> --> + <lightning-datatable + key-field="prodid" + data={data} + columns={columns} + onrowselection={getSelectedRows} + hide-checkbox-column="true" + selected-rows={selectedRows} + class="wrapped-header-datatable" + style="word-wrap: break-word; word-break: break-all" + > + </lightning-datatable> + <!-- </template> --> + <!-- </div> --> + </div> + </div> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 10px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <table> + <tr> + <td> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>閿欒鏄庣粏</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </td> + </tr> + </table> + </div> - </div> - </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:10px"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <table> - <tr> - <td> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>閿欒鏄庣粏</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </td> - </tr> - </table> - </div> - - <div style="padding:10px;"> - <!-- <template if:true={showTables}> --> - - <!-- <c-lex-custom-lightning-datatable key-field="id" data={errorDetail} columns={column} + <div style="padding: 10px"> + <!-- <template if:true={showTables}> --> + + <!-- <c-lex-custom-lightning-datatable key-field="id" data={errorDetail} columns={column} onrowselection={getSelectedRows} hide-checkbox-column="true" selected-rows={selectedRows}> </c-lex-custom-lightning-datatable> --> - <lightning-datatable - key-field="id" data={errorDetail} columns={column} - onrowselection={getSelectedRows} hide-checkbox-column="true" - selected-rows={selectedRows} class="wrapped-header-datatable"> - </lightning-datatable> - <!-- </template> --> - - - </div> + <lightning-datatable + key-field="id" + data={errorDetail} + columns={column} + onrowselection={getSelectedRows} + hide-checkbox-column="true" + selected-rows={selectedRows} + class="wrapped-header-datatable" + style="word-wrap: break-word; word-break: break-all" + > + </lightning-datatable> + <!-- </template> --> </div> - </div> - - - + </div> </div> - -</template> \ No newline at end of file + </div> +</template> diff --git a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js index 81ca3e2..cd935a9 100644 --- a/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js +++ b/force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js @@ -1,83 +1,79 @@ -import { LightningElement, wire, api, track } from 'lwc'; -import init from '@salesforce/apex/LexRemoveBoxController.init'; -import searchDeatail from '@salesforce/apex/LexRemoveBoxController.searchConsumableorderdetails'; -import saveconfirm from '@salesforce/apex/LexRemoveBoxController.removeBoxConfirm'; -import { ShowToastEvent } from 'lightning/platformShowToastEvent'; +import { LightningElement, wire, api, track } from "lwc"; +import init from "@salesforce/apex/LexRemoveBoxController.init"; +import searchDeatail from "@salesforce/apex/LexRemoveBoxController.searchConsumableorderdetails"; +import saveconfirm from "@salesforce/apex/LexRemoveBoxController.removeBoxConfirm"; +import { ShowToastEvent } from "lightning/platformShowToastEvent"; // import { NavigationMixin } from 'lightning/navigation'; -//table css +//table css import { loadStyle } from "lightning/platformResourceLoader"; import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; const columns = [ { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', - wrapText:true, - hideDefaultActions: true, - initialWidth: 400, - + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + wrapText: true, + hideDefaultActions: true + // initialWidth: 400, }, { - label: '瑙勬牸', - fieldName: 'ProductPacking_list_manual__c', + label: "瑙勬牸", + fieldName: "ProductPacking_list_manual__c", hideDefaultActions: true, initialWidth: 50, - cellAttributes: { alignment: "right" }, - - + cellAttributes: { alignment: "right" } }, { - label: 'CFDA鐘舵��', - fieldName: 'CFDA_Status__c', + label: "CFDA鐘舵��", + fieldName: "CFDA_Status__c", + hideDefaultActions: true, + initialWidth: 100, + wrapText: true + }, + { + label: "娉ㄥ唽璇佺紪鐮佸彿", + fieldName: "Report_Product_Approbation__c", hideDefaultActions: true, initialWidth: 200, - + wrapText: true }, { - label: '娉ㄥ唽璇佺紪鐮佸彿', - fieldName: 'Report_Product_Approbation__c', + label: "娉ㄥ唽璇佹晥鏈�", + fieldName: "Report_Product_Expiration__c", hideDefaultActions: true, - initialWidth: 200, + initialWidth: 110, + wrapText: true }, { - label: '娉ㄥ唽璇佹晥鏈�', - fieldName: 'Report_Product_Expiration__c', + label: "BarCode", + fieldName: "Bar_Code__c", hideDefaultActions: true, - // initialWidth: 250, - }, - { - label: 'BarCode', - fieldName: 'Bar_Code__c', - hideDefaultActions: true, - wrapText:true, - initialWidth:400, + wrapText: true + // initialWidth:600, } ]; const column = [ { - label: '娑堣�楀搧鍚嶇О', - fieldName: 'Name__c', + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", hideDefaultActions: true, - + wrapText: true }, { - label: 'BarCode', - fieldName: 'Bar_Code__c', + label: "BarCode", + fieldName: "Bar_Code__c", hideDefaultActions: true, - - - } - , + wrapText: true + // initialWidth:600, + }, { - label: '閿欒鍘熷洜', - fieldName: 'ErrorReason', + label: "閿欒鍘熷洜", + fieldName: "ErrorReason", hideDefaultActions: true, + wrapText: true } ]; - - - export default class LexRemoveBox extends LightningElement { columns = columns; @@ -87,51 +83,53 @@ @track errorDetail = []; // 鏄剧ず - @track showTable = false - @track accountName - @track userWorkLocation - @track agencyProType - @track barcode = '' - @track saveFLGbln = false + @track showTable = false; + @track accountName; + @track userWorkLocation; + @track agencyProType; + @track barcode = ""; + @track saveFLGbln = false; @track dataSize = 0; //鍔犺浇妗� - @track showSpinner = false + @track showSpinner = false; renderedCallback() { if (!this.stylesLoaded) { - Promise.all([loadStyle(this, WrappedHeaderTable)]) - .then(() => { - console.log("Custom styles loaded"); - this.stylesLoaded = true; - }) - .catch((error) => { - console.error("Error loading custom styles"); - }); + Promise.all([loadStyle(this, WrappedHeaderTable)]) + .then(() => { + console.log("Custom styles loaded"); + this.stylesLoaded = true; + }) + .catch((error) => { + console.error("Error loading custom styles"); + }); } -} + } //鍒濆鍖� connectedCallback() { - console.log('鍒濆鍖�'); + console.log("鍒濆鍖�"); this.showTable = false; - init().then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log('result =' + JSON.stringify(result)); - if (result.status = 'Success') { - console.log('result'); - this.agencyProType = result.entity.agencyProType; - this.userWorkLocation = result.entity.userWorkLocation; - this.accountName = result.entity.accountName; - // this.data = JSON.parse(result.entity.codPageRecords); - // this.showTable = true; - } else { - this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error'); - } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)); - }); + init() + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result =" + JSON.stringify(result)); + if ((result.status = "Success")) { + console.log("result"); + this.agencyProType = result.entity.agencyProType; + this.userWorkLocation = result.entity.userWorkLocation; + this.accountName = result.entity.accountName; + // this.data = JSON.parse(result.entity.codPageRecords); + // this.showTable = true; + } else { + this.showMyToast("鍒濆鍖栧け璐�", result.msg, "error"); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); } //褰曞叆 getDetails() { @@ -140,105 +138,112 @@ userWorkLocation: this.userWorkLocation, agencyProType: this.agencyProType, barcode: this.barcode - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log('result =' + JSON.stringify(result)); - if (result.status == 'Success') { - console.log('鎴愬姛'); - this.data = JSON.parse(result.entity.ConsumableorderdetailsRecordsdummy); - this.errorDetail = JSON.parse(result.entity.ConsumableorderdetailsRecordserror); - this.dataSize = result.entity.dataSize; - console.log('this.dataSize'+this.dataSize); - for (let i in this.data) { - this.data[i]['Name__c'] = this.data[i].Prod.Name__c; - this.data[i]['ProductPacking_list_manual__c'] = this.data[i].esd.ProductPacking_list_manual__c; - this.data[i]['CFDA_Status__c'] = this.data[i].esd.CFDA_Status__c; - this.data[i]['Report_Product_Approbation__c'] = this.data[i].esd.Report_Product_Approbation__c; - this.data[i]['Report_Product_Expiration__c'] = this.data[i].esd.Report_Product_Expiration__c; - this.data[i]['Bar_Code__c'] = this.data[i].esd.Bar_Code__c; + }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result =" + JSON.stringify(result)); + if (result.status == "Success") { + console.log("鎴愬姛"); + this.data = JSON.parse( + result.entity.ConsumableorderdetailsRecordsdummy + ); + this.errorDetail = JSON.parse( + result.entity.ConsumableorderdetailsRecordserror + ); + this.dataSize = result.entity.dataSize; + console.log("this.dataSize" + this.dataSize); + for (let i in this.data) { + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["ProductPacking_list_manual__c"] = + this.data[i].esd.ProductPacking_list_manual__c; + this.data[i]["CFDA_Status__c"] = this.data[i].esd.CFDA_Status__c; + this.data[i]["Report_Product_Approbation__c"] = + this.data[i].esd.Report_Product_Approbation__c; + this.data[i]["Report_Product_Expiration__c"] = + this.data[i].esd.Report_Product_Expiration__c; + this.data[i]["Bar_Code__c"] = this.data[i].esd.Bar_Code__c; + } + for (let i in this.errorDetail) { + this.errorDetail[i]["Name__c"] = this.errorDetail[i].Prod.Name__c; + this.errorDetail[i]["Bar_Code__c"] = + this.errorDetail[i].esd.Bar_Code__c; + this.errorDetail[i]["ErrorReason"] = + this.errorDetail[i].ErrorReason; + } + this.showTables = true; + this.showTable = true; + } else { + console.log("result.msg = " + result.msg); + this.showMyToast("鑾峰彇澶辫触", result.msg, "error"); } - for (let i in this.errorDetail) { - this.errorDetail[i]['Name__c'] = this.errorDetail[i].Prod.Name__c; - this.errorDetail[i]['Bar_Code__c'] = this.errorDetail[i].esd.Bar_Code__c; - this.errorDetail[i]['ErrorReason'] = this.errorDetail[i].ErrorReason; - } - this.showTables = true; - this.showTable = true; - } else{ - console.log('result.msg = ' + result.msg); - this.showMyToast('鑾峰彇澶辫触',result.msg,'error'); - } - }).catch((error) => { - console.log('error = ' + JSON.stringify(error)); - }); - + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); } //鑾峰彇褰撳墠杈撳叆鍊� handleChange(event) { let value = event.detail.value; - console.log('value' + value); + console.log("value" + value); this.barcode = value; - console.log('this.barcode' + this.barcode); + console.log("this.barcode" + this.barcode); } saveConfirm() { - console.log('杩涘叆纭'); + console.log("杩涘叆纭"); let msg = "纭鎷嗙洅鍚�"; - if (this.dataSize>0) { - if (confirm(msg) == true) { - this.removeBox(); - } - } else { + if (this.dataSize > 0) { + if (confirm(msg) == true) { this.removeBox(); + } + } else { + this.removeBox(); } - } - removeBox(){ + removeBox() { this.showSpinner = true; saveconfirm({ saveConsumableorderdetailsRecordsdummy: JSON.stringify(this.data), accountName: this.accountName, userWorkLocation: this.userWorkLocation, agencyProType: this.agencyProType - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log('result淇濆瓨 = ' + JSON.stringify(result)); - if (result.status == 'Success') { - this.saveFLGbln = result.entity.saveFLGbln; - // this.showSpinner = false; - if(this.saveFLGbln){ - this.showMyToast(result.msg,'','success'); - this.showSpinner = false; - } - } else { - console.log('result.msg = ' + result.msg); - this.showMyToast('鎷嗙洅澶辫触',result.msg,'error'); - this.showSpinner = false; - } }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result淇濆瓨 = " + JSON.stringify(result)); + if (result.status == "Success") { + this.saveFLGbln = result.entity.saveFLGbln; + // this.showSpinner = false; + if (this.saveFLGbln) { + this.showMyToast(result.msg, "", "success"); + this.showSpinner = false; + } + } else { + console.log("result.msg = " + result.msg); + this.showMyToast("鎷嗙洅澶辫触", result.msg, "error"); + this.showSpinner = false; + } + }) .catch((error) => { - console.log('error = ' + JSON.stringify(error)); + console.log("error = " + JSON.stringify(error)); }); - - } showMyToast(title, message, variant) { - console.log('show custom message'); - var iconName = ''; - var content = ''; - if(variant == 'success'){ - iconName = 'utility:check'; - }else{ - iconName = 'utility:error'; + console.log("show custom message"); + var iconName = ""; + var content = ""; + if (variant == "success") { + iconName = "utility:check"; + } else { + iconName = "utility:error"; } - if(message != ''){ - content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; - }else{ - content = '<h2><strong>'+title+'<strong/></h2>'; + if (message != "") { + content = + "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>"; + } else { + content = "<h2><strong>" + title + "<strong/></h2>"; } - this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000); - } - - - - -} \ No newline at end of file + this.template + .querySelector("c-common-toast") + .showToast(variant, content, iconName, 10000); + } +} diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css index 49d6963..d8ad0bb 100644 --- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css +++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css @@ -1 +1,16 @@ -@import 'c/lexCssUtility'; \ No newline at end of file +@import "c/lexCssUtility"; +.lexButtoun { + font-size: 18px; + font-family: "sans-serif"; + font-weight: 500; + color: #0a81df; + /* border:2px solid rgb(8,16,132); */ + /* border-color:rgb(8,16,132); */ + width: 160px; + height: 36px; + border-radius: 4px; + opacity: 1; + background: #ffffff; + box-sizing: border-box; + border: 1px solid #0a81df; +} diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html index 18ee0c9..fb2aa16 100644 --- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html +++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html @@ -1,129 +1,281 @@ <template> - <template if:true={showSpinner}> - <lightning-spinner size="medium" variant="brand"></lightning-spinner> - </template> - <c-common-toast></c-common-toast> - <div style="border: 1px solid #D4D4D4;border-radius:5px;"> - <div style="border-top: 3px solid #51606E;;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <!-- <p style="font-size: 18px;"><strong>搴撳瓨绠$悊</strong></p> --> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>搴撳瓨绠$悊</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - <div style="padding:10px;"> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:10px;"> - <!-- <lightning-button variant="brand" class = 'lexstyle' style="margin:12px;" label="搴撳瓨鐩樼偣" title="搴撳瓨鐩樼偣" + <template if:true={showSpinner}> + <lightning-spinner size="medium" variant="brand"></lightning-spinner> + </template> + <c-common-toast></c-common-toast> + <div style="border: 1px solid #d4d4d4; border-radius: 5px"> + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <!-- <p style="font-size: 18px;"><strong>搴撳瓨绠$悊</strong></p> --> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>搴撳瓨绠$悊</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + <div style="padding: 10px"> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 10px; + " + > + <!-- <lightning-button variant="brand" class = 'lexstyle' style="margin:12px;" label="搴撳瓨鐩樼偣" title="搴撳瓨鐩樼偣" onclick={inventoryCount}></lightning-button> <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="杩囨湡搴撳瓨閿�瀛�" title="杩囨湡搴撳瓨閿�瀛�" onclick={handleExpired}></lightning-button> <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="鎷嗙洅" title="鎷嗙洅" onclick={removeBox}></lightning-button> <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="鍙栨秷鎷嗙洅" title="鍙栨秷鎷嗙洅" onclick={cancelremoveBox}></lightning-button> --> - <button style ="margin-left:5px;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="搴撳瓨鐩樼偣" onclick={inventoryCount}>搴撳瓨鐩樼偣</button> - <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="杩囨湡搴撳瓨閿�瀛�" style = "margin-left:150px;" onclick={handleExpired}>杩囨湡搴撳瓨閿�瀛�</button> - <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鎷嗙洅" style = "margin-left:150px;" onclick={removeBox}>鎷嗙洅</button> - <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" label="鍙栨秷鎷嗙洅" style = "margin-left:150px;" onclick={cancelremoveBox}>鍙栨秷鎷嗙洅</button> - </div> - </div> - - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;margin-top:30px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;height:115px"> - <table style="margin-top:10px;"> - <colgroup> - <col width="160px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - <col width="10px" /> - <col width="90px" /> - <col width="100px" /> - <col width="85px" /> - <col width="100px" /> - <col width="10px" /> - <col width="70px" /> - <col width="100px" /> - </colgroup> - <tbody> - <tr> - <td style="width:10px;"></td> - <td style="width:250px"> - <div style="width:90px;margin-left:12px;" class="searchName">娑堣�楀搧鍚嶇О</div> - </td> - <td style="width: 21%;"> - <lightning-input class="searchName" type="text" name="Name" label="娑堣�楀搧鍚嶇О" value={Name} - variant="label-hidden" onchange={dataChange} - data-field="Name"></lightning-input> - </td> - <td style="width:150px"> - <div style="width:90px;text-align:center;" class="searchName">绗�3鍒嗙被</div> - </td> - <td style="width: 21%;"> - <lightning-combobox class="inputFont" style="margin-left:5px;" name="CategoryThree" label="绗�3鍒嗙被" value={value} - placeholder="璇烽�夋嫨..." options={category3Options} variant="label-hidden" - data-field="CategoryThree" onchange={dataChange}></lightning-combobox> - </td> - <td style="width:150px"> - <div style="width:90px;text-align:center;" class="searchName">绗�4鍒嗙被</div> - </td> - <td style="width: 21%;"> - <lightning-combobox class="inputFont" name="CategoryFour" label="绗�4鍒嗙被" value={value} - placeholder="璇烽�夋嫨..." options={category4Options} variant="label-hidden" - data-field="CategoryFour" onchange={dataChange}></lightning-combobox> - </td> - <td style="width:150px"> - <div style="width:90px;text-align:center;" class="searchName">绗�5鍒嗙被</div> - </td> - <td style="width: 21%;"> - <lightning-combobox class="inputFont" name="CategoryFive" label="绗�5鍒嗙被" value={value} - placeholder="璇烽�夋嫨..." options={category5Options} variant="label-hidden" - data-field="CategoryFive" onchange={dataChange}></lightning-combobox> - </td> - <td style="width: 1%;"></td> - </tr> - </tbody> - </table> - <br/> - <div style="float:right;margin-right:10px;"> <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" label="娑堣�楀搧鎼滅储" onclick={searchOrderDetail}>娑堣�楀搧鎼滅储</button> - <button style="margin-left:10px;" class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="娓呯┖" onclick={clearAll}>娓呯┖</button></div> - - </div> - </div> - <div style="border: 1px solid #D4D4D4;border-radius:5px;margin-bottom:7px;"> - <div style="border-top: 3px solid #51606E;border-bottom: 1px solid #D4D4D4;padding:3px;"> - <!-- <p style="font-size: 16px;"><strong>搴撳瓨璇︽儏</strong></p> --> - <lightning-layout> - <lightning-layout-item padding="around-small"> - <p style="font-size: 18px"> - <strong>搴撳瓨璇︽儏</strong> - </p> - </lightning-layout-item> - </lightning-layout> - </div> - <div style="padding:10px;"> - <template if:true={showTable}> - <c-lex-custom-lightning-datatable key-field="id" data={data} columns={columns} - default-sort-direction={defaultSortDirection} sorted-direction={sortDirection} - sorted-by={sortedBy} onsort={onHandleSort} hide-checkbox-column={hidecheckboxcolumn} - class="wrapped-header-datatable"> - </c-lex-custom-lightning-datatable> - </template> - <c-paginator onprevious={handlePrevious} onnext={handleNext} onpageschange={handlePageschange} - onfirst={handleFirst} onlast={handleLast} page-size-options={pageSizeOptions} - previous-button-disabled={previousButtonDisabled} next-button-disabled={nextButtonDisabled} - record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator> - </div> - </div> + <button + style="margin-left: 5px" + class="slds-button slds-button_neutral slds-button_stretch lexBorder" + label="搴撳瓨鐩樼偣" + onclick={inventoryCount} + > + 搴撳瓨鐩樼偣 + </button> + <button + class="slds-button slds-button_neutral slds-button_stretch lexButtoun" + label="杩囨湡搴撳瓨閿�瀛�" + style="margin-left: 60px" + onclick={handleExpired} + > + 杩囨湡搴撳瓨閿�瀛� + </button> + <button + class="slds-button slds-button_neutral slds-button_stretch lexButtoun" + label="鎷嗙洅" + style="margin-left: 60px" + onclick={removeBox} + > + 鎷嗙洅 + </button> + <button + class="slds-button slds-button_neutral slds-button_stretch lexButtoun" + label="鍙栨秷鎷嗙洅" + style="margin-left: 60px" + onclick={cancelremoveBox} + > + 鍙栨秷鎷嗙洅 + </button> </div> + </div> - + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + margin-top: 30px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + height: 115px; + " + > + <table style="margin-top: 10px"> + <colgroup> + <col width="160px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + <col width="10px" /> + <col width="90px" /> + <col width="100px" /> + <col width="85px" /> + <col width="100px" /> + <col width="10px" /> + <col width="70px" /> + <col width="100px" /> + </colgroup> + <tbody> + <tr> + <td style="width: 10px"></td> + <td style="width: 250px"> + <div + style="width: 90px; margin-left: 12px" + class="searchName" + > + 娑堣�楀搧鍚嶇О + </div> + </td> + <td style="width: 21%"> + <lightning-input + class="searchName" + type="text" + name="Name" + label="娑堣�楀搧鍚嶇О" + value={Name} + variant="label-hidden" + onchange={dataChange} + data-field="Name" + ></lightning-input> + </td> + <td style="width: 150px"> + <div + style="width: 90px; text-align: center" + class="searchName" + > + 绗�3鍒嗙被 + </div> + </td> + <td style="width: 21%"> + <lightning-combobox + class="inputFont" + style="margin-left: 5px" + name="CategoryThree" + label="绗�3鍒嗙被" + value={value} + placeholder="璇烽�夋嫨..." + options={category3Options} + variant="label-hidden" + data-field="CategoryThree" + onchange={dataChange} + ></lightning-combobox> + </td> + <td style="width: 150px"> + <div + style="width: 90px; text-align: center" + class="searchName" + > + 绗�4鍒嗙被 + </div> + </td> + <td style="width: 21%"> + <lightning-combobox + class="inputFont" + name="CategoryFour" + label="绗�4鍒嗙被" + value={value} + placeholder="璇烽�夋嫨..." + options={category4Options} + variant="label-hidden" + data-field="CategoryFour" + onchange={dataChange} + ></lightning-combobox> + </td> + <td style="width: 150px"> + <div + style="width: 90px; text-align: center" + class="searchName" + > + 绗�5鍒嗙被 + </div> + </td> + <td style="width: 21%"> + <lightning-combobox + class="inputFont" + name="CategoryFive" + label="绗�5鍒嗙被" + value={value} + placeholder="璇烽�夋嫨..." + options={category5Options} + variant="label-hidden" + data-field="CategoryFive" + onchange={dataChange} + ></lightning-combobox> + </td> + <td style="width: 1%"></td> + </tr> + </tbody> + </table> + <br /> + <div style="float: right; margin-right: 10px"> + <button + class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" + label="娑堣�楀搧鎼滅储" + onclick={searchOrderDetail} + > + 娑堣�楀搧鎼滅储 + </button> + <button + style="margin-left: 10px" + class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" + label="娓呯┖" + onclick={clearAll} + > + 娓呯┖ + </button> + </div> + </div> + </div> + <div + style=" + border: 1px solid #d4d4d4; + border-radius: 5px; + margin-bottom: 7px; + " + > + <div + style=" + border-top: 3px solid #51606e; + border-bottom: 1px solid #d4d4d4; + padding: 3px; + " + > + <!-- <p style="font-size: 16px;"><strong>搴撳瓨璇︽儏</strong></p> --> + <lightning-layout> + <lightning-layout-item padding="around-small"> + <p style="font-size: 18px"> + <strong>搴撳瓨璇︽儏</strong> + </p> + </lightning-layout-item> + </lightning-layout> + </div> + <div style="padding: 10px"> + <template if:true={showTable}> + <c-lex-custom-lightning-datatable + key-field="id" + data={data} + columns={columns} + default-sort-direction={defaultSortDirection} + sorted-direction={sortDirection} + sorted-by={sortedBy} + onsort={onHandleSort} + hide-checkbox-column={hidecheckboxcolumn} + class="wrapped-header-datatable" + > + </c-lex-custom-lightning-datatable> + </template> + <c-paginator + onprevious={handlePrevious} + onnext={handleNext} + onpageschange={handlePageschange} + onfirst={handleFirst} + onlast={handleLast} + page-size-options={pageSizeOptions} + previous-button-disabled={previousButtonDisabled} + next-button-disabled={nextButtonDisabled} + record-start={recordStart} + record-end={recordEnd} + total-records={totalRecords} + ></c-paginator> + </div> + </div> </div> -</template> \ No newline at end of file + </div> +</template> diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js index 7b2a2c7..3b4fb28 100644 --- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js +++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js @@ -1,656 +1,688 @@ -import { LightningElement, wire, api, track } from 'lwc'; +import { LightningElement, wire, api, track } from "lwc"; import oninit from "@salesforce/apex/LexInventoryViewController.init"; import { ShowToastEvent } from "lightning/platformShowToastEvent"; import searchOrder from "@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails"; import categoryAllload from "@salesforce/apex/LexInventoryViewController.categoryAllload"; import { NavigationMixin } from "lightning/navigation"; -//table css +//table css import { loadStyle } from "lightning/platformResourceLoader"; import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; +export default class LexinventoryViewLWC extends NavigationMixin( + LightningElement +) { + //鍒嗛〉start + @track sortBy = ""; + //@track sortDirection = "asc"; + @track pageSize = 10; + error; + records; + currentPageToken = 0; + nextPageToken = this.pageSize; + @track totalRecords = 0; + @track loader = false; + @track pageNumber = 1; + @track paginationVisibility = false; + @track totalPages = 1; + pageSizeOptions = [10, 25, 50, 100]; + @track recordStart = 0; + @track recordEnd = 0; + //end -export default class LexinventoryViewLWC extends NavigationMixin(LightningElement) { - //鍒嗛〉start - @track sortBy = ""; - //@track sortDirection = "asc"; - @track pageSize = 10; - error; - records; - currentPageToken = 0; - nextPageToken = this.pageSize; - @track totalRecords = 0; - @track loader = false; - @track pageNumber = 1; - @track paginationVisibility = false; - @track totalPages = 1; - pageSizeOptions = [10,25,50,100]; - @track recordStart = 0; - @track recordEnd = 0; - //end + @track data = []; + @track message = ""; + @track Name; + @track CategoryThree; - @track data = []; - @track message = ""; - @track Name; - @track CategoryThree; + @track category3Options = []; + @track CategoryFour; + @track category4Options = []; + @track CategoryFive; + @track category5Options = []; + @track orderDetZaikuList = []; + @track accountName; + @track agencyProType; + @track userWorkLocation; + @track value = ""; + @track showTable = false; + @track hidecheckboxcolumn = true; + @track check = false; + //鍔犺浇 + @track showSpinner = false; + @track showSpinners = false; + //鍖婚櫌鐗逛环 + @track hasHos = false; + //琛ㄥご鏍峰紡 + stylesLoaded = false; - @track category3Options = []; - @track CategoryFour; - @track category4Options = []; - @track CategoryFive; - @track category5Options = []; - @track orderDetZaikuList = []; - @track accountName; - @track agencyProType; - @track userWorkLocation; - @track value = ""; - @track showTable = false; - @track hidecheckboxcolumn = true; - @track check = false; - //鍔犺浇 - @track showSpinner = false; - @track showSpinners = false; - //鍖婚櫌鐗逛环 - @track hasHos = false; - //琛ㄥご鏍峰紡 - stylesLoaded = false; + @track columns = [ + { + label: "娑堣�楀搧鍚嶇О", + fieldName: "Name__c", + type: "Name", + sortable: true, + hideDefaultActions: true, + initialWidth: 300, + wrapText: true, + cellAttributes: { alignment: "left" } + }, + { + label: "绗笁鍒嗙被", + fieldName: "Category3__c", + initialWidth: 90, + cellAttributes: { alignment: "left" }, + hideDefaultActions: true, + sortable: true, + wrapText: true + }, + { + label: "绗洓鍒嗙被", + fieldName: "Category4__c", + cellAttributes: { alignment: "left" }, + initialWidth: 90, + hideDefaultActions: true, + wrapText: true, + sortable: true + }, + { + label: "绗簲鍒嗙被", + fieldName: "Category5__c", + cellAttributes: { alignment: "left" }, + initialWidth: 90, + hideDefaultActions: true, + wrapText: true, + sortable: true + }, + { + label: "瑙勬牸", + fieldName: "packing_list", + cellAttributes: { alignment: "right" }, + initialWidth: 55, + wrapText: true, + hideDefaultActions: true + }, + { + label: "鍗曚綅", + fieldName: "BoxPiece", + cellAttributes: { alignment: "left" }, + initialWidth: 55, + wrapText: true, + hideDefaultActions: true + }, + { + label: "娉ㄥ唽璇佺紪鐮佸彿", + fieldName: "approbation_No", + cellAttributes: { alignment: "left" }, + wrapText: true, + initialWidth: 155, + hideDefaultActions: true + }, + { + label: "娉ㄥ唽鏈夋晥鏈�", + fieldName: "expiration_Date", + cellAttributes: { alignment: "left" }, + wrapText: true, + hideDefaultActions: true, + initialWidth: 100 + }, + { + label: "CFDA鐘舵��", + fieldName: "SFDA_Status__c", + cellAttributes: { alignment: "left" }, + initialWidth: 95, + wrapText: true, + hideDefaultActions: true + }, + { + label: "浣跨敤鏈熼檺", + fieldName: "guaranteeperiod", + cellAttributes: { alignment: "left" }, + hideDefaultActions: true, + initialWidth: 105 + }, + { + label: "鏈夋晥鏈熷唴搴撳瓨", + type: "customInventoryColor", + // sortable: true, + cellAttributes: { alignment: "right" }, + typeAttributes: { + value: { fieldName: "limitCount" }, + upperlimit: { fieldName: "upperlimit" }, + lowerlimit: { fieldName: "lowerlimit" }, + boxPrice: { fieldName: "BoxPiece" } + }, + hideDefaultActions: true, + initialWidth: 150 + }, - @track columns = [ - { - label: "娑堣�楀搧鍚嶇О", - fieldName: "Name__c", - type: "Name", - sortable: true, - hideDefaultActions: true, - // initialWidth: 300, - wrapText: true, - cellAttributes: { alignment: "left" } - }, - { - label: "绗笁鍒嗙被", - fieldName: "Category3__c", - initialWidth: 90, - cellAttributes: { alignment: "left" }, - hideDefaultActions: true, - sortable: true, - wrapText: true, - }, - { - label: "绗洓鍒嗙被", - fieldName: "Category4__c", - cellAttributes: { alignment: "left" }, - initialWidth: 90, - hideDefaultActions: true, - wrapText: true, - sortable: true, - - }, - { - label: "绗簲鍒嗙被", - fieldName: "Category5__c", - cellAttributes: { alignment: "left" }, - initialWidth: 90, - hideDefaultActions: true, - wrapText: true, - sortable: true, - - }, - - { - label: "瑙勬牸", - fieldName: "packing_list", - cellAttributes: { alignment: "right" }, - initialWidth: 55, - wrapText: true, - hideDefaultActions: true, - }, - { - label: "鍗曚綅", - fieldName: "BoxPiece", - cellAttributes: { alignment: "left" }, - initialWidth: 55, - wrapText: true, - hideDefaultActions: true, - }, - { - label: "娉ㄥ唽璇佺紪鐮佸彿", - fieldName: "approbation_No", - cellAttributes: { alignment: "left" }, - wrapText: true, - initialWidth: 155, - hideDefaultActions: true, - }, - { - label: "娉ㄥ唽鏈夋晥鏈�", - fieldName: "expiration_Date", - cellAttributes: { alignment: "left" }, - wrapText: true, - hideDefaultActions: true, - initialWidth: 100 - }, - { - label: "CFDA鐘舵��", - fieldName: "SFDA_Status__c", - cellAttributes: { alignment: "left" }, - initialWidth: 95, - wrapText: true, - hideDefaultActions: true, - }, - { - label: "浣跨敤鏈熼檺", - fieldName: "guaranteeperiod", - cellAttributes: { alignment: "left" }, - hideDefaultActions: true, - initialWidth: 105 - }, - { - label:'鏈夋晥鏈熷唴搴撳瓨', - type: "customInventoryColor", - // sortable: true, - cellAttributes: {alignment: "right" }, - typeAttributes: { - value: { fieldName:"limitCount"}, - upperlimit: { fieldName: "upperlimit" }, - lowerlimit: { fieldName: "lowerlimit" }, - boxPrice:{ fieldName: "BoxPiece" }, - }, - hideDefaultActions: true, - initialWidth:150 - }, - - { - label: "杩囨湡搴撳瓨", - fieldName: "overlimitCount", - hideDefaultActions: true, - cellAttributes: { alignment: "right" }, - initialWidth:80 - } - ]; - defaultSortDirection = "asc"; - sortDirection = "asc"; - sortedBy; - - - - renderedCallback() { - if (!this.stylesLoaded) { - Promise.all([loadStyle(this, WrappedHeaderTable)]) - .then(() => { - console.log("Custom styles loaded"); - this.stylesLoaded = true; - }) - .catch((error) => { - console.error("Error loading custom styles"); - }); - } + { + label: "杩囨湡搴撳瓨", + fieldName: "overlimitCount", + hideDefaultActions: true, + cellAttributes: { alignment: "right" }, + initialWidth: 80 } + ]; + defaultSortDirection = "asc"; + sortDirection = "asc"; + sortedBy; - - connectedCallback() { - this.loader = true; - this.init(); - } - - init() { - this.showSpinner = true; - oninit({ - pageSizeLWC: this.pageSize, - pageTokenLWC: this.currentPageToken, - sortFieldLWC: this.sortBy, - sortOrderLWC: this.sortDirection - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log("result.pageRecords = " + JSON.stringify(result.entity.pageRecords)); - console.log("result.consumableorderdetailsRecords = " + JSON.stringify(result.entity.consumableorderdetailsRecords)); - console.log("result.status = " + result.status); - console.log("result = " + JSON.stringify(result)); - console.log("result 1= " + JSON.stringify(result.entity)); - console.log("result 2= " + JSON.stringify(result.entity.pageRecords)); - console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.categoryOptionMap)); - console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category4OptionMap)); - console.log("result.entity.categoryOptionMap 2= " + JSON.stringify(result.entity.category5OptionMap)); - if (result.status == "Success") { - console.log('result.entity.paginatedAccounts = ' + JSON.stringify(result.entity.paginatedAccounts)); - this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; - this.totalRecords = result.entity.paginatedAccounts.totalRecords; - this.recordStart = result.entity.paginatedAccounts.recordStart; - this.recordEnd = result.entity.paginatedAccounts.recordEnd; - this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize); - console.log('this.totalPages = ' + this.totalPages); - this.paginationVisibility = this.totalPages > 1 ? true : false; - - this.loader = false; - this.data = result.entity.pageRecords; - - for (var i in this.data) { - this.data[i]["Name__c"] = this.data[i].Prod.Name__c; - this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; - this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; - } - this.showTable = true; - this.orderDetZaikuList = result.entity.orderDetZaikuList; - this.accountName = result.entity.accountName; - this.agencyProType = result.entity.agencyProType; - this.userWorkLocation = result.entity.userWorkLocation; - let option1ValueTemp = []; - for (var key in result.entity.categoryOptionMap) { - let object = {}; - object['label'] = result.entity.categoryOptionMap[key]; - object['value'] = key; - option1ValueTemp.push(object); - } - this.category3Options = option1ValueTemp; - console.log(' this.optionscatone===>' + JSON.stringify(this.optionscatone)); - let option2ValueTemp = []; - for (var key in result.entity.category4OptionMap) { - let object = {}; - object["label"] = result.entity.category4OptionMap[key]; - object["value"] = key; - option2ValueTemp.push(object); - } - this.category4Options = option2ValueTemp; - let option3ValueTemp = []; - for (var key in result.entity.category5OptionMap) { - let object = {}; - object["label"] = result.entity.category5OptionMap[key]; - object["value"] = key; - option3ValueTemp.push(object); - } - this.category5Options = option3ValueTemp; - this.hasHos = result.entity.hasHos; - console.log('this.hasHos'+this.hasHos); - //棰滆壊鏍囪 - - //hasHos = true 鍖婚櫌鐗逛环 - if (this.hasHos) { - let object1 = { - label: "鍖婚櫌鐗逛环", - fieldName: "hospitalSpecialOffer__c", - hideDefaultActions: true, - type:'boolean', - cellAttributes: { alignment: "left" }, - initialWidth:80 - - }; - this.columns.push(object1); - console.log(' this.columns'+ this.columns); - for (var j in this.data) { - this.data[j]["Name__c"] = this.data[j].Prod.Name__c; - this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c; - this.data[j]["Category4__c"] = this.data[j].Prod.Category3__c; - this.data[j]["Category5__c"] = this.data[j].Prod.Category3__c; - this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c; - this.data[j]["hospitalSpecialOffer__c"] = this.data[j].hospitalSpecialOffer; - console.log('this.data[j].hospitalSpecialOffer__c'+this.data[j].hospitalSpecialOffer); - } - } - this.showSpinner = false; - } else { - // this.showToast("Error",'Error', result.msg); - this.showMyToast('鍒濆鍖栧け璐�',result.msg,'error'); - } - }).catch((error) => { - this.loader = false; - this.showSpinner = false; - console.log("error = " + JSON.stringify(error)); - }); - } - - handleChange(event) { - let fieldName = event.target.getAttribute("data-field"); - let value = event.detail.value; - console.log("======>fieldName" + fieldName); - console.log("======>value" + value); - switch (fieldName) { - case "Name": - this.Name = value; - break; - case "CategoryThree": - this.CategoryThree = value; - break; - case "CategoryFour": - this.CategoryFour = value; - break; - case "CategoryFive": - this.CategoryFive = value; - break; - default: - console.log("no data"); - } - } - dataChange(event) { - let fieldName = event.target.getAttribute("data-field"); - let value = event.detail.value; - console.log("fieldName = " + fieldName + " value = " + value); - switch (fieldName) { - case "Name": - this.Name = value; - break; - case "CategoryThree": - this.CategoryThree = value; - //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫� - this.showAllCate(); - if (this.CategoryThree == '') { - this.CategoryFour = ''; - this.CategoryFive = ''; - } - break; - case "CategoryFour": - this.Category4 = value; - //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被 - this.showCate(); - if (this.CategoryFour == '') { - this.CategoryFive = ''; - } - break; - case "CategoryFive": - this.CategoryFive = value; - break; - } - } - - - showAllCate() { - categoryAllload({ - category3LWC: this.CategoryThree, - agencyProTypeLWC:this.agencyProType - }).then((result) => { - result = JSON.parse(JSON.stringify(result)); - console.log("result = " + JSON.stringify(result)); - if (result.status == "Success") { - this.category4Options = []; - this.category5Options = []; - //绗�4鍒嗙被 - for (var key in result.entity.category4OptionMap) { - let object = {}; - object["label"] = result.entity.category4OptionMap[key]; - object["value"] = key; - this.category4Options.push(object); - } - console.log("this.category4Options = " + JSON.stringify(this.category4Options)); - //绗�5鍒嗙被 - for (var key in result.entity.category5OptionMap) { - let object = {}; - object["label"] = result.entity.category5OptionMap[key]; - object["value"] = key; - this.category5Options.push(object); - } - } else { - console.log("result = " + JSON.stringify(result)); - this.showMyToast(result.msg,'','error'); - } - }).catch((error) => { - console.log("error" + JSON.stringify(error)); + renderedCallback() { + if (!this.stylesLoaded) { + Promise.all([loadStyle(this, WrappedHeaderTable)]) + .then(() => { + console.log("Custom styles loaded"); + this.stylesLoaded = true; + }) + .catch((error) => { + console.error("Error loading custom styles"); }); } + } - searchOrderDetail() { - this.showTable = false; - searchOrder({ - category1: this.Name, - Category3: this.CategoryThree, - Category4: this.CategoryFour, - Category5: this.CategoryFive, - orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList), - accountName: this.accountName, - agencyProType: this.agencyProType, - userWorkLocation: this.userWorkLocation, - pageSizeLWC: this.pageSize, - pageTokenLWC: this.currentPageToken, - // sortFieldLWC: this.sortBy, - // sortOrderLWC: this.sortDirection - }) - .then((result) => { - result = JSON.parse(JSON.stringify(result)); - if (result.status == "Success") { - this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; - this.totalRecords = result.entity.paginatedAccounts.totalRecords; - this.recordStart = result.entity.paginatedAccounts.recordStart; - this.recordEnd = result.entity.paginatedAccounts.recordEnd; - this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize); - console.log('this.totalPages = ' + this.totalPages); - this.paginationVisibility = this.totalPages > 1 ? true : false; - console.log('this.sortDirection = ' + this.sortDirection); - // this.showToast("Success",'鎼滅储鎴愬姛', result.msg); - this.showMyToast('鎼滅储鎴愬姛',result.msg,'success'); - this.data = result.entity.pageRecords; - console.log('鎼滅储Data==>'+JSON.stringify(this.data)); - for (var i in this.data) { - this.data[i]["Name__c"] = this.data[i].Prod.Name__c; - this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; - this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; - this.data[i]["hospitalSpecialOffer__c"] = this.data[i].hospitalSpecialOffer; - } - this.data = [...this.data]; - console.log('this.data = ' + JSON.stringify(this.data)); - this.showTable = true; - } else { - // this.showToast("Error",'Error', result.msg); - this.showMyToast('鎼滅储澶辫触',result.msg,'error'); - } - }) - .catch((error) => { - console.log("error = " + JSON.stringify(error)); - }); - } - inventoryCount() { - this[NavigationMixin.Navigate]({ - type: 'standard__webPage', - attributes: { - url: '/lexinventory' - } - }); - } + connectedCallback() { + this.loader = true; + this.init(); + } - handleExpired() { - console.log('杩囨湡搴撳瓨鍛㈤攢瀛�'); - this[NavigationMixin.Navigate]({ - type: 'standard__webPage', - attributes: { - url: '/lexoverduestock' - } - }); + init() { + this.showSpinner = true; + oninit({ + pageSizeLWC: this.pageSize, + pageTokenLWC: this.currentPageToken, + sortFieldLWC: this.sortBy, + sortOrderLWC: this.sortDirection + }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log( + "result.pageRecords = " + JSON.stringify(result.entity.pageRecords) + ); + console.log( + "result.consumableorderdetailsRecords = " + + JSON.stringify(result.entity.consumableorderdetailsRecords) + ); + console.log("result.status = " + result.status); + console.log("result = " + JSON.stringify(result)); + console.log("result 1= " + JSON.stringify(result.entity)); + console.log("result 2= " + JSON.stringify(result.entity.pageRecords)); + console.log( + "result.entity.categoryOptionMap 2= " + + JSON.stringify(result.entity.categoryOptionMap) + ); + console.log( + "result.entity.categoryOptionMap 2= " + + JSON.stringify(result.entity.category4OptionMap) + ); + console.log( + "result.entity.categoryOptionMap 2= " + + JSON.stringify(result.entity.category5OptionMap) + ); + if (result.status == "Success") { + console.log( + "result.entity.paginatedAccounts = " + + JSON.stringify(result.entity.paginatedAccounts) + ); + this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; + this.totalRecords = result.entity.paginatedAccounts.totalRecords; + this.recordStart = result.entity.paginatedAccounts.recordStart; + this.recordEnd = result.entity.paginatedAccounts.recordEnd; + this.totalPages = Math.ceil( + result.entity.paginatedAccounts.totalRecords / this.pageSize + ); + console.log("this.totalPages = " + this.totalPages); + this.paginationVisibility = this.totalPages > 1 ? true : false; - } - removeBox() { - this[NavigationMixin.Navigate]({ - type: 'standard__webPage', - attributes: { - url: '/lexremovebox' - } - }); + this.loader = false; + this.data = result.entity.pageRecords; - } - cancelremoveBox() { - this[NavigationMixin.Navigate]({ - type: 'standard__webPage', - attributes: { - url: '/lexcancelremovebox' - } - }); + for (var i in this.data) { + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; + this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; + } + this.showTable = true; + this.orderDetZaikuList = result.entity.orderDetZaikuList; + this.accountName = result.entity.accountName; + this.agencyProType = result.entity.agencyProType; + this.userWorkLocation = result.entity.userWorkLocation; + let option1ValueTemp = []; + for (var key in result.entity.categoryOptionMap) { + let object = {}; + object["label"] = result.entity.categoryOptionMap[key]; + object["value"] = key; + option1ValueTemp.push(object); + } + this.category3Options = option1ValueTemp; + console.log( + " this.optionscatone===>" + JSON.stringify(this.optionscatone) + ); + let option2ValueTemp = []; + for (var key in result.entity.category4OptionMap) { + let object = {}; + object["label"] = result.entity.category4OptionMap[key]; + object["value"] = key; + option2ValueTemp.push(object); + } + this.category4Options = option2ValueTemp; + let option3ValueTemp = []; + for (var key in result.entity.category5OptionMap) { + let object = {}; + object["label"] = result.entity.category5OptionMap[key]; + object["value"] = key; + option3ValueTemp.push(object); + } + this.category5Options = option3ValueTemp; + this.hasHos = result.entity.hasHos; + console.log("this.hasHos" + this.hasHos); + //棰滆壊鏍囪 - } + //hasHos = true 鍖婚櫌鐗逛环 + if (this.hasHos) { + let object1 = { + label: "鍖婚櫌鐗逛环", + fieldName: "hospitalSpecialOffer__c", + hideDefaultActions: true, + type: "boolean", + cellAttributes: { alignment: "left" }, + initialWidth: 80 + }; + this.columns.push(object1); + console.log(" this.columns" + this.columns); + for (var j in this.data) { + this.data[j]["Name__c"] = this.data[j].Prod.Name__c; + this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c; + this.data[j]["Category4__c"] = this.data[j].Prod.Category3__c; + this.data[j]["Category5__c"] = this.data[j].Prod.Category3__c; + this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c; + this.data[j]["hospitalSpecialOffer__c"] = + this.data[j].hospitalSpecialOffer; + console.log( + "this.data[j].hospitalSpecialOffer__c" + + this.data[j].hospitalSpecialOffer + ); + } + } + this.showSpinner = false; + } else { + // this.showToast("Error",'Error', result.msg); + this.showMyToast("鍒濆鍖栧け璐�", result.msg, "error"); + } + }) + .catch((error) => { + this.loader = false; + this.showSpinner = false; + console.log("error = " + JSON.stringify(error)); + }); + } - clearAll() { - this.showSpinner = true; - this.showTable = false; - this.Name = ''; - this.CategoryThree = ''; - this.CategoryFour = ''; - this.CategoryFive = ''; - this.template.querySelectorAll("lightning-combobox").forEach((each) => { - each.value = null; - }); - console.log(' this.CategoryThree' + this.CategoryThree); - console.log('鏁版嵁鍒楄〃' + this.data); - searchOrder({ - category1: this.Name, - Category3: this.CategoryThree, - Category4: this.CategoryFour, - Category5: this.CategoryFive, - orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList), - accountName: this.accountName, - agencyProType: this.agencyProType, - userWorkLocation: this.userWorkLocation, - pageSizeLWC: this.pageSize, - pageTokenLWC: this.currentPageToken, - }) - .then((result) => { - console.log("result鎼滅储 = " + JSON.stringify(result)); - result = JSON.parse(JSON.stringify(result)); - if (result.status == "Success") { - - this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; - this.totalRecords = result.entity.paginatedAccounts.totalRecords; - this.recordStart = result.entity.paginatedAccounts.recordStart; - this.recordEnd = result.entity.paginatedAccounts.recordEnd; - this.totalPages = Math.ceil(result.entity.paginatedAccounts.totalRecords / this.pageSize); - console.log('this.totalPages = ' + this.totalPages); - this.paginationVisibility = this.totalPages > 1 ? true : false; - console.log('this.sortDirection = ' + this.sortDirection); - this.data = result.entity.pageRecords; - - for (var i in this.data) { - this.data[i]["Name__c"] = this.data[i].Prod.Name__c; - this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; - this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; - this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; - } - this.showSpinner = false; - this.showTable = true; - this.showMyToast('鎼滅储鎴愬姛',result.msg,'success'); - // this.showToast("Success",'鎼滅储鎴愬姛', result.msg); - this.showSpinner = false; - } else { - // this.showToast("Error", 'Error',result.msg); - this.showMyToast('鎼滅储澶辫触',result.msg,'error'); - } - }) - .catch((error) => { - console.log("error = " + JSON.stringify(error)); - }); - } - - sortByMethod(field, reverse, primer) { - const key = primer - ? function (x) { - return primer(x[field]); - } - : function (x) { - return x[field]; - }; - - return function (a, b) { - a = key(a); - b = key(b); - return reverse * ((a > b) - (b > a)); - }; + handleChange(event) { + let fieldName = event.target.getAttribute("data-field"); + let value = event.detail.value; + console.log("======>fieldName" + fieldName); + console.log("======>value" + value); + switch (fieldName) { + case "Name": + this.Name = value; + break; + case "CategoryThree": + this.CategoryThree = value; + break; + case "CategoryFour": + this.CategoryFour = value; + break; + case "CategoryFive": + this.CategoryFive = value; + break; + default: + console.log("no data"); } - - onHandleSort(event) { - console.log("Sort"); - this.sortBy = event.detail.fieldName; - this.sortDirection = event.detail.sortDirection; - this.currentPageToken = 0; - console.log('this.sortBy = ' + this.sortBy) - console.log('this.sortDirection = ' + this.sortDirection) - // if('limitCount' != this.sortBy) - // this.searchOrderDetail(); - // else{ - // const { fieldName: sortedBy, sortDirection } = event.detail; - // const cloneData = [...this.data]; - // cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)); - // this.data = cloneData; - // this.sortDirection = sortDirection; - // this.sortedBy = sortedBy; - // } - const { fieldName: sortedBy, sortDirection } = event.detail; - const cloneData = [...this.data]; - cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)); - this.data = cloneData; - this.sortDirection = sortDirection; - this.sortedBy = sortedBy; - } - handlePaginatorChange(event) { - this.recordsToDisplay = event.detail.recordsToDisplay; - this.preSelected = event.detail.preSelected; - if (this.recordsToDisplay && this.recordsToDisplay > 0) { - this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1; - } else { - this.rowNumberOffset = 0; - } - } - - handlePrevious() { - this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize); - this.searchOrderDetail(); - } - - handleNext() { - this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize); - this.searchOrderDetail(); - } - handleFirst() { - this.currentPageToken = 0; - this.searchOrderDetail(); - } - - handleLast() { - this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0; - this.searchOrderDetail(); - } - - handlePageschange(event) { - console.log(event.detail); - this.pageSize = event.detail; - this.currentPageToken = 0; - this.searchOrderDetail(); - } - get previousButtonDisabled() { - return this.currentPageToken === 0; - } - - get nextButtonDisabled() { - return this.nextPageToken === undefined; - } - showMyToast(title, message, variant) { - console.log('show custom message'); - var iconName = ''; - var content = ''; - if(variant == 'success'){ - iconName = 'utility:check'; - }else{ - iconName = 'utility:error'; + } + dataChange(event) { + let fieldName = event.target.getAttribute("data-field"); + let value = event.detail.value; + console.log("fieldName = " + fieldName + " value = " + value); + switch (fieldName) { + case "Name": + this.Name = value; + break; + case "CategoryThree": + this.CategoryThree = value; + //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫� + this.showAllCate(); + if (this.CategoryThree == "") { + this.CategoryFour = ""; + this.CategoryFive = ""; } - if(message != ''){ - content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>'; - }else{ - content = '<h2><strong>'+title+'<strong/></h2>'; + break; + case "CategoryFour": + this.Category4 = value; + //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被 + this.showCate(); + if (this.CategoryFour == "") { + this.CategoryFive = ""; } - this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000); + break; + case "CategoryFive": + this.CategoryFive = value; + break; + } + } + showAllCate() { + categoryAllload({ + category3LWC: this.CategoryThree, + agencyProTypeLWC: this.agencyProType + }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + console.log("result = " + JSON.stringify(result)); + if (result.status == "Success") { + this.category4Options = []; + this.category5Options = []; + //绗�4鍒嗙被 + for (var key in result.entity.category4OptionMap) { + let object = {}; + object["label"] = result.entity.category4OptionMap[key]; + object["value"] = key; + this.category4Options.push(object); + } + console.log( + "this.category4Options = " + JSON.stringify(this.category4Options) + ); + //绗�5鍒嗙被 + for (var key in result.entity.category5OptionMap) { + let object = {}; + object["label"] = result.entity.category5OptionMap[key]; + object["value"] = key; + this.category5Options.push(object); + } + } else { + console.log("result = " + JSON.stringify(result)); + this.showMyToast(result.msg, "", "error"); + } + }) + .catch((error) => { + console.log("error" + JSON.stringify(error)); + }); + } - // showToast(type,title,msg) { - // this.showSpinner = false; - // let mode = ''; - // if (type.toLowerCase() != 'success') { - // mode = 'sticky'; - // } else { - // mode = 'dismissable'; - // } - // const event = new ShowToastEvent({ - // title: title, - // variant: type, - // message: msg, - // mode: mode - // }); - // this.dispatchEvent(event); - // } - } -} \ No newline at end of file + searchOrderDetail() { + this.showTable = false; + searchOrder({ + category1: this.Name, + Category3: this.CategoryThree, + Category4: this.CategoryFour, + Category5: this.CategoryFive, + orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList), + accountName: this.accountName, + agencyProType: this.agencyProType, + userWorkLocation: this.userWorkLocation, + pageSizeLWC: this.pageSize, + pageTokenLWC: this.currentPageToken + // sortFieldLWC: this.sortBy, + // sortOrderLWC: this.sortDirection + }) + .then((result) => { + result = JSON.parse(JSON.stringify(result)); + if (result.status == "Success") { + this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; + this.totalRecords = result.entity.paginatedAccounts.totalRecords; + this.recordStart = result.entity.paginatedAccounts.recordStart; + this.recordEnd = result.entity.paginatedAccounts.recordEnd; + this.totalPages = Math.ceil( + result.entity.paginatedAccounts.totalRecords / this.pageSize + ); + console.log("this.totalPages = " + this.totalPages); + this.paginationVisibility = this.totalPages > 1 ? true : false; + console.log("this.sortDirection = " + this.sortDirection); + // this.showToast("Success",'鎼滅储鎴愬姛', result.msg); + this.showMyToast("鎼滅储鎴愬姛", result.msg, "success"); + this.data = result.entity.pageRecords; + console.log("鎼滅储Data==>" + JSON.stringify(this.data)); + for (var i in this.data) { + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; + this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; + this.data[i]["hospitalSpecialOffer__c"] = + this.data[i].hospitalSpecialOffer; + } + this.data = [...this.data]; + console.log("this.data = " + JSON.stringify(this.data)); + this.showTable = true; + } else { + // this.showToast("Error",'Error', result.msg); + this.showMyToast("鎼滅储澶辫触", result.msg, "error"); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); + } + inventoryCount() { + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexinventory" + } + }); + } + + handleExpired() { + console.log("杩囨湡搴撳瓨鍛㈤攢瀛�"); + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexoverduestock" + } + }); + } + removeBox() { + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexremovebox" + } + }); + } + cancelremoveBox() { + this[NavigationMixin.Navigate]({ + type: "standard__webPage", + attributes: { + url: "/lexcancelremovebox" + } + }); + } + + clearAll() { + this.showSpinner = true; + this.showTable = false; + this.Name = ""; + this.CategoryThree = ""; + this.CategoryFour = ""; + this.CategoryFive = ""; + this.template.querySelectorAll("lightning-combobox").forEach((each) => { + each.value = null; + }); + console.log(" this.CategoryThree" + this.CategoryThree); + console.log("鏁版嵁鍒楄〃" + this.data); + searchOrder({ + category1: this.Name, + Category3: this.CategoryThree, + Category4: this.CategoryFour, + Category5: this.CategoryFive, + orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList), + accountName: this.accountName, + agencyProType: this.agencyProType, + userWorkLocation: this.userWorkLocation, + pageSizeLWC: this.pageSize, + pageTokenLWC: this.currentPageToken + }) + .then((result) => { + console.log("result鎼滅储 = " + JSON.stringify(result)); + result = JSON.parse(JSON.stringify(result)); + if (result.status == "Success") { + this.nextPageToken = result.entity.paginatedAccounts.nextPageToken; + this.totalRecords = result.entity.paginatedAccounts.totalRecords; + this.recordStart = result.entity.paginatedAccounts.recordStart; + this.recordEnd = result.entity.paginatedAccounts.recordEnd; + this.totalPages = Math.ceil( + result.entity.paginatedAccounts.totalRecords / this.pageSize + ); + console.log("this.totalPages = " + this.totalPages); + this.paginationVisibility = this.totalPages > 1 ? true : false; + console.log("this.sortDirection = " + this.sortDirection); + this.data = result.entity.pageRecords; + + for (var i in this.data) { + this.data[i]["Name__c"] = this.data[i].Prod.Name__c; + this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category4__c"] = this.data[i].Prod.Category3__c; + this.data[i]["Category5__c"] = this.data[i].Prod.Category3__c; + this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c; + } + this.showSpinner = false; + this.showTable = true; + this.showMyToast("鎼滅储鎴愬姛", result.msg, "success"); + // this.showToast("Success",'鎼滅储鎴愬姛', result.msg); + this.showSpinner = false; + } else { + // this.showToast("Error", 'Error',result.msg); + this.showMyToast("鎼滅储澶辫触", result.msg, "error"); + } + }) + .catch((error) => { + console.log("error = " + JSON.stringify(error)); + }); + } + + sortByMethod(field, reverse, primer) { + const key = primer + ? function (x) { + return primer(x[field]); + } + : function (x) { + return x[field]; + }; + + return function (a, b) { + a = key(a); + b = key(b); + return reverse * ((a > b) - (b > a)); + }; + } + + onHandleSort(event) { + console.log("Sort"); + this.sortBy = event.detail.fieldName; + this.sortDirection = event.detail.sortDirection; + this.currentPageToken = 0; + console.log("this.sortBy = " + this.sortBy); + console.log("this.sortDirection = " + this.sortDirection); + // if('limitCount' != this.sortBy) + // this.searchOrderDetail(); + // else{ + // const { fieldName: sortedBy, sortDirection } = event.detail; + // const cloneData = [...this.data]; + // cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)); + // this.data = cloneData; + // this.sortDirection = sortDirection; + // this.sortedBy = sortedBy; + // } + const { fieldName: sortedBy, sortDirection } = event.detail; + const cloneData = [...this.data]; + cloneData.sort( + this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1) + ); + this.data = cloneData; + this.sortDirection = sortDirection; + this.sortedBy = sortedBy; + } + handlePaginatorChange(event) { + this.recordsToDisplay = event.detail.recordsToDisplay; + this.preSelected = event.detail.preSelected; + if (this.recordsToDisplay && this.recordsToDisplay > 0) { + this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1; + } else { + this.rowNumberOffset = 0; + } + } + + handlePrevious() { + this.currentPageToken = + Number(this.currentPageToken) - Number(this.pageSize); + this.searchOrderDetail(); + } + + handleNext() { + this.currentPageToken = + Number(this.currentPageToken) + Number(this.pageSize); + this.searchOrderDetail(); + } + handleFirst() { + this.currentPageToken = 0; + this.searchOrderDetail(); + } + + handleLast() { + this.currentPageToken = + this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0; + this.searchOrderDetail(); + } + + handlePageschange(event) { + console.log(event.detail); + this.pageSize = event.detail; + this.currentPageToken = 0; + this.searchOrderDetail(); + } + get previousButtonDisabled() { + return this.currentPageToken === 0; + } + + get nextButtonDisabled() { + return this.nextPageToken === undefined; + } + showMyToast(title, message, variant) { + console.log("show custom message"); + var iconName = ""; + var content = ""; + if (variant == "success") { + iconName = "utility:check"; + } else { + iconName = "utility:error"; + } + if (message != "") { + content = + "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>"; + } else { + content = "<h2><strong>" + title + "<strong/></h2>"; + } + this.template + .querySelector("c-common-toast") + .showToast(variant, content, iconName, 10000); + + // showToast(type,title,msg) { + // this.showSpinner = false; + // let mode = ''; + // if (type.toLowerCase() != 'success') { + // mode = 'sticky'; + // } else { + // mode = 'dismissable'; + // } + // const event = new ShowToastEvent({ + // title: title, + // variant: type, + // message: msg, + // mode: mode + // }); + // this.dispatchEvent(event); + // } + } +} -- Gitblit v1.9.1