Merge
commit
7f31fb0fa0
|
@ -35,12 +35,12 @@ type Nullable<T> = T | undefined | null;
|
|||
export class InvoiceSearchOption{
|
||||
invoiceNo: Nullable<string>
|
||||
invoiceCode: Nullable<string>
|
||||
invoiceUploadTimeStart: Nullable<Date>
|
||||
invoiceUploadTimeEnd:Nullable<Date>
|
||||
invoiceUploadTimeStart: Nullable<string>
|
||||
invoiceUploadTimeEnd:Nullable<string>
|
||||
invoiceState:Nullable<number>
|
||||
invoiceKind:Nullable<string>
|
||||
invoiceDateStart:Nullable<Date>
|
||||
invoiceDateEnd:Nullable<Date>
|
||||
invoiceDateStart:Nullable<string>
|
||||
invoiceDateEnd:Nullable<string>
|
||||
invoiceNote:Nullable<string>
|
||||
invoiceUploader:Nullable<string>
|
||||
pageNum:number
|
||||
|
@ -76,16 +76,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;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import {Card, Dropdown, List,Menu,Input,Button,Radio,Divider} from "antd";
|
||||
import {Card, Dropdown, List, Menu, Input, Button, Radio, Divider, DatePicker, Form, TimePicker, Select} from "antd";
|
||||
import type {MenuProps} from 'antd';
|
||||
import {DownOutlined, UploadOutlined} from '@ant-design/icons';
|
||||
import React, {ReactElement, JSXElementConstructor, ReactFragment, ReactPortal, useState} from "react";
|
||||
|
@ -7,9 +7,32 @@ import { Space, Typography } from 'antd';
|
|||
import {SizeType} from "antd/es/config-provider/SizeContext";
|
||||
import axios from "axios";
|
||||
import axiosInstance, {baseUrl} from "../../../utils/axiosInstance";
|
||||
import {Simulate} from "react-dom/test-utils";
|
||||
import change = Simulate.change;
|
||||
import {useNavigate} from "react-router-dom";
|
||||
import {useAppDispatch} from "../../../models/hooks";
|
||||
|
||||
const {Meta} = Card;
|
||||
const {Search} = Input;
|
||||
const {Option} = Select
|
||||
let invoices: Array<Invoice>
|
||||
const {RangePicker} = DatePicker;
|
||||
const formItemLayout = {
|
||||
labelCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 8},
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16},
|
||||
},
|
||||
};
|
||||
const config = {
|
||||
rules: [{type: 'object' as const, required: false, message: 'Please select time!'}],
|
||||
};
|
||||
const rangeConfig = {
|
||||
rules: [{type: 'array' as const, required: false, message: 'Please select time!'}],
|
||||
};
|
||||
|
||||
class InvoiceSearch extends React.Component<any, any> {
|
||||
constructor(props: { handleSearchData: any; }) {
|
||||
|
@ -17,21 +40,27 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
this.state = {
|
||||
activatedOption: "发票代码",
|
||||
searchContent: '请在此输入',
|
||||
complexEnabled:true,
|
||||
invoiceSearchOption: new InvoiceSearchOption()
|
||||
}
|
||||
this.onSearch('')
|
||||
}
|
||||
|
||||
onSearch = (value: string) => {
|
||||
if(!this.state.complexEnabled)
|
||||
this.state.invoiceSearchOption.clear()
|
||||
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
|
||||
//const dispatch = useAppDispatch();
|
||||
//const navigate = useNavigate();
|
||||
console.log(baseUrl + 'common/invoice/list?'+this.state.invoiceSearchOption.toString())
|
||||
let params = this.state.invoiceSearchOption
|
||||
if(params.invoiceNo==="") params.invoiceNo=null
|
||||
if(params.invoiceCode==="") params.invoiceCode=null
|
||||
|
@ -45,11 +74,12 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
}).catch(function (error) {
|
||||
console.log(error)
|
||||
})
|
||||
/* axiosInstance.get(baseUrl + 'common/invoice/list?'+this.state.invoiceSearchOption.toString()).then(function (response) {
|
||||
/* 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(this.props.handleSearchData(response.data.records))
|
||||
//dispatch(handleSearchData(response.data.records))
|
||||
//models.commit('setStaff', response.data.data)
|
||||
//navigate('/')
|
||||
}).catch(function (error) {
|
||||
|
@ -59,6 +89,7 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
//console.log(value)
|
||||
//this.props.handleSearchData(value)
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
|
@ -67,7 +98,8 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
label: (<a className="simpleSearchOption" onClick={() => {
|
||||
this.state.invoiceSearchOption.clear();
|
||||
this.setState({activatedOption: "发票代码"}
|
||||
)}}>
|
||||
)
|
||||
}}>
|
||||
发票代码
|
||||
</a>)
|
||||
},
|
||||
|
@ -76,12 +108,34 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
label: (<a className="simpleSearchOption" onClick={() => {
|
||||
this.state.invoiceSearchOption.clear();
|
||||
this.setState({activatedOption: "发票编号"}
|
||||
)}}>
|
||||
)
|
||||
}}>
|
||||
发票编号
|
||||
</a>)
|
||||
}
|
||||
];
|
||||
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 (
|
||||
<div className="headBar">
|
||||
<div className="simpleSearchBar" style={{display: "flex", justifyContent: "space-evenly"}}>
|
||||
<Search className="simpleSearch"
|
||||
addonBefore={<Dropdown
|
||||
|
@ -108,6 +162,45 @@ class InvoiceSearch extends React.Component<any, any> {
|
|||
上传
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="complexSearchBar" hidden={!this.state.complexEnabled} style={{display: "flex"}}>
|
||||
<Form name="time_related_controls" {...formItemLayout} onValuesChange={onValuesChange}>
|
||||
<Form.Item name="upload-time-picker" label="发票上传时间" {...rangeConfig}>
|
||||
<RangePicker/>
|
||||
</Form.Item>
|
||||
<Form.Item name="invoice-time-picker" label="发票开票日期" {...rangeConfig}>
|
||||
<RangePicker/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={`invoice-state`}
|
||||
label={`发票状态`}
|
||||
><Select defaultValue="全部">
|
||||
<Option value="全部">全部</Option>
|
||||
<Option value="0">未使用</Option>
|
||||
<Option value="1">报销中</Option>
|
||||
<Option value="2">已报销</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={`invoice-kind`}
|
||||
label={`发票类型`}
|
||||
><Select defaultValue="全部">
|
||||
<Option value="全部">全部</Option>
|
||||
<Option value="增值税普通发票">增值税普通发票</Option>
|
||||
<Option value="增值税专用发票">增值税专用发票</Option>
|
||||
<Option value="定额发票">定额发票</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={`invoice-uploader`}
|
||||
label={`上传者`}
|
||||
>
|
||||
<Input placeholder="任意上传者"/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +240,7 @@ class InvoiceItem extends React.Component<any, any> {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
class InvoiceListView extends React.Component<any, any> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
|
@ -159,11 +253,13 @@ class InvoiceListView extends React.Component<any, any>{
|
|||
pageSize: 20
|
||||
}
|
||||
}
|
||||
|
||||
handleInvoice(value: string) {
|
||||
if (this.state.isNoOrCode == '1')
|
||||
this.setState({invoiceNo: value, invoiceCode: null});
|
||||
else this.setState({invoiceNo: null, invoiceCode: value})
|
||||
}
|
||||
|
||||
handleInvoicesContent = (value: Array<Invoice>) => {
|
||||
console.log(value)
|
||||
this.setState({invoices: value})
|
||||
|
|
Loading…
Reference in New Issue