Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
杨明
/
scrm-micro-config
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 95526d49
authored
Nov 23, 2021
by
yangming
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
method
1 parent
14629b40
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
271 additions
and
336 deletions
package.json
src/api/modules/baseInfo.js
src/api/modules/employee.js
src/api/modules/merchant.js
src/api/modules/role.js
src/api/modules/store.js
src/views/account/components/selectProduct.vue
src/views/account/detailAccount.vue
src/views/account/editAccount.vue
src/views/role/components/selectProduct.vue
src/views/role/create.vue
package.json
View file @
95526d4
...
...
@@ -11,8 +11,9 @@
"axios"
:
"^0.21.1"
,
"core-js"
:
"^3.4.4"
,
"glsx-common"
:
"^1.4.6"
,
"
vue"
:
"^2.6.11
"
,
"
glsx-components"
:
"^1.1.8
"
,
"glsx-table"
:
"^1.0.9"
,
"vue"
:
"^2.6.11"
,
"vue-amap"
:
"^0.5.10"
},
"devDependencies"
:
{
...
...
src/api/modules/baseInfo.js
View file @
95526d4
...
...
@@ -8,7 +8,7 @@
*/
import
{
http_config
}
from
'@/main'
const
getMerchantTree
=
params
=>
{
params
.
method
=
'
org.ore
.api.common.findMerchantTreeByMerchantNo.list'
params
.
method
=
'
entmicro
.api.common.findMerchantTreeByMerchantNo.list'
return
http_config
({
url
:
'/rop-scrm-entmicro/router'
,
method
:
'POST'
,
...
...
@@ -17,7 +17,7 @@ const getMerchantTree = params => {
})
}
const
getDepartment
=
params
=>
{
params
.
method
=
'
cn.com.glsx.entmicro
.department.listDepartmentTree'
params
.
method
=
'
entmicro.api
.department.listDepartmentTree'
return
http_config
({
url
:
'/rop-scrm-entmicro/router'
,
method
:
'POST'
,
...
...
@@ -26,7 +26,7 @@ const getDepartment = params => {
})
}
const
toGL
=
params
=>
{
params
.
method
=
'
org.ore
.api.common.relevanceEntmicro.list'
params
.
method
=
'
entmicro
.api.common.relevanceEntmicro.list'
return
http_config
({
url
:
'/rop-scrm-entmicro/router'
,
method
:
'POST'
,
...
...
@@ -35,7 +35,7 @@ const toGL = params => {
})
}
const
merchantInfo
=
params
=>
{
params
.
method
=
'
org.ore
.api.common.findMerchantInfoByMerchantNo.list'
params
.
method
=
'
entmicro
.api.common.findMerchantInfoByMerchantNo.list'
return
http_config
({
url
:
'/rop-scrm-entmicro/router'
,
method
:
'POST'
,
...
...
src/api/modules/employee.js
View file @
95526d4
import
{
http
}
from
'@/main'
var
defaultPath
=
'
cn.com.glsx.merchants
.'
var
defaultPath
=
'
merchants.api
.'
const
getListApi
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
staff.findStaffByPage`
...
...
@@ -22,7 +22,7 @@ const getAllMerchantListApi = params => {
}
const
getRoleListApi
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.list'
params
.
method
=
'
merchants
.api.role.list'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
src/api/modules/merchant.js
View file @
95526d4
...
...
@@ -9,7 +9,7 @@
import
{
http
}
from
'@/main'
export
function
getThirdTable
(
params
)
{
params
.
method
=
'
cn.com.glsx.merchants
.menu.findLog'
params
.
method
=
'
merchants.api
.menu.findLog'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
@@ -19,7 +19,7 @@ export function getThirdTable(params) {
})
}
// const getThirdTable =(params)=>{
// params.method = '
cn.com.glsx.merchants
.menu.findLog'
// params.method = '
merchants.api
.menu.findLog'
// return http({
// url: '/rop-merchants/router',
...
...
@@ -31,7 +31,7 @@ export function getThirdTable(params) {
// }
//获取功能权限树
const
findMenuFunTreeByMerId
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMenuFunTreeByMerId'
params
.
method
=
'
merchants.api
.merchant.findMenuFunTreeByMerId'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
@@ -42,7 +42,7 @@ const findMenuFunTreeByMerId = params => {
}
//获取商户信息
const
getFirstInfo
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMerchantDetail'
params
.
method
=
'
merchants.api
.merchant.findMerchantDetail'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
@@ -53,7 +53,7 @@ const getFirstInfo = params => {
}
//获取上下级信息
const
getSecondInfo
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.menu.findSubordinateRelationship'
params
.
method
=
'
merchants.api
.menu.findSubordinateRelationship'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
@@ -63,7 +63,7 @@ const getSecondInfo = params => {
})
}
const
getSecondTree
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMerchantTree'
params
.
method
=
'
merchants.api
.merchant.findMerchantTree'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
@@ -73,7 +73,7 @@ const getSecondTree = params => {
})
}
const
getSecondTable
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.staff.findMerchantStaffList'
params
.
method
=
'
merchants.api
.staff.findMerchantStaffList'
return
http
({
url
:
'/rop-merchants/router'
,
...
...
src/api/modules/role.js
View file @
95526d4
...
...
@@ -8,7 +8,7 @@
*/
import
{
http
}
from
'@/main'
const
roleDataList
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.page'
params
.
method
=
'
merchants
.api.role.page'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -17,7 +17,7 @@ const roleDataList = params => {
})
}
const
merchantDataList
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.menu.findAllMerchant'
params
.
method
=
'
merchants.api
.menu.findAllMerchant'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -26,7 +26,7 @@ const merchantDataList = params => {
})
}
const
roleInfoData
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.getById'
params
.
method
=
'
merchants
.api.role.getById'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -35,7 +35,7 @@ const roleInfoData = params => {
})
}
const
roleTreeDataById
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMenuFunTreeByRoleId'
params
.
method
=
'
merchants.api
.merchant.findMenuFunTreeByRoleId'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -44,7 +44,7 @@ const roleTreeDataById = params => {
})
}
const
merchantRootById
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMenuFunTreeByMerId'
params
.
method
=
'
merchants.api
.merchant.findMenuFunTreeByMerId'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -53,7 +53,7 @@ const merchantRootById = params => {
})
}
const
createRole
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.insert'
params
.
method
=
'
merchants
.api.role.insert'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -62,7 +62,7 @@ const createRole = params => {
})
}
const
updateRole
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.update'
params
.
method
=
'
merchants
.api.role.update'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -71,7 +71,7 @@ const updateRole = params => {
})
}
const
deleteRole
=
params
=>
{
params
.
method
=
'
org.ore
.api.role.deleteById'
params
.
method
=
'
merchants
.api.role.deleteById'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
src/api/modules/store.js
View file @
95526d4
...
...
@@ -8,7 +8,7 @@
*/
import
{
http
}
from
'@/main'
const
findMerchantByPage
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.menu.findMerchantByPage'
params
.
method
=
'
merchants.api
.menu.findMerchantByPage'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -17,7 +17,7 @@ const findMerchantByPage = params => {
})
}
const
findAllDictData
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.menu.findAllDictData'
params
.
method
=
'
merchants.api
.menu.findAllDictData'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -27,7 +27,7 @@ const findAllDictData = params => {
}
//主营品牌
const
getCarbrandTree
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchantCommon.getCarbrandTree'
params
.
method
=
'
merchants.api
.merchantCommon.getCarbrandTree'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -37,7 +37,7 @@ const getCarbrandTree = params => {
}
//详情
const
findMerchantDetail
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMerchantDetail'
params
.
method
=
'
merchants.api
.merchant.findMerchantDetail'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -47,7 +47,7 @@ const findMerchantDetail = params => {
}
//下一步
const
saveMerchant
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.saveMerchant'
params
.
method
=
'
merchants.api
.merchant.saveMerchant'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -56,7 +56,7 @@ const saveMerchant = params => {
})
}
const
updateMerchant
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.updateMerchant'
params
.
method
=
'
merchants.api
.merchant.updateMerchant'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -65,7 +65,7 @@ const updateMerchant = params => {
})
}
const
accountTypeSearchRequest
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.accountTypeSearchRequest'
params
.
method
=
'
merchants.api
.merchant.accountTypeSearchRequest'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -75,7 +75,7 @@ const accountTypeSearchRequest = params => {
}
//功能权限
const
findPermissionsByMerId
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findPermissionsByMerId'
params
.
method
=
'
merchants.api
.merchant.findPermissionsByMerId'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -85,7 +85,7 @@ const findPermissionsByMerId = params => {
}
//功能权限
const
findMenuFunTreeByMerId
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.findMenuFunTreeByMerId'
params
.
method
=
'
merchants.api
.merchant.findMenuFunTreeByMerId'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
@@ -95,7 +95,7 @@ const findMenuFunTreeByMerId = params => {
}
//草稿保存
const
updatePermissions
=
params
=>
{
params
.
method
=
'
cn.com.glsx.merchants
.merchant.updatePermissions'
params
.
method
=
'
merchants.api
.merchant.updatePermissions'
return
http
({
url
:
'/rop-merchants/router'
,
method
:
'POST'
,
...
...
src/views/account/components/selectProduct.vue
View file @
95526d4
...
...
@@ -178,31 +178,30 @@ export default {
}
else
{
account
=
"accountTypeSearchRequest"
;
}
let
tabMenu
=
await
this
.
$apis
.
store
[
account
](
params
);
this
.
accountList
=
tabMenu
.
map
((
item
)
=>
{
return
{
productsArr
:
[],
products
:
item
.
products
,
accounttypeName
:
item
.
accounttypeName
,
accounttypeId
:
item
.
accounttypeId
,
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
};
});
this
.
$nextTick
(()
=>
{
this
.
addStyle
();
});
console
.
log
(
this
.
accountList
);
this
.
accountTypes
=
tabMenu
.
map
((
item
)
=>
{
return
{
products
:
null
,
accounttypeId
:
item
.
accounttypeId
,
};
this
.
$apis
.
store
[
account
](
params
).
then
((
res
)
=>
{
console
.
log
(
res
);
let
tabMenu
=
res
;
this
.
accountList
=
tabMenu
.
map
((
item
)
=>
{
return
{
productsArr
:
[],
products
:
item
.
products
,
accounttypeName
:
item
.
accounttypeName
,
accounttypeId
:
item
.
accounttypeId
,
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
};
});
console
.
log
(
this
.
accountList
);
this
.
accountTypes
=
tabMenu
.
map
((
item
)
=>
{
return
{
products
:
null
,
accounttypeId
:
item
.
accounttypeId
,
};
});
this
.
tabMenu_s
=
util
.
deepClone
(
this
.
accountList
);
this
.
findPermissionsByMerId
(
params
.
merchantId
?
params
.
merchantId
:
params
.
id
);
});
this
.
tabMenu_s
=
util
.
deepClone
(
this
.
accountList
);
// this.tabName = this.tabMenu[0].accounttypeId
this
.
findPermissionsByMerId
(
params
.
merchantId
?
params
.
merchantId
:
params
.
id
);
return
this
.
accountList
;
},
// 获取已选择的权限
findPermissionsByMerId
(
id
)
{
...
...
@@ -226,6 +225,7 @@ export default {
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
][
0
].
setCheckedKeys
(
i
.
menuIds
);
this
.
addStyle
();
});
}
});
...
...
@@ -285,7 +285,8 @@ export default {
addStyle
()
{
const
nodes
=
document
.
getElementsByClassName
(
"fun-tree-node"
);
for
(
let
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
const
parentNode
=
nodes
[
i
].
parentNode
;
const
parentNode
=
nodes
[
i
].
parentNode
.
parentNode
;
console
.
log
(
parentNode
);
parentNode
.
style
.
float
=
"left"
;
}
},
...
...
src/views/account/detailAccount.vue
View file @
95526d4
...
...
@@ -150,7 +150,7 @@
<div
id=
"secondmerchantName"
>
{{ secondPageObj.merchantName }}
</div>
</el-tooltip>
<div>
商户号:
商户号:
<span
id=
"secondmerchantId"
>
{{ secondPageObj.merchantNo }}
</span>
</div>
<div>
...
...
@@ -177,15 +177,7 @@
</span>
</el-tree>
</div>
<!-- <form class="layui-form" action="">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 232px">
<input class="layui-input" id="treeInput" placeholder="请输入" name="nameVal" />
</div>
<button type="button" id="merchantBtn" class="layui-btn">查询</button>
</div>
</form>
<ul id="merchantTree" class="ztree wrapper-tree"></ul> -->
</div>
<div
class=
"merchant-right"
>
<div>
...
...
@@ -200,7 +192,8 @@
<el-button
type=
"primary"
id=
"tableSearch"
size=
"small"
@
click=
"getSecondTable"
>
查询
</el-button>
</div>
</div>
<GLTable
ref=
"subMerchantTable"
:tableTotal=
"subMerchantTableTotal"
:hasPage=
"false"
:tableData=
"subMerchantTableList"
:hasNum=
"true"
:pageConf=
"pageConf"
:tableParams=
"secondtableParams"
@
refreshTable=
"getSecondTable"
></GLTable>
<!-- :height="'350px'" -->
<GLTable
ref=
"subMerchantTable"
:tableTotal=
"subMerchantTableTotal"
:hasPage=
"false"
:tableData=
"subMerchantTableList"
:hasNum=
"true"
:pageConf=
"pageConf"
:tableParams=
"secondtableParams"
@
refreshTable=
"getSecondTable"
></GLTable>
</div>
</div>
</div>
...
...
@@ -432,12 +425,14 @@ export default {
let
data
=
this
.
formateNullFieldData
(
res
)
this
.
subMerchantTableList
=
data
// this.subMerchantTableList = res
this
.
subMerchantTableTotal
=
res
.
length
}
if
(
res
&&
res
.
length
==
0
)
{
this
.
$refs
.
subMerchantTable
.
setTableHeightFun
()
}
// total > 50?calc(100vh - '199px'): calc(100vh - '152px')
this
.
$refs
.
subMerchantTable
.
tableHeightValues
=
`calc(100vh - 300px)`
// if (res && res.length == 0) {
// this.$refs.subMerchantTable.setTableHeightFun()
// }
})
},
getThirdTable
()
{
...
...
@@ -570,6 +565,8 @@ export default {
//
line-height
:
20px
;
display
:
inline-block
;
width
:
calc
(
100%
-
200px
);
word-wrap
:
break-word
;
line-height
:
initial
;
}
.account-type-span
{
display
:
inline-block
;
...
...
@@ -662,7 +659,9 @@ export default {
.merchant-left
{
padding-top
:
15px
;
padding-left
:
20px
;
min-height
:
calc
(
100vh
-
200px
);
//
min-height
:
calc
(
100vh
-
200px
);
//
max-height
:
100vh
;
background-color
:
#fff
;
width
:
360px
;
margin-right
:
20px
;
...
...
@@ -714,6 +713,8 @@ export default {
}
.secondTreeWrap
{
margin-top
:
20px
;
height
:
calc
(
100vh
-
350px
);
overflow-y
:
auto
;
}
}
//
.ztree
.wrapper-tree
{
...
...
src/views/account/editAccount.vue
View file @
95526d4
...
...
@@ -267,13 +267,13 @@ export default {
methods
:
{
hanleTab
(
status
)
{
if
(
this
.
editStatus
)
{
this
.
$confirm
(
"
离开将不保存本页修改
"
,
"提示"
,
{
this
.
$confirm
(
"
是否保存修改信息?
"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
})
.
then
(()
=>
{
this
.
handleNext
(
status
);
status
==
1
?
this
.
handleNext
(
status
):
this
.
handleSave
(
status
);
})
.
catch
(()
=>
{
this
.
tabCancel
(
status
);
...
...
@@ -306,7 +306,7 @@ export default {
this
.
$router
.
push
(
"/account/index"
);
},
//保存
handleSave
()
{
handleSave
(
status
)
{
let
product
=
this
.
$refs
.
productForm
.
getSelectInfo
();
if
(
product
&&
product
.
every
((
item
)
=>
item
.
products
.
length
==
0
))
{
this
.
$message
.
error
(
"请选择产品"
);
...
...
@@ -319,9 +319,9 @@ export default {
merchantId
:
this
.
accountAddForm
.
id
,
};
this
.
$apis
.
store
.
updatePermissions
(
params
).
then
((
res
)
=>
{
if
(
res
)
{
this
.
$router
.
push
(
"/account/index"
);
}
if
(
res
)
{
status
?
this
.
handleTabs
(
status
)
:
this
.
$router
.
push
(
"/account/index"
);
}
});
},
//下一步
...
...
@@ -417,13 +417,13 @@ export default {
para
=
{
id
:
this
.
accountAddForm
.
id
,
parentId
:
res
.
parentId
,
account
L
evel
:
res
.
merchantAccountLevel
,
account
l
evel
:
res
.
merchantAccountLevel
,
};
}
else
{
para
=
{
ids
:
res
.
accountType
,
merchantId
:
res
.
id
,
account
L
evel
:
res
.
merchantAccountLevel
,
account
l
evel
:
res
.
merchantAccountLevel
,
};
}
this
.
$refs
.
productForm
.
accountTypeSearchRequest
(
para
,
res
.
parentMerchant
);
...
...
src/views/role/components/selectProduct.vue
View file @
95526d4
<
template
>
<div
class=
"account-body scrm-box-f"
v-loading=
"loading"
v-if=
"tabMenuStatus"
>
<div
class=
"account-title"
>
{{
title
}}
</div>
<el-tabs
v-if=
"tabMenu.length != 0"
v-model=
"tabName"
type=
"card"
@
tab-click=
"handleClik"
>
<el-tabs
v-if=
"tabMenu.length != 0"
v-model=
"tabName"
type=
"card"
@
tab-click=
"handleClik"
>
<template
v-for=
"(item, index) in tabMenu"
>
<el-tab-pane
v-show=
"item && item.accounttypeId"
:label=
"item.accounttypeName"
:name=
"item.accounttypeId"
v-if=
"item"
:key=
"index"
></el-tab-pane>
<el-tab-pane
v-show=
"item && item.accounttypeId"
:label=
"item.accounttypeName"
:name=
"item.accounttypeId"
v-if=
"item"
:key=
"index"
></el-tab-pane>
</
template
>
</el-tabs>
<div
class=
"account-select-pro"
v-for=
"(item, index) in tabMenu"
:key=
"index"
v-show=
"tabName == item.accounttypeId"
>
<div
class=
"account-select-pro"
v-for=
"(item, index) in tabMenu"
:key=
"index"
v-show=
"tabName == item.accounttypeId"
>
<label>
选择产品
</label>
<el-checkbox-group
v-model=
"item.productsArr"
@
change=
"selectPro"
>
<el-checkbox
v-for=
"(itm, idx) in item.products"
:label=
"itm"
:key=
"idx"
>
{{
itm.productName
}}
</el-checkbox>
<el-checkbox
v-for=
"(itm, idx) in item.products"
:label=
"itm"
:key=
"idx"
>
{{ itm.productName }}
</el-checkbox>
</el-checkbox-group>
</div>
<div
class=
"account-select-menu"
>
请选择产品权限
</div>
...
...
@@ -35,52 +17,20 @@
<div
class=
"menu-box-panel"
>
<div
:key=
"index"
v-for=
"(item, index) in tabMenu"
>
<div
class=
"menu-box-tab"
v-show=
"tabName == item.accounttypeId"
>
<div
v-show=
"item.productsArr.indexOf(itm) != -1"
class=
"tab-item text-hide"
:class=
"{ 'select-checked': productTab == itm.productId }"
@
click=
"productClick(itm.productId)"
v-for=
"(itm, idx) in item.products"
:key=
"idx"
>
<div
v-show=
"item.productsArr.indexOf(itm) != -1"
class=
"tab-item text-hide"
:class=
"{ 'select-checked': productTab == itm.productId }"
@
click=
"productClick(itm.productId)"
v-for=
"(itm, idx) in item.products"
:key=
"idx"
>
{{ itm.productName }}
</div>
</div>
<div
v-show=
"tabName == item.accounttypeId"
class=
"menu-box-tree"
v-if=
"item.products"
:style=
"{ 'min-height': treeHeight + 'px' }"
>
<div
v-show=
"tabName == item.accounttypeId"
class=
"menu-box-tree"
v-if=
"item.products"
:style=
"{ 'min-height': treeHeight + 'px' }"
>
<div
v-for=
"(itm, idx) in item.products"
:key=
"idx"
>
<div
class=
"nodata"
v-if=
"
item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0
"
>
<div
class=
"nodata"
v-if=
"item.productsArr.length == 0 || itm.merchantProTreeResponses.length == 0"
>
<img
src=
"../../../assets/img/empty.png"
alt=
""
/>
<div>
{{ item.productsArr.length == 0 ?
"请先选择产品" : "暂无菜单权限"
}}
{{ item.productsArr.length == 0 ?
'请先选择产品' : '暂无菜单权限'
}}
</div>
</div>
<div
v-else
>
<el-tree
v-show=
"productTab == itm.productId"
:data=
"itm.merchantProTreeResponses"
show-checkbox
check-strictly
check-on-click-node
:expand-on-click-node=
"false"
default-expand-all
node-key=
"id"
:class=
"'tree_' + item.accounttypeId + '_' + itm.productId"
:ref=
"`tree_${item.accounttypeId}_${itm.productId}`"
highlight-current
:render-content=
"renderContent"
:props=
"defaultProps"
@
check=
"clickDeal"
></el-tree>
<el-tree
v-show=
"productTab == itm.productId"
:data=
"itm.merchantProTreeResponses"
show-checkbox
check-strictly
check-on-click-node
:expand-on-click-node=
"false"
default-expand-all
node-key=
"id"
:class=
"'tree_' + item.accounttypeId + '_' + itm.productId"
:ref=
"`tree_${item.accounttypeId}_${itm.productId}`"
highlight-current
:render-content=
"renderContent"
:props=
"defaultProps"
@
check=
"clickDeal"
></el-tree>
</div>
</div>
</div>
...
...
@@ -90,16 +40,16 @@
</div>
</template>
<
script
>
import
util
from
"@/utils/util"
;
import
util
from
'@/utils/util'
export
default
{
name
:
"product"
,
name
:
'product'
,
props
:
{
title
:
{
type
:
String
,
type
:
String
},
roleType
:
{
type
:
Boolean
,
}
,
type
:
Boolean
}
},
data
()
{
return
{
...
...
@@ -115,208 +65,200 @@ export default {
productId
:
0
,
products
:
[],
productsArr
:
[],
tabName
:
""
,
productTab
:
""
,
tabName
:
''
,
productTab
:
''
,
defaultProps
:
{
children
:
"children"
,
label
:
"label"
,
children
:
'children'
,
label
:
'label'
},
accountTypes
:
[]
,
}
;
accountTypes
:
[]
}
},
watch
:
{
tabMenu
:
{
handler
()
{
this
.
tabMenuStatus
=
this
.
tabMenu
.
every
(
item
=>
item
)
this
.
tabMenuStatus
=
this
.
tabMenu
.
some
(
item
=>
item
)
},
deep
:
true
,
}
,
deep
:
true
}
},
methods
:
{
handleClik
(
tab
,
event
)
{
console
.
log
(
tab
,
event
);
const
tabId
=
tab
.
name
;
const
productTab
=
this
.
tabMenu
.
find
(
(
i
)
=>
i
.
accounttypeId
==
tabId
)
this
.
productTab
=
productTab
.
productsArr
[
0
]?
productTab
.
productsArr
[
0
].
productId
:
''
;
console
.
log
(
tab
,
event
)
const
tabId
=
tab
.
name
const
productTab
=
this
.
tabMenu
.
find
(
i
=>
i
.
accounttypeId
==
tabId
)
this
.
productTab
=
productTab
.
productsArr
[
0
]
?
productTab
.
productsArr
[
0
].
productId
:
''
},
selectPro
(
data
)
{
this
.
$parent
.
roleRootRules
=
false
;
this
.
$parent
.
editStatus
=
true
;
this
.
productTab
=
data
.
length
!=
0
?
data
[
data
.
length
-
1
].
productId
:
""
;
const
{
tabName
,
tabMenu
,
productTab
}
=
this
;
console
.
log
(
tabName
,
data
,
productTab
,
"选中"
);
this
.
$parent
.
roleRootRules
=
false
this
.
$parent
.
editStatus
=
true
this
.
productTab
=
data
.
length
!=
0
?
data
[
data
.
length
-
1
].
productId
:
''
const
{
tabName
,
tabMenu
,
productTab
}
=
this
console
.
log
(
tabName
,
data
,
productTab
,
'选中'
)
// 设置全选
var
arr
=
tabMenu
.
find
((
i
)
=>
i
.
accounttypeId
==
tabName
)
.
products
.
find
((
j
)
=>
j
.
productId
==
productTab
).
merchantProTreeResponses
;
this
.
$refs
[
`tree_
${
tabName
}
_
${
productTab
}
`
]?
this
.
$refs
[
`tree_
${
tabName
}
_
${
productTab
}
`
][
0
].
setCheckedKeys
(
this
.
getAllId
(
arr
)):
''
;
console
.
log
(
tabMenu
);
var
arr
=
tabMenu
.
find
(
i
=>
i
.
accounttypeId
==
tabName
).
products
.
find
(
j
=>
j
.
productId
==
productTab
).
merchantProTreeResponses
this
.
$refs
[
`tree_
${
tabName
}
_
${
productTab
}
`
]
?
this
.
$refs
[
`tree_
${
tabName
}
_
${
productTab
}
`
][
0
].
setCheckedKeys
(
this
.
getAllId
(
arr
))
:
''
console
.
log
(
tabMenu
)
},
productClick
(
productId
)
{
this
.
productTab
=
productId
;
this
.
productTab
=
productId
},
findMenuFunTree
(
id
,
status
)
{
console
.
log
(
id
,
status
)
;
let
tabMenu
=
util
.
deepClone
(
this
.
tabMenu_r
)
;
let
menu
=
tabMenu
.
filter
(
(
item
)
=>
item
.
accounttypeId
==
id
);
let
index
=
tabMenu
.
findIndex
(
(
item
)
=>
item
.
accounttypeId
==
id
);
console
.
log
(
id
,
status
)
let
tabMenu
=
util
.
deepClone
(
this
.
tabMenu_r
)
let
menu
=
tabMenu
.
filter
(
item
=>
item
.
accounttypeId
==
id
)
let
index
=
tabMenu
.
findIndex
(
item
=>
item
.
accounttypeId
==
id
)
this
.
tabMenu_r
.
forEach
((
item
,
index
)
=>
{
if
(
!
this
.
tabMenu
[
index
])
{
this
.
$set
(
this
.
tabMenu
,
index
,
""
);
this
.
$set
(
this
.
tabMenu
,
index
,
''
)
}
})
;
})
if
(
status
)
{
this
.
$set
(
this
.
tabMenu
,
index
,
menu
[
0
])
;
this
.
$set
(
this
.
tabMenu
,
index
,
menu
[
0
])
}
else
{
this
.
$set
(
this
.
tabMenu
,
index
,
""
);
this
.
$set
(
this
.
tabMenu
,
index
,
''
)
}
},
// 获取当前的所有权限
async
findMenuFunTreeByMerId
(
params
)
{
let
tabMenu
=
await
this
.
$apis
.
store
.
findMenuFunTreeByMerId
(
params
)
;
tabMenu
=
tabMenu
.
map
(
(
item
)
=>
{
let
tabMenu
=
await
this
.
$apis
.
store
.
findMenuFunTreeByMerId
(
params
)
tabMenu
=
tabMenu
.
map
(
item
=>
{
return
{
productsArr
:
[],
products
:
item
.
products
,
accounttypeName
:
item
.
accounttypeName
,
accounttypeId
:
item
.
accounttypeId
,
}
;
})
;
this
.
tabMenu_r
=
util
.
deepClone
(
tabMenu
)
;
accounttypeId
:
item
.
accounttypeId
}
})
this
.
tabMenu_r
=
util
.
deepClone
(
tabMenu
)
this
.
$nextTick
(()
=>
{
this
.
addStyle
()
;
})
;
this
.
accountTypes
=
tabMenu
.
map
(
(
item
)
=>
{
this
.
addStyle
()
})
this
.
accountTypes
=
tabMenu
.
map
(
item
=>
{
return
{
products
:
null
,
accounttypeId
:
item
.
accounttypeId
,
}
;
})
;
this
.
tabName
=
this
.
tabMenu_r
[
0
].
accounttypeId
;
return
this
.
tabMenu_r
;
accounttypeId
:
item
.
accounttypeId
}
})
this
.
tabName
=
this
.
tabMenu_r
[
0
].
accounttypeId
return
this
.
tabMenu_r
},
// 获取当前的所有权限
async
accountTypeSearchRequest
(
params
,
arr
)
{
let
account
=
""
;
let
tabMenu
=
await
this
.
$apis
.
store
.
findMenuFunTreeByMerId
(
params
)
;
this
.
accountList
=
tabMenu
.
map
(
(
item
)
=>
{
let
account
=
''
let
tabMenu
=
await
this
.
$apis
.
store
.
findMenuFunTreeByMerId
(
params
)
this
.
accountList
=
tabMenu
.
map
(
item
=>
{
return
{
productsArr
:
[],
products
:
item
.
products
,
accounttypeName
:
item
.
accounttypeName
,
accounttypeId
:
item
.
accounttypeId
,
accounttypeId
:
item
.
accounttypeId
// merchantProTreeResponses: item.merchantProTreeResponses,
// productId: ''
}
;
})
;
}
})
this
.
$nextTick
(()
=>
{
this
.
addStyle
()
;
})
;
console
.
log
(
this
.
accountList
)
;
this
.
accountTypes
=
tabMenu
.
map
(
(
item
)
=>
{
this
.
addStyle
()
})
console
.
log
(
this
.
accountList
)
this
.
accountTypes
=
tabMenu
.
map
(
item
=>
{
return
{
products
:
null
,
accounttypeId
:
item
.
accounttypeId
,
}
;
})
;
this
.
tabMenu_s
=
util
.
deepClone
(
this
.
accountList
)
;
accounttypeId
:
item
.
accounttypeId
}
})
this
.
tabMenu_s
=
util
.
deepClone
(
this
.
accountList
)
// this.tabName = this.tabMenu[0].accounttypeId
this
.
findPermissionsByMerId
(
arr
)
;
this
.
tabMenu_r
=
util
.
deepClone
(
this
.
accountList
)
;
return
this
.
accountList
;
this
.
findPermissionsByMerId
(
arr
)
this
.
tabMenu_r
=
util
.
deepClone
(
this
.
accountList
)
return
this
.
accountList
},
// 获取已选择的权限
findPermissionsByMerId
(
arr
)
{
arr
.
forEach
(
(
item
)
=>
{
this
.
accountList
.
forEach
(
(
itm
)
=>
{
arr
.
forEach
(
item
=>
{
this
.
accountList
.
forEach
(
itm
=>
{
if
(
item
.
accounttypeId
==
itm
.
accounttypeId
)
{
this
.
tabMenu
.
push
(
itm
)
;
if
(
!
item
.
productList
)
{
this
.
tabMenu
.
push
(
itm
)
if
(
!
item
.
productList
)
{
return
}
item
.
productList
.
forEach
(
(
i
)
=>
{
itm
.
products
.
forEach
(
(
j
)
=>
{
item
.
productList
.
forEach
(
i
=>
{
itm
.
products
.
forEach
(
j
=>
{
if
(
i
.
productId
==
j
.
productId
)
{
itm
.
productsArr
.
push
(
j
)
;
itm
.
productsArr
.
push
(
j
)
this
.
$nextTick
(()
=>
{
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
][
0
].
setCheckedKeys
(
i
.
idList
);
});
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
][
0
].
setCheckedKeys
(
i
.
idList
)
})
}
})
;
})
;
})
})
}
})
;
})
;
this
.
tabName
=
this
.
tabMenu
[
0
].
accounttypeId
;
this
.
productTab
=
this
.
tabMenu
[
0
].
productsArr
[
0
].
productId
;
})
})
this
.
tabName
=
this
.
tabMenu
[
0
].
accounttypeId
this
.
productTab
=
this
.
tabMenu
[
0
].
productsArr
[
0
].
productId
},
resetView
()
{
this
.
tabMenu
=
[]
;
this
.
accountList
=
util
.
deepClone
(
this
.
tabMenu_s
)
;
this
.
tabMenu_x
.
forEach
(
(
item
)
=>
{
this
.
accountList
.
forEach
(
(
itm
)
=>
{
console
.
log
(
itm
)
;
this
.
tabMenu
=
[]
this
.
accountList
=
util
.
deepClone
(
this
.
tabMenu_s
)
this
.
tabMenu_x
.
forEach
(
item
=>
{
this
.
accountList
.
forEach
(
itm
=>
{
console
.
log
(
itm
)
if
(
item
.
accounttypeId
==
itm
.
accounttypeId
)
{
this
.
tabMenu
.
push
(
itm
)
;
item
.
products
.
forEach
(
(
i
)
=>
{
itm
.
products
.
forEach
(
(
j
)
=>
{
this
.
tabMenu
.
push
(
itm
)
item
.
products
.
forEach
(
i
=>
{
itm
.
products
.
forEach
(
j
=>
{
if
(
i
.
productId
==
j
.
productId
)
{
itm
.
productsArr
.
push
(
j
)
;
itm
.
productsArr
.
push
(
j
)
this
.
$nextTick
(()
=>
{
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
][
0
].
setCheckedKeys
(
i
.
menuIds
);
});
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
]
?
this
.
$refs
[
`tree_
${
itm
.
accounttypeId
}
_
${
j
.
productId
}
`
][
0
].
setCheckedKeys
(
i
.
menuIds
)
:
''
})
}
})
;
})
;
})
})
}
})
;
})
;
})
})
},
// 渲染树结构
renderContent
(
h
,
v
)
{
if
(
v
.
data
.
logo
==
"functionValue"
)
{
if
(
v
.
data
.
logo
==
'functionValue'
)
{
return
(
<
div
class
=
"custom-tree-node fun-tree-node"
>
<
span
>
{
v
.
node
.
label
}
<
/span
>
<
/div
>
)
;
)
}
else
{
return
(
<
div
class
=
"custom-tree-node"
>
<
span
>
{
v
.
node
.
label
}
<
/span
>
<
/div
>
)
;
)
}
},
addStyle
()
{
const
nodes
=
document
.
getElementsByClassName
(
"fun-tree-node"
);
const
nodes
=
document
.
getElementsByClassName
(
'fun-tree-node'
)
for
(
let
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
const
parentNode
=
nodes
[
i
].
parentNode
;
parentNode
.
style
.
float
=
"left"
;
const
parentNode
=
nodes
[
i
].
parentNode
parentNode
.
style
.
float
=
'left'
}
},
clickDeal
(
currentObj
,
treeStatus
)
{
this
.
$parent
.
editStatus
=
true
;
this
.
$parent
.
editStatus
=
true
// 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。
let
selected
=
treeStatus
.
checkedKeys
.
indexOf
(
currentObj
.
id
)
;
// -1未选中
let
selected
=
treeStatus
.
checkedKeys
.
indexOf
(
currentObj
.
id
)
// -1未选中
// 选中
if
(
selected
!==
-
1
)
{
// 子节点只要被选中父节点就被选中
this
.
selectedParent
(
currentObj
)
;
this
.
selectedParent
(
currentObj
)
// 统一处理子节点为相同的勾选状态
this
.
uniteChildSame
(
currentObj
,
true
)
;
this
.
uniteChildSame
(
currentObj
,
true
)
}
else
{
// 未选中 处理子节点全部未选中
console
.
log
(
currentObj
)
;
console
.
log
(
currentObj
)
if
(
currentObj
.
children
!==
null
)
{
if
(
currentObj
.
children
.
length
!==
0
)
{
this
.
uniteChildSame
(
currentObj
,
false
)
;
this
.
uniteChildSame
(
currentObj
,
false
)
}
//放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定
// this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态
...
...
@@ -328,147 +270,136 @@ export default {
},
uniteParentSame
(
id
,
treeStatus
)
{
//当子节点全为未选中时父节点也变为未选中状态
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
;
let
node
=
this
.
$refs
[
tree_ref
][
0
].
getNode
(
id
)
;
//获取当前节点的节点树
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
let
node
=
this
.
$refs
[
tree_ref
][
0
].
getNode
(
id
)
//获取当前节点的节点树
if
(
node
.
parent
!==
null
&&
node
.
parent
!==
undefined
)
{
let
parentNode
=
node
.
parent
.
data
;
//获取当前节点的父节点树
let
parentNode
=
node
.
parent
.
data
//获取当前节点的父节点树
if
(
parentNode
!=
undefined
)
{
//判断父节点是否存在
for
(
let
i
=
0
;
i
<
parentNode
.
children
.
length
;
i
++
)
{
let
checkedKeys
=
this
.
$refs
[
tree_ref
][
0
].
getCheckedKeys
()
;
let
hafCheckedKeys
=
this
.
$refs
[
tree_ref
][
0
].
getHalfCheckedKeys
()
;
let
selectNodes
=
checkedKeys
.
concat
(
hafCheckedKeys
)
;
//获取已选择树节点
let
selected
=
selectNodes
.
indexOf
(
parentNode
.
children
[
i
].
id
)
;
// -1当前节点的同级节点是否全部未选中
let
checkedKeys
=
this
.
$refs
[
tree_ref
][
0
].
getCheckedKeys
()
let
hafCheckedKeys
=
this
.
$refs
[
tree_ref
][
0
].
getHalfCheckedKeys
()
let
selectNodes
=
checkedKeys
.
concat
(
hafCheckedKeys
)
//获取已选择树节点
let
selected
=
selectNodes
.
indexOf
(
parentNode
.
children
[
i
].
id
)
// -1当前节点的同级节点是否全部未选中
if
(
selected
!==
-
1
)
{
return
;
return
}
}
}
else
{
return
;
return
}
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
parentNode
.
id
,
false
)
;
//修改节点为未选择
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
parentNode
.
id
,
false
)
//修改节点为未选择
if
(
node
.
level
>
2
)
{
//判断是否是最上级节点
this
.
uniteParentSame
(
parentNode
.
id
,
treeStatus
)
;
this
.
uniteParentSame
(
parentNode
.
id
,
treeStatus
)
}
}
else
{
return
;
return
}
},
// 统一处理子节点为相同的勾选状态
uniteChildSame
(
treeList
,
isSelected
)
{
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
;
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
treeList
.
id
,
isSelected
)
;
console
.
log
(
treeList
)
;
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
treeList
.
id
,
isSelected
)
console
.
log
(
treeList
)
if
(
treeList
.
children
!==
null
)
{
for
(
let
i
=
0
;
i
<
treeList
.
children
.
length
;
i
++
)
{
this
.
uniteChildSame
(
treeList
.
children
[
i
],
isSelected
)
;
this
.
uniteChildSame
(
treeList
.
children
[
i
],
isSelected
)
}
}
},
// 统一处理父节点为选中
selectedParent
(
currentObj
)
{
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
;
let
currentNode
=
this
.
$refs
[
tree_ref
][
0
].
getNode
(
currentObj
)
;
const
tree_ref
=
`tree_
${
this
.
tabName
}
_
${
this
.
productTab
}
`
let
currentNode
=
this
.
$refs
[
tree_ref
][
0
].
getNode
(
currentObj
)
if
(
currentNode
.
parent
.
key
!==
undefined
)
{
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
currentNode
.
parent
,
true
)
;
this
.
selectedParent
(
currentNode
.
parent
)
;
this
.
$refs
[
tree_ref
][
0
].
setChecked
(
currentNode
.
parent
,
true
)
this
.
selectedParent
(
currentNode
.
parent
)
}
},
// 获取所有节点的id
getAllId
(
data
,
arr
=
[])
{
if
(
data
)
{
data
.
forEach
(
(
item
)
=>
{
arr
.
push
(
item
.
id
)
;
data
.
forEach
(
item
=>
{
arr
.
push
(
item
.
id
)
if
(
item
.
children
&&
item
.
children
.
length
!=
0
)
{
item
.
children
.
forEach
(
(
i
)
=>
{
arr
.
push
(
i
.
id
)
;
this
.
getAllId
(
i
.
children
,
arr
)
;
})
;
item
.
children
.
forEach
(
i
=>
{
arr
.
push
(
i
.
id
)
this
.
getAllId
(
i
.
children
,
arr
)
})
}
})
;
})
}
return
arr
;
return
arr
},
getSelectInfo
()
{
this
.
tabMenu
=
this
.
tabMenu
.
filter
(
item
=>
item
)
this
.
accountTypes
=
this
.
tabMenu
.
map
((
item
)
=>
{
let
products
=
[];
let
productList
=
[];
item
.
productsArr
.
forEach
((
itm
)
=>
{
const
checkedNodes
=
this
.
$refs
[
`tree_
${
item
.
accounttypeId
}
_
${
itm
.
productId
}
`
]
?
this
.
$refs
[
`tree_
${
item
.
accounttypeId
}
_
${
itm
.
productId
}
`
][
0
].
getCheckedNodes
()
:
[];
console
.
log
(
checkedNodes
);
this
.
tabMenu
=
this
.
tabMenu
.
filter
(
item
=>
item
)
this
.
accountTypes
=
this
.
tabMenu
.
map
(
item
=>
{
let
products
=
[]
let
productList
=
[]
item
.
productsArr
.
forEach
(
itm
=>
{
const
checkedNodes
=
this
.
$refs
[
`tree_
${
item
.
accounttypeId
}
_
${
itm
.
productId
}
`
]
?
this
.
$refs
[
`tree_
${
item
.
accounttypeId
}
_
${
itm
.
productId
}
`
][
0
].
getCheckedNodes
()
:
[]
console
.
log
(
checkedNodes
)
const
menuIdList
=
checkedNodes
// .filter((item) => item.logo === "menu")
.
filter
(
(
item
)
=>
item
.
logo
!==
"function"
&&
item
.
logo
!==
"functionValue"
&&
item
.
logo
!==
"neglect"
)
.
map
((
i
)
=>
i
.
id
);
// 全选菜单idlist
.
filter
(
item
=>
item
.
logo
!==
'function'
&&
item
.
logo
!==
'functionValue'
&&
item
.
logo
!==
'neglect'
)
.
map
(
i
=>
i
.
id
)
// 全选菜单idlist
// const partSelectList = halfCheckedNodes.filter(item => item.logo === 'menu').map(i => i.id) // 半选菜单idlist
const
functionIdList
=
checkedNodes
.
filter
((
item
)
=>
item
.
logo
===
"function"
);
const
functionValueIdLists
=
checkedNodes
.
filter
(
(
item
)
=>
item
.
logo
===
"functionValue"
);
var
list
=
[];
const
functionIdList
=
checkedNodes
.
filter
(
item
=>
item
.
logo
===
'function'
)
const
functionValueIdLists
=
checkedNodes
.
filter
(
item
=>
item
.
logo
===
'functionValue'
)
var
list
=
[]
/** { menuId, id, functionValue} */
if
(
functionValueIdLists
.
length
!==
0
)
{
functionValueIdLists
.
forEach
((
j
,
index
)
=>
{
if
(
list
.
map
(
(
item
)
=>
item
.
id
).
includes
(
j
.
parentId
))
{
const
obj
=
list
.
find
(
(
k
)
=>
k
.
id
===
j
.
parentId
);
obj
.
functionValue
+=
";"
+
j
.
id
+
":"
+
j
.
label
;
if
(
list
.
map
(
item
=>
item
.
id
).
includes
(
j
.
parentId
))
{
const
obj
=
list
.
find
(
k
=>
k
.
id
===
j
.
parentId
)
obj
.
functionValue
+=
';'
+
j
.
id
+
':'
+
j
.
label
}
else
{
list
.
push
({
id
:
j
.
parentId
,
menuId
:
j
.
superParentId
,
functionValue
:
j
.
id
+
":"
+
j
.
label
,
})
;
functionValue
:
j
.
id
+
':'
+
j
.
label
})
}
})
;
})
}
console
.
log
(
menuIdList
,
functionIdList
,
functionValueIdLists
,
list
)
;
console
.
log
(
menuIdList
,
functionIdList
,
functionValueIdLists
,
list
)
if
(
this
.
roleType
)
{
productList
.
push
({
productId
:
itm
.
productId
,
functionIdList
:
functionIdList
,
// functionValue: list,
menuIdList
:
menuIdList
,
})
;
menuIdList
:
menuIdList
})
}
else
{
products
.
push
({
productId
:
itm
.
productId
,
functionIds
:
functionIdList
,
functionValue
:
list
,
menuIds
:
menuIdList
,
})
;
menuIds
:
menuIdList
})
}
})
;
})
if
(
this
.
roleType
)
{
return
{
accounttypeId
:
item
.
accounttypeId
,
productList
,
}
;
productList
}
}
else
{
return
{
accounttypeId
:
item
.
accounttypeId
,
products
,
}
;
products
}
}
})
;
return
this
.
accountTypes
;
}
,
})
return
this
.
accountTypes
}
},
mounted
()
{
// this.accountTypeSearchRequest();
// this.findPermissionsByMerId()
}
,
}
;
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
...
...
src/views/role/create.vue
View file @
95526d4
...
...
@@ -25,7 +25,7 @@
</el-form-item>
<!--
<el-form-item
label=
"角色权限"
prop=
"roleRoot"
>
<div
class=
"custom_element"
>
<template
v-for=
"(item, index) in accountList"
>
<template
v-for=
"(item, index) in accountList
Select
"
>
<div
:key=
"index"
class=
"wrap"
>
<AutoButton
@
getBtnStatus=
"selectCurAccount(item, index)"
:typeStatus=
"item.select"
:btnLabel=
"item.accounttypeName"
></AutoButton>
</div>
...
...
@@ -41,7 +41,7 @@
<auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button>
</div> -->
<div
class=
"custom_element"
>
<
template
v-for=
"(item, index) in accountList"
>
<
template
v-for=
"(item, index) in accountList
Select
"
>
<div
:key=
"index"
class=
"wrap"
>
<AutoButton
@
getBtnStatus=
"selectCurAccount(item, index)"
:typeStatus=
"item.select"
:btnLabel=
"item.accounttypeName"
></AutoButton>
</div>
...
...
@@ -106,7 +106,7 @@ export default {
pageName
:
'新增角色'
,
roleInfo
:
null
,
pageType
:
'create'
,
accountList
:
[],
accountList
Select
:
[],
//商户
merchantList
:
[],
// tree数据
...
...
@@ -145,7 +145,8 @@ export default {
}
}
}
this
.
accountList
=
res
this
.
accountListSelect
=
res
console
.
log
(
this
.
accountListSelect
)
})
},
getMerchantName
()
{
...
...
@@ -168,18 +169,18 @@ export default {
// 选择商户----获取权限
async
selectMerchant
(
id
)
{
let
res
=
await
this
.
$refs
.
productFrom
.
findMenuFunTreeByMerId
({
id
})
this
.
accountList
=
res
.
map
(
item
=>
{
this
.
accountList
Select
=
res
.
map
(
item
=>
{
item
.
select
=
false
return
item
})
// this.rootList = this.accountList
// this.rootList = this.accountList
Select
},
// 选择商户权限
selectCurAccount
(
item
,
index
)
{
this
.
roleRootRules
=
false
this
.
accountList
[
index
].
select
=
!
item
.
select
this
.
accountList
Select
[
index
].
select
=
!
item
.
select
this
.
curRootIndex
=
0
if
(
this
.
accountList
[
index
].
select
)
{
if
(
this
.
accountList
Select
[
index
].
select
)
{
this
.
rootList
.
push
(
item
)
}
else
{
let
arr
=
this
.
rootList
.
filter
(
el
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment