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
sunyihao
bkunyun
Commits
a194e03a
Commit
a194e03a
authored
Jul 05, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220620-taskSubmission' into feat-20220705-customTemplate
parents
deb97f9f
c85ccbe7
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
131 additions
and
74 deletions
+131
-74
project_api.ts
src/api/project_api.ts
+2
-2
useMyRouter.ts
src/components/MyRouter/useMyRouter.ts
+2
-27
MyPopconfirm.tsx
src/components/mui/MyPopconfirm.tsx
+8
-2
currentProject.ts
src/store/modules/currentProject.ts
+20
-3
index.tsx
src/views/ConsoleLayout/index.tsx
+43
-3
index.tsx
src/views/MenuLayout/index.tsx
+9
-1
index.tsx
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
+7
-1
index.tsx
src/views/Project/ProjectSubmitWork/index.tsx
+2
-4
util.ts
src/views/Project/ProjectSubmitWork/util.ts
+22
-20
index.tsx
src/views/Project/components/AddProject/index.tsx
+5
-6
index.tsx
src/views/Project/components/CurrentProject/index.tsx
+5
-3
project.ts
src/views/Project/project.ts
+6
-2
No files found.
src/api/project_api.ts
View file @
a194e03a
...
...
@@ -21,7 +21,7 @@ type projectListParams = {
};
// 查询当前用户可以看到的项目列表
const
produc
t
=
(
params
:
projectListParams
)
=>
{
const
getProjectLis
t
=
(
params
:
projectListParams
)
=>
{
return
request
({
url
:
Api
.
API_PROJECT_LIST
,
method
:
"get"
,
...
...
@@ -246,7 +246,7 @@ const getworkFlowTaskInfo = (params: { jobId: string; taskId: string }) => {
export
{
current
,
menu
,
produc
t
,
getProjectLis
t
,
hpczone
,
addProject
,
getProject
,
...
...
src/components/MyRouter/useMyRouter.ts
View file @
a194e03a
import
{
useStores
}
from
"@/store/index"
;
import
{
elements
}
from
"@/router"
;
import
{
current
}
from
"@/api/demo_api"
;
import
{
product
}
from
"@/api/project_api"
;
import
localStorageKey
from
"@/utils/localStorageKey"
;
import
NotFound
from
"@/views/404"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
useEffect
}
from
"react"
;
import
{
menu
}
from
"@/api/routes_api"
;
import
{
setFileServerEndPointLocalStorage
,
getFiletokenAccordingToId
,
}
from
"@/views/Project/project"
;
const
useMyRouter
=
()
=>
{
const
{
permissionStore
,
menuStore
,
currentProjectStore
}
=
useStores
();
const
{
permissionStore
,
menuStore
}
=
useStores
();
const
userInfo
=
useMyRequest
(
current
);
const
menuInfo
=
useMyRequest
(
menu
);
const
productInfo
=
useMyRequest
(
product
);
useEffect
(()
=>
{
userInfo
.
run
();
menuInfo
.
run
();
productInfo
.
run
({
product
:
"CADD"
,
});
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[]);
...
...
@@ -47,24 +38,8 @@ const useMyRouter = () => {
permissionStore
.
initAllRoutes
();
}
if
(
productInfo
.
res
)
{
let
list
=
productInfo
.
data
?.
data
;
if
(
list
.
length
===
0
)
{
currentProjectStore
.
setProjectList
([]);
currentProjectStore
.
changeProject
({});
}
else
{
currentProjectStore
.
setProjectList
(
list
);
currentProjectStore
.
changeProject
(
list
[
0
]);
setFileServerEndPointLocalStorage
(
list
[
0
].
zoneId
);
getFiletokenAccordingToId
(
list
[
0
].
id
).
then
((
res
)
=>
{
list
[
0
].
filetoken
=
res
;
currentProjectStore
.
changeProject
(
list
[
0
]);
});
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[
userInfo
.
data
,
menuInfo
.
data
,
productInfo
.
data
]);
},
[
userInfo
.
data
,
menuInfo
.
data
]);
return
permissionStore
.
allRoutes
;
};
...
...
src/components/mui/MyPopconfirm.tsx
View file @
a194e03a
import
*
as
React
from
"react"
;
import
{
ReactNode
}
from
"react"
;
import
{
ReactNode
,
useEffect
}
from
"react"
;
import
Box
from
"@mui/material/Box"
;
import
ButtonComponent
from
"./Button"
;
import
tipsIcon
from
"@/assets/project/information-outline.svg"
;
...
...
@@ -28,7 +28,7 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
<
null
|
HTMLElement
>
(
null
);
const
handleClick
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
console
.
log
(
123
);
event
.
nativeEvent
.
stopImmediatePropagation
(
);
setAnchorEl
(
anchorEl
?
null
:
event
.
currentTarget
);
};
...
...
@@ -45,6 +45,12 @@ const MyPopconfirm = (props: IMyPopconfirmProps) => {
onConfirm
&&
onConfirm
();
};
useEffect
(()
=>
{
document
.
addEventListener
(
"click"
,
(
e
)
=>
{
setAnchorEl
(
null
);
});
},
[]);
return
(
<
div
>
<
div
aria
-
describedby=
{
id
}
onClick=
{
handleClick
}
>
...
...
src/store/modules/currentProject.ts
View file @
a194e03a
...
...
@@ -11,22 +11,39 @@ type productInfo = {
id
?:
string
;
name
?:
string
;
};
const
sessionStorageCurrentProjectInfo
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"currentProjectInfo"
)
||
"{}"
);
const
sessionStorageCurrentProductInfo
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"currentProductInfo"
)
||
"{}"
);
const
sessionStorageProjectList
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"projectList"
)
||
"[]"
);
class
currentProject
{
constructor
()
{
makeAutoObservable
(
this
);
}
// 选中的项目
currentProjectInfo
:
projectInfo
=
{}
;
currentProjectInfo
:
projectInfo
=
sessionStorageCurrentProjectInfo
;
// 选中的产品下的项目列表
projectList
:
Array
<
projectInfo
>
=
[]
;
projectList
:
Array
<
projectInfo
>
=
sessionStorageProjectList
;
// 选中的产品
currentProductInfo
:
productInfo
=
{}
;
currentProductInfo
:
productInfo
=
sessionStorageCurrentProductInfo
;
setProjectList
=
(
list
:
Array
<
projectInfo
>
)
=>
{
this
.
projectList
=
list
;
sessionStorage
.
setItem
(
"projectList"
,
JSON
.
stringify
(
list
));
};
changeProject
=
(
project
:
projectInfo
)
=>
{
this
.
currentProjectInfo
=
project
;
sessionStorage
.
setItem
(
"currentProjectInfo"
,
JSON
.
stringify
(
project
));
};
changeProductInfo
=
(
productInfo
:
productInfo
)
=>
{
this
.
currentProductInfo
=
productInfo
;
sessionStorage
.
setItem
(
"currentProductInfo"
,
JSON
.
stringify
(
productInfo
));
};
}
...
...
src/views/ConsoleLayout/index.tsx
View file @
a194e03a
import
React
,
{
useEffect
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Outlet
,
useLocation
,
useNavigate
}
from
"react-router-dom"
;
import
cx
from
"classnames"
;
import
{
observer
}
from
"mobx-react-lite"
;
...
...
@@ -14,7 +14,12 @@ import Button from "@/components/mui/Button";
import
logo
from
"@/assets/img/logo.svg"
;
import
MyPopover
from
"@/components/mui/MyPopover"
;
import
TranSferList
from
"./components/TransferList"
;
import
{
getProjectList
}
from
"@/api/project_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
{
setFileServerEndPointLocalStorage
,
getFiletokenAccordingToId
,
}
from
"@/views/Project/project"
;
import
style
from
"./index.module.css"
;
const
ConsoleLayout
=
observer
(()
=>
{
...
...
@@ -28,6 +33,41 @@ const ConsoleLayout = observer(() => {
handleClose
,
}
=
useIndex
();
const
[
currentProduct
,
setCurrentProduct
]
=
useState
<
{
path
:
string
;
name
:
string
;
}
>
();
const
{
currentProjectStore
}
=
useStores
();
const
{
run
:
runGetProjectList
}
=
useMyRequest
(
getProjectList
,
{
onSuccess
:
(
res
)
=>
{
let
list
=
res
.
data
;
if
(
list
.
length
===
0
)
{
currentProjectStore
.
setProjectList
([]);
currentProjectStore
.
changeProject
({});
navigate
(
currentProduct
?.
path
as
string
);
}
else
{
currentProjectStore
.
setProjectList
(
list
);
currentProjectStore
.
changeProject
(
list
[
0
]);
setFileServerEndPointLocalStorage
(
list
[
0
].
zoneId
);
getFiletokenAccordingToId
(
list
[
0
].
id
).
then
((
res
)
=>
{
list
[
0
].
filetoken
=
res
;
currentProjectStore
.
changeProject
(
list
[
0
]);
});
navigate
(
currentProduct
?.
path
as
string
);
}
},
});
// 切换产品
const
getProduct
=
(
item
:
any
)
=>
{
currentProjectStore
.
changeProductInfo
({
id
:
item
.
name
,
name
:
item
.
name
});
setCurrentProduct
(
item
);
runGetProjectList
({
product
:
item
.
name
,
});
};
const
navigate
=
useNavigate
();
const
location
=
useLocation
();
const
{
permissionStore
,
menuStore
}
=
useStores
();
...
...
@@ -86,7 +126,7 @@ const ConsoleLayout = observer(() => {
root
:
style
.
menuItemRoot
,
}
}
onClick=
{
()
=>
{
navigate
(
item
.
path
);
getProduct
(
item
);
handleClose
();
}
}
>
...
...
src/views/MenuLayout/index.tsx
View file @
a194e03a
...
...
@@ -6,13 +6,21 @@ import style from "./index.module.css";
import
{
observer
}
from
"mobx-react-lite"
;
import
{
useStores
}
from
"@/store/index"
;
import
classnames
from
"classnames"
;
import
{
toJS
}
from
"mobx"
;
const
MenuLayout
=
observer
(()
=>
{
const
{
permissionStore
}
=
useStores
();
const
{
permissionStore
,
currentProjectStore
}
=
useStores
();
let
pathname
=
new
URL
(
window
.
location
.
href
).
pathname
;
const
navigate
=
useNavigate
();
const
productInfo
=
toJS
(
currentProjectStore
.
currentProductInfo
);
// 未选择产品时 直接跳转home页面
if
(
!
productInfo
.
name
)
{
navigate
(
"/home"
);
}
return
(
<
Box
className=
{
style
.
container
}
>
<
Box
className=
{
style
.
aside
}
>
...
...
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
View file @
a194e03a
...
...
@@ -97,7 +97,13 @@ const ConfigForm = (props: ConfigFormProps) => {
const
checkName
=
(
name
:
string
=
""
)
=>
{
const
reg
=
new
RegExp
(
/^
[
a-zA-Z0-9
\u
4e00-
\u
9fa5-_
]{3,30}
$/
);
if
(
reg
.
test
(
name
))
{
if
(
!
name
)
{
setNameHelp
({
error
:
true
,
helperText
:
"任务名称不能为空"
,
});
return
true
;
}
else
if
(
reg
.
test
(
name
))
{
setNameHelp
({
error
:
false
,
helperText
:
""
,
...
...
src/views/Project/ProjectSubmitWork/index.tsx
View file @
a194e03a
...
...
@@ -91,14 +91,12 @@ const ProjectSubmitWork = () => {
const
checkResult
=
getCheckResult
(
parameter
,
value
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
}
else
{
return
;
}
if
(
getCheckResult
(
parameter
,
value
).
error
===
true
)
{
if
(
getCheckResult
(
parameter
,
parameter
.
value
).
error
===
true
)
{
isCheck
=
false
;
}
tack
.
isCheck
=
isCheck
;
});
tack
.
isCheck
=
isCheck
;
}
else
{
return
;
}
...
...
src/views/Project/ProjectSubmitWork/util.ts
View file @
a194e03a
import
{
IParameter
}
from
"./interface"
export
const
getCheckResult
=
(
parameter
:
IParameter
,
value
:
string
):
{
error
:
boolean
,
helperText
:
string
import
{
IParameter
}
from
"./interface"
;
export
const
getCheckResult
=
(
parameter
:
IParameter
,
value
:
string
):
{
error
:
boolean
;
helperText
:
string
;
}
=>
{
let
error
=
false
let
helperText
=
''
let
error
=
false
;
let
helperText
=
""
;
// 表单校验
if
(
parameter
.
required
)
{
if
(
Array
.
isArray
(
value
))
{
if
(
value
.
length
===
0
)
{
error
=
true
helperText
=
'该选项是必填项'
error
=
true
;
helperText
=
"该选项是必填项"
;
}
}
else
if
(
value
===
''
||
value
===
null
||
value
===
undefined
)
{
error
=
true
helperText
=
'该选项是必填项'
}
else
if
(
value
===
""
||
value
===
null
||
value
===
undefined
)
{
error
=
true
;
helperText
=
"该选项是必填项"
;
}
}
if
(
parameter
.
validators
.
length
>
0
)
{
parameter
.
validators
.
forEach
((
validator
)
=>
{
const
reg
=
new
RegExp
(
validator
.
regex
)
parameter
.
validators
.
forEach
((
validator
)
=>
{
const
reg
=
new
RegExp
(
validator
.
regex
);
if
(
!
reg
.
test
(
value
))
{
error
=
true
helperText
=
validator
.
message
error
=
true
;
helperText
=
validator
.
message
;
}
})
});
}
return
{
error
,
helperText
}
}
\ No newline at end of file
helperText
,
};
};
src/views/Project/components/AddProject/index.tsx
View file @
a194e03a
...
...
@@ -84,17 +84,16 @@ const AddProject = (props: any) => {
const
handleClickOpen
=
()
=>
{
DialogRef
.
current
.
handleClickOpen
();
initData
()
initData
()
;
};
const
initData
=
()
=>
{
setName
(
''
)
setDesc
(
''
)
setName
(
""
);
setDesc
(
""
);
if
(
zoneIdOptions
.
length
>
0
)
{
setZoneId
(
zoneIdOptions
[
0
].
id
)
setZoneId
(
zoneIdOptions
[
0
].
id
)
;
}
}
};
const
checkName
=
(
name
:
string
)
=>
{
if
(
name
)
{
...
...
src/views/Project/components/CurrentProject/index.tsx
View file @
a194e03a
...
...
@@ -45,7 +45,6 @@ const CurrentProject = observer(() => {
const
openAddProject
=
()
=>
{
addProjectRef
.
current
.
handleClickOpen
();
// setAddProjectOpen(true);
setProjectListOpen
(
false
);
};
...
...
@@ -59,9 +58,12 @@ const CurrentProject = observer(() => {
<
img
src=
{
logo
}
alt=
""
className=
{
style
.
logo
}
/>
<
div
className=
{
style
.
info
}
>
<
div
className=
{
style
.
productName
}
>
{
currentProjectStore
.
currentProductInfo
.
name
||
"CADD"
}
{
currentProjectStore
.
currentProductInfo
.
name
}
</
div
>
<
div
className=
{
style
.
projectName
}
title=
{
currentProjectStore
.
currentProjectInfo
.
name
}
>
<
div
className=
{
style
.
projectName
}
title=
{
currentProjectStore
.
currentProjectInfo
.
name
}
>
{
currentProjectStore
.
currentProjectInfo
.
name
||
"暂无项目"
}
</
div
>
</
div
>
...
...
src/views/Project/project.ts
View file @
a194e03a
...
...
@@ -6,10 +6,14 @@
* @FilePath: /bkunyun/src/views/Project/project.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
product
,
hpczone
,
getDataFileToken
}
from
"@/api/project_api"
;
import
{
getProjectList
as
getProjectListApi
,
hpczone
,
getDataFileToken
,
}
from
"@/api/project_api"
;
export
const
getProjectList
=
async
()
=>
{
const
res
=
await
product
({
product
:
"CADD"
});
const
res
=
await
getProjectListApi
({
product
:
"CADD"
});
return
res
.
data
;
};
...
...
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