抢救了爆炸现场,接入后端

main
白封羽 2022-12-26 22:50:46 +08:00
parent 415075c217
commit f628f5dbfb
4 changed files with 12 additions and 11 deletions

View File

@ -25,7 +25,7 @@ export interface Invoice {
invoiceApprovalOpinion: string; invoiceApprovalOpinion: string;
invoiceNote: string; invoiceNote: string;
invoiceKind: string; invoiceKind: string;
invoiceAmount: number; invoiceAmountWithoutTax: number;
reimbursementId: number; reimbursementId: number;
modified: boolean; modified: boolean;
} }
@ -77,8 +77,8 @@ export class InvoiceSearchOption{
} }
toString(){ toString(){
let res="pageNum="+this.pageNum+"&pageSize="+this.pageSize let res="pageNum="+this.pageNum+"&pageSize="+this.pageSize
res+=(this.invoiceNo===null?"":("&invoiceNo="+this.invoiceNo)); res+=(this.invoiceNo===null||this.invoiceNo===""?"":("&invoiceNo="+this.invoiceNo));
res+=(this.invoiceCode===null?"":("&invoiceCode="+this.invoiceCode)); res+=(this.invoiceCode===null||this.invoiceCode===""?"":("&invoiceCode="+this.invoiceCode));
res+=(this.invoiceUploadTimeStart===null?"":("&invoiceUploadTimeStart="+this.invoiceUploadTimeStart?.toDateString())); res+=(this.invoiceUploadTimeStart===null?"":("&invoiceUploadTimeStart="+this.invoiceUploadTimeStart?.toDateString()));
res+=(this.invoiceUploadTimeEnd===null?"":("&invoiceUploadTimeEnd="+this.invoiceUploadTimeEnd?.toDateString())); res+=(this.invoiceUploadTimeEnd===null?"":("&invoiceUploadTimeEnd="+this.invoiceUploadTimeEnd?.toDateString()));
res+=(this.invoiceState===null?"":("&invoiceState="+this.invoiceState)); res+=(this.invoiceState===null?"":("&invoiceState="+this.invoiceState));

View File

@ -13,6 +13,7 @@ const tokenSlice = createSlice({
setToken: (state, action: PayloadAction<Token>) => { setToken: (state, action: PayloadAction<Token>) => {
state.accessToken = action.payload.accessToken state.accessToken = action.payload.accessToken
state.refreshToken = action.payload.refreshToken state.refreshToken = action.payload.refreshToken
console.log('action: '+action)
}, },
}, },
}); });

View File

@ -7,7 +7,7 @@ import {Invoice,InvoiceSearchOption} from "../../../models/Staff"
import { Space, Typography } from 'antd'; import { Space, Typography } from 'antd';
import {SizeType} from "antd/es/config-provider/SizeContext"; import {SizeType} from "antd/es/config-provider/SizeContext";
import axios from "axios"; import axios from "axios";
import {baseUrl} from "../../../utils/axiosInstance"; import axiosInstance, {baseUrl} from "../../../utils/axiosInstance";
const {Meta} = Card; const {Meta} = Card;
const { Search } = Input; const { Search } = Input;
let invoices:Array<Invoice> let invoices:Array<Invoice>
@ -31,8 +31,8 @@ class InvoiceSearch extends React.Component<any, any> {
const {handleSearchData} = this.props const {handleSearchData} = this.props
//const dispatch = useAppDispatch(); //const dispatch = useAppDispatch();
//const navigate = useNavigate(); //const navigate = useNavigate();
console.log(baseUrl + 'invoice/list?'+this.state.invoiceSearchOption.toString()) console.log(baseUrl + 'common/invoice/list?'+this.state.invoiceSearchOption.toString())
axios.get(baseUrl + 'invoice/list?'+this.state.invoiceSearchOption.toString()).then(function (this:any,response) { axiosInstance.get(baseUrl + 'common/invoice/list?'+this.state.invoiceSearchOption.toString()).then(function (response) {
console.log(response.data) console.log(response.data)
//console.log(this.state) //console.log(this.state)
handleSearchData(response.data.records) handleSearchData(response.data.records)
@ -104,7 +104,7 @@ class InvoiceItem extends React.Component<any, any> {
super(props); super(props);
this.state = { this.state = {
invoiceKind: props.invoice.invoiceKind, invoiceKind: props.invoice.invoiceKind,
invoiceAmount: props.invoice.invoiceAmount, invoiceAmountWithoutTax: props.invoice.invoiceAmountWithoutTax,
invoiceDate: props.invoice.invoiceDate, invoiceDate: props.invoice.invoiceDate,
invoiceNo: props.invoice.invoiceNo, invoiceNo: props.invoice.invoiceNo,
} }
@ -127,7 +127,7 @@ class InvoiceItem extends React.Component<any, any> {
<div style={{marginTop: -20}}> <div style={{marginTop: -20}}>
<li style={{fontWeight: "bold", fontSize: 20}}>{this.state.invoiceNo}</li> <li style={{fontWeight: "bold", fontSize: 20}}>{this.state.invoiceNo}</li>
<li>{this.state.invoiceKind}</li> <li>{this.state.invoiceKind}</li>
<li>¥{this.state.invoiceAmount}</li> <li>¥{(this.state.invoiceAmountWithoutTax/100.0).toFixed(2)}</li>
<li>{this.state.invoiceDate}</li> <li>{this.state.invoiceDate}</li>
</div> </div>
</Card> </Card>

View File

@ -2,7 +2,7 @@ import axios, {AxiosRequestConfig, AxiosResponse} from "axios";
import {store} from "../models/store"; import {store} from "../models/store";
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-ae5ae4e4/" //export const baseUrl = "https://mock.apifox.cn/m1/2116708-0-default/"
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: baseUrl, baseURL: baseUrl,
@ -11,9 +11,9 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.request.use( axiosInstance.interceptors.request.use(
function (config: AxiosRequestConfig) { function (config: AxiosRequestConfig) {
console.log(config)
// @ts-ignore // @ts-ignore
config.headers.Authorization = "bearer "+store.getState().token.accessToken config.headers.Authorization = "Bearer "+store.getState().token.accessToken
console.log(config)
return config return config
}, },
function (error) { function (error) {