Merge remote-tracking branch 'origin/main' into main
commit
433d79de81
|
@ -76,8 +76,9 @@ class DepartmentConfig extends React.Component<any, any> {
|
|||
return []
|
||||
}
|
||||
let res = []
|
||||
console.log(columns)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
console.log(columns[i].departmentName)
|
||||
if (columns[i].deletedAt == null)
|
||||
res.push({
|
||||
id: columns[i].departmentId,
|
||||
departmentId: columns[i].departmentId,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React, {useRef, useState} from "react";
|
||||
import {Button, Popover, Tabs, TabsProps, theme} from "antd";
|
||||
import {ActionType, ProColumns, ProTable} from "@ant-design/pro-components";
|
||||
import {ActionType, ProColumns, ProFormInstance, ProTable} from "@ant-design/pro-components";
|
||||
import Search from "antd/es/input/Search";
|
||||
import {statusEnum} from "../mine/MyReimbursement";
|
||||
import {preStatusFilter, statusEnum} from "../mine/MyReimbursement";
|
||||
import axiosInstance from "../../../utils/axiosInstance";
|
||||
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
||||
import {openNotification} from "../mine/utils";
|
||||
|
@ -31,6 +31,7 @@ export type TableListItem = {
|
|||
|
||||
class ReimbursementTab extends React.Component<any, any> {
|
||||
tableAction = React.createRef<ActionType>();
|
||||
formRef: React.MutableRefObject<ProFormInstance> = React.createRef<ProFormInstance>() as any;
|
||||
departments = new Map<number, string>()
|
||||
columns: ProColumns<TableListItem>[] = [
|
||||
{
|
||||
|
@ -89,6 +90,7 @@ class ReimbursementTab extends React.Component<any, any> {
|
|||
onFilter: false,
|
||||
search: false,
|
||||
valueEnum: statusEnum,
|
||||
// defaultFilteredValue:preStatusFilter(),
|
||||
//render: (_) => <a>{_}</a>,
|
||||
},
|
||||
{
|
||||
|
@ -138,6 +140,7 @@ class ReimbursementTab extends React.Component<any, any> {
|
|||
mode: props.mode,
|
||||
detailedReimbursement: undefined,
|
||||
activate: props.activate,
|
||||
initialized: false,
|
||||
reload: () => {
|
||||
this.tableAction.current?.reload()
|
||||
},
|
||||
|
@ -149,6 +152,7 @@ class ReimbursementTab extends React.Component<any, any> {
|
|||
prevState.reload()
|
||||
if (nextProps.activate !== prevState.activate) {
|
||||
return {
|
||||
initialized: false,
|
||||
mode: nextProps.mode,
|
||||
activate: nextProps.activate,
|
||||
detailedReimbursement: undefined,
|
||||
|
@ -190,7 +194,14 @@ class ReimbursementTab extends React.Component<any, any> {
|
|||
async updateRequest(current: number | undefined, pageSize: number | undefined, sort: Record<string, SortOrder>, filter: Record<string, React.ReactText[] | null>) {
|
||||
let tableListDataSource: TableListItem[] = []
|
||||
let totalRecordLength = 0
|
||||
|
||||
if(this.departments.size===0){
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
if (!this.state.initialize && this.state.mode === 0) {
|
||||
console.log({status: [statusEnum[0]]})
|
||||
this.formRef.current?.setFieldsValue({status: [statusEnum[0]]})
|
||||
this.setState({initialize: true})
|
||||
}
|
||||
current = (current === undefined ? 1 : current)
|
||||
pageSize = (pageSize === undefined ? 5 : pageSize)
|
||||
let params: any = {
|
||||
|
@ -288,6 +299,7 @@ class ReimbursementTab extends React.Component<any, any> {
|
|||
accessLevel={this.props.accessLevel}
|
||||
/>
|
||||
<ProTable<TableListItem>
|
||||
formRef={this.formRef}
|
||||
actionRef={this.tableAction}
|
||||
columns={this.columns}
|
||||
request={async (params, sorter, filter) => {
|
||||
|
|
|
@ -15,6 +15,20 @@ import ReimbursementDetail from "./ReimbursementDetail";
|
|||
import {openNotification} from "./utils";
|
||||
import {store} from "../../../models/store";
|
||||
|
||||
export function preStatusFilter(mode:number) {
|
||||
let d1 = store.getState().staff.managingDepartment
|
||||
let d2 = store.getState().staff.staffDepartments
|
||||
if (store.getState().token.staffId === "manager") {
|
||||
return ["3"]
|
||||
} else if ((d1 && d1.departmentId === 1)) {
|
||||
return ["2"]
|
||||
} else if ((d2 && d2.find((value, index, obj) => value.departmentId === 1))) {
|
||||
return ["4"]
|
||||
} else {
|
||||
return ["0"]
|
||||
}
|
||||
}
|
||||
|
||||
const valueEnum = {
|
||||
0: 'success',
|
||||
1: 'wait1',
|
||||
|
@ -277,6 +291,9 @@ class Subpage extends React.Component<any, any> {
|
|||
async updateRequest(current: number | undefined, pageSize: number | undefined, sort: Record<string, SortOrder>, filter: Record<string, React.ReactText[] | null>) {
|
||||
let tableListDataSource: TableListItem[] = []
|
||||
let totalRecordLength = 0
|
||||
if(this.departments.size === 0){
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
if (this.state.searchWord.trim() === "") {
|
||||
current = (current === undefined ? 0 : current)
|
||||
pageSize = (pageSize === undefined ? 5 : pageSize)
|
||||
|
|
Loading…
Reference in New Issue