|
|
@@ -7,16 +7,17 @@ import { apiCompanyDetail } from '@/services/company'
|
|
|
import CompanyForm from '@/components/PopContent/Companys/CompanyForm'
|
|
|
import CompanyLowerList from '@/components/PopContent/Companys/CompanyLowerList'
|
|
|
import CompanyTabList from '@/components/PopContent/Companys/CompanyTabList'
|
|
|
+import { connect } from 'dva'
|
|
|
|
|
|
const index = props => {
|
|
|
- const { visible, onClose,collapsed, id = '' } = props
|
|
|
+ const { dispatch, shouldUpdate, visible, onClose, collapsed, id = '' } = props
|
|
|
const needSubtractHeight = 55 // 需要被裁掉的高度
|
|
|
// const needSubtractWidth = (collapsed ? 208 : 48) + 48 + 48 + 48 // 需要被裁掉的高度
|
|
|
- const [x,y] = useAutoTable(collapsed, needSubtractHeight)
|
|
|
+ const [x, y] = useAutoTable(collapsed, needSubtractHeight)
|
|
|
const [clientWidth, setClientWidth] = useState(document.body.clientWidth * 0.75)
|
|
|
const [state, setState] = useState({
|
|
|
customer: {},
|
|
|
- log:[]
|
|
|
+ log: []
|
|
|
})
|
|
|
const initData = async () => {
|
|
|
const {
|
|
|
@@ -24,11 +25,17 @@ const index = props => {
|
|
|
code = -1
|
|
|
} = await apiCompanyDetail(id)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ if (shouldUpdate) {
|
|
|
+ dispatch({
|
|
|
+ type: 'refresh/commitAction',
|
|
|
+ payload: 'company'
|
|
|
+ })
|
|
|
+ }
|
|
|
setState({ ...state, customer, log })
|
|
|
}
|
|
|
}
|
|
|
useEffect(() => {
|
|
|
- if (visible) {
|
|
|
+ if (visible || shouldUpdate) {
|
|
|
initData()
|
|
|
}
|
|
|
window.addEventListener('resize', () => {
|
|
|
@@ -37,27 +44,27 @@ const index = props => {
|
|
|
return () => {
|
|
|
window.removeEventListener('resize', () => {})
|
|
|
}
|
|
|
- }, [visible])
|
|
|
+ }, [visible, shouldUpdate])
|
|
|
return (
|
|
|
<div>
|
|
|
- <div className='sheet-box'>
|
|
|
+ <div className="sheet-box">
|
|
|
<Drawer
|
|
|
- title="公司"
|
|
|
- placement="right"
|
|
|
- bodyStyle={{
|
|
|
- height:y,
|
|
|
- overflowY:'hidden'
|
|
|
- }}
|
|
|
- width={clientWidth}
|
|
|
- closable
|
|
|
- onClose={onClose}
|
|
|
- visible={visible}
|
|
|
- // mask={false}
|
|
|
- >
|
|
|
+ title="公司"
|
|
|
+ placement="right"
|
|
|
+ bodyStyle={{
|
|
|
+ height: y,
|
|
|
+ overflowY: 'hidden'
|
|
|
+ }}
|
|
|
+ width={clientWidth}
|
|
|
+ closable
|
|
|
+ onClose={onClose}
|
|
|
+ visible={visible}
|
|
|
+ // mask={false}
|
|
|
+ >
|
|
|
<Row>
|
|
|
- <Col span={12} className="sheet-box-left" style={{ height:y-25,overflowY:'auto' }}>
|
|
|
+ <Col span={12} className="sheet-box-left" style={{ height: y - 25, overflowY: 'auto' }}>
|
|
|
<div className="sheet-left-panel zh-pd-right-15">
|
|
|
- <CompanyForm customer={state.customer}/>
|
|
|
+ <CompanyForm customer={state.customer} />
|
|
|
</div>
|
|
|
</Col>
|
|
|
<Col span={12}>
|
|
|
@@ -71,4 +78,7 @@ const index = props => {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default index
|
|
|
+// export default index
|
|
|
+export default connect(({ refresh }) => ({
|
|
|
+ shouldUpdate: refresh.company
|
|
|
+}))(index)
|