Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
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
劳工
zeroing-editor
Commits
5200368d
Commit
5200368d
authored
Apr 17, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改权限管理的表现形式
parent
93afec2d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
121 deletions
+80
-121
common.js
src/api/common.js
+1
-1
zh-CN.json
src/locales/zh-CN.json
+7
-1
project.js
src/store/modules/project.js
+6
-5
ProjectConflictResolveDialog.vue
src/views/Editor/dialogs/ProjectConflictResolveDialog.vue
+3
-3
AuthManagerEditor.vue
src/views/Editor/dialogs/editors/AuthManagerEditor.vue
+63
-111
No files found.
src/api/common.js
View file @
5200368d
...
...
@@ -24,7 +24,7 @@ class ApiError extends Error {
}
}
export
async
function
fetchApi
(
uri
,
{
host
=
''
,
params
,
method
=
'get'
,
auth
=
true
,
judgeSuccess
=
true
,
contentType
=
'json'
,
dataField
=
'data'
,
errMessage
})
{
export
async
function
fetchApi
(
uri
,
{
host
=
''
,
params
,
method
=
'get'
,
auth
=
true
,
judgeSuccess
=
true
,
contentType
=
'json'
,
dataField
=
'data'
,
errMessage
}
=
{}
)
{
let
url
=
host
+
(
uri
.
startsWith
(
'http'
)
||
uri
.
startsWith
(
'//'
)
?
uri
:
API_HOST
+
uri
);
const
options
=
{
...
...
src/locales/zh-CN.json
View file @
5200368d
...
...
@@ -25,6 +25,7 @@
"Behavior"
:
"行为"
,
"Search"
:
"搜索"
,
"Only mine"
:
"仅我的"
,
"Creator"
:
"创建人"
,
"Add"
:
"添加"
,
"Delete"
:
"删除"
,
"Delete all"
:
"删除全部"
,
...
...
@@ -392,5 +393,10 @@
"customCmds"
:
{
"z-for"
:
"循环"
,
"z-if"
:
"存在"
}
},
"project-conflicts-resolve-steps"
:
[
"查看冲突"
,
"手动合并"
,
"完成"
]
}
\ No newline at end of file
src/store/modules/project.js
View file @
5200368d
...
...
@@ -100,8 +100,8 @@ export const projectStore = {
state
.
id
=
id
;
state
.
name
=
name
;
state
.
creator
=
creator
;
state
.
operators
=
operators
;
state
.
operator
=
operator
;
state
.
operators
=
operators
;
state
.
update_time
=
update_time
;
const
localData
=
state
.
data
;
...
...
@@ -477,12 +477,13 @@ export const projectStore = {
},
getters
:
{
project
(
state
)
{
const
{
id
,
name
,
creator
,
data
,
update_time
}
=
state
;
const
{
id
,
name
,
creator
,
data
,
update_time
,
operator
,
operators
,
}
=
state
;
let
newData
=
clonePureObj
(
data
);
delete
newData
[
'dependencies'
];
deleteDesignConfig
(
newData
.
processes
);
deleteAssetsDepConfig
(
newData
);
return
{
id
,
name
,
creator
,
update_time
,
id
,
name
,
creator
,
update_time
,
operator
,
operators
,
data
:
JSON
.
stringify
(
newData
),
};
},
...
...
src/views/Editor/dialogs/ProjectConflictResolveDialog.vue
View file @
5200368d
...
...
@@ -7,9 +7,7 @@
>
<div
class=
"wrapper"
>
<el-steps
:active=
"step"
finish-status=
"success"
align-center
>
<el-step
title=
"查看冲突"
></el-step>
<el-step
title=
"手动合并"
></el-step>
<el-step
title=
"完成"
></el-step>
<el-step
v-for=
"item in steps"
:title=
"item"
></el-step>
</el-steps>
<div
class=
"container"
>
<monaco-editor
...
...
@@ -57,6 +55,7 @@
step
:
0
,
remoteData
:
''
,
localData
:
''
,
steps
:
this
.
$t
(
'project-conflicts-resolve-steps'
),
}
},
mounted
()
{
...
...
@@ -110,6 +109,7 @@
cancelButtonText
:
this
.
$t
(
'Cancel'
),
type
:
'warning'
}).
then
(()
=>
{
this
.
step
++
;
this
.
visible
=
false
;
this
.
$emit
(
'resolved'
,
this
.
localData
);
}).
catch
((
e
)
=>
{
...
...
src/views/Editor/dialogs/editors/AuthManagerEditor.vue
View file @
5200368d
<
template
>
<div
class=
"project-auth-manager"
>
<el-card
shadow=
"hover"
>
<h3
class=
"title"
>
当前权限用户列表
</h3>
<div
class=
"user-list"
v-if=
"operatorsData.length > 0"
>
<el-tag
:key=
"tag"
v-for=
"tag in operatorsData"
closable
:disable-transitions=
"false"
@
close=
"deleteAuth(tag)"
>
{{
tag
}}
</el-tag>
</div>
<p
v-else
>
空
</p>
<el-divider></el-divider>
<el-button
type=
"primary"
size=
"small"
@
click=
"addDivShow = true"
>
增加权限
</el-button
>
</el-card>
<br
/>
<el-card
shadow=
"hover"
v-show=
"addDivShow"
>
<p>
请先勾选后,点击添加按钮
</p>
<el-checkbox-group
v-model=
"checkList"
>
<el-checkbox
v-for=
"item in devPersons"
:key=
"'dev-' + item.id"
<p><b>
{{
$t
(
'Creator'
)
}}
</b>
:
{{
project
.
creator
}}
</p>
<el-select
style=
"width: 100%;"
size=
"mini"
v-model=
"operators"
filterable
multiple
:disabled=
"!editable"
>
<el-option
v-for=
"(item, index) in devPersons"
:key=
"index"
:disabled=
"item.name === project.creator || item.name === currentOperator"
:label=
"item.name"
:disabled=
"operatorsData.includes(item.name)"
></el-checkbox>
</el-checkbox-group>
<br
/>
<el-button
type=
"primary"
size=
"small"
@
click=
"onAdd"
>
添加
</el-button>
</el-card>
:value=
"item.name"
>
</el-option>
</el-select>
</div>
</
template
>
<
script
>
import
{
mapState
,
mapGetters
,
mapMutations
}
from
"vuex"
;
import
{
playWaiting
}
from
"../../../../utils"
;
import
{
getDevPersons
}
from
"../../../../api/editor"
;
import
{
updateOperators
}
from
"../../../../api/project"
;
// updateOperators
export
default
{
import
{
mapState
,
mapGetters
,
mapMutations
}
from
"vuex"
;
import
{
playWaiting
}
from
"../../../../utils"
;
import
{
getDevPersons
}
from
"../../../../api/editor"
;
import
{
updateOperators
}
from
"../../../../api/project"
;
export
default
{
name
:
"AuthManagerEditor"
,
data
()
{
return
{
checkList
:
[],
devPersons
:
[],
addDivShow
:
false
,
operators
:
[]
,
};
},
computed
:
{
editable
(){
return
this
.
operators
.
includes
(
this
.
currentOperator
);
},
...
mapState
({
operatorsData
:
(
state
)
=>
state
.
project
.
operators
&&
state
.
project
.
operators
.
split
(
","
),
projectId
:
(
state
)
=>
state
.
project
.
id
,
currentOperator
:
(
state
)
=>
state
.
editor
.
operator
,
}),
...
mapState
([
'project'
]),
},
methods
:
{
...
mapMutations
([
"modifyOperators"
]),
async
edit
()
{
this
.
devPersons
=
await
getDevPersons
();
this
.
operators
=
this
.
project
.
operators
.
split
(
','
);
this
.
operatorsOrigin
=
this
.
operators
.
concat
().
sort
().
join
(
','
);
},
onAdd
()
{
if
(
!
this
.
operatorsData
.
includes
(
this
.
currentOperator
))
{
this
.
$message
({
message
:
this
.
$t
(
'No permission'
),
type
:
"error"
});
return
false
;
async
save
()
{
let
operatorsNew
=
this
.
operators
.
concat
().
sort
().
join
(
','
);
if
(
operatorsNew
===
this
.
operatorsOrigin
)
{
return
;
}
let
mergeData
=
[...
this
.
operatorsData
,
...
this
.
checkList
].
join
(
","
);
this
.
onUpdate
(
mergeData
);
},
async
onUpdate
(
mergeData
)
{
updateOperators
(
this
.
projectId
,
mergeData
)
let
operatorsStr
=
this
.
operators
.
join
(
','
);
updateOperators
(
this
.
projectId
,
operatorsStr
)
.
then
(()
=>
{
this
.
$message
({
message
:
this
.
$t
(
"Operate success"
),
type
:
"success"
,
});
this
.
modifyOperators
(
mergeData
);
this
.
checkList
=
[];
this
.
addDivShow
=
false
;
this
.
modifyOperators
(
operatorsStr
);
})
.
catch
((
e
)
=>
{
this
.
$message
({
message
:
e
.
message
,
type
:
"error"
});
this
.
$message
({
message
:
e
.
message
,
type
:
"error"
});
});
},
deleteAuth
(
tag
)
{
if
(
this
.
currentOperator
===
tag
)
{
this
.
$message
({
message
:
this
.
$t
(
'Error delete self'
),
type
:
"error"
});
return
false
;
}
if
(
!
this
.
operatorsData
.
includes
(
this
.
currentOperator
))
{
this
.
$message
({
message
:
this
.
$t
(
'No permission'
),
type
:
"error"
});
return
false
;
}
this
.
$confirm
(
this
.
$t
(
"Are you sure to delete this user auth"
)
+
tag
,
{
confirmButtonText
:
this
.
$t
(
"Confirm"
),
cancelButtonText
:
this
.
$t
(
"Cancel"
),
type
:
"warning"
,
})
.
then
(()
=>
{
let
mergeData
=
this
.
operatorsData
.
filter
((
item
)
=>
item
!==
tag
)
.
join
(
","
);
this
.
onUpdate
(
mergeData
);
})
.
catch
((
e
)
=>
{});
},
},
};
};
</
script
>
<
style
lang=
"scss"
scoped
>
.el-tag
+
.el-tag
{
margin-left
:
10px
;
}
</
style
>
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