Merge remote-tracking branch 'origin/main' into main
commit
81cd8157b8
|
@ -80,3 +80,45 @@ export class InvoiceSearchOption{
|
||||||
// return res;
|
// return res;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class InvoiceCommit {
|
||||||
|
invoiceFileName: string
|
||||||
|
invoiceNo: string
|
||||||
|
invoiceCode:string
|
||||||
|
invoiceKind:string
|
||||||
|
invoiceDate:Date
|
||||||
|
invoiceAmount:number
|
||||||
|
invoiceAmountWithoutTax: number
|
||||||
|
invoiceCheckCode:string
|
||||||
|
invoiceRegionCode: Nullable<string>
|
||||||
|
invoiceSellerTaxCode:Nullable<string>
|
||||||
|
|
||||||
|
invoiceExtraInfo: []
|
||||||
|
constructor() {
|
||||||
|
this.invoiceFileName = ""
|
||||||
|
this.invoiceNo = ""
|
||||||
|
this.invoiceCode = ""
|
||||||
|
this.invoiceKind = ""
|
||||||
|
this.invoiceDate = new Date()
|
||||||
|
this.invoiceAmount = 0
|
||||||
|
this.invoiceAmountWithoutTax = 0
|
||||||
|
this.invoiceCheckCode = "000000"
|
||||||
|
this.invoiceRegionCode = null
|
||||||
|
this.invoiceSellerTaxCode = null
|
||||||
|
this.invoiceExtraInfo = []
|
||||||
|
}
|
||||||
|
setValue(props: FormData) {
|
||||||
|
console.log("1111"+props.toString())
|
||||||
|
this.invoiceFileName = props.get("invoiceFileName")!.toString()
|
||||||
|
this.invoiceNo = props.get("invoiceNo")!.toString()
|
||||||
|
this.invoiceCode = props.get("invoiceCode")!.toString()
|
||||||
|
this.invoiceKind = props.get("invoiceKind")!.toString()
|
||||||
|
this.invoiceDate = new Date(props.get("invoiceDate")!.toString())
|
||||||
|
//this.invoiceAmount = props.get("invoiceAmount")!.toString()
|
||||||
|
//this.invoiceAmountWithoutTax = props.get("invoiceAmountWithoutTax")!.toString()
|
||||||
|
this.invoiceCheckCode = props.get("invoiceCheckCode")!.toString()
|
||||||
|
this.invoiceRegionCode = props.get("invoiceRegionCode")!.toString()
|
||||||
|
this.invoiceSellerTaxCode = props.get("invoiceSellerTaxCode")!.toString()
|
||||||
|
//this.invoiceExtraInfo = props.get("invoiceExtraInfo")!.
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,222 @@
|
||||||
|
import React, {useState} from 'react';
|
||||||
|
import {Button, Modal, UploadProps, message, Upload, UploadFile, Form, Input,DatePicker} from 'antd';
|
||||||
|
import { InboxOutlined } from '@ant-design/icons';
|
||||||
|
import axiosInstance from "../../../utils/axiosInstance";
|
||||||
|
import {InvoiceCommit} from "../../../models/Staff";
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import TextArea from "antd/es/input/TextArea";
|
||||||
|
import {constants} from "http2";
|
||||||
|
const { Dragger } = Upload;
|
||||||
|
let tempFile :File
|
||||||
|
const props: UploadProps = {
|
||||||
|
name: 'file',
|
||||||
|
multiple: false,
|
||||||
|
maxCount: 1,
|
||||||
|
accept: "image/png, image/jpeg, image/jpg",
|
||||||
|
beforeUpload: (file,fileList)=>{
|
||||||
|
tempFile=file
|
||||||
|
console.log(file)
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
onChange(info) {
|
||||||
|
// const { status } = info.file;
|
||||||
|
// if (status !== 'uploading') {
|
||||||
|
// console.log('here---------'+info.file, info.fileList);
|
||||||
|
// }
|
||||||
|
// if (status === 'done') {
|
||||||
|
// message.success(`${info.file.name} file uploaded successfully.`);
|
||||||
|
// } else if (status === 'error') {
|
||||||
|
// message.error(`${info.file.name} file upload failed.`);
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
onDrop(e) {
|
||||||
|
console.log('Dropped files', e.dataTransfer.files);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
class FileUploadView extends React.Component<any, any>{
|
||||||
|
render() {
|
||||||
|
return (<Dragger {...props}>
|
||||||
|
<p className="ant-upload-drag-icon">
|
||||||
|
<InboxOutlined/>
|
||||||
|
</p>
|
||||||
|
<p className="ant-upload-text">点击或将文件拖拽到这里上传</p>
|
||||||
|
<p className="ant-upload-hint">
|
||||||
|
支持扩展名: .png, .jpg, .jpeg
|
||||||
|
</p>
|
||||||
|
</Dragger>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class InvoiceUploadView extends React.Component<any, any>{
|
||||||
|
constructor(props: {}) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
loading: false,
|
||||||
|
open: false,
|
||||||
|
uploadOpen: false,
|
||||||
|
uploadStep: 0,
|
||||||
|
invoiceCommit: new InvoiceCommit(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setUploadOpen(value: Boolean) {
|
||||||
|
this.setState({uploadOpen: value})
|
||||||
|
}
|
||||||
|
setOpen(value: Boolean) {
|
||||||
|
this.setState({open : value})
|
||||||
|
}
|
||||||
|
setLoading(value: Boolean) {
|
||||||
|
this.setState({loading : value})
|
||||||
|
}
|
||||||
|
setUploadStep(value: number) {
|
||||||
|
this.setState({uploadStep : value})
|
||||||
|
}
|
||||||
|
|
||||||
|
showUploadView = () => {
|
||||||
|
this.setOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleOk = () => {
|
||||||
|
this.setLoading(true);
|
||||||
|
//this.setLoading(false);
|
||||||
|
this.setOpen(false);
|
||||||
|
let data= new FormData();
|
||||||
|
data.append('invoiceFile',tempFile)
|
||||||
|
axiosInstance({
|
||||||
|
url: '/invoice/identify',//123131',//FIXME
|
||||||
|
method: 'POST',
|
||||||
|
data: data
|
||||||
|
}).then(response => {
|
||||||
|
console.log(response.data)
|
||||||
|
let result = new InvoiceCommit()
|
||||||
|
result.invoiceNo = response.data.invoiceNo
|
||||||
|
result.invoiceDate = response.data.invoiceDate
|
||||||
|
result.invoiceAmount = response.data.invoiceAmount
|
||||||
|
result.invoiceCode = response.data.invoiceCode
|
||||||
|
result.invoiceCheckCode = response.data.invoiceCheckCode
|
||||||
|
result.invoiceKind = response.data.invoiceKind
|
||||||
|
result.invoiceFileName = response.data.invoiceFileName
|
||||||
|
result.invoiceExtraInfo = response.data.invoiceExtraInfo
|
||||||
|
this.setState({invoiceCommit:result})
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
this.setState({uploadStep:1})
|
||||||
|
this.setUploadOpen(true)
|
||||||
|
this.setLoading(false);
|
||||||
|
// let fakeData=new InvoiceCommit()
|
||||||
|
// fakeData.invoiceNo="No"
|
||||||
|
// fakeData.invoiceCode="Code"
|
||||||
|
// fakeData.invoiceDate=new Date()
|
||||||
|
// setInvoiceCommit(fakeData)
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
handleCancel = () => {
|
||||||
|
this.setOpen(false);
|
||||||
|
};
|
||||||
|
submit=()=>{
|
||||||
|
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
console.log(this.state.invoiceCommit)
|
||||||
|
console.log(this.state.uploadStep)
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button type="primary" onClick={this.showUploadView}>
|
||||||
|
Open Modal with customized footer
|
||||||
|
</Button>
|
||||||
|
<Modal
|
||||||
|
open={this.state.open}
|
||||||
|
title="Title"
|
||||||
|
onOk={this.handleOk}
|
||||||
|
onCancel={this.handleCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={this.handleCancel}>
|
||||||
|
取消
|
||||||
|
</Button>,
|
||||||
|
<Button key="next" type="primary" loading={this.state.loading} onClick={this.handleOk}>
|
||||||
|
下一步
|
||||||
|
</Button>
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<FileUploadView/>
|
||||||
|
</Modal>
|
||||||
|
<Modal
|
||||||
|
open={this.state.uploadOpen}
|
||||||
|
title="Title"
|
||||||
|
onOk={this.submit}
|
||||||
|
onCancel={this.handleCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={this.handleCancel}>
|
||||||
|
取消
|
||||||
|
</Button>,
|
||||||
|
<Button key="next" type="primary" loading={this.state.loading} onClick={this.submit}
|
||||||
|
>
|
||||||
|
下一步
|
||||||
|
</Button>
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Form>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-no`}
|
||||||
|
label={`发票编码`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceNo}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-Code`}
|
||||||
|
label={`发票代码`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceCode}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-Kind`}
|
||||||
|
label={`发票类型`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceKind}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-amount`}
|
||||||
|
label={`计税总额`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceAmount}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-amount-without-tax`}
|
||||||
|
label={`非税金额`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceAmountWithoutTax}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-date`}
|
||||||
|
label={`开票日期`}
|
||||||
|
>
|
||||||
|
<DatePicker defaultValue={dayjs(this.state.invoiceCommit.invoiceDate)}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-check-code`}
|
||||||
|
label={`核验码`}
|
||||||
|
>
|
||||||
|
<Input defaultValue={this.state.invoiceCommit.invoiceCheckCode}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={`invoice-extra-info`}
|
||||||
|
label={`其他信息`}
|
||||||
|
>
|
||||||
|
<TextArea defaultValue={this.state.invoiceCommit.invoiceExtraInfo}/>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
</>);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export default InvoiceUploadView;
|
|
@ -3,8 +3,8 @@ import {persistor, setAccessToken, setToken, store} from "../models/store";
|
||||||
import {history} from "../router/router";
|
import {history} from "../router/router";
|
||||||
|
|
||||||
|
|
||||||
export const baseUrl = "http://101.34.228.45:8080/"
|
// export const baseUrl = "http://101.34.228.45:8080/"
|
||||||
//export const baseUrl = "https://mock.apifox.cn/m1/2116708-0-default/"
|
export const baseUrl = "https://mock.apifox.cn/m1/2116708-0-ae5ae4e4/"
|
||||||
|
|
||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
baseURL: baseUrl,
|
baseURL: baseUrl,
|
||||||
|
|
Loading…
Reference in New Issue