|
|
@@ -7,7 +7,7 @@ import { connect } from 'dva'
|
|
|
import { ModalForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'
|
|
|
|
|
|
const RoleMenu = props => {
|
|
|
- const { dispatch, departments = [] } = props
|
|
|
+ const { dispatch, departments = [], shouldUpdate } = props
|
|
|
const [state, setState] = useState({
|
|
|
params: {},
|
|
|
visible: false
|
|
|
@@ -28,7 +28,7 @@ const RoleMenu = props => {
|
|
|
// 刷新数据
|
|
|
dispatch({
|
|
|
type: 'refresh/commitAction',
|
|
|
- payload: 'contact'
|
|
|
+ payload: 'department'
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -58,16 +58,7 @@ const RoleMenu = props => {
|
|
|
<ProFormText name="name" label="新增部门" rules={[{ message: '请输入部门名称' }]} />
|
|
|
<ProFormSelect
|
|
|
width="md"
|
|
|
- options={[
|
|
|
- {
|
|
|
- value: 'time',
|
|
|
- label: '总部'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 'timea',
|
|
|
- label: '研究中心'
|
|
|
- }
|
|
|
- ]}
|
|
|
+ options={departments.map(item => ({ label: item.name, value: item.id }))}
|
|
|
name="unusedMode"
|
|
|
label="上级部门"
|
|
|
/>
|
|
|
@@ -75,7 +66,13 @@ const RoleMenu = props => {
|
|
|
</div>
|
|
|
<div className="p-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
|
|
|
<ul className="p-0 m-0 list-none text-primary flex flex-col flex-1">
|
|
|
- <li>全公司</li>
|
|
|
+ {departments.map(item => (
|
|
|
+ <li
|
|
|
+ key={item.id}
|
|
|
+ className="flex justify-between items-center py-2 px-5 cursor-pointer">
|
|
|
+ <span>{item.name}</span>
|
|
|
+ </li>
|
|
|
+ ))}
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -83,6 +80,7 @@ const RoleMenu = props => {
|
|
|
}
|
|
|
|
|
|
// export default RoleMenu
|
|
|
-export default connect(({ staff }) => ({
|
|
|
- departments: staff.departments
|
|
|
+export default connect(({ staff, refresh }) => ({
|
|
|
+ departments: staff.departments,
|
|
|
+ shouldUpdate: refresh.department
|
|
|
}))(RoleMenu)
|