完善了搜索
parent
9b6d5f2361
commit
30cd60c925
|
@ -184,11 +184,8 @@ class Subpage extends React.Component<any, any> {
|
||||||
|
|
||||||
search(value: string, form: FormProps['form'], dom: ReactNode[]) {
|
search(value: string, form: FormProps['form'], dom: ReactNode[]) {
|
||||||
this.setState({searchWord: value});
|
this.setState({searchWord: value});
|
||||||
if (value === "") {
|
// @ts-ignore
|
||||||
// @ts-ignore
|
this.tableAction.current.reloadAndRest()
|
||||||
this.tableAction.current.reloadAndRest()
|
|
||||||
}
|
|
||||||
this.tableAction.current?.reload()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
|
@ -201,11 +198,30 @@ class Subpage extends React.Component<any, any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async converter(value: Reimbursement[] | undefined, pageSize: number | undefined) {
|
async converter(value: Reimbursement[] | undefined | Reimbursement, pageSize: number | undefined) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
let result: TableListItem[] = []
|
let result: TableListItem[] = []
|
||||||
|
if("reimbursementAdditionalAmount" in value){
|
||||||
|
result.push({
|
||||||
|
key:1,
|
||||||
|
id: value.reimbursementId,
|
||||||
|
beginDate: Date.parse(value.reimbursementDepartureInvoice.invoiceDate),
|
||||||
|
endDate: Date.parse(value.reimbursementDepartureInvoice.invoiceDate) + value.reimbursementTripDuration * 24 * 60 * 60 * 1000,
|
||||||
|
duration: value.reimbursementTripDuration,
|
||||||
|
OD: [value.reimbursementDepartureName, value.reimbursementDestinationName],
|
||||||
|
amount: value.reimbursementInvoiceAmount + value.reimbursementAdditionalAmount,
|
||||||
|
invoiceAmount: value.reimbursementInvoiceAmount,
|
||||||
|
additionalAmount: value.reimbursementAdditionalAmount,
|
||||||
|
status: value.reimbursementStatus % 6,
|
||||||
|
departmentId: value.reimbursementSubmitDepartment.departmentId,
|
||||||
|
submitDateTime: Date.parse(value.reimbursementSubmitTime),
|
||||||
|
detail: "查看详情",
|
||||||
|
back: value.reimbursementDestinationInvoice !== undefined,
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
result.push({
|
result.push({
|
||||||
key:i,
|
key:i,
|
||||||
|
@ -284,15 +300,21 @@ class Subpage extends React.Component<any, any> {
|
||||||
params['sortBy'] = "reimbursementDepartureDate"
|
params['sortBy'] = "reimbursementDepartureDate"
|
||||||
params['asc'] = (sort.beginDate === "ascend")
|
params['asc'] = (sort.beginDate === "ascend")
|
||||||
}
|
}
|
||||||
console.log(params)
|
|
||||||
let response = await axiosInstance.get('common/reimbursement', {params: params})
|
let response = await axiosInstance.get('common/reimbursement', {params: params})
|
||||||
tableListDataSource = await this.converter(response.data.records, pageSize)
|
tableListDataSource = await this.converter(response.data.records, pageSize)
|
||||||
console.log(response.data.records)
|
|
||||||
totalRecordLength = response.data.total
|
totalRecordLength = response.data.total
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let response = await axiosInstance.get('common/reimbursement/' + this.state.searchWord.trim(), {})
|
let response = await axiosInstance.get('common/reimbursement/' + Number(this.state.searchWord.trim()), {}).catch(error => {
|
||||||
tableListDataSource = await this.converter(response.data.records, pageSize)
|
tableListDataSource = []
|
||||||
|
totalRecordLength = 0
|
||||||
|
return Promise.resolve({
|
||||||
|
data: tableListDataSource,
|
||||||
|
success: false,
|
||||||
|
total: totalRecordLength,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
tableListDataSource = await this.converter(response.data, pageSize)
|
||||||
totalRecordLength = tableListDataSource.length
|
totalRecordLength = tableListDataSource.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue