Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-4
Overview
Overview
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
office
haoban-4
Commits
3742f137
Commit
3742f137
authored
Sep 10, 2020
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 门店导购范围
parent
eb0391f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
13 deletions
+65
-13
admin-list.js
src/api/admin-list.js
+2
-0
edit-store-role.vue
src/views/enterprise/edit-store-role.vue
+63
-13
No files found.
src/api/admin-list.js
View file @
3742f137
...
...
@@ -25,6 +25,8 @@ const api = {
method
:
'post'
,
useFormData
:
true
},
// 应用开关-保存
findStoreRange
:
'/find-store-range'
,
// 门店角色-查看门店导购范围
saveStoreRange
:
'/save-store-range'
,
// 门店角色-保存门店导购范围
};
export
default
getFetch
(
api
,
'/hb-manage-web'
);
src/views/enterprise/edit-store-role.vue
View file @
3742f137
...
...
@@ -35,6 +35,23 @@
</div>
</div>
</el-form-item>
<el-form-item
label=
"门店导购范围"
>
<p
class=
"type-title"
>
当前门店
</p>
<div>
<span
class=
"type-label"
>
查看导购
</span>
<el-radio-group
v-model=
"roleData.seeType"
>
<el-radio
label=
"1"
>
门店下全部导购
</el-radio>
<el-radio
label=
"0"
>
仅自己
</el-radio>
</el-radio-group>
</div>
<div>
<span
class=
"type-label"
>
管理导购
</span>
<el-radio-group
v-model=
"roleData.managerType"
>
<el-radio
label=
"1"
>
门店下全部导购
</el-radio>
<el-radio
label=
"0"
>
仅自己
</el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item
style=
"margin-top: 50px"
>
<el-button
type=
"primary"
:loading=
"loading"
@
click=
"onSave"
>
保存
</el-button>
</el-form-item>
...
...
@@ -48,7 +65,7 @@ import navCrumb from '@/components/nav/nav.vue';
import
MenuTree
from
'./edit-role/menu-tree.vue'
;
import
api
from
'@/api/admin-list'
;
const
{
resourceList
,
menuList
,
editRole
,
roleDetail
,
findAppSetting
,
saveAppSetting
}
=
api
;
const
{
resourceList
,
menuList
,
editRole
,
roleDetail
,
findAppSetting
,
saveAppSetting
,
findStoreRange
,
saveStoreRange
}
=
api
;
export
default
{
name
:
'EditStoreRole'
,
...
...
@@ -71,7 +88,9 @@ export default {
roleId
:
''
,
roleName
:
''
,
menuIds
:
[],
// {appType:"",menuIds:,menuName:}选中的菜单id
resourceCode
:
{}
resourceCode
:
{},
seeType
:
'1'
,
// 0仅自己,1门店下全部导购
managerType
:
'1'
,
// 0仅自己,1门店下全部导购
},
roleDataRule
:
{
roleName
:
[
{
required
:
true
}
],
...
...
@@ -97,29 +116,24 @@ export default {
const
haoBanUser
=
JSON
.
parse
(
localStorage
.
getItem
(
'haoBanUser'
)
||
'{}'
);
this
.
wxEnterpriseId
=
haoBanUser
.
wxEnterpriseId
;
this
.
$emit
(
'showAsideMenu'
,
false
);
await
this
.
initData
(
roleId
);
await
this
.
initData
();
this
.
getRoleDetail
(
roleId
);
},
methods
:
{
initData
(
roleId
)
{
const
params
=
{
wxEnterpriseId
:
this
.
wxEnterpriseId
,
roleType
:
2
};
initData
()
{
const
prom
=
[];
// 获取权限数据
this
.
tabList
.
forEach
(
el
=>
{
// appType 1好办后台2应用后台3好办小程序4小程序应用
// roleType 1管理员角色 2门店角色
prom
.
push
(
menuList
(
Object
.
assign
({},
params
,
{
appType
:
el
.
appType
})
).
then
(
res
=>
{
prom
.
push
(
menuList
(
{
wxEnterpriseId
:
this
.
wxEnterpriseId
,
roleType
:
2
,
appType
:
el
.
appType
}
).
then
(
res
=>
{
el
.
menuList
=
this
.
flatDataToTree
(
res
.
result
||
[]);
el
.
menuList
.
forEach
(
item
=>
{
this
.
$set
(
el
.
checkedId
,
item
.
menuId
,
[]);
});
if
(
el
.
appType
==
4
)
{
findAppSetting
(
Object
.
assign
({},
params
,
{
roleId
,
appType
:
el
.
appType
})).
then
(
res
=>
{
el
.
appIds
=
res
.
result
||
[];
this
.
setChildrenDisable
(
el
.
menuList
,
el
.
appIds
);
});
}
}));
});
// 获取资源范围数据
prom
.
push
(
resourceList
().
then
(
res
=>
{
this
.
resourceList
=
res
.
result
||
[];
this
.
resourceList
.
forEach
(
el
=>
{
...
...
@@ -129,7 +143,9 @@ export default {
return
Promise
.
all
(
prom
);
},
// 获取角色相关的数据
getRoleDetail
(
roleId
)
{
// 获取角色权限配置、资源范围等数据
roleDetail
({
roleId
}).
then
(
res
=>
{
let
{
roleId
,
roleName
,
menuIds
,
resourceCode
}
=
res
.
result
||
{};
menuIds
=
typeof
menuIds
==
'string'
?
menuIds
.
split
(
','
)
:
[];
...
...
@@ -155,6 +171,23 @@ export default {
});
}
});
// 获取门店导购范围数据
findStoreRange
({
roleId
}).
then
(
res
=>
{
const
{
seeType
,
managerType
}
=
res
.
result
||
{};
Object
.
assign
(
this
.
roleData
,
{
seeType
:
typeof
seeType
!=
'string'
&&
typeof
seeType
!=
'number'
?
'1'
:
String
(
seeType
),
managerType
:
typeof
managerType
!=
'string'
&&
typeof
managerType
!=
'number'
?
'1'
:
String
(
seeType
)
});
});
// 获取应用开启状态的数据
this
.
tabList
.
forEach
(
el
=>
{
if
(
el
.
appType
==
4
)
{
findAppSetting
({
wxEnterpriseId
:
this
.
wxEnterpriseId
,
roleType
:
2
,
roleId
,
appType
:
el
.
appType
}).
then
(
res
=>
{
el
.
appIds
=
res
.
result
||
[];
this
.
setChildrenDisable
(
el
.
menuList
,
el
.
appIds
);
});
}
});
function
getAllMenuId
(
menuList
,
allMenuIds
)
{
let
result
=
[];
...
...
@@ -253,7 +286,7 @@ export default {
onSave
()
{
this
.
$refs
.
roleData
.
validate
(
vali
=>
{
if
(
!
vali
)
return
;
const
{
roleId
,
roleName
,
menuIds
,
resourceCode
}
=
this
.
roleData
;
const
{
roleId
,
roleName
,
menuIds
,
resourceCode
,
seeType
,
managerType
}
=
this
.
roleData
;
const
params
=
{
roleId
,
roleName
,
...
...
@@ -266,10 +299,12 @@ export default {
}
params
.
resourceCode
=
params
.
resourceCode
.
join
(
','
);
this
.
loading
=
true
;
// 保存权限和资源范围配置
editRole
(
params
).
then
(
succ
.
bind
(
this
,
roleId
,
'保存成功'
)).
catch
(()
=>
this
.
loading
=
false
);
function
succ
(
roleId
,
msg
)
{
const
prom
=
[];
const
params
=
{
roleId
,
wxEnterpriseId
:
this
.
wxEnterpriseId
};
// 单独保存应用开关配置
this
.
tabList
.
forEach
(
el
=>
{
if
(
el
.
appType
==
4
)
{
prom
.
push
(
new
Promise
(
resolve
=>
{
...
...
@@ -277,6 +312,10 @@ export default {
}));
}
});
// 单独保存门店导购范围配置
prom
.
push
(
new
Promise
(
resolve
=>
{
saveStoreRange
({
roleId
,
seeType
,
managerType
}).
finally
(
resolve
);
}));
Promise
.
all
(
prom
).
then
(()
=>
{
this
.
$message
.
success
(
msg
);
this
.
$router
.
go
(
-
1
);
...
...
@@ -311,4 +350,15 @@ export default {
}
}
}
.type-title
{
font-size
:
14px
;
font-weight
:
400
;
color
:
@
gray02
;
}
.type-label
{
margin-right
:
30px
;
font-size
:
14px
;
font-weight
:
700
;
color
:
@
gray01
;
}
</
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