|
@@ -8,12 +8,19 @@ import { queryStaff } from '@/services/staff'
|
|
|
import { useTableScroll } from '@/hooks/useAutoTable'
|
|
import { useTableScroll } from '@/hooks/useAutoTable'
|
|
|
import EmployeeDetail from '@/pages/staff/Employee/components/EmployeeDetail'
|
|
import EmployeeDetail from '@/pages/staff/Employee/components/EmployeeDetail'
|
|
|
import { delDepartment } from '@/services/department'
|
|
import { delDepartment } from '@/services/department'
|
|
|
|
|
+import { connect } from 'dva'
|
|
|
|
|
|
|
|
-const Employee = () => {
|
|
|
|
|
|
|
+const Employee = props => {
|
|
|
|
|
+ const { dispatch } = props
|
|
|
const [selectKeys, setSelectKeys] = useState([])
|
|
const [selectKeys, setSelectKeys] = useState([])
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
params: { id: '0' }
|
|
params: { id: '0' }
|
|
|
})
|
|
})
|
|
|
|
|
+ const initData = () => {
|
|
|
|
|
+ dispatch({
|
|
|
|
|
+ type: 'staff/fetchDepartments'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
// 展示员工详情
|
|
// 展示员工详情
|
|
|
const showDrawer = id => {
|
|
const showDrawer = id => {
|
|
@@ -110,7 +117,6 @@ const Employee = () => {
|
|
|
|
|
|
|
|
const handleDelDepartment = async id => {
|
|
const handleDelDepartment = async id => {
|
|
|
const { code = -1 } = await delDepartment(id)
|
|
const { code = -1 } = await delDepartment(id)
|
|
|
- console.log(id)
|
|
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
message.success('删除成功')
|
|
message.success('删除成功')
|
|
|
initData()
|
|
initData()
|
|
@@ -170,4 +176,7 @@ const Employee = () => {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export default Employee
|
|
|
|
|
|
|
+// export default Employee
|
|
|
|
|
+export default connect(({ staff }) => ({
|
|
|
|
|
+ departments: staff.departments
|
|
|
|
|
+}))(Employee)
|