.sf/config.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexRemoveBox/lexRemoveBox.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
.sf/config.json
@@ -1,3 +1,3 @@ { "target-org": "DaikinDev" "target-org": "OlympusDev" } 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> <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> 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); } } this.template .querySelector("c-common-toast") .showToast(variant, content, iconName, 10000); } } 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> </div> </template> 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); } } this.template .querySelector("c-common-toast") .showToast(variant, content, iconName, 10000); } } force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.css
@@ -1 +1,16 @@ @import 'c/lexCssUtility'; @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; } 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> </div> </template> 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); // } } } 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); // } } }