|
|
@@ -0,0 +1,59 @@
|
|
|
+import React, { useState, useEffect } from 'react'
|
|
|
+import { Row, Col } from 'antd'
|
|
|
+import consts from '@/consts'
|
|
|
+import { apiStaffDetail } from '@/services/staff'
|
|
|
+import Detail from './StaffDetail'
|
|
|
+import TabList from './TabList'
|
|
|
+import LowerList from './LowerList'
|
|
|
+import { connect } from 'dva'
|
|
|
+
|
|
|
+const SoftwareDetail = props => {
|
|
|
+ const { dispatch, shouldUpdate, visible, dataId = '' } = props
|
|
|
+ const [state, setState] = useState({
|
|
|
+ loading: false,
|
|
|
+ staff: {},
|
|
|
+ log: []
|
|
|
+ })
|
|
|
+ const initData = async id => {
|
|
|
+ setState({ ...state, loading: true })
|
|
|
+ const {
|
|
|
+ data: { staff = {}, log = [] },
|
|
|
+ code = -1
|
|
|
+ } = await apiStaffDetail(id)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ if (shouldUpdate) {
|
|
|
+ dispatch({
|
|
|
+ type: 'refresh/commitAction',
|
|
|
+ payload: 'stafflist'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ setState({ ...state, staff, log, loading: false })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ useEffect(() => {
|
|
|
+ shouldUpdate && initData(dataId)
|
|
|
+ }, [shouldUpdate])
|
|
|
+ useEffect(() => {
|
|
|
+ visible && initData(dataId)
|
|
|
+ }, [visible])
|
|
|
+ return (
|
|
|
+ <div className="sheet-box">
|
|
|
+ <Row>
|
|
|
+ <Col span={12} className="sheet-box-left">
|
|
|
+ <div className="sheet-left-panel pr-4">
|
|
|
+ <Detail longle={state.staff} />
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+ <Col span={12} className="sheet-box-right">
|
|
|
+ <TabList />
|
|
|
+ <LowerList />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default connect(({ refresh, single }) => ({
|
|
|
+ visible: single.drawer.visible,
|
|
|
+ shouldUpdate: refresh.stafflist
|
|
|
+}))(SoftwareDetail)
|