From a2dd7529df0c1eaeddc8ce88aaab5e0db2b245f7 Mon Sep 17 00:00:00 2001
From: ruanhan1988 <2856197796@qq.com>
Date: Fri, 12 Jun 2020 18:43:54 +0800
Subject: [PATCH] fix origanzation three fields
---
.../Organizations/Organization.less | 7 +
.../containers/Organizations/Organization.tsx | 31 +++-
.../Organizations/component/Project.tsx | 8 +-
.../Organizations/component/ProjectList.tsx | 7 +-
.../Organizations/component/RoleList.tsx | 28 ++-
.../Organizations/component/Setting.tsx | 35 +---
.../Organizations/component/TeamForm.tsx | 166 ------------------
webapp/app/containers/Organizations/types.ts | 2 +
8 files changed, 58 insertions(+), 226 deletions(-)
delete mode 100644 webapp/app/containers/Organizations/component/TeamForm.tsx
diff --git a/webapp/app/containers/Organizations/Organization.less b/webapp/app/containers/Organizations/Organization.less
index 2db45c24c..d87a4864b 100644
--- a/webapp/app/containers/Organizations/Organization.less
+++ b/webapp/app/containers/Organizations/Organization.less
@@ -127,6 +127,7 @@
width: 260px;
height: 120px;
margin-right: 20px;
+ flex-shrink: 0;
background-color: @body-background;
background-repeat: no-repeat;
background-size: 100%;
@@ -143,16 +144,22 @@
display: flex;
flex-direction: column;
.title {
+ max-width: 460px;
font-size: 18px;
font-weight: 600;
margin-bottom: 16px;
color: @blue;
cursor: pointer;
+ padding: 0px 58px 0 0;
+ .ellipsis;
}
.desc {
font-size: 12px;
+ max-width: 400px;
color: @light-text-color;
margin-bottom: 8px;
+
+ .ellipsis;
}
.tag {
margin-bottom: 8px;
diff --git a/webapp/app/containers/Organizations/Organization.tsx b/webapp/app/containers/Organizations/Organization.tsx
index ea78812f6..4706cf8a8 100644
--- a/webapp/app/containers/Organizations/Organization.tsx
+++ b/webapp/app/containers/Organizations/Organization.tsx
@@ -23,6 +23,7 @@ import {
makeSelectCurrentOrganizations,
makeSelectCurrentOrganizationProjects,
makeSelectCurrentOrganizationProjectsDetail,
+ makeSelectCurrentOrganizationRole,
makeSelectCurrentOrganizationMembers,
makeSelectInviteMemberList
} from './selectors'
@@ -53,11 +54,13 @@ export class Organization extends React.PureComponent {
@@ -71,22 +74,34 @@ export class Organization extends React.PureComponent m.user.id === loginUser.id)
const isLoginUserOwner = !!memeberOfLoginUser && memeberOfLoginUser.user.role === 1
return (
@@ -108,7 +123,7 @@ export class Organization extends React.PureComponent {name}
- 项目{projectNum}} key="projects">
+ 项目{this.getProjectsTotal()}} key="projects">
- 成员{memberNum}} key="members">
+ 成员{this.getMembersTotal()}} key="members">
- 角色{roleNum}} key="roles">
+ 角色{this.getRolesTotal()}} key="roles">
dispatch(ProjectActions.getProjectStarUser(id)),
onLoadOrganizationProjects: (param) => dispatch(OrganizationActions.loadOrganizationProjects(param)),
+ onLoadOrganizationRole: (orgId) => dispatch(OrganizationActions.loadOrganizationRole(orgId)),
onLoadOrganizationMembers: (id) => dispatch(OrganizationActions.loadOrganizationMembers(id)),
onLoadOrganizationDetail: (id) => dispatch(OrganizationActions.loadOrganizationDetail(id)),
onEditOrganization: (organization) => dispatch(OrganizationActions.editOrganization(organization)),
diff --git a/webapp/app/containers/Organizations/component/Project.tsx b/webapp/app/containers/Organizations/component/Project.tsx
index 380728626..65017f308 100644
--- a/webapp/app/containers/Organizations/component/Project.tsx
+++ b/webapp/app/containers/Organizations/component/Project.tsx
@@ -99,6 +99,10 @@ export class ProjectsForm extends React.PureComponent 14 ? `${str.substr(0, 14)}...` : str
+ }
+
public render () {
const { type, organizations, modalLoading, onCheckUniqueName } = this.props
const { getFieldDecorator } = this.props.form
@@ -236,7 +240,7 @@ export class ProjectsForm extends React.PureComponent创建人 {createBy.username}
-
+
@@ -254,7 +258,7 @@ export class ProjectsForm extends React.PureComponent
-
+
diff --git a/webapp/app/containers/Organizations/component/ProjectList.tsx b/webapp/app/containers/Organizations/component/ProjectList.tsx
index c7ddd9b29..a761b64ee 100644
--- a/webapp/app/containers/Organizations/component/ProjectList.tsx
+++ b/webapp/app/containers/Organizations/component/ProjectList.tsx
@@ -347,7 +347,6 @@ export class ProjectList extends React.PureComponent<
vizs,
organizations
} = this.props
- const { id: userId } = loginUser
let CreateButton = void 0
if (currentOrganization) {
@@ -514,7 +513,11 @@ export function mapDispatchToProps(dispatch) {
}
}
-const withConnect = connect<{}, {}, IProjectsProps>(
+
+type MappedStates = ReturnType
+type MappedDispatches = ReturnType
+
+const withConnect = connect(
mapStateToProps,
mapDispatchToProps
)
diff --git a/webapp/app/containers/Organizations/component/RoleList.tsx b/webapp/app/containers/Organizations/component/RoleList.tsx
index 6977966a7..5398a96cf 100644
--- a/webapp/app/containers/Organizations/component/RoleList.tsx
+++ b/webapp/app/containers/Organizations/component/RoleList.tsx
@@ -4,17 +4,16 @@ import { createStructuredSelector } from 'reselect'
import RoleForm from './RoleForm'
import RelRoleMember from './RelRoleMember'
import { connect } from 'react-redux'
-
+import {FormComponentProps} from 'antd/lib/form'
import { Row, Col, Tooltip, Button, Input, Table, Modal, Popconfirm, Divider, message} from 'antd'
import { ColumnProps } from 'antd/lib/table'
const styles = require('../Organization.less')
-import * as Organization from '../Organization'
import {checkNameUniqueAction} from 'containers/App/actions'
import { OrganizationActions } from '../actions'
const { addRole, loadOrganizationRole, deleteRole, relRoleMember, editRole, getRelRoleMember } = OrganizationActions
import ComponentPermission from 'containers/Account/components/checkMemberPermission'
import { makeSelectRoleModalLoading, makeSelectCurrentOrganizationRole } from '../selectors'
-import { IOrganization } from '../types'
+import { IOrganization, IOrganizationRole } from '../types'
interface IRoleState {
formType: string
@@ -39,7 +38,7 @@ interface IRoleProps {
onGetRelRoleMember: (id: number, resolve: (result: any) => any) => any
onLoadOrganizationRole?: (orgId: number) => any
currentOrganization: IOrganization
- currentOrganizationRole: any
+ currentOrganizationRole: IOrganizationRole[]
organizationMembers: any[]
organizations: any
roleModalLoading?: boolean
@@ -88,11 +87,6 @@ export class RoleList extends React.PureComponent {
RelRoleMember: (ref) => this.RelRoleMember = ref
}
- public componentWillMount () {
- const {onLoadOrganizationRole, currentOrganization: {id}} = this.props
- onLoadOrganizationRole(id)
- }
-
private showRelRoleForm = (flag, roleId?: number) => (e) => {
const { onGetRelRoleMember } = this.props
e.stopPropagation()
@@ -189,12 +183,12 @@ export class RoleList extends React.PureComponent {
}
private handleDelete = (roleId) => () => {
- const {onDeleteRole, onLoadOrganizationRole, currentOrganization: {id}} = this.props
- onLoadOrganizationRole(id)
+ const {onDeleteRole} = this.props
+ this.loadOrganizationRole()
if (roleId) {
onDeleteRole(roleId, () => {
message.success('删除成功')
- onLoadOrganizationRole(id)
+ this.loadOrganizationRole()
})
}
}
@@ -222,19 +216,19 @@ export class RoleList extends React.PureComponent {
private createOrRole = () => {
const {formType} = this.state
- const {onAddRole, onEditRole, onLoadOrganizationRole} = this.props
+ const {onAddRole, onEditRole} = this.props
this.RoleForm.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const {name, description, id} = values
const orgId = this.props.currentOrganization.id
if (formType === 'add') {
onAddRole(name, description, orgId, () => {
- onLoadOrganizationRole(orgId)
+ this.loadOrganizationRole()
this.hideTeamForm()
})
} else {
onEditRole(name, description, id, () => {
- onLoadOrganizationRole(orgId)
+ this.loadOrganizationRole()
this.hideTeamForm()
})
}
@@ -375,6 +369,8 @@ export class RoleList extends React.PureComponent {
}
}
+type MappedStates = ReturnType
+type MappedDispatches = ReturnType
const mapStateToProps = createStructuredSelector({
roleModalLoading: makeSelectRoleModalLoading(),
@@ -393,6 +389,6 @@ export function mapDispatchToProps (dispatch) {
}
}
-export default connect<{}, {}, IRoleProps>(mapStateToProps, mapDispatchToProps)(RoleList)
+export default connect(mapStateToProps, mapDispatchToProps)(RoleList)
diff --git a/webapp/app/containers/Organizations/component/Setting.tsx b/webapp/app/containers/Organizations/component/Setting.tsx
index f29d36a3c..2d20ee90d 100644
--- a/webapp/app/containers/Organizations/component/Setting.tsx
+++ b/webapp/app/containers/Organizations/component/Setting.tsx
@@ -1,6 +1,7 @@
import React from 'react'
const styles = require('../Organization.less')
import { Button, Input, Form, Row, Col, Radio, Modal } from 'antd'
+import {FormComponentProps} from 'antd/lib/form'
const FormItem = Form.Item
const RadioButton = Radio.Button
import UploadAvatar from 'components/UploadAvatar'
@@ -130,36 +131,6 @@ export class Setting extends React.PureComponent {
)}
- {/**/}
- {/**/}
- {/*{getFieldDecorator('allowDeleteOrTransferProject', {*/}
- {/*initialValue: true*/}
- {/*})(*/}
- {/**/}
- {/*禁止*/}
- {/*允许*/}
- {/**/}
- {/*)}*/}
- {/**/}
- {/**/}
- {/**/}
- {/**/}
- {/*{getFieldDecorator('allowChangeVisibility', {*/}
- {/*initialValue: true*/}
- {/*})(*/}
- {/**/}
- {/*禁止*/}
- {/*允许*/}
- {/**/}
- {/*)}*/}
- {/**/}
- {/**/}
{
不可见任何
只可见公开
- {/* 修改
- 删除 */}
)}
@@ -205,7 +174,7 @@ export class Setting extends React.PureComponent {
}
}
-export default Form.create()(Setting)
+export default Form.create()(Setting)
diff --git a/webapp/app/containers/Organizations/component/TeamForm.tsx b/webapp/app/containers/Organizations/component/TeamForm.tsx
deleted file mode 100644
index 665ec9d34..000000000
--- a/webapp/app/containers/Organizations/component/TeamForm.tsx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
-
-import React from 'react'
-import { Form, Row, Col, Input, Button, Select } from 'antd'
-const FormItem = Form.Item
-const TextArea = Input.TextArea
-const Option = Select.Option
-import Avatar from 'components/Avatar'
-const styles = require('../Organization.less')
-import { ITeam } from './RoleList'
-
-
-
-interface IProjectsFormProps {
- listType: string
- type: string
- form: any
- orgId: number
- teams: ITeam[]
- modalLoading: boolean
- onModalOk: () => any
- onWidgetTypeChange: () => any
- onOrganizationTypeChange: () => any
- onCheckUniqueName: (pathname: any, data: any, resolve: () => any, reject: (error: string) => any) => any
-}
-
-export class ProjectsForm extends React.PureComponent {
- private filterTeamsByOrg = (teams) => {
- if (teams) {
- const { orgId } = this.props
- const result = teams.filter((team) => {
- if (team.organization.id === orgId) {
- return team
- }
- })
- return result
- }
- }
- public render () {
- const { onOrganizationTypeChange, modalLoading, teams, listType } = this.props
- const { getFieldDecorator } = this.props.form
-
- const filterTeams = this.filterTeamsByOrg(teams)
- const teamsOptions = filterTeams ? filterTeams.map((o) => (
-
- )) : ''
-
- const commonFormItemStyle = {
- labelCol: { span: 3 },
- wrapperCol: { span: 24 }
- }
-
- const modalButtons = [(
-
- )]
- return (
-
-
-
- 创建团队
-
-
- 团队隶属于组织,可以在团队中指定项目的模块权限
-
-
-
-
-
-
- {modalButtons}
-
-
- )
- }
-}
-
-export default Form.create()(ProjectsForm)
diff --git a/webapp/app/containers/Organizations/types.ts b/webapp/app/containers/Organizations/types.ts
index 004be4da0..a2c393d07 100644
--- a/webapp/app/containers/Organizations/types.ts
+++ b/webapp/app/containers/Organizations/types.ts
@@ -186,6 +186,7 @@ export interface IOrganizationProps {
inviteMemberList: any
currentOrganization: IOrganization
collectProjects: IProject[]
+ currentOrganizationRole: IOrganizationRole[]
onLoadOrganizationProjects: (param: {id: number, pageNum?: number, pageSize?: number}) => any
onLoadOrganizationMembers: (id: number) => any
onLoadOrganizationDetail: (id: number) => any
@@ -202,6 +203,7 @@ export interface IOrganizationProps {
onDeleteOrganization: (id: number, resolve: () => any) => any
onCheckUniqueName: (pathname: any, data: any, resolve: () => any, reject: (error: string) => any) => any
onGetRoleListByMemberId: onGetRoleListByMemberId
+ onLoadOrganizationRole: (id: number) => any
}
export interface IInviteMemberProps {