diff --git a/src/models/Staff.ts b/src/models/Staff.ts index af7dbf5..7c276a6 100644 --- a/src/models/Staff.ts +++ b/src/models/Staff.ts @@ -34,12 +34,12 @@ type Nullable = T | undefined | null; export class InvoiceSearchOption{ invoiceNo: Nullable invoiceCode: Nullable - invoiceUploadTimeStart: Nullable - invoiceUploadTimeEnd:Nullable + invoiceUploadTimeStart: Nullable + invoiceUploadTimeEnd:Nullable invoiceState:Nullable invoiceKind:Nullable - invoiceDateStart:Nullable - invoiceDateEnd:Nullable + invoiceDateStart:Nullable + invoiceDateEnd:Nullable invoiceNote:Nullable invoiceUploader:Nullable pageNum:number @@ -75,16 +75,16 @@ export class InvoiceSearchOption{ toString(){ let res="pageNum="+this.pageNum+"&pageSize="+this.pageSize - res+=(this.invoiceNo===null||this.invoiceNo===""?"":("&invoiceNo="+this.invoiceNo)); - res+=(this.invoiceCode===null||this.invoiceCode===""?"":("&invoiceCode="+this.invoiceCode)); - res+=(this.invoiceUploadTimeStart===null?"":("&invoiceUploadTimeStart="+this.invoiceUploadTimeStart?.toDateString())); - res+=(this.invoiceUploadTimeEnd===null?"":("&invoiceUploadTimeEnd="+this.invoiceUploadTimeEnd?.toDateString())); - res+=(this.invoiceState===null?"":("&invoiceState="+this.invoiceState)); - res+=(this.invoiceKind===null?"":("&invoiceKind="+this.invoiceKind)); - res+=(this.invoiceDateStart===null?"":("&invoiceDateStart="+this.invoiceDateStart?.toDateString())); - res+=(this.invoiceDateEnd===null?"":("&invoiceDateEnd="+this.invoiceDateEnd?.toDateString())); - res+=(this.invoiceNote===null?"":("&invoiceNote="+this.invoiceNote)); - res+=(this.invoiceUploader===null?"":("&invoiceUploader="+this.invoiceUploader)); + res+=(this.invoiceNo===undefined||this.invoiceNo===null||this.invoiceNo===""?"":("&invoiceNo="+this.invoiceNo)); + res+=(this.invoiceCode===undefined||this.invoiceCode===null||this.invoiceCode===""?"":("&invoiceCode="+this.invoiceCode)); + res+=(this.invoiceUploadTimeStart===undefined||this.invoiceUploadTimeStart===null?"":("&invoiceUploadTimeStart="+this.invoiceUploadTimeStart)); + res+=(this.invoiceUploadTimeEnd===undefined||this.invoiceUploadTimeEnd===null?"":("&invoiceUploadTimeEnd="+this.invoiceUploadTimeEnd)); + res+=(this.invoiceState===undefined||this.invoiceState===null?"":("&invoiceState="+this.invoiceState)); + res+=(this.invoiceKind===undefined||this.invoiceKind===null?"":("&invoiceKind="+this.invoiceKind)); + res+=(this.invoiceDateStart===undefined||this.invoiceDateStart===null?"":("&invoiceDateStart="+this.invoiceDateStart)); + res+=(this.invoiceDateEnd===undefined||this.invoiceDateEnd===null?"":("&invoiceDateEnd="+this.invoiceDateEnd)); + res+=(this.invoiceNote===undefined||this.invoiceNote===null?"":("&invoiceNote="+this.invoiceNote)); + res+=(this.invoiceUploader===undefined||this.invoiceUploader===null?"":("&invoiceUploader="+this.invoiceUploader)); return res; } } \ No newline at end of file diff --git a/src/pages/Invoice/mine/InvoiceListView.tsx b/src/pages/Invoice/mine/InvoiceListView.tsx index 24e921b..b9fbd06 100644 --- a/src/pages/Invoice/mine/InvoiceListView.tsx +++ b/src/pages/Invoice/mine/InvoiceListView.tsx @@ -53,8 +53,10 @@ class InvoiceSearch extends React.Component { console.log(this.state.invoiceSearchOption.toString()) if (this.state.activatedOption === "发票代码") { this.state.invoiceSearchOption.invoiceCode = value; + this.state.invoiceSearchOption.invoiceNo = null; } else { this.state.invoiceSearchOption.invoiceNo = value; + this.state.invoiceSearchOption.invoiceCode = null; } const {handleSearchData} = this.props @@ -65,7 +67,7 @@ class InvoiceSearch extends React.Component { console.log(response.data) //console.log(this.state) handleSearchData(response.data.records) - //dispatch(this.props.handleSearchData(response.data.records)) + //dispatch(handleSearchData(response.data.records)) //models.commit('setStaff', response.data.data) //navigate('/') }).catch(function (error) { @@ -100,32 +102,92 @@ class InvoiceSearch extends React.Component { ) } ]; + const onValuesChange = (changedValues: any, allValues: any) => { + this.state.invoiceSearchOption.clear() + if (allValues['upload-time-picker'] !== null) { + this.state.invoiceSearchOption.invoiceUploadTimeStart = allValues['upload-time-picker'][0].format('YYYY-MM-DDtHH:mm:ss') + this.state.invoiceSearchOption.invoiceUploadTimeEnd = allValues['upload-time-picker'][1].format('YYYY-MM-DDtHH:mm:ss') + } + if (allValues['invoice-time-picker'] !== null) { + this.state.invoiceSearchOption.invoiceDateStart = allValues['invoice-time-picker'][0].format('YYYY-MM-DD') + this.state.invoiceSearchOption.invoiceDateEnd = allValues['invoice-time-picker'][1].format('YYYY-MM-DD') + } + if (allValues['invoice-state'] !== "全部") { + this.state.invoiceSearchOption.invoiceState = allValues['invoice-state'] + } + if (allValues['invoice-kind'] !== "全部") { + this.state.invoiceSearchOption.invoiceKind = allValues['invoice-kind'] + } + if (allValues['invoice-uploader'] !== null) { + this.state.invoiceSearchOption.invoiceUploader = allValues['invoice-uploader'].trim() + } + } return ( -
- +
+ + + + {this.state.activatedOption} + + + + } + placeholder={this.state.searchContent} + allowClear + onSearch={(value) => this.onSearch(value)} + style={{width: 304}} + enterButton + /> + +
+ + +
) }