|
@@ -1,14 +1,25 @@
|
|
|
import BasicTable from '@/components/Table'
|
|
import BasicTable from '@/components/Table'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
-import { queryStaff } from '@/services/staff'
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
|
-import React, { useState } from 'react'
|
|
|
|
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
|
|
+import { connect } from 'umi'
|
|
|
import Organization from './components/Organization'
|
|
import Organization from './components/Organization'
|
|
|
|
|
|
|
|
-const AddressBook = () => {
|
|
|
|
|
|
|
+const AddressBook = props => {
|
|
|
|
|
+ const { dispatch, allStaffList = [] } = props
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
params: { id: '0' }
|
|
params: { id: '0' }
|
|
|
})
|
|
})
|
|
|
|
|
+ const initData = () => {
|
|
|
|
|
+ dispatch({
|
|
|
|
|
+ type: 'staff/fetchStaffList'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (!allStaffList.length) {
|
|
|
|
|
+ initData()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [])
|
|
|
const onSelect = id => {
|
|
const onSelect = id => {
|
|
|
setState({ ...state, params: { id } })
|
|
setState({ ...state, params: { id } })
|
|
|
}
|
|
}
|
|
@@ -75,15 +86,16 @@ const AddressBook = () => {
|
|
|
params={{ departmentId: state.params.id }}
|
|
params={{ departmentId: state.params.id }}
|
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
|
columns={columns}
|
|
columns={columns}
|
|
|
- request={async params => {
|
|
|
|
|
- const { code = -1, data: { list = [], total = 0 } = { list: [], total: 0 } } =
|
|
|
|
|
- await queryStaff({ ...params })
|
|
|
|
|
- return {
|
|
|
|
|
- data: list,
|
|
|
|
|
- success: code === consts.RET_CODE.SUCCESS,
|
|
|
|
|
- total
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
|
|
+ dataSource={allStaffList}
|
|
|
|
|
+ // request={async params => {
|
|
|
|
|
+ // const { code = -1, data: { list = [], total = 0 } = { list: [], total: 0 } } =
|
|
|
|
|
+ // await queryStaff({ ...params })
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // data: list,
|
|
|
|
|
+ // success: code === consts.RET_CODE.SUCCESS,
|
|
|
|
|
+ // total
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }}
|
|
|
search={false}
|
|
search={false}
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|
|
@@ -94,4 +106,6 @@ const AddressBook = () => {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export default AddressBook
|
|
|
|
|
|
|
+export default connect(({ staff }) => ({
|
|
|
|
|
+ allStaffList: staff.allStaffList
|
|
|
|
|
+}))(AddressBook)
|