Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
21d75bb6
Commit
21d75bb6
authored
Sep 01, 2022
by
wuyongsheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加项目成员优化
parent
ca0fc530
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
294 additions
and
128 deletions
+294
-128
api_manager.ts
src/api/api_manager.ts
+4
-1
project_api.ts
src/api/project_api.ts
+32
-1
index.tsx
src/components/mui/MyTable/index.tsx
+190
-79
interface.ts
src/components/mui/MyTable/interface.ts
+5
-2
index.tsx
src/views/ConsoleLayout/components/TransferList/index.tsx
+1
-1
AddMember.tsx
...ct/ProjectSetting/ProjectMembers/components/AddMember.tsx
+49
-32
index.tsx
src/views/Project/ProjectWorkbench/workbenchList/index.tsx
+13
-12
No files found.
src/api/api_manager.ts
View file @
21d75bb6
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-13 09:56:57
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-0
8-15 17:10:49
* @LastEditTime: 2022-0
9-01 15:30:28
* @FilePath: /bkunyun/src/api/api_manager.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -45,6 +45,9 @@ const RESTAPI = {
API_TASK_OVERVIEW_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflowJobInformation`
,
// 查询任务概览
API_OPERATOR_LISTSTREAMACTORS
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/liststreamactors`
,
// 获取流算子列表,可用于模糊查询,返回所有版本流算子
API_SAVE_BATCHACTOR
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/workflow/savebatchactor`
,
// 保存批算子
API_PROJECT_USERS_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/project/listusers`
,
// 获取项目成员
API_ADD_PROJECT_USER
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/project/updatemember`
,
// 添加项目成员
API_GET_PROJECT_POWER
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/project/listroles`
,
// 获取项目权限
};
export
default
RESTAPI
;
src/api/project_api.ts
View file @
21d75bb6
...
...
@@ -318,6 +318,34 @@ const saveBatchActor = (params: saveBatchParams) => {
});
};
// 获取项目成员
const
fetchProjectUsersList
=
(
params
:
{
id
:
string
})
=>
{
return
request
({
url
:
Api
.
API_PROJECT_USERS_LIST
,
method
:
"get"
,
params
,
});
};
// 修改项目成员信息
const
addProjectUser
=
(
id
:
string
,
params
:
any
)
=>
{
return
request
({
url
:
`
${
Api
.
API_ADD_PROJECT_USER
}
?id=
${
id
}
`
,
method
:
"put"
,
data
:
params
,
});
};
// 获取项目权限
const
fetchProjectPower
=
(
params
:
{
id
:
string
})
=>
{
return
request
({
url
:
Api
.
API_GET_PROJECT_POWER
,
method
:
"get"
,
params
,
});
};
export
{
current
,
menu
,
...
...
@@ -342,5 +370,8 @@ export {
getTaskOverview
,
getOperatorList
,
saveBatchActor
,
fetchFlowOutputNumber
fetchFlowOutputNumber
,
fetchProjectUsersList
,
addProjectUser
,
fetchProjectPower
};
src/components/mui/MyTable/index.tsx
View file @
21d75bb6
import
React
,
{
useCallback
,
useState
}
from
"react"
;
import
React
,
{
useCallback
,
useState
}
from
"react"
;
import
Table
from
"@mui/material/Table"
;
import
TableBody
from
"@mui/material/TableBody"
;
import
TableCell
from
"@mui/material/TableCell"
;
import
TableContainer
from
"@mui/material/TableContainer"
;
import
{
TablePagination
}
from
'@mui/material'
;
import
{
TablePagination
}
from
"@mui/material"
;
import
TableRow
from
"@mui/material/TableRow"
;
import
Paper
from
"@mui/material/Paper"
;
import
Checkbox
from
"@mui/material/Checkbox"
;
import
{
useEffect
}
from
"react"
;
import
{
useImperativeHandle
}
from
"react"
;
// import Spin from "./Spin
";
import
MyCircularProgress
from
"@/components/mui/MyCircularProgress
"
;
import
EnhancedTableHeadComponent
from
"./components/EnhancedTableHead"
import
EnhancedTableHeadComponent
from
"./components/EnhancedTableHead"
;
import
{
getComparator
,
stableSort
,
useStyles
}
from
"./utils"
;
import
ActionsComponent
from
"./components/ActionsComponent"
;
import
{
ITableProps
}
from
'./interface'
import
{
ITableProps
}
from
"./interface"
;
export
default
function
EnhancedTable
(
props
:
ITableProps
)
{
const
classes
:
any
=
useStyles
;
const
[
order
,
setOrder
]
=
useState
(
"asc"
);
const
[
orderBy
,
setOrderBy
]
=
useState
(
""
);
const
{
headCells
,
rows
,
footer
=
true
,
elevation1
,
tableStyle
,
tableCellStyle
,
tableContainerStyle
,
stickyHeader
,
onRowClick
,
defaultRow
,
minHeight
=
''
,
borderBottom
=
''
,
onDoubleClick
,
load
,
size
,
checkboxData
,
rowsPerPage
=
10
,
initSelected
,
page
=
0
,
changePage
=
function
()
{
},
toolbar
,
count
,
param
,
disabledParam
=
"id"
,
headTableCellCheckbox
,
RowHeight
=
''
,
CellWidth
=
''
,
rowHover
,
TableNodataPadding
=
''
,
TableNodataLineHeight
=
''
,
tableBodySx
,
radioClick
}
=
props
;
const
{
headCells
,
rows
,
footer
=
true
,
elevation1
,
tableStyle
,
tableCellStyle
,
tableContainerStyle
,
stickyHeader
,
onRowClick
,
defaultRow
,
minHeight
=
""
,
borderBottom
=
""
,
onDoubleClick
,
loading
=
false
,
noDataText
=
"暂无数据"
,
size
,
checkboxData
,
rowsPerPage
=
10
,
initSelected
,
page
=
0
,
changePage
=
function
()
{},
toolbar
,
count
,
param
,
disabledParam
=
"id"
,
headTableCellCheckbox
,
RowHeight
=
""
,
CellWidth
=
""
,
rowHover
,
TableNodataPadding
=
""
,
TableNodataLineHeight
=
""
,
tableBodySx
,
radioClick
,
}
=
props
;
const
[
selected
,
setSelected
]
=
useState
(
initSelected
||
[]);
const
[
rowsPerPageOptions
]
=
useState
(
initSelected
||
[
5
,
10
,
20
,
50
,
{
value
:
-
1
,
label
:
'All'
}]);
const
[
onRow
,
setOnRow
]
=
useState
(
''
)
const
[
rowsPerPageOptions
]
=
useState
(
initSelected
||
[
5
,
10
,
20
,
50
,
{
value
:
-
1
,
label
:
"All"
}]
);
const
[
onRow
,
setOnRow
]
=
useState
(
""
);
// 重置复选框选中选项
const
initSelectedFunc
=
(
e
:
any
)
=>
{
setSelected
(
e
)
}
setSelected
(
e
);
};
useImperativeHandle
(
props
.
onRef
,
()
=>
{
return
{
...
...
@@ -38,13 +73,13 @@ export default function EnhancedTable(props: ITableProps) {
});
useEffect
(()
=>
{
setOnRow
(
defaultRow
)
},
[
defaultRow
])
setOnRow
(
defaultRow
);
},
[
defaultRow
]);
const
onRowClickDefault
=
(
value
:
any
)
=>
{
setOnRow
(
value
)
onRowClick
&&
onRowClick
(
value
)
}
setOnRow
(
value
);
onRowClick
&&
onRowClick
(
value
);
};
const
handleRequestSort
=
(
event
:
any
,
property
:
any
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
...
...
@@ -54,7 +89,7 @@ export default function EnhancedTable(props: ITableProps) {
const
handleSelectAllClick
=
(
event
:
any
)
=>
{
if
(
event
.
target
.
checked
)
{
const
newSelecteds
=
rows
.
map
((
n
:
any
)
=>
n
[
param
||
'id'
]);
const
newSelecteds
=
rows
.
map
((
n
:
any
)
=>
n
[
param
||
"id"
]);
setSelected
(
newSelecteds
);
checkboxData
(
newSelecteds
);
return
;
...
...
@@ -78,13 +113,13 @@ export default function EnhancedTable(props: ITableProps) {
selected
.
slice
(
selectedIndex
+
1
)
);
}
checkboxData
(
newSelected
)
checkboxData
(
newSelected
);
setSelected
(
newSelected
);
};
const
handleRadioClick
=
(
id
:
string
)
=>
{
setSelected
(
id
)
}
setSelected
(
id
);
};
const
handleOnPageChange
=
(
event
:
any
,
newPage
:
number
)
=>
{
changePage
(
newPage
,
Number
(
rowsPerPage
));
...
...
@@ -98,27 +133,39 @@ export default function EnhancedTable(props: ITableProps) {
// const emptyRows = rowsPerPage - Math.min(rowsPerPage, rows.length - page * rowsPerPage);
const
renderTableCellValue
=
useCallback
(((
item
:
any
,
row
:
any
,
index
:
number
)
=>
{
if
(
item
.
render
)
{
return
<>
{
item
.
render
(
row
[
item
.
id
],
row
,
index
)
}
</>
}
else
if
(
row
[
item
.
id
])
{
return
row
[
item
.
id
]
||
'-'
const
renderTableCellValue
=
useCallback
(
(
item
:
any
,
row
:
any
,
index
:
number
)
=>
{
if
(
item
.
render
)
{
return
<>
{
item
.
render
(
row
[
item
.
id
],
row
,
index
)
}
</>;
}
else
if
(
row
[
item
.
id
])
{
return
row
[
item
.
id
]
||
"-"
;
}
else
{
return
'-'
return
"-"
;
}
}),[])
},
[]
);
return
(
<
div
className=
{
classes
.
root
}
>
<
Paper
sx=
{
{
boxShadow
:
'none'
}
}
className=
{
classes
.
paper
}
classes=
{
{
elevation1
:
elevation1
||
classes
.
elevation1
}
}
>
{
/* <Spin spin={spin} /> */
}
<
Paper
sx=
{
{
boxShadow
:
"none"
,
}
}
className=
{
classes
.
paper
}
classes=
{
{
elevation1
:
elevation1
||
classes
.
elevation1
}
}
>
{
toolbar
&&
toolbar
}
<
TableContainer
style=
{
{
...
tableContainerStyle
}
}
>
<
Table
stickyHeader=
{
stickyHeader
||
false
}
className=
{
classes
.
table
}
style=
{
{
...
tableStyle
}
}
aria
-
labelledby=
"tableTitle"
size=
{
size
||
"medium"
}
aria
-
label=
"cloudam table header"
>
<
Table
stickyHeader=
{
stickyHeader
||
false
}
className=
{
classes
.
table
}
style=
{
{
...
tableStyle
}
}
aria
-
labelledby=
"tableTitle"
size=
{
size
||
"medium"
}
aria
-
label=
"cloudam table header"
>
<
MyCircularProgress
loading=
{
loading
}
>
<
EnhancedTableHeadComponent
classes=
{
classes
()
}
{
...
props
}
...
...
@@ -131,38 +178,81 @@ export default function EnhancedTable(props: ITableProps) {
rowCount=
{
rows
.
length
}
headCells=
{
headCells
||
[]
}
/>
<
TableBody
sx=
{
{
...
tableBodySx
}
}
>
{
(
rows
.
length
===
0
&&
!
load
)
&&
<
TableRow
>
<
TableBody
sx=
{
{
...
tableBodySx
,
}
}
>
{
rows
.
length
===
0
&&
!
loading
&&
(
<
TableRow
>
<
TableCell
sx=
{
{
borderBottom
:
'1px solid #F0F2F5'
,
textAlign
:
'center'
borderBottom
:
"1px solid #F0F2F5"
,
textAlign
:
"center"
,
color
:
"#8A9099"
,
}
}
colSpan=
{
headCells
?.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
)?.
length
===
0
?
headCells
?.
length
:
headCells
?.
length
+
1
}
colSpan=
{
headCells
?.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
)
?.
length
===
0
?
headCells
?.
length
:
headCells
?.
length
+
1
}
className=
{
classes
.
TypographyStyle
}
style=
{
{
minHeight
:
minHeight
,
height
:
minHeight
,
borderBottom
:
borderBottom
,
padding
:
TableNodataPadding
,
lineHeight
:
TableNodataLineHeight
}
}
style=
{
{
minHeight
:
minHeight
,
height
:
minHeight
,
borderBottom
:
borderBottom
,
padding
:
TableNodataPadding
,
lineHeight
:
TableNodataLineHeight
,
}
}
>
No Data
{
noDataText
}
</
TableCell
>
</
TableRow
>
}
{
stableSort
(
rows
,
getComparator
(
order
,
orderBy
)).
slice
(
page
*
Number
(
rowsPerPage
),
page
*
Number
(
rowsPerPage
)
+
Number
(
rowsPerPage
)).
map
((
row
:
any
,
index
:
number
)
=>
{
)
}
{
stableSort
(
rows
,
getComparator
(
order
,
orderBy
))
.
slice
(
page
*
Number
(
rowsPerPage
),
page
*
Number
(
rowsPerPage
)
+
Number
(
rowsPerPage
)
)
.
map
((
row
:
any
,
index
:
number
)
=>
{
const
isItemSelected
=
isSelected
(
row
[
param
||
"id"
]);
const
labelId
=
`enhanced-table-checkbox-${index}`
;
return
(
<
TableRow
hover=
{
rowHover
?
false
:
(
row
[
disabledParam
||
"enabled"
]
?
true
:
false
)
}
hover=
{
rowHover
?
false
:
row
[
disabledParam
||
"enabled"
]
?
true
:
false
}
onDoubleClick=
{
()
=>
{
onDoubleClick
&&
onDoubleClick
(
row
)
onDoubleClick
&&
onDoubleClick
(
row
);
}
}
style=
{
{
height
:
RowHeight
,
border
:
onRow
===
row
[
param
||
"id"
]
?
!
row
[
disabledParam
]
?
""
:
'1px solid #136EFA'
:
""
,
backgroundColor
:
onRow
===
row
[
param
||
"id"
]
?
!
row
[
disabledParam
]
?
"rgba(255, 255, 255, 0.4)"
:
"rgba(19, 110, 250, 0.1)"
:
""
,
cursor
:
props
.
cursor
?
(
row
[
props
.
cursor
]
?
"pointer"
:
"auto"
)
:
(
onRowClick
?
!
row
[
disabledParam
]
?
"no-drop"
:
"pointer"
:
"auto"
),
border
:
onRow
===
row
[
param
||
"id"
]
?
!
row
[
disabledParam
]
?
""
:
"1px solid #136EFA"
:
""
,
backgroundColor
:
onRow
===
row
[
param
||
"id"
]
?
!
row
[
disabledParam
]
?
"rgba(255, 255, 255, 0.4)"
:
"rgba(19, 110, 250, 0.1)"
:
""
,
cursor
:
props
.
cursor
?
row
[
props
.
cursor
]
?
"pointer"
:
"auto"
:
onRowClick
?
!
row
[
disabledParam
]
?
"no-drop"
:
"pointer"
:
"auto"
,
}
}
role=
"checkbox"
aria
-
checked=
{
isItemSelected
}
...
...
@@ -170,53 +260,75 @@ export default function EnhancedTable(props: ITableProps) {
key=
{
row
[
param
||
"id"
]
||
index
}
selected=
{
isItemSelected
}
onClick=
{
()
=>
{
radioClick
&&
radioClick
(
row
)
radioClick
&&
handleRadioClick
(
row
[
param
||
"id"
])
radioClick
&&
radioClick
(
row
);
radioClick
&&
handleRadioClick
(
row
[
param
||
"id"
]);
}
}
>
{
headCells
.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
).
length
>
0
&&
<
TableCell
{
headCells
.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
)
.
length
>
0
&&
(
<
TableCell
sx=
{
{
borderBottom
:
'1px solid #F0F2F5'
borderBottom
:
"1px solid #F0F2F5"
,
}
}
onClick=
{
(
event
)
=>
{
// if (!row[disabledParam]) return;
onRowClick
&&
onRowClickDefault
(
row
[
param
||
"id"
])
headCells
.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
).
length
>
0
&&
handleClick
(
event
,
row
[
param
||
"id"
])
onRowClick
&&
onRowClickDefault
(
row
[
param
||
"id"
]);
headCells
.
filter
((
k
:
any
)
=>
k
.
id
===
"checkbox"
)
.
length
>
0
&&
handleClick
(
event
,
row
[
param
||
"id"
]);
}
}
padding=
"checkbox"
>
<
Checkbox
sx=
{
{
color
:
'#D1D6DE'
}
}
color=
{
"primary"
}
checked=
{
isItemSelected
}
inputProps=
{
{
"aria-labelledby"
:
labelId
}
}
/>
padding=
"checkbox"
>
<
Checkbox
sx=
{
{
color
:
"#D1D6DE"
}
}
color=
{
"primary"
}
checked=
{
isItemSelected
}
inputProps=
{
{
"aria-labelledby"
:
labelId
}
}
/>
</
TableCell
>
}
{
headCells
.
filter
((
item
:
any
)
=>
item
.
id
!==
'checkbox'
).
map
((
item
:
any
,
k
:
any
)
=>
{
)
}
{
headCells
.
filter
((
item
:
any
)
=>
item
.
id
!==
"checkbox"
)
.
map
((
item
:
any
,
k
:
any
)
=>
{
return
(
<
TableCell
key=
{
k
}
component=
"th"
id=
{
labelId
+
k
}
<
TableCell
key=
{
k
}
component=
"th"
id=
{
labelId
+
k
}
sx=
{
{
borderBottom
:
'1px solid #F0F2F5'
borderBottom
:
"1px solid #F0F2F5"
,
}
}
// align=
{}
style=
{
{
width
:
CellWidth
,
textAlign
:
item
.
numeric
?
"right"
:
"left"
,
paddingRight
:
item
.
sort
&&
item
.
numeric
?
"40px"
:
""
,
border
:
tableCellStyle
}
}
style=
{
{
width
:
CellWidth
,
textAlign
:
item
.
numeric
?
"right"
:
"left"
,
paddingRight
:
item
.
sort
&&
item
.
numeric
?
"40px"
:
""
,
border
:
tableCellStyle
,
}
}
scope=
"row"
padding=
{
item
.
disablePadding
?
"none"
:
"normal"
}
padding=
{
item
.
disablePadding
?
"none"
:
"normal"
}
classes=
{
{
body
:
classes
.
bodyTableCell
body
:
classes
.
bodyTableCell
,
}
}
>
{
renderTableCellValue
(
item
,
row
,
index
)
}
>
{
" "
}
{
renderTableCellValue
(
item
,
row
,
index
)
}
</
TableCell
>
)
})
}
);
})
}
</
TableRow
>
);
})
}
</
TableBody
>
</
MyCircularProgress
>
</
Table
>
</
TableContainer
>
{
footer
?
<
TablePagination
{
footer
?
(
<
TablePagination
rowsPerPageOptions=
{
rowsPerPageOptions
}
component=
"div"
count=
{
count
||
rows
.
length
}
...
...
@@ -225,9 +337,8 @@ export default function EnhancedTable(props: ITableProps) {
ActionsComponent=
{
ActionsComponent
}
onPageChange=
{
handleOnPageChange
}
onRowsPerPageChange=
{
handleChangeRowsPerPage
}
/>
:
null
}
/>
)
:
null
}
</
Paper
>
</
div
>
);
...
...
src/components/mui/MyTable/interface.ts
View file @
21d75bb6
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生 15770852798@163.com
* @Date: 2022-07-26 10:23:43
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-0
7-26 11:53:00
* @LastEditTime: 2022-0
9-01 16:00:34
* @FilePath: /bkunyun/src/components/mui/MyTable/interface.ts
* @Description: 这是默认设置,请设置`customMade`,打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -32,7 +32,7 @@ export interface ITableProps {
/** 每行双击事件 */
onDoubleClick
?:
any
,
/** 是否loading */
load
?:
boolean
,
load
ing
?:
boolean
,
/** table size */
size
?:
any
,
/** 选中的checkbox数据 */
...
...
@@ -71,4 +71,6 @@ export interface ITableProps {
onRef
?:
any
;
/** 手型 */
cursor
?:
string
/** 没有数据文案 */
noDataText
?:
string
}
\ No newline at end of file
src/views/ConsoleLayout/components/TransferList/index.tsx
View file @
21d75bb6
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-10 18:05:21
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-09-01 1
4:09:28
* @LastEditTime: 2022-09-01 1
5:54:33
* @FilePath: /bkunyun/src/views/ConsoleLayout/components/TransferList/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
src/views/Project/ProjectSetting/ProjectMembers/components/AddMember.tsx
View file @
21d75bb6
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-09-01 1
4:09:34
* @LastEditTime: 2022-09-01 1
6:14:10
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -13,12 +13,17 @@ import { memo, useCallback, useEffect, useMemo, useState } from "react";
import
{
Box
,
OutlinedInput
}
from
"@mui/material"
;
import
Dialog
from
"@/components/mui/MyDialog"
;
import
{
IResponse
,
useHttp
}
from
"@/api/http
"
;
import
useMyRequest
from
"@/hooks/useMyRequest
"
;
import
{
useStores
}
from
"@/store"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
MySelect
,
{
IOption
}
from
"@/components/mui/MySelect"
;
import
MyTable
from
"@/components/mui/MyTable"
;
import
SearchInput
from
"@/components/BusinessComponents/SearchInput"
;
import
{
addProjectUser
,
fetchProjectPower
,
fetchProjectUsersList
,
}
from
"@/api/project_api"
;
interface
IProps
{
setAddMemberDialog
:
(
val
:
boolean
)
=>
void
;
...
...
@@ -29,7 +34,6 @@ interface IProps {
const
AddMember
=
observer
((
props
:
IProps
)
=>
{
const
{
addMemberDialog
,
setAddMemberDialog
,
getTableList
}
=
props
;
const
http
=
useHttp
();
const
{
currentProjectStore
}
=
useStores
();
const
[
tableData
,
setTableData
]
=
useState
([]);
...
...
@@ -76,14 +80,6 @@ const AddMember = observer((props: IProps) => {
];
},
[
changePermission
,
selectOptions
]);
useEffect
(()
=>
{
if
(
addMemberDialog
)
{
http
.
get
<
IResponse
<
any
>
>
("/cpp/project/listroles").then((res) =
>
{
setSelectOptions
(
res
.
data
);
}
);
}
}, [addMemberDialog, http]);
/** 过滤表格数据 */
useEffect
(()
=>
{
if
(
!!
projectMember
)
{
...
...
@@ -97,18 +93,48 @@ const AddMember = observer((props: IProps) => {
}
},
[
projectMember
,
tableData
]);
// 获取表格数据接口
const
{
run
:
getProjectUsersList
}
=
useMyRequest
(
fetchProjectUsersList
,
{
onSuccess
:
(
res
:
any
)
=>
{
setTableData
(
res
?.
data
);
},
});
// 获取项目权限
const
{
run
:
getProjectPower
}
=
useMyRequest
(
fetchProjectPower
,
{
onSuccess
:
(
res
:
any
)
=>
{
setSelectOptions
(
res
.
data
);
},
});
// 添加项目成员
const
{
run
:
saveProjectUser
}
=
useMyRequest
(
addProjectUser
,
{
onSuccess
:
(
res
:
any
)
=>
{
const
{
errorCode
}
=
res
;
if
(
errorCode
===
0
)
{
Message
.
success
(
"新增成功!"
);
getTableList
();
setAddMemberDialog
(
false
);
}
},
});
useEffect
(()
=>
{
if
(
addMemberDialog
)
{
getProjectPower
();
}
},
[
addMemberDialog
,
getProjectPower
]);
/** 获取表格数据 */
useEffect
(()
=>
{
if
(
!
addMemberDialog
)
return
;
const
projectInfo
=
toJS
(
currentProjectStore
?.
currentProjectInfo
);
http
.
get
<
IResponse
<
any
>
>
("/cpp/project/listusers",
{
params
:
{
id
:
projectInfo
?.
id
||
""
},
}
)
.then((res) =
>
{
setTableData
(
res
?.
data
);
}
);
}
, [currentProjectStore?.currentProjectInfo, http, addMemberDialog]);
getProjectUsersList
({
id
:
projectInfo
?.
id
||
""
});
},
[
currentProjectStore
?.
currentProjectInfo
,
addMemberDialog
,
getProjectUsersList
,
]);
const
onClose
=
(
event
:
any
=
{},
reason
:
any
=
"other"
)
=>
{
// 点击弹窗外不关闭弹窗
...
...
@@ -124,19 +150,7 @@ const AddMember = observer((props: IProps) => {
return
checkData
.
includes
(
item
?.
username
);
});
if
(
params
.
length
)
{
http
.
put
<
IResponse
<
any
>>
(
`/cpp/project/updatemember?id=${projectInfo?.id || ""}`
,
params
)
.
then
((
res
)
=>
{
const
{
errorCode
}
=
res
;
if
(
errorCode
===
0
)
{
Message
.
success
(
"新增成功!"
);
getTableList
();
setAddMemberDialog
(
false
);
}
});
saveProjectUser
(
projectInfo
?.
id
||
""
,
params
);
}
else
{
Message
.
info
(
"请先选择项目成员!"
);
}
...
...
@@ -162,6 +176,9 @@ const AddMember = observer((props: IProps) => {
/>
<
div
style=
{
{
overflow
:
"overlay"
,
maxHeight
:
400
}
}
>
<
MyTable
noDataText=
{
projectMember
?
`暂无 "${projectMember}" 搜索结果`
:
undefined
}
tableContainerStyle=
{
{
height
:
346
}
}
checkboxData=
{
(
val
:
string
[])
=>
setCheckData
(
val
)
}
param=
"username"
...
...
src/views/Project/ProjectWorkbench/workbenchList/index.tsx
View file @
21d75bb6
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-0
8-22 15:33
:02
* @LastEditTime: 2022-0
9-01 16:35
:02
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -87,13 +87,11 @@ const ProjectMembers = observer(() => {
const
[
jobData
,
setJobData
]
=
useState
(
""
);
const
[
openDialog
,
setOpenDialog
]
=
useState
(
false
);
const
[
dialogType
,
setDialogType
]
=
useState
(
"del"
);
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
loading
,
setLoading
]
=
useState
(
false
)
;
// 获取作业列表
const
{
run
:
getWorkflowJobInfo
}
=
useMyRequest
(
getWorkflowJobList
,
{
const
{
run
:
getWorkflowJobInfo
}
=
useMyRequest
(
getWorkflowJobList
,
{
onSuccess
:
(
result
:
any
)
=>
{
setLoading
(
false
)
setLoading
(
false
);
setJobList
(
result
.
data
.
content
);
setCount
(
result
.
data
.
totalElements
);
timer
&&
clearTimeout
(
timer
as
number
);
...
...
@@ -108,8 +106,7 @@ const ProjectMembers = observer(() => {
});
},
60000
);
},
}
);
});
useEffect
(()
=>
{
return
()
=>
{
...
...
@@ -298,7 +295,7 @@ const ProjectMembers = observer(() => {
const
handleKeyWordChangeKeyUp
=
(
e
:
any
)
=>
{
if
(
e
.
keyCode
===
13
)
{
setJobName
(
e
.
target
.
value
);
setLoading
(
true
)
setLoading
(
true
)
;
}
};
...
...
@@ -367,7 +364,7 @@ const ProjectMembers = observer(() => {
name
:
jobName
,
state
:
currency
===
"ALL"
?
""
:
currency
,
});
setLoading
(
true
)
setLoading
(
true
)
;
}
}
>
<
img
alt=
""
src=
{
onload
}
/>
...
...
@@ -375,7 +372,7 @@ const ProjectMembers = observer(() => {
</
Box
>
<
Box
className=
{
styles
.
body
}
style=
{
{
position
:
"relative"
}
}
>
<
MyCircularProgress
loading=
{
loading
}
/
>
<
MyCircularProgress
loading=
{
loading
}
>
{
jobList
.
length
===
0
&&
!
loading
&&
(
<
Box
sx=
{
{
...
...
@@ -397,7 +394,10 @@ const ProjectMembers = observer(() => {
{
jobList
.
length
>
0
&&
jobList
.
map
((
item
:
any
,
key
)
=>
{
return
(
<
Box
className=
{
styles
.
tabBox
}
onClick=
{
()
=>
rowClick
(
item
.
id
)
}
>
<
Box
className=
{
styles
.
tabBox
}
onClick=
{
()
=>
rowClick
(
item
.
id
)
}
>
<
Box
className=
{
styles
.
tabBoxInfo
}
>
<
div
className=
{
styles
.
tabBoxTitle
}
>
{
item
.
name
}
</
div
>
<
Box
className=
{
styles
.
tabBoxDescInfo
}
>
...
...
@@ -493,6 +493,7 @@ const ProjectMembers = observer(() => {
</
Box
>
);
})
}
</
MyCircularProgress
>
</
Box
>
<
TablePagination
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment