Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
cloudSystem
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0cff4816
authored
Aug 08, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
css
parent
eaf42f75
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
304 additions
and
155 deletions
src/assets/css/info/message.less
src/assets/css/info/message.min.css
src/assets/css/info/message.min.css.map
src/components/menu.vue
src/views/Info/message.vue
src/views/Info/subAccount.vue
src/views/Info/subAccountAdd.vue
src/views/Info/subAccountEdit.vue
src/assets/css/info/message.less
View file @
0cff4816
.messagexk {
.message-box {
background: #fff;
padding: 20px;
height: calc(100vh - 136px);
.h3 {
font-size: 16px;
color: #333;
font-weight: bold;
position: relative;
&::before {
content: "";
width: 3px;
height: 100%;
background: #1969F9;
position: absolute;
left: -20px;
top: 0;
}
}
.up-box {
position: relative;
.avatar-uploader {
width: 98px;
height: 34px;
border-radius: 2px;
border: 1px solid #BEC9DF;
overflow: hidden;
line-height: 34px;
font-size: 14px;
color: #646B78;
.iconfont {
font-size: 18px;
position: relative;
top: -1px;
margin-left: 10px;
.message-box {
background: #fff;
padding: 20px;
height: calc(100vh - 136px);
.h3 {
font-size: 16px;
color: #333;
font-weight: bold;
position: relative;
&::before {
content: "";
width: 3px;
height: 100%;
background: #1969F9;
position: absolute;
left: -20px;
top: 0;
}
}
.up-box {
position: relative;
.avatar-uploader {
width: 98px;
height: 34px;
border-radius: 2px;
border: 1px solid #BEC9DF;
overflow: hidden;
line-height: 34px;
font-size: 14px;
color: #646B78;
.iconfont {
font-size: 18px;
position: relative;
top: -1px;
margin-left: 10px;
}
&:hover, .el-upload--picture-card:hover, .el-upload:focus {
color: #1969F9 !important;
border-color: #1969F9 !important;
}
}
.imspre {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 50px;
margin-bottom: 16px;
}
}
&:hover, .el-upload--picture-card:hover, .el-upload:focus {
color: #1969F9 !important;
border-color: #1969F9 !important;
}
.role-auth {
background: #FFFFFF;
margin-bottom: 10px;
ul {
li {
padding: 0 10px;
border-right: 1px dashed #DCDFE6;
margin-bottom: 10px;
&:last-child {
border-right: none;
}
}
}
}
.imspre {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 50px;
margin-bottom: 16px;
}
}
}
}
\ No newline at end of file
src/assets/css/info/message.min.css
View file @
0cff4816
...
...
@@ -50,4 +50,16 @@
border-radius
:
50px
;
margin-bottom
:
16px
;
}
.messagexk
.role-auth
{
background
:
#FFFFFF
;
margin-bottom
:
10px
;
}
.messagexk
.role-auth
ul
li
{
padding
:
0
10px
;
border-right
:
1px
dashed
#DCDFE6
;
margin-bottom
:
10px
;
}
.messagexk
.role-auth
ul
li
:last-child
{
border-right
:
none
;
}
/*# sourceMappingURL=message.min.css.map */
\ No newline at end of file
src/assets/css/info/message.min.css.map
View file @
0cff4816
{"version":3,"sources":["message.less"],"names":[],"mappings":"AAAA,UAEE;EACE,gBAAA;EACA,aAAA;EACA,QAAQ,mBAAR;;AALJ,UAEE,aAKE;EACE,eAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;;AAEA,UAXJ,aAKE,IAMG;EACC,SAAS,EAAT;EACA,UAAA;EACA,YAAA;EACA,mBAAA;EACA,kBAAA;EACA,WAAA;EACA,MAAA;;AApBR,UAEE,aAuBE;EACE,kBAAA;;AA1BN,UAEE,aAuBE,QAGE;EACE,WAAA;EACA,YAAA;EACA,kBAAA;EACA,yBAAA;EACA,gBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;;AApCR,UAEE,aAuBE,QAGE,iBAUE;EACE,eAAA;EACA,kBAAA;EACA,SAAA;EACA,iBAAA;;AAGF,UA3CN,aAuBE,QAGE,iBAiBG;AA7CT,UAEE,aAuBE,QAGE,iBAiBW,yBAAwB;AA7CzC,UAEE,aAuBE,QAGE,iBAiB2C,WAAU;EACjD,cAAA;EACA,qBAAA;;AA/CV,UAEE,aAuBE,QA0BE;EACE,YAAA;EACA,aAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA","file":"message.min.css"}
\ No newline at end of file
{"version":3,"sources":["message.less"],"names":[],"mappings":"AAAA,UAEI;EACI,gBAAA;EACA,aAAA;EACA,QAAQ,mBAAR;;AALR,UAEI,aAKI;EACI,eAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;;AAEA,UAXR,aAKI,IAMK;EACG,SAAS,EAAT;EACA,UAAA;EACA,YAAA;EACA,mBAAA;EACA,kBAAA;EACA,WAAA;EACA,MAAA;;AApBhB,UAEI,aAuBI;EACI,kBAAA;;AA1BZ,UAEI,aAuBI,QAGI;EACI,WAAA;EACA,YAAA;EACA,kBAAA;EACA,yBAAA;EACA,gBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;;AApChB,UAEI,aAuBI,QAGI,iBAUI;EACI,eAAA;EACA,kBAAA;EACA,SAAA;EACA,iBAAA;;AAGJ,UA3CZ,aAuBI,QAGI,iBAiBK;AA7CjB,UAEI,aAuBI,QAGI,iBAiBa,yBAAwB;AA7CjD,UAEI,aAuBI,QAGI,iBAiB6C,WAAU;EAC/C,cAAA;EACA,qBAAA;;AA/CpB,UAEI,aAuBI,QA0BI;EACI,YAAA;EACA,aAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA;;AAxDhB,UA6DI;EACI,mBAAA;EACA,mBAAA;;AA/DR,UA6DI,WAGI,GACI;EACI,eAAA;EACA,gCAAA;EACA,mBAAA;;AAEA,UATZ,WAGI,GACI,GAKK;EACG,kBAAA","file":"message.min.css"}
\ No newline at end of file
src/components/menu.vue
View file @
0cff4816
...
...
@@ -363,9 +363,9 @@ export default {
if
(
res
.
code
===
0
)
{
const
overviewItem
=
res
.
data
.
data
.
find
(
item
=>
item
.
name
===
"概况"
);
const
menuData
=
res
.
data
.
data
.
filter
(
item
=>
item
.
name
!==
"概况"
);
this
.
index_home
=
overviewItem
;
this
.
menuData
=
menuData
;
}
else
{
this
.
$message
({
message
:
res
.
msg
,
...
...
src/views/Info/message.vue
View file @
0cff4816
...
...
@@ -4,7 +4,7 @@
<div
class=
"tip"
>
基本信息
</div>
<div
class=
"row verCenter"
>
<div
class=
"up-box"
>
<img
:src=
"userinfo.avatar"
class=
"imspre"
/>
<img
:src=
"userinfo.avatar
|| 'https://www.ichunt.com/v3/dist/res/home/images/headimg/boy1.png'
"
class=
"imspre"
/>
<el-upload
class=
"avatar-uploader"
:data=
"fileData"
:action=
"upUrl"
:show-file-list=
"false"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
>
<span
class=
"icon iconfont fl"
>
</span>
<div
class=
"fl"
>
更换头像
</div>
...
...
@@ -28,34 +28,43 @@
<div
class=
"tip"
style=
"margin-top: 20px"
>
猎芯联系渠道
</div>
<el-form
:inline=
"true"
:model=
"userinfo"
label-width=
"124px"
>
<el-form-item
label=
"猎芯专属采购经理"
>
<el-input
v-model=
"userinfo.sku_user_info.name"
placeholder=
""
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.sku_user_info.name"
placeholder=
""
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话"
>
<el-input
v-model=
"userinfo.sku_user_info.mobile"
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.sku_user_info.mobile"
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
<el-form-item
label=
"邮箱"
>
<el-input
v-model=
"userinfo.sku_user_info.email"
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.sku_user_info.email"
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
<br>
<el-form-item
label=
"猎芯渠道经理"
>
<el-input
v-model=
"userinfo.channel_user_info.name"
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.channel_user_info.name"
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话"
>
<el-input
v-model=
"userinfo.channel_user_info.mobile"
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.channel_user_info.mobile"
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
<el-form-item
label=
"邮箱"
>
<el-input
v-model=
"userinfo.channel_user_info.email"
:readonly=
"true"
></el-input>
<el-input
v-model=
"userinfo.channel_user_info.email"
:readonly=
"true"
disabled
v-if=
"userinfo.sku_user_info"
></el-input>
</el-form-item>
</el-form>
<div
class=
"tip"
style=
"margin-top: 20px"
>
意见反馈渠道
</div>
<div
class=
"tip"
>
意见反馈渠道
</div>
<el-form
:inline=
"true"
:model=
"userinfo"
label-width=
"124px"
>
<el-form-item
label=
"运营总监"
>
<el-input
value=
"Sophie(符静女士)"
placeholder=
""
></el-input>
<el-input
value=
"Sophie(符静女士)"
placeholder=
""
disabled
></el-input>
</el-form-item>
<el-form-item
label=
"邮箱"
>
<el-input
value=
"sophie@ichunt.com"
></el-input>
<el-input
value=
"sophie@ichunt.com"
disabled
></el-input>
</el-form-item>
</el-form>
<div
class=
"tip"
>
消息推送配置
</div>
<!--子账号消息推送配置-->
<section
class=
"role-auth"
>
<ul
class=
"row"
>
<li
v-for=
"(item,index) in messageMenu"
:key=
"item.id"
>
<el-tree
:data=
"item"
show-checkbox
:props=
"defaultProps"
:default-checked-keys=
"filteredMessageIds"
default-expand-all
node-key=
"id"
@
check-change=
"handleCheckMsgChange"
></el-tree>
</li>
</ul>
</section>
<el-row>
<el-button
type=
"primary"
@
click=
"submituser"
>
编辑
</el-button>
</el-row>
...
...
@@ -68,48 +77,97 @@ import Vue from 'vue';
import
Menu
from
"@/components/menu.vue"
;
import
{
NODE_ENVS
}
from
"../../ajax"
;
import
Tool
from
'../../tool'
import
{
Form
,
FormItem
,
Input
,
Message
,
Row
,
Upload
}
from
'element-ui'
import
{
Form
,
FormItem
,
Input
,
Message
,
Row
,
Tree
,
Upload
}
from
'element-ui'
Vue
.
prototype
.
$message
=
Message
;
Vue
.
use
(
Form
).
use
(
FormItem
).
use
(
Input
).
use
(
Upload
).
use
(
Row
);
Vue
.
use
(
Form
).
use
(
FormItem
).
use
(
Input
).
use
(
Upload
).
use
(
Row
)
.
use
(
Tree
)
;
export
default
{
name
:
"message"
,
data
()
{
return
{
defaultProps
:
{
children
:
'children'
,
label
:
'name'
},
filteredMessageIds
:
[],
upUrl
:
NODE_ENVS
+
'/api/user/setavatar'
,
fileData
:
{
token
:
Tool
.
getCookie
(
'token'
)},
userinfo
:
{
company_name
:
''
,
contacts_name
:
''
,
mobile
:
''
,
email
:
''
,
avatar
:
'https://www.ichunt.com/v3/dist/res/home/images/headimg/boy1.png'
}
messageMenu
:
[],
//消息权限菜单
user_message_rule
:
[],
userinfo
:
{}
};
},
created
()
{
this
.
getUseInfo
()
this
.
getUseInfo
();
this
.
getMessageMenu
();
},
computed
:
{},
methods
:
{
/**
* 获取当前用户的消息权限菜单
*/
getMessageMenu
()
{
this
.
$http
(
'GET'
,
"/api/subAccount/getMessageMenu"
,
{}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
let
newMenuData
=
res
.
data
.
data
.
map
(
item
=>
[
item
]);
this
.
messageMenu
=
newMenuData
;
const
filteredIds
=
[];
res
.
data
.
data
.
forEach
(
item
=>
{
if
(
item
.
children
)
{
const
childrenWithChecked
=
item
.
children
.
filter
(
child
=>
child
.
checked
);
const
ids
=
childrenWithChecked
.
map
(
child
=>
child
.
id
);
filteredIds
.
push
(...
ids
);
}
else
{
if
(
item
.
checked
)
{
filteredIds
.
push
(
item
.
id
);
}
}
});
this
.
filteredMessageIds
=
filteredIds
;
//筛选出rule-message
const
result
=
[];
for
(
let
obj
of
res
.
data
.
data
)
{
if
(
obj
.
checked
)
{
result
.
push
(
obj
.
name
);
}
if
(
obj
.
children
)
{
for
(
let
child
of
obj
.
children
)
{
if
(
child
.
checked
)
{
result
.
push
(
child
.
name
);
}
}
}
}
this
.
user_message_rule
=
result
;
}
else
{
this
.
$message
({
message
:
res
.
msg
,
type
:
'warning'
});
}
})
},
getUseInfo
()
{
if
(
window
.
userInfo
)
{
this
.
userinfo
=
window
.
userInfo
;
}
else
{
this
.
$http
(
'get'
,
"/api/user/getuserinfo"
).
then
(
res
=>
{
this
.
$http
(
'GET'
,
"/api/user/getuserinfo"
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
userinfo
=
res
.
data
;
window
.
userInfo
=
res
.
data
})
}
}
else
{
this
.
$message
({
message
:
res
.
msg
,
type
:
'warning'
});
}
})
},
submituser
()
{
this
.
$http
(
'post'
,
"/api/user/setuserinfo"
,
{
email
:
this
.
userinfo
.
email
,
contacts_name
:
this
.
userinfo
.
contacts_name
contacts_name
:
this
.
userinfo
.
contacts_name
,
user_message_rule
:
JSON
.
stringify
(
this
.
user_message_rule
)
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
$message
({
message
:
'
操作
成功'
,
message
:
'
更新
成功'
,
type
:
'success'
});
sessionStorage
.
removeItem
(
'userInfox'
)
...
...
@@ -152,6 +210,28 @@ export default {
});
}
return
isJPG
&&
isLt2M
;
},
/**
* 筛选子账号勾选的消息推送配置
* @param data
* @param checked
*/
handleCheckMsgChange
(
data
,
checked
)
{
if
(
checked
)
{
if
(
!
this
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
user_message_rule
.
push
(
data
.
name
);
}
}
else
{
const
index
=
this
.
user_message_rule
.
indexOf
(
data
.
name
);
if
(
index
!==
-
1
)
{
this
.
user_message_rule
.
splice
(
index
,
1
);
}
if
(
data
.
children
)
{
if
(
!
this
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
user_message_rule
.
push
(
data
.
name
);
}
}
}
}
},
components
:
{
...
...
src/views/Info/subAccount.vue
View file @
0cff4816
...
...
@@ -72,11 +72,14 @@
<
script
>
import
Vue
from
'vue'
;
import
Menu
from
"@/components/menu.vue"
;
import
{
Autocomplete
,
Button
,
DatePicker
,
Dialog
,
Dropdown
,
DropdownItem
,
DropdownMenu
,
Form
,
FormItem
,
Input
,
MessageBox
,
Option
,
Pagination
,
Popover
,
Radio
,
RadioButton
,
RadioGroup
,
Select
,
Table
,
TableColumn
,
Tag
,
Tooltip
}
from
'element-ui'
import
{
A
lert
,
A
utocomplete
,
Button
,
DatePicker
,
Dialog
,
Dropdown
,
DropdownItem
,
DropdownMenu
,
Form
,
FormItem
,
Input
,
MessageBox
,
Option
,
Pagination
,
Popover
,
Radio
,
RadioButton
,
RadioGroup
,
Select
,
Table
,
TableColumn
,
Tag
,
Tooltip
}
from
'element-ui'
Vue
.
prototype
.
$msgbox
=
MessageBox
;
Vue
.
prototype
.
$alert
=
MessageBox
.
alert
;
Vue
.
prototype
.
$confirm
=
MessageBox
.
confirm
;
Vue
.
use
(
Button
).
use
(
Form
).
use
(
Select
).
use
(
Option
).
use
(
Input
).
use
(
FormItem
).
use
(
Dialog
).
use
(
Autocomplete
).
use
(
Radio
).
use
(
RadioGroup
).
use
(
RadioButton
);
Vue
.
use
(
DatePicker
).
use
(
Dropdown
).
use
(
DropdownMenu
).
use
(
DropdownItem
).
use
(
TableColumn
).
use
(
Table
).
use
(
Pagination
).
use
(
Popover
).
use
(
Tag
).
use
(
Tooltip
);
Vue
.
use
(
DatePicker
).
use
(
Dropdown
).
use
(
DropdownMenu
).
use
(
DropdownItem
).
use
(
TableColumn
).
use
(
Table
).
use
(
Pagination
).
use
(
Popover
).
use
(
Tag
).
use
(
Tooltip
)
.
use
(
Alert
)
;
export
default
{
name
:
"subAccount"
,
...
...
@@ -128,14 +131,20 @@ export default {
})
},
/**
*
启用,
禁用
*
1启用,2
禁用
* @param row
*/
confirmEnable
(
row
,
type
)
{
this
.
$confirm
(
`确定要"
${
row
.
status
==
1
?
'禁用'
:
'启用'
}
" 吗?`
,
'提示'
,
{
if
(
type
==
1
)
{
var
html
=
`确定<span style="color: #00BFBF">启用</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:启用后,该子账号可登录芯链系统,操作对应权限页面</p>`
;
}
else
{
var
html
=
`确定<span style="color: #E6A23C">禁用</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:禁用后,该子账号无法再登录芯链系统</p>`
;
}
this
.
$confirm
(
html
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
type
,
dangerouslyUseHTMLString
:
true
}).
then
(()
=>
{
this
.
$http
(
'POST'
,
"/api/subAccount/changeStatus"
,
{
sbat_id
:
row
.
sbat_id
,
status
:
type
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -155,10 +164,12 @@ export default {
* 删除
*/
confirmDelete
(
row
)
{
this
.
$confirm
(
`确定要删除 "
${
row
.
name
}
" 吗?`
,
'提示'
,
{
var
html
=
`确定<span style="color: red;">删除</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:删除后,该子账号从系统清除,无法再登录芯链系统!</p>`
;
this
.
$confirm
(
html
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
,
dangerouslyUseHTMLString
:
true
}).
then
(()
=>
{
this
.
$http
(
'POST'
,
"/api/subAccount/changeStatus"
,
{
sbat_id
:
row
.
sbat_id
,
status
:
0
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
src/views/Info/subAccountAdd.vue
View file @
0cff4816
...
...
@@ -26,7 +26,7 @@
<!--子账号权限配置-->
<section
class=
"role-auth"
>
<ul
class=
"row"
>
<li
v-for=
"(item,index) in menuData"
:key=
"i
ndex
"
>
<li
v-for=
"(item,index) in menuData"
:key=
"i
tem.id
"
>
<el-tree
:data=
"item"
show-checkbox
node-key=
"id"
:props=
"defaultProps"
default-expand-all
@
check-change=
"handleCheckChange"
></el-tree>
</li>
</ul>
...
...
@@ -35,7 +35,7 @@
<!--子账号消息推送配置-->
<section
class=
"role-auth"
>
<ul
class=
"row"
>
<li
v-for=
"(item,index) in messageMenu"
:key=
"i
ndex
"
>
<li
v-for=
"(item,index) in messageMenu"
:key=
"i
tem.id
"
>
<el-tree
:data=
"item"
show-checkbox
node-key=
"id"
:props=
"defaultProps"
default-expand-all
@
check-change=
"handleCheckMsgChange"
></el-tree>
</li>
</ul>
...
...
@@ -66,11 +66,10 @@ export default {
label
:
'name'
},
rules
:
{
mobile
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
}],
mobile
:
[
{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
},
{
pattern
:
/^1
\d{10}
$/
,
message
:
'请输入有效的手机号'
,
trigger
:
'blur'
}
],
name
:
[{
required
:
true
,
message
:
'请输入名称'
,
...
...
@@ -81,16 +80,13 @@ export default {
message
:
'请输入密码'
,
trigger
:
'blur'
}],
email
:
[{
required
:
true
,
message
:
'请输入邮箱'
,
trigger
:
'blur'
}],
email
:
[
{
required
:
true
,
message
:
'请输入邮箱'
,
trigger
:
'blur'
},
{
type
:
'email'
,
message
:
'请输入有效的邮箱地址'
,
trigger
:
[
'blur'
,
'change'
]}
]
},
menuData
:
[],
//权限菜单
messageMenu
:
[],
//消息权限菜单
checkedNodes
:
[],
//存储勾选的子账号权限配置
checkedMessageNodes
:
[],
//存储勾选的消息菜单
formParam
:
{
mobile
:
''
,
name
:
''
,
...
...
@@ -145,17 +141,17 @@ export default {
*/
handleCheckChange
(
data
,
checked
)
{
if
(
checked
)
{
if
(
!
this
.
checkedNodes
.
includes
(
data
.
name
))
{
this
.
checkedNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_rule
.
push
(
data
.
name
);
}
}
else
{
const
index
=
this
.
checkedNodes
.
indexOf
(
data
.
name
);
const
index
=
this
.
formParam
.
user_rule
.
indexOf
(
data
.
name
);
if
(
index
!==
-
1
)
{
this
.
checkedNodes
.
splice
(
index
,
1
);
this
.
formParam
.
user_rule
.
splice
(
index
,
1
);
}
if
(
data
.
children
)
{
if
(
!
this
.
checkedNodes
.
includes
(
data
.
name
))
{
this
.
checkedNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_rule
.
push
(
data
.
name
);
}
}
}
...
...
@@ -167,17 +163,17 @@ export default {
*/
handleCheckMsgChange
(
data
,
checked
)
{
if
(
checked
)
{
if
(
!
this
.
checkedMessageNodes
.
includes
(
data
.
name
))
{
this
.
checkedMessageNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_message_rule
.
push
(
data
.
name
);
}
}
else
{
const
index
=
this
.
checkedMessageNodes
.
indexOf
(
data
.
name
);
const
index
=
this
.
formParam
.
user_message_rule
.
indexOf
(
data
.
name
);
if
(
index
!==
-
1
)
{
this
.
checkedMessageNodes
.
splice
(
index
,
1
);
this
.
formParam
.
user_message_rule
.
splice
(
index
,
1
);
}
if
(
data
.
children
)
{
if
(
!
this
.
checkedMessageNodes
.
includes
(
data
.
name
))
{
this
.
checkedMessageNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_message_rule
.
push
(
data
.
name
);
}
}
}
...
...
@@ -189,8 +185,8 @@ export default {
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
formParam
.
user_
message_rule
=
JSON
.
stringify
(
this
.
checkedMessageNodes
);
this
.
formParam
.
user_
rule
=
JSON
.
stringify
(
this
.
checkedNodes
);
this
.
formParam
.
user_
rule
=
JSON
.
stringify
(
this
.
formParam
.
user_rule
);
this
.
formParam
.
user_
message_rule
=
JSON
.
stringify
(
this
.
formParam
.
user_message_rule
);
this
.
$http
(
'POST'
,
"/api/subAccount/create"
,
this
.
formParam
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
$message
({
...
...
src/views/Info/subAccountEdit.vue
View file @
0cff4816
...
...
@@ -8,10 +8,10 @@
<el-input
v-model=
"formParam.mobile"
placeholder=
"请输入手机号"
></el-input>
</el-form-item>
<el-form-item
label=
"密码"
prop=
"password_raw"
>
<el-input
v-model=
"formParam.password_raw"
placeholder=
"请输入登录密码"
></el-input>
<el-input
placeholder=
"请输入登录密码"
v-model=
"formParam.password_raw"
show-password
></el-input>
</el-form-item>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"formParam.name"
placeholder=
"请输入名称"
></el-input>
<el-input
v-model=
"formParam.name"
placeholder=
"请输入名称"
maxlength=
"10"
></el-input>
</el-form-item>
<el-form-item
label=
"邮箱"
prop=
"email"
>
<el-input
v-model=
"formParam.email"
placeholder=
"请输入邮箱"
></el-input>
...
...
@@ -35,7 +35,7 @@
<!--子账号消息推送配置-->
<section
class=
"role-auth"
>
<ul
class=
"row"
>
<li
v-for=
"(item,index) in messageMenu"
:key=
"i
ndex
"
>
<li
v-for=
"(item,index) in messageMenu"
:key=
"i
tem.id
"
>
<el-tree
:data=
"item"
show-checkbox
:props=
"defaultProps"
:default-checked-keys=
"filteredMessageIds"
default-expand-all
node-key=
"id"
@
check-change=
"handleCheckMsgChange"
></el-tree>
</li>
</ul>
...
...
@@ -66,11 +66,10 @@ export default {
label
:
'name'
},
rules
:
{
mobile
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
}],
mobile
:
[
{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
'blur'
},
{
pattern
:
/^1
\d{10}
$/
,
message
:
'请输入有效的手机号'
,
trigger
:
'blur'
}
],
name
:
[{
required
:
true
,
message
:
'请输入名称'
,
...
...
@@ -81,16 +80,13 @@ export default {
message
:
'请输入密码'
,
trigger
:
'blur'
}],
email
:
[{
required
:
true
,
message
:
'请输入邮箱'
,
trigger
:
'blur'
}],
email
:
[
{
required
:
true
,
message
:
'请输入邮箱'
,
trigger
:
'blur'
},
{
type
:
'email'
,
message
:
'请输入有效的邮箱地址'
,
trigger
:
[
'blur'
,
'change'
]}
]
},
menuData
:
[],
//权限菜单
messageMenu
:
[],
//消息权限菜单
checkedNodes
:
[],
//存储勾选的子账号权限配置
checkedMessageNodes
:
[],
//存储勾选的消息菜单
filteredRuleIds
:
[],
filteredMessageIds
:
[],
ynat_id
:
this
.
$route
.
query
.
ynat_id
,
...
...
@@ -142,9 +138,29 @@ export default {
const
childrenWithChecked
=
item
.
children
.
filter
(
child
=>
child
.
checked
);
const
ids
=
childrenWithChecked
.
map
(
child
=>
child
.
id
);
filteredIds
.
push
(...
ids
);
}
else
{
if
(
item
.
checked
)
{
filteredIds
.
push
(
item
.
id
);
}
}
});
this
.
filteredRuleIds
=
filteredIds
;
//筛选出rule
const
result
=
[];
for
(
let
obj
of
res
.
data
.
data
)
{
if
(
obj
.
checked
)
{
result
.
push
(
obj
.
name
);
}
if
(
obj
.
children
)
{
for
(
let
child
of
obj
.
children
)
{
if
(
child
.
checked
)
{
result
.
push
(
child
.
name
);
}
}
}
}
this
.
formParam
.
user_rule
=
result
;
}
}
else
{
this
.
$message
({
...
...
@@ -169,9 +185,28 @@ export default {
const
childrenWithChecked
=
item
.
children
.
filter
(
child
=>
child
.
checked
);
const
ids
=
childrenWithChecked
.
map
(
child
=>
child
.
id
);
filteredIds
.
push
(...
ids
);
}
else
{
if
(
item
.
checked
)
{
filteredIds
.
push
(
item
.
id
);
}
}
});
this
.
filteredMessageIds
=
filteredIds
;
//筛选出rule-message
const
result
=
[];
for
(
let
obj
of
res
.
data
.
data
)
{
if
(
obj
.
checked
)
{
result
.
push
(
obj
.
name
);
}
if
(
obj
.
children
)
{
for
(
let
child
of
obj
.
children
)
{
if
(
child
.
checked
)
{
result
.
push
(
child
.
name
);
}
}
}
}
this
.
formParam
.
user_message_rule
=
result
;
}
}
else
{
this
.
$message
({
...
...
@@ -188,17 +223,17 @@ export default {
*/
handleCheckChange
(
data
,
checked
)
{
if
(
checked
)
{
if
(
!
this
.
checkedNodes
.
includes
(
data
.
name
))
{
this
.
checkedNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_rule
.
push
(
data
.
name
);
}
}
else
{
const
index
=
this
.
checkedNodes
.
indexOf
(
data
.
name
);
const
index
=
this
.
formParam
.
user_rule
.
indexOf
(
data
.
name
);
if
(
index
!==
-
1
)
{
this
.
checkedNodes
.
splice
(
index
,
1
);
this
.
formParam
.
user_rule
.
splice
(
index
,
1
);
}
if
(
data
.
children
)
{
if
(
!
this
.
checkedNodes
.
includes
(
data
.
name
))
{
this
.
checkedNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_rule
.
push
(
data
.
name
);
}
}
}
...
...
@@ -210,17 +245,17 @@ export default {
*/
handleCheckMsgChange
(
data
,
checked
)
{
if
(
checked
)
{
if
(
!
this
.
checkedMessageNodes
.
includes
(
data
.
name
))
{
this
.
checkedMessageNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_message_rule
.
push
(
data
.
name
);
}
}
else
{
const
index
=
this
.
checkedMessageNodes
.
indexOf
(
data
.
name
);
const
index
=
this
.
formParam
.
user_message_rule
.
indexOf
(
data
.
name
);
if
(
index
!==
-
1
)
{
this
.
checkedMessageNodes
.
splice
(
index
,
1
);
this
.
formParam
.
user_message_rule
.
splice
(
index
,
1
);
}
if
(
data
.
children
)
{
if
(
!
this
.
checkedMessageNodes
.
includes
(
data
.
name
))
{
this
.
checkedMessageNodes
.
push
(
data
.
name
);
if
(
!
this
.
formParam
.
user_message_rule
.
includes
(
data
.
name
))
{
this
.
formParam
.
user_message_rule
.
push
(
data
.
name
);
}
}
}
...
...
@@ -232,8 +267,8 @@ export default {
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
formParam
.
user_
message_rule
=
JSON
.
stringify
(
this
.
checkedNodes
);
this
.
formParam
.
user_
rule
=
JSON
.
stringify
(
this
.
checkedMessageNodes
);
this
.
formParam
.
user_
rule
=
JSON
.
stringify
(
this
.
formParam
.
user_rule
);
this
.
formParam
.
user_
message_rule
=
JSON
.
stringify
(
this
.
formParam
.
user_message_rule
);
this
.
$http
(
'POST'
,
"/api/subAccount/edit"
,
this
.
formParam
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
$message
({
...
...
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