buli
2023-05-22 71b93327e8f3fb3bffffc7c033c1f782e7b6ab32
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -6,21 +6,24 @@
import searchOrderInstatus from '@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus';
import searchConsumableorderdetails from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails';
import searchConsumableorFinish from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
const columns = [
    {
        label: '出库日',
        fieldName: 'Outbound_Date__c',
    {
        label: '出库日',
        fieldName: 'Outbound_Date__c',
        type: 'date',
        initialWidth : 100,
        hideDefaultActions: true ,
        initialWidth: 100,
        hideDefaultActions: true,
        sortable: true
    },
    {
        label: '出库单号',
        fieldName: 'url',
        type : 'url',
        initialWidth : 175,
    {
        label: '出库单号',
        fieldName: 'url',
        type: 'url',
        initialWidth: 175,
        typeAttributes: {
            label: {
                fieldName: 'Name'
@@ -28,75 +31,75 @@
            target: '_blank'
        },
        hideDefaultActions: true,
        sortable: true
    },
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true ,
        wrapText:true,
        sortable: true
    },
    {
        label: '科室',
        fieldName: 'Order_ForCustomerText__c',
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true,
        initialWidth : 120
        wrapText: true,
        sortable: true
    },
    {
        label: '出库单状态',
        fieldName: 'SummonsStatus_c__c',
        hideDefaultActions: true ,
        sortable: true,
        initialWidth : 100
    {
        label: '科室',
        fieldName: 'Order_ForCustomerText__c',
        hideDefaultActions: true,
        initialWidth: 120
    },
    {
        label: '开票状态',
        fieldName: 'Billed_Status__c',
    {
        label: '出库单状态',
        fieldName: 'SummonsStatus_c__c',
        hideDefaultActions: true,
        sortable: true,
        initialWidth : 100
        initialWidth: 100
    },
    {
        label: '未发票金额(元)',
        fieldName: 'InvoiceNotPro_money__c',
    {
        label: '开票状态',
        fieldName: 'Billed_Status__c',
        hideDefaultActions: true,
        type : "number",
        typeAttributes:{
            minimumFractionDigits:2,
        sortable: true,
        initialWidth: 100
    },
    {
        label: '未发票金额(元)',
        fieldName: 'InvoiceNotPro_money__c',
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
        initialWidth : 150
        initialWidth: 150
    },
    {
        label: '创建日期',
    {
        label: '创建日期',
        fieldName: 'CreatedDate',
        hideDefaultActions: true,
        sortable: true ,
        sortable: true,
        type: "date",
        typeAttributes:{
            timeZone : "Asia/Shanghai",
        typeAttributes: {
            timeZone: "Asia/Shanghai",
            day: "numeric",
            month: "numeric",
            year: "numeric",
            hour: "2-digit",
            minute: "2-digit"
        },
        initialWidth : 200
        initialWidth: 200
    }
];
const editColumns = [
    {
        label: '出库日',
        fieldName: 'Outbound_Date__c',
        type: 'date',
        hideDefaultActions: true ,
    {
        label: '出库日',
        fieldName: 'Outbound_Date__c',
        type: 'date',
        hideDefaultActions: true,
        sortable: true
    },
    {
        label: '出库单号',
        fieldName: 'url',
        type : 'url',
    {
        label: '出库单号',
        fieldName: 'url',
        type: 'url',
        typeAttributes: {
            label: {
                fieldName: 'Name'
@@ -104,44 +107,44 @@
            target: '_blank'
        },
        hideDefaultActions: true,
        sortable: true
    },
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true ,
        sortable: true
    },
    {
        label: '科室',
        fieldName: 'Order_ForCustomerText__c',
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true,
        sortable: true
    },
    {
        label: '科室',
        fieldName: 'Order_ForCustomerText__c',
        hideDefaultActions: true
    },
    {
        label: '出库单状态',
        fieldName: 'SummonsStatus_c__c',
        hideDefaultActions: true ,
        sortable: true,
        initialWidth : 100
    },
    {
        label: '开票状态',
        fieldName: 'Billed_Status__c',
    {
        label: '出库单状态',
        fieldName: 'SummonsStatus_c__c',
        hideDefaultActions: true,
        sortable: true,
        initialWidth : 100
        initialWidth: 100
    },
    {
        label: '未发票金额(元)',
        fieldName: 'InvoiceNotPro_money__c',
    {
        label: '开票状态',
        fieldName: 'Billed_Status__c',
        hideDefaultActions: true,
        initialWidth : 150
        sortable: true,
        initialWidth: 100
    },
    {
        label: '创建日期',
    {
        label: '未发票金额(元)',
        fieldName: 'InvoiceNotPro_money__c',
        hideDefaultActions: true,
        initialWidth: 150
    },
    {
        label: '创建日期',
        fieldName: 'CreatedDate',
        hideDefaultActions: true,
        sortable: true
        sortable: true
    },
    // { 
    //     label: '单位', 
@@ -152,13 +155,13 @@
    //     label: '出货数量', 
    //     hideDefaultActions: true,
    //     type:'customShipment',
    // },
    // { 
    //     label: '出货单价(元)', 
    //     hideDefaultActions: true,
    //     type:'customShipmentUnitPrice',
    // }
];
export default class LexSaleAndDelivery extends NavigationMixin(LightningElement) {
@@ -176,6 +179,7 @@
    @track userWorkLocation = '';
    @track showTable = false;
    @track hidecheckboxcolumn = true;
    stylesLoaded = false;
    //排序
    defaultSortDirection = 'asc';
@@ -192,12 +196,13 @@
                this.agencyProType = r.entity.agencyProType;
                this.userWorkLocation = r.entity.userWorkLocation;
                this.data = r.entity.raesList;
                for(var i in this.data){
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid='+this.data[i].Id;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                console.log('this.data = ' + JSON.stringify(this.data));
                this.isShowSpinner = false;
                this.showTable = true;
            } else {
                console.log('r = ' + JSON.stringify(r))
                this.showToast('Error', r.msg);
@@ -207,8 +212,22 @@
        })
    }
    renderedCallback() {
        debugger
        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");
                });
        }
    }
    //新建出库单
    neworderhead(){
    neworderhead() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
@@ -235,16 +254,17 @@
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for(var i in this.data){
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid='+this.data[i].Id;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if(this.message == '没有搜索到相关出库单。'){
                if (this.message == '没有搜索到相关出库单。') {
                    this.showToast('Error', this.message);
                }else{
                } else {
                    this.showToast('Success', this.message);
                }
                this.isShowSpinner = false;
                //this.isCssLoaded = true
                this.showTable = true;
            } else {
                this.showToast('Error', r.msg);
@@ -255,7 +275,7 @@
    }
    //还没出库的出库单
    searchConsumableorderdetailsJs(){
    searchConsumableorderdetailsJs() {
        this.isShowSpinner = true;
        this.showTable = false;
        console.log('searchConsumableorderdetailsJs');
@@ -274,13 +294,13 @@
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for(var i in this.data){
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid='+this.data[i].Id;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if(this.message == '没有搜索到相关出库单。'){
                if (this.message == '没有搜索到相关出库单。') {
                    this.showToast('Error', this.message);
                }else{
                } else {
                    this.showToast('Success', this.message);
                }
                this.isShowSpinner = false;
@@ -294,7 +314,7 @@
    }
    //已出库已开票的出库单
    searchConsumableorFinishJs(){
    searchConsumableorFinishJs() {
        this.isShowSpinner = true;
        this.showTable = false;
        console.log('searchConsumableorFinishJs');
@@ -311,13 +331,13 @@
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for(var i in this.data){
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid='+this.data[i].Id;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if(this.message == '没有搜索到相关出库单。'){
                if (this.message == '没有搜索到相关出库单。') {
                    this.showToast('Error', this.message);
                }else{
                } else {
                    this.showToast('Success', this.message);
                }
                this.isShowSpinner = false;
@@ -347,13 +367,13 @@
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for(var i in this.data){
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid='+this.data[i].Id;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if(this.message == '没有搜索到相关出库单。'){
                if (this.message == '没有搜索到相关出库单。') {
                    this.showToast('Error', this.message);
                }else{
                } else {
                    this.showToast('Success', this.message);
                }
                this.isShowSpinner = false;
@@ -367,15 +387,15 @@
    }
    //Capture the event fired from the paginator component
    handlePaginatorChange(event){
    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{
        if (this.recordsToDisplay && this.recordsToDisplay > 0) {
            this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
        } else {
            this.rowNumberOffset = 0;
        }
    }
        }
    }
    //排序
    onHandleSort(event) {
@@ -390,11 +410,11 @@
    sortBy(field, reverse, primer) {
        const key = primer
            ? function (x) {
                  return primer(x[field]);
              }
                return primer(x[field]);
            }
            : function (x) {
                  return x[field];
              };
                return x[field];
            };
        return function (a, b) {
            a = key(a);
@@ -426,7 +446,7 @@
    }
    editProductLimit(){
    editProductLimit() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
@@ -446,7 +466,7 @@
    }
    @track isModalOpen = false;
    openModal(){
    openModal() {
        this.isModalOpen = true;
    }
}