diff --git a/src/models/Staff.ts b/src/models/Staff.ts index 457d767..c9b8fb4 100644 --- a/src/models/Staff.ts +++ b/src/models/Staff.ts @@ -46,18 +46,9 @@ export class InvoiceSearchOption{ pageNum:number pageSize:number constructor(){ - this.invoiceNo=null - this.invoiceCode=null - this.invoiceUploadTimeStart=null - this.invoiceUploadTimeEnd=null - this.invoiceState=null - this.invoiceKind=null - this.invoiceDateStart=null - this.invoiceDateEnd=null - this.invoiceNote=null - this.invoiceUploader=null this.pageNum=0 this.pageSize=20 + this.clear() } clear(){ this.invoiceNo=null @@ -74,18 +65,18 @@ export class InvoiceSearchOption{ this.pageSize=20 } - toString(){ - let res="pageNum="+this.pageNum+"&pageSize="+this.pageSize - 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; - } + // toString(){ + // let res="pageNum="+this.pageNum+"&pageSize="+this.pageSize + // 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 a6946e4..3a2f710 100644 --- a/src/pages/Invoice/mine/InvoiceListView.tsx +++ b/src/pages/Invoice/mine/InvoiceListView.tsx @@ -1,4 +1,19 @@ -import {Card, Dropdown, List, Menu, Input, Button, Radio, Divider, DatePicker, Form, TimePicker, Select} from "antd"; +import { + Card, + Dropdown, + List, + Row, + Input, + Button, + Radio, + Col, + Divider, + DatePicker, + Form, + TimePicker, + Select, + Checkbox +} from "antd"; import type {MenuProps} from 'antd'; import {DownOutlined, UploadOutlined} from '@ant-design/icons'; import React, {ReactElement, JSXElementConstructor, ReactFragment, ReactPortal, useState} from "react"; @@ -19,12 +34,12 @@ let invoices: Array const {RangePicker} = DatePicker; const formItemLayout = { labelCol: { - xs: {span: 24}, - sm: {span: 8}, + xs: {span: 10}, + sm: {span: 10}, }, wrapperCol: { - xs: {span: 24}, - sm: {span: 16}, + xs: {span: 14}, + sm: {span: 14}, }, }; const config = { @@ -40,16 +55,18 @@ class InvoiceSearch extends React.Component { this.state = { activatedOption: "发票代码", searchContent: '请在此输入', - complexEnabled:true, - invoiceSearchOption: new InvoiceSearchOption() + complexEnabled: false, + invoiceSearchOption: new InvoiceSearchOption(), + pageSize: 20, + pageNum: 0 } this.onSearch('') } onSearch = (value: string) => { - if(!this.state.complexEnabled) + if (!this.state.complexEnabled) this.state.invoiceSearchOption.clear() - console.log(this.state.invoiceSearchOption.toString()) + console.log(this.state.invoiceSearchOption) if (this.state.activatedOption === "发票代码") { this.state.invoiceSearchOption.invoiceCode = value; this.state.invoiceSearchOption.invoiceNo = null; @@ -62,8 +79,11 @@ class InvoiceSearch extends React.Component { //const dispatch = useAppDispatch(); //const navigate = useNavigate(); let params = this.state.invoiceSearchOption - if(params.invoiceNo==="") params.invoiceNo=null - if(params.invoiceCode==="") params.invoiceCode=null + Object.keys(params).forEach(key => { + if (params[key] != null && params[key] !== undefined && params[key] === "") { + params[key] = null + } + }) axiosInstance({ url: 'common/invoice/list', method: 'get', @@ -74,20 +94,6 @@ class InvoiceSearch extends React.Component { }).catch(function (error) { console.log(error) }) - /* console.log(baseUrl + 'common/invoice/list?' + this.state.invoiceSearchOption.toString()) - axiosInstance.get(baseUrl + 'common/invoice/list?' + this.state.invoiceSearchOption.toString()).then(function (response) { - console.log(response.data) - //console.log(this.state) - handleSearchData(response.data.records) - //dispatch(handleSearchData(response.data.records)) - //models.commit('setStaff', response.data.data) - //navigate('/') - }).catch(function (error) { - console.log(error); - //showAlert.value = true - });*/ - //console.log(value) - //this.props.handleSearchData(value) } render() { @@ -116,11 +122,13 @@ class InvoiceSearch extends React.Component { ]; const onValuesChange = (changedValues: any, allValues: any) => { this.state.invoiceSearchOption.clear() - if (allValues['upload-time-picker'] !== null) { + + console.log(allValues) + if (allValues['upload-time-picker'] != null && allValues['upload-time-picker'] !== undefined) { 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) { + if (allValues['invoice-time-picker'] !== null && allValues['invoice-time-picker'] !== undefined) { 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') } @@ -130,7 +138,7 @@ class InvoiceSearch extends React.Component { if (allValues['invoice-kind'] !== "全部") { this.state.invoiceSearchOption.invoiceKind = allValues['invoice-kind'] } - if (allValues['invoice-uploader'] !== null) { + if (allValues['invoice-uploader'] !== null && allValues['invoice-uploader'] !== undefined && allValues['invoice-uploader'].trim() !== "") { this.state.invoiceSearchOption.invoiceUploader = allValues['invoice-uploader'].trim() } } @@ -158,50 +166,63 @@ class InvoiceSearch extends React.Component { style={{width: 304}} enterButton /> + { + this.setState({complexEnabled: e.target.checked}) + + }}>高级搜索 + {this.state.complexEnabled&& +
+
+ + + + - - +
} ) + } } @@ -268,7 +289,6 @@ class InvoiceListView extends React.Component { render() { return (
- // TODO:复杂搜索
{this.state.invoices.map((item: Invoice) =>