完善了用户配置

main
wuyize 2023-01-09 11:57:49 +08:00
parent abe3bc4af0
commit c88426f575
1 changed files with 16 additions and 7 deletions

View File

@ -18,6 +18,8 @@ function UserConfig(props: any) {
const [createStaffLoading, setCreateStaffLoading] = useState(false) const [createStaffLoading, setCreateStaffLoading] = useState(false)
const [placeOptions, setPlaceOptions] = useState<{ value: string; label: string; }[]>([]) const [placeOptions, setPlaceOptions] = useState<{ value: string; label: string; }[]>([])
const [form] = Form.useForm() const [form] = Form.useForm()
const [pageNum, setPageNum] = useState(1)
const [pageSize, setPageSize] = useState(10)
const departmentToString = (staff: Staff) => { const departmentToString = (staff: Staff) => {
if (staff.staffId === 'manager') if (staff.staffId === 'manager')
@ -88,6 +90,8 @@ function UserConfig(props: any) {
} }
const onChange = (pageCurrentNum: number, pageCurrentSize: number) => { const onChange = (pageCurrentNum: number, pageCurrentSize: number) => {
setPageNum(pageCurrentNum)
setPageSize(pageCurrentSize)
getStaffList(pageCurrentNum, pageCurrentSize) getStaffList(pageCurrentNum, pageCurrentSize)
} }
@ -111,6 +115,7 @@ function UserConfig(props: any) {
}).then(response => { }).then(response => {
setCreateStaffLoading(false) setCreateStaffLoading(false)
setCreateStaffModalOpen(false) setCreateStaffModalOpen(false)
getStaffList(pageNum, pageSize)
}).catch(function (error) { }).catch(function (error) {
console.log(error) console.log(error)
setCreateStaffLoading(false) setCreateStaffLoading(false)
@ -123,13 +128,17 @@ function UserConfig(props: any) {
url: 'common/place', url: 'common/place',
method: 'get' method: 'get'
}).then(response => { }).then(response => {
const data:{placeName: string, subsidyPerDay: number}[] = response.data const data:{placeName: string, subsidyPerDay: number, base: boolean}[] = response.data
setPlaceOptions(data.map((value, index, array) => { let options = []
return { for(const value of data)
value: value.placeName, {
label: value.placeName if(value.base)
} options.push( {
})) value: value.placeName,
label: value.placeName
})
}
setPlaceOptions(options)
}).catch(function (error) { }).catch(function (error) {
console.log(error) console.log(error)
}) })