Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-manage-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-manage-ui
Commits
168f1cba
Commit
168f1cba
authored
Jul 04, 2023
by
李鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限管理接口联调
parent
4a22f86a
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
82 additions
and
4677 deletions
+82
-4677
src/page/main/authority/role/add/role_form.vue
src/page/main/authority/role/add/role_form.vue
+8
-22
src/page/main/authority/role/index.vue
src/page/main/authority/role/index.vue
+16
-45
src/page/main/authority/user/add/contact-form.vue
src/page/main/authority/user/add/contact-form.vue
+0
-104
src/page/main/authority/user/add/index.vue
src/page/main/authority/user/add/index.vue
+34
-146
src/page/main/authority/user/index.vue
src/page/main/authority/user/index.vue
+24
-20
src/page/main/system/organization/directory-form.vue
src/page/main/system/organization/directory-form.vue
+0
-116
src/page/main/system/organization/index.vue
src/page/main/system/organization/index.vue
+0
-967
src/page/main/system/organization/org-detail/index.vue
src/page/main/system/organization/org-detail/index.vue
+0
-268
src/page/main/system/organization/org-form.vue
src/page/main/system/organization/org-form.vue
+0
-152
src/page/main/system/organization/org-user/index.vue
src/page/main/system/organization/org-user/index.vue
+0
-337
src/page/main/system/organization/org-user/org-account-form.vue
...ge/main/system/organization/org-user/org-account-form.vue
+0
-229
src/page/main/system/organization/org-user/org-person-form.vue
...age/main/system/organization/org-user/org-person-form.vue
+0
-86
src/page/main/system/organization/platform-user/index.vue
src/page/main/system/organization/platform-user/index.vue
+0
-354
src/page/main/system/organization/platform-user/platform-account-form.vue
...stem/organization/platform-user/platform-account-form.vue
+0
-201
src/page/main/system/organization/platform-user/platform-person-form.vue
...ystem/organization/platform-user/platform-person-form.vue
+0
-58
src/page/main/system/organization/tree.vue
src/page/main/system/organization/tree.vue
+0
-484
src/page/main/system/organization/user-detail/index.vue
src/page/main/system/organization/user-detail/index.vue
+0
-219
src/page/main/system/role/add/index.vue
src/page/main/system/role/add/index.vue
+0
-8
src/page/main/system/role/add/role_form.vue
src/page/main/system/role/add/role_form.vue
+0
-243
src/page/main/system/role/edit/index.vue
src/page/main/system/role/edit/index.vue
+0
-8
src/page/main/system/role/index.vue
src/page/main/system/role/index.vue
+0
-610
No files found.
src/page/main/authority/role/add/role_form.vue
View file @
168f1cba
...
...
@@ -18,14 +18,6 @@
:autosize=
"
{ minRows: 5 }"
:disabled="rowType != 0">
</el-input>
</el-form-item>
<el-form-item
label=
"数据权限"
prop=
"data_purview"
>
<el-radio-group
v-model=
"formData.data_purview"
:disabled=
"rowType != 0"
>
<el-radio
:label=
"3"
>
全平台所有
</el-radio>
<el-radio
:label=
"2"
>
本组织所有
</el-radio>
<el-radio
:label=
"1"
>
仅自己
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"菜单功能权限"
prop=
"permission_arr"
>
<bg-permission
:values=
"formData.permission_arr"
...
...
@@ -76,14 +68,11 @@ const roleState = reactive({
formData
:
{
role_name
:
""
,
role_desc
:
""
,
data_purview
:
3
,
state
:
1
,
permission_arr
:
[],
},
// 表单项
rules
:
{
role_name
:
[{
required
:
true
,
message
:
"
请输入角色名称
"
,
trigger
:
"
blur
"
}],
data_purview
:
[{
required
:
true
,
message
:
"
请选择数据权限
"
,
trigger
:
"
change
"
}],
state
:
[{
required
:
true
,
message
:
"
请选择是否启用
"
,
trigger
:
"
change
"
}],
permission_arr
:
[{
required
:
true
,
type
:
"
array
"
,
validator
:
checkMenuLength
,
trigger
:
"
change
"
}],
},
// 表单校验规则
...
...
@@ -97,7 +86,7 @@ const roleState = reactive({
rowType
:
0
,
});
const
getMenuTree
=
()
=>
{
axios
.
get
(
`/
apaas/system/v5
/menu/tree`
).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api
/menu/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
roleState
.
permissionData
=
res
.
data
.
data
||
[];
}
else
{
...
...
@@ -111,9 +100,9 @@ const changeMenu = (val) => {
};
// 修改选中的菜单
const
getRoleDetail
=
()
=>
{
axios
.
get
(
`/
apaas/system/v5
/role/detail/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api
/role/detail/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
{
role_name
,
role_desc
,
data_purview
,
state
,
menus
}
=
res
.
data
.
data
;
let
{
role_name
,
role_desc
,
state
,
menus
}
=
res
.
data
.
data
;
roleState
.
rowType
=
res
.
data
.
data
.
role_type
;
let
permission_arr
=
[];
if
(
menus
&&
menus
.
length
>
0
)
{
...
...
@@ -124,11 +113,9 @@ const getRoleDetail = () => {
roleState
.
formData
=
{
role_name
,
role_desc
,
data_purview
,
state
,
permission_arr
:
[...
permission_arr
],
};
console
.
log
(
roleState
.
formData
.
permission_arr
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
...
...
@@ -142,15 +129,14 @@ const saveRole = () => {
role_name
:
roleState
.
formData
.
role_name
,
role_desc
:
roleState
.
formData
.
role_desc
,
state
:
roleState
.
formData
.
state
,
data_purview
:
roleState
.
formData
.
data_purview
,
menu_ids
:
[...
roleState
.
formData
.
permission_arr
],
};
if
(
!
route
.
query
.
id
)
{
// 新增
axios
.
put
(
`/
apaas/system/v5
/role/create`
,
params
).
then
((
res
)
=>
{
axios
.
put
(
`/
v1/api
/role/create`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
router
.
push
(
"
/
system
/role
"
);
router
.
push
(
"
/
authority
/role
"
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
...
...
@@ -158,10 +144,10 @@ const saveRole = () => {
}
else
{
// 编辑
params
.
id
=
+
route
.
query
.
id
;
axios
.
post
(
`/
apaas/system/v5
/role/update`
,
params
).
then
((
res
)
=>
{
axios
.
post
(
`/
v1/api
/role/update`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
router
.
push
(
"
/
system
/role
"
);
router
.
push
(
"
/
authority
/role
"
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
...
...
@@ -171,7 +157,7 @@ const saveRole = () => {
});
};
// 新增或编辑角色的保存
const
goList
=
()
=>
{
router
.
push
(
"
/
system
/role
"
);
router
.
push
(
"
/
authority
/role
"
);
};
onBeforeMount
(()
=>
{
...
...
src/page/main/authority/role/index.vue
View file @
168f1cba
...
...
@@ -69,7 +69,7 @@
delete_row(row);
}
"
:disabled="row.state == 1 || row.role_type == 1">
:disabled="row.state == 1 || row.role_type == 1
|| row.role_type == 2 || row.user_count > 0
">
删除
</bg-table-btn>
</
template
>
...
...
@@ -105,14 +105,6 @@
<span
class=
"can_click_text"
@
click=
"clearUserSelection"
>
清空
</span>
</div>
<div
class=
"right"
>
<el-select
v-model=
"userFilter.is_admin"
placeholder=
"请选择"
style=
"width: 200px"
>
<el-option
v-for=
"(item, index) in userTypeList"
:key=
"'pushOptions' + index"
:label=
"item.name"
:value=
"item.value"
>
</el-option>
</el-select>
<el-cascader
v-model=
"userFilter.organization_id"
:options=
"orgList"
...
...
@@ -127,7 +119,7 @@
}"
:clearable=
"true"
collapse-tags
style=
"width: 200px"
>
style=
"width: 200px
; margin-right: 30px
"
>
<
template
#default
="{
data
}"
>
<span>
{{
data
.
name
}}
</span>
</
template
>
...
...
@@ -135,9 +127,9 @@
<el-input
v-model.trim=
"userFilter.search"
placeholder=
"请输入内容"
style=
"width: 200px"
style=
"width: 200px
; margin-right: 30px
"
:prefix-icon=
"Search"
/>
<el-button
type=
"primary"
@
click=
"searchAction"
>
查询
</el-button>
<el-button
style=
"margin-right: 15px"
type=
"primary"
@
click=
"searchAction"
>
查询
</el-button>
<el-button
type=
"default"
@
click=
"clearAction"
>
重置
</el-button>
</div>
</div>
...
...
@@ -236,26 +228,11 @@ const state = reactive({
});
const
userState
=
reactive
({
userFilter
:
{
is_admin
:
""
,
organization_id
:
""
,
search
:
""
,
limit
:
10
,
page
:
1
,
},
userTypeList
:
[
{
name
:
"
全部类型
"
,
value
:
""
,
},
{
name
:
"
组织管理员账号
"
,
value
:
2
,
},
{
name
:
"
平台用户账号
"
,
value
:
3
,
},
],
orgList
:
[],
userHeaders
:
[
{
...
...
@@ -280,10 +257,10 @@ const userState = reactive({
userSelection
:
[],
distributeDialog
:
false
,
// 分配用户弹窗
});
// 获取角色列表
const
getRoleRows
=
()
=>
{
let
params
=
{
...
state
.
filter
};
console
.
log
(
params
);
axios
.
get
(
`/apaas/system/v5/role/list`
,
{
params
}).
then
((
res
)
=>
{
axios
.
get
(
`/v1/api/role/list`
,
{
params
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
state
.
tableRows
=
res
.
data
.
data
||
[];
state
.
tableTotal
=
res
.
data
.
total
;
...
...
@@ -291,12 +268,11 @@ const getRoleRows = () => {
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
// 获取角色列表
};
//获取组织树
const
getOrgList
=
()
=>
{
axios
.
get
(
`/
apaas/system/v5
/org/tree`
).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api
/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
console
.
log
(
res
.
data
.
data
);
userState
.
orgList
=
res
.
data
.
data
||
[];
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
...
...
@@ -319,10 +295,11 @@ const changeSearch = (val) => {
};
// 表格关键字筛选
const
changeUseRow
=
(
row
)
=>
{
//内置角色不能删除和编辑
if
(
row
.
role_type
==
1
||
row
.
role_type
==
2
)
{
return
;
}
axios
.
post
(
`/
apaas/system/v5
/role/state/
${
row
.
id
}
/
${
row
.
state
}
`
).
then
((
res
)
=>
{
axios
.
post
(
`/
v1/api
/role/state/
${
row
.
id
}
/
${
row
.
state
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
changePage
(
1
);
...
...
@@ -370,10 +347,9 @@ const getUserList = () => {
page
:
userState
.
userFilter
.
page
,
search
:
userState
.
userFilter
.
search
,
organization_id
:
userState
.
userFilter
.
organization_id
,
is_admin
:
userState
.
userFilter
.
is_admin
,
role_id
:
state
.
actionRow
.
id
,
};
axios
.
get
(
`/
apaas/system/v5
/role/allotment/list`
,
{
params
}).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api
/role/allotment/list`
,
{
params
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
console
.
log
(
res
.
data
.
data
);
userState
.
userRows
=
res
.
data
.
data
||
[];
...
...
@@ -381,7 +357,6 @@ const getUserList = () => {
nextTick
(()
=>
{
userState
.
userRows
.
forEach
((
e
)
=>
{
if
(
e
.
is_bind
==
1
)
{
console
.
log
(
userTable
);
userTable
.
value
.
toggleRowSelection
(
e
,
true
);
}
});
...
...
@@ -402,13 +377,11 @@ const changeUserSize = (val) => {
};
const
searchAction
=
()
=>
{
console
.
log
(
userState
.
userFilter
);
changeUserPage
(
1
);
};
const
clearAction
=
(
type
)
=>
{
userState
.
userFilter
=
{
is_admin
:
""
,
organization_id
:
""
,
search
:
""
,
limit
:
10
,
...
...
@@ -420,7 +393,6 @@ const clearAction = (type) => {
};
const
clearUserSelection
=
()
=>
{
console
.
log
(
userTable
.
value
);
userTable
.
value
.
clearTable
();
};
...
...
@@ -437,7 +409,7 @@ const distribute = () => {
id
:
state
.
actionRow
.
id
,
user_ids
:
user_ids
,
};
axios
.
post
(
`/
apaas/system/v5
/role/allotment/user`
,
params
).
then
((
res
)
=>
{
axios
.
post
(
`/
v1/api
/role/allotment/user`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
userState
.
distributeDialog
=
false
;
...
...
@@ -475,7 +447,7 @@ const deleteData = () => {
let
params
=
{
ids
:
[...
ids
],
};
axios
.
delete
(
`/
apaas/system/v5
/role/delete`
,
{
data
:
{
ids
:
[...
ids
]
}
}).
then
((
res
)
=>
{
axios
.
delete
(
`/
v1/api
/role/delete`
,
{
data
:
{
ids
:
[...
ids
]
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
state
.
delDialog
=
false
;
...
...
@@ -492,8 +464,7 @@ onBeforeMount(() => {
const
{
filter
,
headers
,
tableRows
,
tableTotal
,
delDialog
,
selection
}
=
toRefs
(
state
);
const
{
userFilter
,
userTypeList
,
orgList
,
userHeaders
,
userRows
,
total
,
userSelection
,
distributeDialog
}
=
toRefs
(
userState
);
const
{
userFilter
,
orgList
,
userHeaders
,
userRows
,
total
,
userSelection
,
distributeDialog
}
=
toRefs
(
userState
);
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
@@ -569,7 +540,7 @@ const { userFilter, userTypeList, orgList, userHeaders, userRows, total, userSel
flex
:
1
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
justify-content
:
flex-end
;
.el-button
{
margin
:
0
;
width
:
64px
;
...
...
src/page/main/authority/user/add/contact-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"contactForm"
:rules=
"contactFormRules"
ref=
"contactRef"
style=
"max-width: 66%"
>
<el-form-item
label=
"联系人姓名"
prop=
"contact_name"
>
<el-input
v-model=
"contactForm.contact_name"
/>
</el-form-item>
<el-form-item
label=
"联系人手机号"
prop=
"contact_phone"
>
<el-input
v-model=
"contactForm.contact_phone"
/>
</el-form-item>
<el-form-item
label=
"联系人邮箱"
prop=
"contact_email"
>
<el-input
v-model=
"contactForm.contact_email"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"contactForm.remark"
show-word-limit
maxlength=
"300"
/>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
}
from
"
vue
"
;
const
contactForm
=
reactive
({
contact_name
:
""
,
contact_phone
:
""
,
contact_email
:
""
,
remark
:
""
,
});
const
props
=
defineProps
({
formType
:
{
type
:
Boolean
,
default
:
false
,
//false 新增 true 编辑
},
id
:
{
type
:
String
,
default
:
""
,
},
});
const
checkPhone
=
(
rule
,
value
,
callback
)
=>
{
var
phone_ruler
=
/^
(?:(?:\+
|00
)
86
)?
1
[
3-9
]\d{9}
$/
;
setTimeout
(()
=>
{
if
(
!
phone_ruler
.
test
(
value
)
&&
value
.
length
!==
0
)
{
callback
(
new
Error
(
"
请输入正确的手机号码
"
));
}
else
{
callback
();
}
});
};
const
checkName
=
(
rule
,
value
,
callback
)
=>
{
var
reg
=
/^
[
a-zA-Z0-9
\u
4e00-
\u
9fa5
]
+$/
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
"
只能输入字母、数字和汉字
"
));
}
else
{
callback
();
}
};
const
contactFormRules
=
reactive
({
contact_name
:
[
{
required
:
true
,
message
:
"
请输入联系人姓名
"
,
trigger
:
"
blur
"
},
{
max
:
50
,
message
:
"
联系人姓名最大长度为50个字符
"
,
trigger
:
"
blur
"
},
{
validator
:
checkName
,
trigger
:
"
blur
"
},
],
contact_phone
:
[
{
required
:
true
,
message
:
"
请输入联系人手机号
"
,
trigger
:
"
blur
"
},
{
validator
:
checkPhone
,
trigger
:
"
blur
"
},
],
contact_email
:
[
{
type
:
"
email
"
,
message
:
"
请输入正确的邮箱
"
,
trigger
:
"
blur
"
},
{
max
:
100
,
message
:
"
邮箱最大长度为100个字符
"
,
trigger
:
"
blur
"
},
],
});
const
contactRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
contactRef
)
return
;
await
contactRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
contactForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
contactRef
)
return
;
contactRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
contactForm
,
data
);
};
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/authority/user/add/index.vue
View file @
168f1cba
...
...
@@ -3,88 +3,17 @@
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"page_content flex_cloumn"
>
<div
class=
"content_top apaas_scroll"
>
<div
class=
"content_process"
>
<div>
<el-steps
:active=
"step"
>
<el-step
title=
""
:class=
"
{ process_complete: step > 1 }">
<template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 0"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
业务系统信息
</span>
</
template
>
</el-step>
<el-step
title=
""
:class=
"{ process_complete: step > 2 }"
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 1"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-staff"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
联系人信息
</span>
</
template
>
</el-step>
<el-step
title=
""
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 2"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-success"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
完成
</span>
</
template
>
</el-step>
</el-steps>
</div>
</div>
<div
class=
"content_main"
>
<systemForm
v-show=
"step === 1"
ref=
"systemFormRef"
:form-type=
"route.query.id ? true : false"
:id=
"route.query.id"
@
action=
"getSystemFormData"
></systemForm>
<contactForm
v-show=
"step === 2"
ref=
"contactFormRef"
:id=
"route.query.id"
@
action=
"getContactFormData"
></contactForm>
<div
class=
"process_end"
v-show=
"step === 3"
>
<div>
<div>
<img
v-if=
"successFlag"
src=
"@/assets/imgs/img_data-complete.png"
alt=
""
/>
<img
v-else
src=
"@/assets/imgs/img_data-fail.png"
alt=
""
/>
</div>
<div
class=
"font_bold"
>
{{
route.query.id
? successFlag
? "业务系统编辑成功"
: "业务系统编辑失败"
: successFlag
? "业务系统新增成功"
: "业务系统新增失败"
}}
</div>
<el-button
@
click=
"cancel"
>
返回列表
</el-button>
<el-button
v-if=
"!route.query.id"
type=
"primary"
@
click=
"continueCreate"
>
继续创建
</el-button>
</div>
</div>
</div>
</div>
<div
class=
"content_bottom"
v-if=
"step !== 3"
>
<div
v-show=
"step === 1"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"nextStep"
>
下一步
</el-button>
</div>
<div
v-show=
"step === 2"
>
<div
class=
"content_bottom"
>
<div>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"previousStep"
>
上一步
</el-button>
<el-button
type=
"primary"
@
click=
"submit"
>
保存
</el-button>
</div>
</div>
...
...
@@ -95,17 +24,14 @@
<
script
setup
>
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
;
import
systemForm
from
"
./system-form.vue
"
;
import
contactForm
from
"
./contact-form.vue
"
;
import
{
reactive
,
ref
,
onBeforeUnmount
,
onMounted
}
from
"
vue
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
route
=
useRoute
();
const
router
=
useRouter
();
const
step
=
ref
(
1
);
const
systemFormRef
=
ref
(
null
);
const
contactFormRef
=
ref
(
null
);
//业务系统表单
const
formData
=
reactive
({
organization_id
:
""
,
business_code
:
""
,
...
...
@@ -120,82 +46,51 @@ const formData = reactive({
access_address
:
""
,
develop_id
:
""
,
state
:
1
,
});
contact_name
:
""
,
contact_phone
:
""
,
contact_email
:
""
,
remark
:
""
,
});
//业务系统表单+联系人表单
const
successFlag
=
ref
(
false
);
// 下一步
const
nextStep
=
()
=>
{
systemFormRef
.
value
.
submitForm
();
};
//业务系统表单检验触发事件 data为null 校验失败
const
getSystemFormData
=
(
data
)
=>
{
if
(
data
)
{
Object
.
assign
(
formData
,
data
);
step
.
value
=
2
;
}
else
{
}
};
//联系人表单检验触发事件 data为null 校验失败
const
getContactFormData
=
(
data
)
=>
{
if
(
data
)
{
Object
.
assign
(
formData
,
data
);
if
(
route
.
query
.
id
)
{
console
.
log
(
formData
);
let
params
=
{
...
formData
,
id
:
parseInt
(
route
.
query
.
id
),
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
};
axios
.
post
(
`/apaas/system/v5/user/update`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
else
{
let
params
=
{
...
formData
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
password
:
CryptoJS
.
AES
.
encrypt
(
formData
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
};
axios
.
put
(
`/apaas/system/v5/user/create`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
}
};
//上一步
const
previousStep
=
()
=>
{
step
.
value
--
;
};
//提交表单
const
submit
=
()
=>
{
contactFormRef
.
value
.
submitForm
();
};
//继续创建 清空表单
const
continueCreate
=
()
=>
{
systemFormRef
.
value
.
clearForm
();
contactFormRef
.
value
.
clearForm
();
step
.
value
=
1
;
successFlag
.
value
=
false
;
if
(
route
.
query
.
id
)
{
let
params
=
{
...
formData
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
};
axios
.
put
(
`/v1/api/user/
${
route
.
query
.
id
}
`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
cancel
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
else
{
let
params
=
{
...
formData
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
password
:
CryptoJS
.
AES
.
encrypt
(
formData
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
};
axios
.
put
(
`/v1/api/user/add`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
cancel
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
};
//取消
const
cancel
=
()
=>
{
// router.go(-1);
router
.
push
({
path
:
"
/
develop/account
"
,
path
:
"
/
authority/user
"
,
query
:
{
id
:
formData
.
organization_id
,
},
...
...
@@ -203,7 +98,7 @@ const cancel = () => {
};
const
getDetail
=
()
=>
{
axios
.
get
(
`/
apaas/system/v5/user/detail
/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api/user
/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
form
=
res
.
data
.
data
;
systemFormRef
.
value
.
setForm
({
...
...
@@ -221,13 +116,6 @@ const getDetail = () => {
appid
:
form
.
app_id
,
appsecret
:
form
.
app_secret
,
});
contactFormRef
.
value
.
setForm
({
contact_name
:
form
.
contact_name
,
contact_phone
:
form
.
contact_phone
,
contact_email
:
form
.
contact_email
,
remark
:
form
.
remark
,
});
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
...
...
src/page/main/authority/user/index.vue
View file @
168f1cba
...
...
@@ -14,7 +14,7 @@
:data=
"orgData"
:props=
"defaultProps"
@
node-click=
"handleNodeClick"
node-key=
"id"
node-key=
"
organization_
id"
:highlight-current=
"true"
:filter-node-method=
"filterNode"
:default-expand-all=
"true"
>
...
...
@@ -276,7 +276,7 @@ const route = useRoute();
const
getTableRows
=
()
=>
{
let
params
=
{
...
filter
,
organization_id
:
selectNode
.
value
};
axios
.
get
(
`/
apaas/system/v5/user/list
`
,
{
.
get
(
`/
v1/api/org/detail
`
,
{
params
,
})
.
then
((
res
)
=>
{
...
...
@@ -297,7 +297,7 @@ const addAccount = (params) => {
const
handleNodeClick
=
(
data
)
=>
{
if
(
data
.
data_type
==
1
)
{
selectNode
.
value
=
data
.
id
;
selectNode
.
value
=
data
.
organization_
id
;
changePage
(
1
);
}
else
{
nextTick
(()
=>
{
...
...
@@ -321,18 +321,19 @@ const defaultProps = {
class
:
customNodeClass
,
};
const
getOrgTree
=
()
=>
{
axios
.
get
(
`/
apaas/system/v5
/org/tree`
).
then
((
res
)
=>
{
axios
.
get
(
`/
v1/api
/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
orgData
.
value
=
res
.
data
.
data
||
[];
orgData
.
value
.
shift
();
//
orgData.value.shift();
const
orgList
=
searchOrg
(
orgData
.
value
);
if
(
route
.
query
.
id
)
{
searchItem
(
orgData
.
value
,
route
.
query
.
id
);
console
.
log
(
"
orgList
"
,
orgList
);
if
(
route
.
query
.
organization_id
)
{
searchItem
(
orgData
.
value
,
route
.
query
.
organization_id
);
}
else
{
selectNode
.
value
=
orgList
.
length
>
0
?
orgList
[
0
].
id
:
""
;
selectNode
.
value
=
orgList
.
length
>
0
?
orgList
[
0
].
organization_
id
:
""
;
}
nextTick
(()
=>
{
if
(
route
.
query
.
id
)
{
if
(
route
.
query
.
organization_
id
)
{
treeRef
.
value
.
setCurrentNode
(
selectNodeObj
.
value
);
}
else
{
if
(
orgList
.
length
>
0
)
{
...
...
@@ -346,14 +347,14 @@ const getOrgTree = () => {
}
});
};
const
searchItem
=
(
data
,
id
)
=>
{
const
searchItem
=
(
data
,
organization_
id
)
=>
{
data
.
forEach
((
e
)
=>
{
if
(
e
.
organization_id
==
id
)
{
if
(
e
.
organization_id
==
organization_
id
)
{
selectNodeObj
.
value
=
e
;
selectNode
.
value
=
e
.
id
;
selectNode
.
value
=
e
.
organization_
id
;
}
else
{
if
(
e
.
Child
)
{
searchItem
(
e
.
Child
,
id
);
searchItem
(
e
.
Child
,
organization_
id
);
}
}
});
...
...
@@ -361,7 +362,7 @@ const searchItem = (data, id) => {
const
searchOrg
=
(
data
)
=>
{
const
arr
=
[];
data
.
forEach
((
item
)
=>
{
if
(
item
.
data_type
===
1
)
{
if
(
item
.
data_type
>
0
)
{
arr
.
push
(
item
);
return
;
}
else
{
...
...
@@ -385,8 +386,11 @@ const filterNode = (value, data) => {
};
const
stateChange
=
(
row
)
=>
{
const
state
=
row
.
state
.
toString
();
axios
.
post
(
`/apaas/system/v5/user/state/
${
row
.
id
}
/
${
state
}
`
).
then
((
res
)
=>
{
const
params
=
{
id
:
row
.
id
,
state
:
row
.
state
==
1
?
0
:
1
,
};
axios
.
post
(
`/v1/api/user/updateState`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
...
...
@@ -449,7 +453,7 @@ const handleCloseRowDelete = () => {
const
deleteConfirm
=
()
=>
{
const
ids
=
selected
.
value
.
map
((
item
)
=>
item
.
id
);
axios
.
delete
(
`/
apaas/system/v5/user/delete
`
,
{
data
:
{
ids
:
ids
}
}).
then
((
res
)
=>
{
axios
.
delete
(
`/
v1/api/user/del
`
,
{
data
:
{
ids
:
ids
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
...
...
@@ -461,7 +465,7 @@ const deleteConfirm = () => {
};
const
deleteRowConfirm
=
()
=>
{
axios
.
delete
(
`/
apaas/system/v5/user/delete
`
,
{
data
:
{
ids
:
[
selectedRow
.
value
.
id
]
}
}).
then
((
res
)
=>
{
axios
.
delete
(
`/
v1/api/user/del
`
,
{
data
:
{
ids
:
[
selectedRow
.
value
.
id
]
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
...
...
@@ -494,7 +498,7 @@ const resetPsd = () => {
const
resetConfirm
=
()
=>
{
const
ids
=
selected
.
value
.
map
((
item
)
=>
item
.
id
);
axios
.
post
(
`/
apaas/system/v5/user/resetp
wd`
,
{
ids
:
ids
}).
then
((
res
)
=>
{
axios
.
post
(
`/
v1/api/user/resetP
wd`
,
{
ids
:
ids
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
...
...
@@ -522,7 +526,7 @@ const editConfirm = () => {
passwordRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
axios
.
post
(
`/
apaas/system/v5/user/editp
wd`
,
{
.
post
(
`/
v1/api/user/updateP
wd`
,
{
id
:
selectedRow
.
value
.
id
,
password
:
CryptoJS
.
AES
.
encrypt
(
passwordForm
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
})
...
...
src/page/main/system/organization/directory-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"directoryForm"
:rules=
"directoryFormRules"
ref=
"directoryRef"
style=
"max-width: 80%"
>
<el-form-item
label=
"上级目录"
prop=
"p_organization_id"
v-if=
"formType === 'create'"
>
<el-tree-select
v-model=
"directoryForm.p_organization_id"
:data=
"orgData"
:props=
"treeProps"
:render-after-expand=
"false"
:check-strictly=
"true"
:disabled=
"directoryForm.level"
style=
"width: 80%"
/>
<el-form-item
label=
""
style=
"padding-left: 16px"
>
<el-checkbox
v-model=
"directoryForm.level"
@
change=
"isTop"
label=
"顶级"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"directoryForm.name"
/>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
,
onBeforeMount
,
nextTick
}
from
"
vue
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
const
props
=
defineProps
({
formType
:
{
type
:
String
,
default
:
"
create
"
,
//false 新增 true 编辑
},
});
const
directoryForm
=
reactive
({
p_organization_id
:
""
,
name
:
""
,
level
:
false
,
});
const
directoryFormRules
=
reactive
({
p_organization_id
:
[{
required
:
true
,
message
:
"
请输入上级目录
"
,
trigger
:
"
blur
"
}],
name
:
[{
required
:
true
,
message
:
"
请输入名称
"
,
trigger
:
"
blur
"
}],
});
const
directoryRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
directoryRef
)
return
;
await
directoryRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
directoryForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
directoryRef
)
return
;
directoryRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
directoryForm
,
data
);
};
const
orgData
=
ref
([]);
const
treeProps
=
{
label
:
"
name
"
,
children
:
"
Child
"
,
value
:
"
organization_id
"
,
disabled
:
"
disabled
"
,
};
const
getOrgTree
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
orgDataTemp
=
res
.
data
.
data
||
[];
orgDataTemp
.
shift
();
orgData
.
value
=
filterOrg
(
orgDataTemp
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
filterOrg
=
(
data
)
=>
{
if
(
data
.
length
>
0
)
{
data
.
forEach
((
item
)
=>
{
item
.
disabled
=
item
.
data_type
===
0
?
false
:
true
;
if
(
item
.
Child
)
{
filterOrg
(
item
.
Child
);
}
else
{
return
;
}
});
}
return
data
;
};
const
isTop
=
(
data
)
=>
{
directoryForm
.
p_organization_id
=
data
?
"
"
:
""
;
//空格绕过表单非空校验
};
onBeforeMount
(()
=>
{
getOrgTree
();
});
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/index.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<div
class=
"page_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"flex_row"
>
<div
class=
"flex_left bgc_white"
>
<div
class=
"tree_header"
>
政务组织
</div>
<div
class=
"tree_content"
>
<div
class=
"search"
>
<el-input
v-model=
"search"
placeholder=
"请输入组织名称搜索"
:prefix-icon=
"Search"
@
input=
"searchChange"
/>
</div>
<div
class=
"tree"
>
<tree
ref=
"orgTree"
@
action=
"treeAction"
@
select=
"treeSelect"
></tree>
</div>
</div>
</div>
<div
class=
"flex_right"
>
<div
class=
"info_container bgc_white"
>
<div
class=
"title"
>
<span
class=
"icon_box"
>
<span
class=
"step_icon"
>
<bg-icon
icon=
"#bg-ic-file"
></bg-icon>
</span>
<span>
基本信息
</span>
</span>
<span
class=
"can_click_text detail_btn"
v-if=
"selectTreeDataType === 1"
@
click=
"toOrgDetail"
>
查看详情
<bg-icon
style=
"font-size: 8px; color: #95a3ca; vertical-align: middle"
icon=
"#bg-ic-arrow-right"
/>
</span>
</div>
<bg-info
class=
"info_box"
v-if=
"selectTreeDataType === 1"
:data=
"baseInfo"
></bg-info>
<bg-info
class=
"info_box"
v-if=
"selectTreeDataType === 2"
:data=
"baseInfo2"
></bg-info>
</div>
<div
class=
"main_container bgc_white"
>
<bg-filter-group
@
search=
"changeSearch"
v-model=
"filter.key_word"
placeholder=
"请输入关键字"
>
<template
v-slot:left_action
>
<div
class=
"apaas_button"
>
<el-button
type=
"primary"
@
click=
"addAccount"
>
<bg-icon
style=
"font-size: 12px; color: #fff; margin-right: 8px"
icon=
"#bg-ic-add"
></bg-icon>
{{
selectTreeDataType
===
1
?
"
新增组织管理员
"
:
"
新增平台用户
"
}}
</el-button>
<el-button
@
click=
"deleteBatch"
>
批量删除
</el-button>
<el-button
@
click=
"resetPsd"
>
重置密码
</el-button>
<span
class=
"header_info"
>
已选择
<span
style=
"color: #202531; font-weight: bold"
>
{{
selected
.
length
}}
</span
>
项
</span
>
<span
class=
"header_info can_click_text"
@
click=
"clearSelected"
>
清空
</span>
</div>
</
template
>
<
template
v-slot:filter_group
>
<div
class=
"left-filter filter_list"
>
<div
class=
"filter_item"
>
<span
class=
"filter_title"
>
启用状态
</span>
<el-select
v-model=
"filter.state"
placeholder=
"请选择"
style=
"width: 300px"
>
<el-option
v-for=
"(item, index) in stateOptions"
:key=
"'pushOptions' + index"
:label=
"item.name"
:value=
"item.value"
>
</el-option>
</el-select>
</div>
</div>
<div
class=
"right-action apaas_button"
>
<el-button
type=
"primary"
@
click=
"filterAction"
>
查询
</el-button>
<el-button
type=
"default"
@
click=
"filterClear"
>
重置
</el-button>
</div>
</
template
>
</bg-filter-group>
<div
class=
"table_container apaas_scroll"
>
<bg-table
ref=
"dataTable"
:headers=
"headers"
:rows=
"tableRows"
:isIndex=
"true"
canEdit
canEditFlag=
"canSelect"
:stripe=
"true"
:select=
"true"
@
selectAc=
"selectRows"
>
<
template
v-slot:system_account=
"{ row }"
>
<span
@
click=
"goDetail(row)"
class=
"can_click_text"
>
{{
row
.
system_account
}}
</span>
</
template
>
<
template
v-slot:state=
"{ row }"
>
<bg-switch
@
click=
"stateChange(row)"
:labels=
"['否', '是']"
:values=
"[0, 1]"
v-model=
"row.state"
:disabled=
"row.is_admin == 4"
></bg-switch>
</
template
>
<
template
v-slot:action=
"{ row }"
>
<bg-table-btn
:disabled=
"row.is_admin == 4"
@
click=
"editAccount(row)"
class=
"can_click_text"
>
编辑
</bg-table-btn>
<bg-table-btn
:disabled=
"row.is_admin == 4 && userInfo.is_admin !== 4"
@
click=
"editPsdAccount(row)"
class=
"can_click_text"
>
修改密码
</bg-table-btn>
<bg-table-btn
:disabled=
"row.is_admin == 4"
@
click=
"deleteAccount(row)"
class=
"can_click_text"
>
删除
</bg-table-btn>
</
template
>
</bg-table>
<div
class=
"pagination_box"
>
<bg-pagination
:page=
"filter.page"
:size=
"filter.limit"
:total=
"tableTotal"
@
change-page=
"changePage"
@
change-size=
"changeSize"
>
</bg-pagination>
</div>
</div>
</div>
</div>
</div>
<el-dialog
v-model=
"dialogDirectory"
:title=
"action === 'create' ? '新增目录' : '编辑目录'"
width=
"758px"
:before-close=
"handleCloseDirectory"
destroy-on-close
>
<div
class=
"dialog_form"
>
<directoryForm
ref=
"directoryFormRef"
:form-type=
"directoryFormType"
@
action=
"getDirectoryFromData"
></directoryForm>
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseDirectory"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"saveDirectory"
>
保存
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"dialogOrg"
:title=
"action === 'create' ? '新增组织' : '编辑组织'"
width=
"758px"
:before-close=
"handleCloseOrg"
destroy-on-close
>
<div
class=
"dialog_form"
>
<orgForm
ref=
"orgFormRef"
:form-type=
"orgFormType"
@
action=
"getOrgFormData"
></orgForm>
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseOrg"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"saveOrg"
>
保存
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"dialogDelNode"
title=
"删除"
width=
"520px"
:before-close=
"handleCloseDelNode"
>
<div
class=
"dialog_form"
>
确认删除吗?
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseDelNode"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmDelNode"
>
确认
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"deleteRowFlag"
title=
"删除"
width=
"520px"
:before-close=
"handleCloseRowDelete"
>
<div
class=
"warning_info"
>
<bg-icon
style=
"font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline"
icon=
"#bg-ic-circle-tips"
></bg-icon>
您正在对
<span
class=
"danger_info"
>
{{ selectedRow.system_account }}
</span
>
做删除操作。
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseRowDelete"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"deleteRowConfirm"
>
确定
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"editFlag"
title=
"修改密码"
width=
"520px"
:before-close=
"handleCloseEdit"
>
<div
class=
"warning_info"
>
<bg-icon
style=
"font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline"
icon=
"#bg-ic-circle-tips"
></bg-icon>
您正在对
<span
class=
"danger_info"
>
{{ selectedRow.system_account }}
</span
>
做修改密码操作,修改后旧密码将无法登录。
</div>
<div>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"passwordForm"
:rules=
"passwordFormRules"
ref=
"passwordRef"
style=
"max-width: 80%"
>
<el-form-item
label=
"新密码"
prop=
"password"
>
<el-input
v-model=
"passwordForm.password"
:type=
"password_eye ? 'text' : 'password'"
placeholder=
"请输入密码"
>
<
template
#suffix
>
<bg-icon
@
click=
"password_eye = !password_eye"
class=
"icon_eye"
icon=
"#bg-ic-eye"
></bg-icon>
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"确认新密码"
prop=
"confirm_password"
>
<el-input
v-model=
"passwordForm.confirm_password"
:type=
"confirm_eye ? 'text' : 'password'"
placeholder=
"请确认新密码"
>
<
template
#suffix
>
<bg-icon
@
click=
"confirm_eye = !confirm_eye"
class=
"icon_eye"
icon=
"#bg-ic-eye"
></bg-icon>
</
template
>
</el-input>
</el-form-item>
</el-form>
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseEdit"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"editConfirm"
>
确定
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"deleteFlag"
title=
"删除"
width=
"520px"
:before-close=
"handleCloseDelete"
>
<div
class=
"warning_info"
>
<bg-icon
style=
"font-size: 12px; color: #a9b1c7; mdeleteconfirmargin-right: 8px; vertical-align: baseline"
icon=
"#bg-ic-circle-tips"
></bg-icon>
您正在对
<span
class=
"danger_info"
>
{{ selectedName.join("、") }}
</span
>
做删除操作。
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseDelete"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"deleteConfirm"
>
确定
</el-button>
</span>
</
template
>
</el-dialog>
<el-dialog
v-model=
"resetFlag"
title=
"重置密码"
width=
"520px"
:before-close=
"handleCloseReset"
>
<div
class=
"warning_info"
>
<bg-icon
style=
"font-size: 12px; color: #a9b1c7; margin-right: 8px; vertical-align: baseline"
icon=
"#bg-ic-circle-tips"
></bg-icon>
您正在对
<span
class=
"danger_info"
>
{{ selectedName.join("、") }}
</span
>
做重置密码操作。
</div>
<div>
重置密码为123456,是否继续?
</div>
<
template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"handleCloseReset"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"resetConfirm"
>
确定
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
<
script
setup
>
import
{
Search
}
from
"
@element-plus/icons-vue
"
;
import
{
computed
,
onBeforeMount
,
nextTick
,
reactive
,
ref
,
toRefs
}
from
"
@vue/runtime-core
"
;
import
{
useRouter
}
from
"
vue-router
"
;
import
tree
from
"
./tree.vue
"
;
import
directoryForm
from
"
./directory-form.vue
"
;
import
orgForm
from
"
./org-form.vue
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
{
downloadFileFormatNew
}
from
"
@/services/helper
"
;
import
store
from
"
@/store
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
dataTable
=
ref
(
null
);
const
toOrgDetail
=
()
=>
{
router
.
push
({
path
:
"
/system/organization/org-detail
"
,
query
:
{
id
:
selectOrgNode
.
value
.
organization_id
,
},
});
};
const
baseInfo
=
reactive
([
{
name
:
"
组织类型
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织代码
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织名称
"
,
value
:
""
,
callback
:
toOrgDetail
,
nameWidth
:
130
,
},
{
name
:
"
创建时间
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织管理员数量
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
业务系统数量
"
,
value
:
""
,
nameWidth
:
130
,
},
]);
const
baseInfo2
=
reactive
([
{
name
:
"
组织名称
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织代码
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
用户数
"
,
value
:
""
,
nameWidth
:
130
,
full
:
true
,
},
]);
const
headers
=
reactive
([
{
label
:
"
账号
"
,
prop
:
"
system_account
"
,
minWidth
:
150
,
},
{
label
:
"
手机号
"
,
prop
:
"
contact_phone
"
,
minWidth
:
150
,
},
{
label
:
"
角色
"
,
prop
:
"
system_role
"
,
minWidth
:
150
,
},
{
label
:
"
创建时间
"
,
prop
:
"
created_time
"
,
minWidth
:
200
,
},
{
label
:
"
是否启用
"
,
prop
:
"
state
"
,
width
:
80
,
},
{
label
:
"
操作
"
,
prop
:
"
action
"
,
width
:
220
,
fixed
:
"
right
"
,
},
]);
const
stateOptions
=
ref
([
{
name
:
"
全部
"
,
value
:
""
,
},
{
name
:
"
启用
"
,
value
:
"
1
"
,
},
{
name
:
"
禁用
"
,
value
:
"
0
"
,
},
]);
const
tableRows
=
ref
([]);
const
tableTotal
=
ref
(
0
);
const
orgTree
=
ref
(
null
);
const
selectTreeData
=
ref
(
null
);
const
actionTreeData
=
ref
(
null
);
const
selectTreeDataType
=
ref
(
2
);
const
selectOrgNode
=
ref
(
null
);
const
dialogDelNode
=
ref
(
false
);
const
router
=
useRouter
();
const
filter
=
reactive
({
state
:
""
,
key_word
:
""
,
page
:
1
,
limit
:
10
,
});
const
deleteFlag
=
ref
(
false
);
const
deleteRowFlag
=
ref
(
false
);
const
resetFlag
=
ref
(
false
);
const
selectedRow
=
ref
({});
const
selected
=
ref
([]);
const
selectedName
=
ref
([]);
const
editFlag
=
ref
(
false
);
const
password_eye
=
ref
(
false
);
const
confirm_eye
=
ref
(
false
);
const
passwordRef
=
ref
(
null
);
const
passwordForm
=
reactive
({
password
:
""
,
confirm_password
:
""
,
});
const
search
=
ref
(
""
);
const
userInfo
=
computed
(()
=>
{
return
store
.
state
.
userInfo
;
});
const
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
!==
passwordForm
.
password
)
{
callback
(
new
Error
(
"
密码输入不一致
"
));
}
else
{
callback
();
}
};
const
passwordFormRules
=
reactive
({
password
:
[
{
required
:
true
,
message
:
"
请输入密码
"
,
trigger
:
"
blur
"
},
{
min
:
8
,
message
:
"
密码长度不得低于8位
"
,
trigger
:
"
blur
"
},
],
confirm_password
:
[
{
required
:
true
,
message
:
"
请确认密码
"
,
trigger
:
"
blur
"
},
{
validator
:
validatePass
,
trigger
:
"
blur
"
},
],
});
const
addAccount
=
()
=>
{
if
(
selectTreeDataType
.
value
===
1
)
{
router
.
push
({
path
:
"
/system/organization/org-user
"
,
query
:
{
orgId
:
selectOrgNode
.
value
.
organization_id
,
},
});
}
else
{
router
.
push
({
path
:
"
/system/organization/platform-user
"
,
});
}
};
const
changeSize
=
(
size
)
=>
{
filter
.
limit
=
size
;
changePage
(
1
);
};
const
changePage
=
(
page
)
=>
{
filter
.
page
=
page
;
getTableRows
();
};
const
changeSearch
=
(
val
)
=>
{
filter
.
key_word
=
val
;
changePage
(
1
);
};
// 表格关键字筛选
const
filterAction
=
()
=>
{
changePage
(
1
);
};
// 查询按钮
const
filterClear
=
()
=>
{
filter
.
state
=
""
;
filter
.
key_word
=
""
;
filter
.
limit
=
10
;
filter
.
page
=
1
;
changePage
(
1
);
};
// 重置筛选项
const
dialogDirectory
=
ref
(
false
);
const
directoryFormType
=
ref
(
"
create
"
);
const
orgFormType
=
ref
(
"
create
"
);
const
handleCloseDirectory
=
()
=>
{
dialogDirectory
.
value
=
false
;
};
const
directoryFormRef
=
ref
(
null
);
const
saveDirectory
=
()
=>
{
directoryFormRef
.
value
.
submitForm
();
};
//新增/编剧目录
const
getDirectoryFromData
=
(
data
)
=>
{
if
(
directoryFormType
.
value
===
"
create
"
)
{
const
params
=
{
p_organization_id
:
data
.
level
?
""
:
data
.
p_organization_id
,
name
:
data
.
name
,
data_type
:
0
,
};
axios
.
post
(
`/apaas/system/v5/org/add`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
res
.
data
.
data
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseDirectory
();
});
}
else
if
(
directoryFormType
.
value
===
"
edit
"
)
{
const
params
=
{
name
:
data
.
name
,
data_type
:
0
,
};
axios
.
put
(
`/apaas/system/v5/org/
${
actionTreeData
.
value
.
id
}
`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
actionTreeData
.
value
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseDirectory
();
});
}
};
const
dialogOrg
=
ref
(
false
);
const
handleCloseOrg
=
()
=>
{
dialogOrg
.
value
=
false
;
};
const
orgFormRef
=
ref
(
null
);
const
saveOrg
=
()
=>
{
orgFormRef
.
value
.
submitForm
();
};
//新增/编辑组织
const
getOrgFormData
=
(
data
)
=>
{
if
(
orgFormType
.
value
===
"
create
"
)
{
const
params
=
{
p_organization_id
:
data
.
level
?
""
:
data
.
p_organization_id
,
name
:
data
.
name
,
organization_code
:
data
.
organization_code
,
description
:
data
.
description
,
attachment
:
data
.
attachment
&&
data
.
attachment
.
length
>
0
?
data
.
attachment
.
map
((
item
)
=>
item
.
url
).
join
(
"
,
"
)
:
""
,
data_type
:
1
,
};
axios
.
post
(
`/apaas/system/v5/org/add`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
res
.
data
.
data
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseOrg
();
});
}
else
if
(
orgFormType
.
value
===
"
edit
"
)
{
const
params
=
{
// p_organization_id: data.level ? "" : data.p_organization_id,
name
:
data
.
name
,
organization_code
:
data
.
organization_code
,
description
:
data
.
description
,
attachment
:
data
.
attachment
&&
data
.
attachment
.
length
>
0
?
data
.
attachment
.
map
((
item
)
=>
item
.
url
).
join
(
"
,
"
)
:
""
,
data_type
:
1
,
};
axios
.
put
(
`/apaas/system/v5/org/
${
actionTreeData
.
value
.
id
}
`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
actionTreeData
.
value
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseOrg
();
});
}
};
const
handleCloseDelNode
=
()
=>
{
dialogDelNode
.
value
=
false
;
};
//删除目录/组织
const
confirmDelNode
=
()
=>
{
axios
.
delete
(
`/apaas/system/v5/org/
${
actionTreeData
.
value
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
actionTreeData
.
value
.
id
===
selectTreeData
.
value
.
id
?
null
:
selectTreeData
.
value
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseDelNode
();
});
};
const
moveOrg
=
(
params
)
=>
{
axios
.
put
(
`/apaas/system/v5/org/sort`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
orgTree
.
value
.
getOrgTree
(
selectTreeData
.
value
.
id
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
action
=
ref
(
"
create
"
);
const
treeAction
=
(
data
)
=>
{
action
.
value
=
data
.
action
;
if
(
data
.
action
===
"
create
"
||
data
.
action
===
"
edit
"
)
{
if
(
data
.
type
===
"
org
"
)
{
orgFormType
.
value
=
data
.
action
;
dialogOrg
.
value
=
true
;
nextTick
(()
=>
{
if
(
data
.
data
)
{
if
(
data
.
action
===
"
edit
"
)
{
orgFormRef
.
value
.
setForm
({
name
:
data
.
data
.
value
.
name
,
p_organization_id
:
data
.
data
.
value
.
p_organization_id
,
level
:
data
.
data
.
value
.
p_organization_id
?
false
:
true
,
organization_code
:
data
.
data
.
value
.
organization_code
,
description
:
data
.
data
.
value
.
description
,
attachment
:
data
.
data
.
value
.
attachment
.
split
(
"
,
"
).
map
((
i
)
=>
{
return
{
name
:
downloadFileFormatNew
(
i
),
url
:
i
};
}),
});
}
else
if
(
data
.
action
===
"
create
"
)
{
orgFormRef
.
value
.
setForm
({
p_organization_id
:
data
.
data
.
value
.
organization_id
});
}
}
});
}
else
{
directoryFormType
.
value
=
data
.
action
;
dialogDirectory
.
value
=
true
;
nextTick
(()
=>
{
if
(
data
.
data
)
{
if
(
data
.
action
===
"
edit
"
)
{
directoryFormRef
.
value
.
setForm
({
name
:
data
.
data
.
value
.
name
});
}
else
if
(
data
.
action
===
"
create
"
)
{
directoryFormRef
.
value
.
setForm
({
p_organization_id
:
data
.
data
.
value
.
organization_id
});
}
}
});
}
}
else
if
(
data
.
action
===
"
delete
"
)
{
dialogDelNode
.
value
=
true
;
}
else
if
(
data
.
action
===
"
mvup
"
||
data
.
action
===
"
mvdown
"
)
{
moveOrg
(
data
.
data
);
}
};
const
treeSelect
=
(
data
)
=>
{
if
(
data
.
type
===
"
action
"
)
{
actionTreeData
.
value
=
data
.
data
.
value
;
}
else
{
selectTreeData
.
value
=
data
.
data
.
value
;
}
if
(
data
.
type
===
"
click
"
&&
(
data
.
data
.
value
.
data_type
===
1
||
data
.
data
.
value
.
data_type
===
2
))
{
selectTreeDataType
.
value
=
data
.
data
.
value
.
data_type
;
selectOrgNode
.
value
=
data
.
data
.
value
;
getTableRows
();
}
};
const
getTableRows
=
()
=>
{
let
params
=
{
...
filter
,
organization_id
:
selectTreeData
.
value
.
organization_id
,
data_type
:
selectTreeData
.
value
.
data_type
,
};
axios
.
get
(
`/apaas/system/v5/org/detail`
,
{
params
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
tableRows
.
value
=
(
res
.
data
.
data
.
org_users
.
data
||
[]).
map
((
item
)
=>
{
item
.
system_role
=
item
.
system_role
?
item
.
system_role
.
join
(
"
、
"
)
:
"
-
"
;
return
item
;
});
tableRows
.
value
.
forEach
((
e
)
=>
{
if
(
e
.
is_admin
==
4
&&
userInfo
.
value
.
is_admin
!=
4
)
{
e
.
canSelect
=
1
;
}
else
{
e
.
canSelect
=
0
;
}
});
tableTotal
.
value
=
res
.
data
.
data
.
org_users
.
total
;
if
(
params
.
data_type
===
1
)
{
baseInfo
[
0
].
value
=
res
.
data
.
data
.
org_info
.
organization_type
;
baseInfo
[
1
].
value
=
res
.
data
.
data
.
org_info
.
organization_code
;
baseInfo
[
2
].
value
=
res
.
data
.
data
.
org_info
.
name
;
baseInfo
[
3
].
value
=
res
.
data
.
data
.
org_info
.
created_time
;
baseInfo
[
4
].
value
=
res
.
data
.
data
.
org_info
.
org_admin_number
;
baseInfo
[
5
].
value
=
res
.
data
.
data
.
org_info
.
business_system_number
;
}
else
{
baseInfo2
[
0
].
value
=
res
.
data
.
data
.
org_info
.
name
;
baseInfo2
[
1
].
value
=
res
.
data
.
data
.
org_info
.
organization_code
;
baseInfo2
[
2
].
value
=
res
.
data
.
data
.
org_info
.
platform_users_number
;
}
console
.
log
(
baseInfo
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
searchChange
=
(
val
)
=>
{
orgTree
.
value
.
filterTree
(
val
);
};
const
goDetail
=
(
params
)
=>
{
router
.
push
({
path
:
"
/system/organization/user-detail
"
,
query
:
{
id
:
params
.
id
,
},
});
};
const
stateChange
=
(
row
)
=>
{
if
(
row
.
is_admin
==
4
)
{
return
;
}
const
state
=
row
.
state
.
toString
();
axios
.
post
(
`/apaas/system/v5/user/state/
${
row
.
id
}
/
${
state
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
row
.
state
=
row
.
state
==
0
?
1
:
0
;
}
});
};
const
editPsdAccount
=
(
data
)
=>
{
selectedRow
.
value
=
data
;
editFlag
.
value
=
true
;
};
const
handleCloseEdit
=
()
=>
{
if
(
!
passwordRef
)
return
;
passwordRef
.
value
.
resetFields
();
editFlag
.
value
=
false
;
};
const
editConfirm
=
()
=>
{
if
(
!
passwordRef
)
return
;
passwordRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
axios
.
post
(
`/apaas/system/v5/user/editpwd`
,
{
id
:
selectedRow
.
value
.
id
,
password
:
CryptoJS
.
AES
.
encrypt
(
passwordForm
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseEdit
();
});
}
});
};
const
deleteAccount
=
(
data
)
=>
{
if
(
data
.
state
===
0
)
{
selectedRow
.
value
=
data
;
deleteRowFlag
.
value
=
true
;
}
else
{
ElMessage
.
error
(
"
当前状态已启用,不可删除!
"
);
}
};
const
handleCloseRowDelete
=
()
=>
{
deleteRowFlag
.
value
=
false
;
};
const
deleteRowConfirm
=
()
=>
{
axios
.
delete
(
`/apaas/system/v5/user/delete`
,
{
data
:
{
ids
:
[
selectedRow
.
value
.
id
]
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseRowDelete
();
});
};
const
editAccount
=
(
data
)
=>
{
if
(
selectTreeDataType
.
value
===
1
)
{
router
.
push
({
path
:
"
/system/organization/org-user/edit
"
,
query
:
{
id
:
data
.
id
,
orgId
:
selectOrgNode
.
value
.
organization_id
,
},
});
}
else
{
router
.
push
({
path
:
"
/system/organization/platform-user/edit
"
,
query
:
{
id
:
data
.
id
,
},
});
}
};
const
handleCloseDelete
=
()
=>
{
deleteFlag
.
value
=
false
;
};
const
deleteConfirm
=
()
=>
{
const
ids
=
selected
.
value
.
map
((
item
)
=>
item
.
id
);
axios
.
delete
(
`/apaas/system/v5/user/delete`
,
{
data
:
{
ids
:
ids
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseDelete
();
});
};
const
deleteBatch
=
()
=>
{
if
(
selectedName
.
value
.
length
>
0
)
{
deleteFlag
.
value
=
true
;
}
else
{
ElMessage
.
error
(
"
请先选择需要操作的数据!
"
);
}
};
const
handleCloseReset
=
()
=>
{
resetFlag
.
value
=
false
;
};
const
resetPsd
=
()
=>
{
if
(
selectedName
.
value
.
length
>
0
)
{
resetFlag
.
value
=
true
;
}
else
{
ElMessage
.
error
(
"
请先选择需要操作的数据!
"
);
}
};
const
resetConfirm
=
()
=>
{
const
ids
=
selected
.
value
.
map
((
item
)
=>
item
.
id
);
axios
.
post
(
`/apaas/system/v5/user/resetpwd`
,
{
ids
:
ids
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
getTableRows
();
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
handleCloseReset
();
});
};
const
selectRows
=
(
data
)
=>
{
selected
.
value
=
data
.
selection
;
selectedName
.
value
=
data
.
selection
.
map
((
item
)
=>
item
.
system_account
);
};
const
clearSelected
=
()
=>
{
dataTable
.
value
.
clearTable
();
};
onBeforeMount
(()
=>
{});
</
script
>
<
style
scoped
>
.tree_header
{
height
:
40px
;
line-height
:
40px
;
background-color
:
#f7f7f9
;
border-radius
:
6px
6px
0px
0px
;
font-size
:
16px
;
letter-spacing
:
0px
;
color
:
#202531
;
padding-left
:
16px
;
}
.tree_content
{
overflow
:
hidden
;
height
:
calc
(
100%
-
45px
);
}
.search
{
padding
:
16px
;
}
.tree
{
overflow
:
hidden
auto
;
height
:
calc
(
100%
-
65px
);
/* padding: 5px; */
}
.tree
:deep
()
.el-tree-node
>
.el-tree-node__children
{
overflow
:
unset
;
}
.flex_right
{
display
:
flex
;
flex-direction
:
column
;
}
.info_container
{
padding
:
15px
;
margin-bottom
:
10px
;
}
.title
{
font-size
:
18px
;
color
:
#202531
;
font-weight
:
bold
;
margin-bottom
:
10px
;
max-width
:
960px
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.detail_btn
{
font-size
:
14px
;
font-weight
:
normal
;
}
.icon_box
{
display
:
flex
;
align-items
:
center
;
}
.step_icon
{
display
:
inline-block
;
width
:
20px
;
height
:
20px
;
text-align
:
center
;
line-height
:
20px
;
background-color
:
#2a4aa7
;
color
:
#fff
;
border-radius
:
4px
;
font-size
:
14px
;
margin-right
:
8px
;
}
.info_box
{
max-width
:
960px
;
}
.main_container
{
flex
:
1
;
overflow
:
hidden
;
}
.filter-group
.left-filter
{
flex
:
1
;
display
:
flex
;
justify-content
:
start
;
flex-wrap
:
wrap
;
}
.filter-group
.right-action
{
width
:
144px
;
padding-bottom
:
16px
;
}
.filter-group
.right-action
.el-button
{
width
:
64px
;
}
.table_container
{
height
:
calc
(
100%
-
20px
);
overflow
:
auto
;
padding
:
0
16px
;
}
.bg-pagination
{
bottom
:
unset
;
}
.dialog_form
{
padding
:
24px
8px
6px
;
}
</
style
>
src/page/main/system/organization/org-detail/index.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<div
class=
"page_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"page_content apaas_scroll"
>
<div
class=
"info_row"
>
<div
class=
"title"
>
<div><span
class=
"icon_box"
></span>
基础信息
</div>
<div
class=
"dashed_line"
></div>
</div>
<div
class=
"info_content"
>
<div
class=
"info_box"
>
<bg-info
:data=
"baseInfo"
></bg-info>
</div>
<div
class=
"org_file info_box"
>
<div
class=
"pl-1"
>
组织附件
</div>
<div>
<div
class=
"file_item pl-1"
v-for=
"(item, index) in fileList"
:key=
"'file_' + index"
>
<span><bg-icon
style=
"font-size: 24px"
:icon=
"'#bg-ic-' + formatFile(item)"
></bg-icon></span>
<span
class=
"file_name"
>
{{
downloadFileFormatNew
(
item
)
}}
</span>
<span
class=
"fr download_btn"
>
<el-button
type=
"primary"
@
click=
"downloadFile(item)"
><bg-icon
icon=
"#bg-ic-to-bottom"
></bg-icon>
下载
</el-button
>
</span>
</div>
</div>
</div>
</div>
</div>
<div>
<div
class=
"title"
>
<div><span
class=
"icon_box"
></span>
业务系统信息
</div>
<div
class=
"dashed_line"
></div>
</div>
<div
class=
"info_content info_box"
>
<bg-table
ref=
"bgTable"
:headers=
"headers"
:rows=
"tableRows"
:isIndex=
"true"
:stripe=
"true"
>
</bg-table>
<div
class=
"pagination_box"
>
<bg-pagination
:page=
"filter.page"
:size=
"filter.limit"
:total=
"tableTotal"
@
change-page=
"changePage"
@
change-size=
"changeSize"
>
</bg-pagination>
</div>
</div>
</div>
</div>
</div>
</
template
>
<
script
setup
>
import
{
reactive
,
toRefs
,
ref
,
computed
,
onBeforeMount
}
from
"
vue
"
;
import
{
useRoute
}
from
"
vue-router
"
;
import
{
downloadFileFormatNew
}
from
"
@/services/helper
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
route
=
useRoute
();
const
baseInfo
=
reactive
([
{
name
:
"
组织名称
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织代码
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织管理员数量
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
业务系统数量
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
组织描述
"
,
value
:
""
,
nameWidth
:
130
,
},
]);
const
headers
=
reactive
([
{
label
:
"
业务系统名称
"
,
prop
:
"
business_name
"
,
},
{
label
:
"
是否启用
"
,
prop
:
"
state
"
,
},
{
label
:
"
业务系统账号
"
,
prop
:
"
system_account
"
,
},
]);
const
tableRows
=
ref
([]);
const
fileList
=
ref
([]);
const
filter
=
reactive
({
page
:
1
,
limit
:
10
,
});
const
tableTotal
=
ref
(
0
);
const
changeSize
=
(
size
)
=>
{
filter
.
limit
=
size
;
changePage
(
1
);
};
const
changePage
=
(
page
)
=>
{
filter
.
page
=
page
;
getSystemInfo
();
};
const
downloadFile
=
(
data
)
=>
{
const
a
=
document
.
createElement
(
"
a
"
);
// 创建a标签
a
.
setAttribute
(
"
download
"
,
""
);
// download属性
a
.
setAttribute
(
"
href
"
,
data
);
// href链接
a
.
click
();
// 自执行点击事件
};
const
formatFile
=
(
url
)
=>
{
const
file
=
url
.
split
(
"
.
"
)[
1
];
let
icon
=
""
;
if
(
"
docx
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-doc
"
;
}
else
if
(
"
xlsx
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-xlsx
"
;
}
else
if
(
"
pdf
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-pdf
"
;
}
else
if
(
"
txt
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-txt
"
;
}
else
if
(
"
zip
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-zip
"
;
}
else
if
(
"
jpg,png
"
.
indexOf
(
file
)
!==
-
1
)
{
icon
=
"
c-file-image
"
;
}
else
{
icon
=
"
txt
"
;
}
return
icon
;
};
const
getDetail
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/detail?organization_id=
${
route
.
query
.
id
}
&key_word=&state=&limit=&page=&data_type=1`
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
detail
=
res
.
data
.
data
.
org_info
;
baseInfo
[
0
].
value
=
detail
.
name
;
baseInfo
[
1
].
value
=
detail
.
organization_code
;
baseInfo
[
2
].
value
=
detail
.
org_admin_number
;
baseInfo
[
3
].
value
=
detail
.
business_system_number
;
baseInfo
[
4
].
value
=
detail
.
description
;
fileList
.
value
=
detail
.
attachment
?
detail
.
attachment
.
split
(
"
,
"
)
:
[];
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
getSystemInfo
=
()
=>
{
const
params
=
{
...
filter
,
organization_id
:
route
.
query
.
id
};
axios
.
get
(
`/apaas/system/v5/org/business/msg`
,
{
params
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
tableRows
.
value
=
res
.
data
.
data
||
[];
tableTotal
.
value
=
res
.
data
.
total
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
onBeforeMount
(()
=>
{
if
(
route
.
query
.
id
)
{
getDetail
();
getSystemInfo
();
}
});
</
script
>
<
style
scoped
>
.page_content
{
padding
:
15px
;
overflow
:
auto
;
font-size
:
14px
;
color
:
#202531
;
}
.info_content
{
/* display: flex; */
}
.org_file
{
margin-top
:
15px
;
}
.file_item
{
height
:
48px
;
line-height
:
48px
;
background-color
:
#fafafa
;
border-radius
:
4px
;
font-size
:
14px
;
margin-bottom
:
8px
;
}
.file_name
{
padding-left
:
10px
;
color
:
#202531
;
}
.download_btn
{
padding-right
:
4px
;
}
.info_row
{
margin-bottom
:
40px
;
}
.img_box
{
width
:
120px
\
;
;
}
.info_box
{
width
:
60%
;
}
.title
{
font-size
:
18px
;
color
:
#1a1a1a
;
font-weight
:
bold
;
margin-bottom
:
10px
;
display
:
flex
;
align-items
:
center
;
}
.dashed_line
{
flex
:
1
;
height
:
1px
;
margin
:
0
10px
;
border-bottom
:
dashed
1px
#dadee7
;
}
.icon_box
{
display
:
inline-block
;
width
:
4px
;
height
:
14px
;
background-color
:
#3759be
;
border-radius
:
2px
;
margin-right
:
5px
;
}
.pagination_box
{
position
:
sticky
;
position
:
-webkit-sticky
;
margin-top
:
16px
;
bottom
:
-15px
;
background-color
:
#fff
;
z-index
:
1024
;
height
:
40px
;
line-height
:
40px
;
padding-top
:
5px
;
}
.bg-pagination
{
margin-top
:
0px
;
}
.info_content
:deep
()
.bg-table
.empty_container
{
height
:
160px
;
padding-top
:
25px
;
}
</
style
>
src/page/main/system/organization/org-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"orgForm"
:rules=
"formRules"
ref=
"orgRef"
>
<el-form-item
label=
"上级目录"
prop=
"p_organization_id"
v-if=
"formType === 'create'"
>
<el-tree-select
v-model=
"orgForm.p_organization_id"
:data=
"orgData"
:props=
"treeProps"
:render-after-expand=
"false"
:check-strictly=
"true"
:disabled=
"orgForm.level"
style=
"width: 80%"
/>
<el-form-item
label=
""
style=
"padding-left: 16px"
>
<el-checkbox
v-model=
"orgForm.level"
@
change=
"isTop"
label=
"顶级"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"政务组织名称"
prop=
"name"
>
<el-input
v-model=
"orgForm.name"
/>
</el-form-item>
<el-form-item
label=
"组织代码"
prop=
"organization_code"
>
<el-input
v-model=
"orgForm.organization_code"
/>
</el-form-item>
<el-form-item
label=
"组织介绍"
prop=
"description"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"orgForm.description"
maxlength=
"300"
show-word-limit
/>
</el-form-item>
<el-form-item
label=
"组织附件"
prop=
"logo"
>
<bg-upload
v-model=
"orgForm.attachment"
customTips
:limit=
"3"
:fileTypes=
"['zip', 'rar', 'doc', 'docx', 'xlsx', 'xls', 'png', 'jpg']"
:otherInfo=
"'最多可上传三个附件,可上传zip,rar,doc,docx,xlsx,xls,png,jpg,可上传营业执照和相关协议文件等'"
>
<span>
将文件拖到此处,或 点击上传
</span>
</bg-upload>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
,
onBeforeMount
}
from
"
vue
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
const
props
=
defineProps
({
formType
:
{
type
:
String
,
default
:
"
create
"
,
//false 新增 true 编辑
},
});
const
orgForm
=
reactive
({
p_organization_id
:
""
,
level
:
false
,
name
:
""
,
organization_code
:
""
,
description
:
""
,
attachment
:
[],
});
const
checkCode
=
(
rule
,
value
,
callback
)
=>
{
var
reg
=
/^
[
a-zA-Z0-9
]
+$/
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
"
只能输入字母和数字
"
));
}
else
{
callback
();
}
};
const
checkName
=
(
rule
,
value
,
callback
)
=>
{
var
reg
=
/^
[
a-zA-Z
\u
4e00-
\u
9fa5
]
+$/
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
"
只能输入字母和汉字
"
));
}
else
{
callback
();
}
};
const
formRules
=
reactive
({
p_organization_id
:
[{
required
:
true
,
message
:
"
输入上级目录
"
,
trigger
:
"
blur
"
}],
name
:
[
{
required
:
true
,
message
:
"
请输入组织名称
"
,
trigger
:
"
blur
"
},
{
max
:
50
,
message
:
"
组织名称最大长度为50位
"
,
trigger
:
"
blur
"
},
{
validator
:
checkName
,
trigger
:
"
blur
"
},
],
organization_code
:
[
{
required
:
true
,
message
:
"
请输入组织代码
"
,
trigger
:
"
blur
"
},
{
max
:
18
,
message
:
"
组织代码最大长度为18位
"
,
trigger
:
"
blur
"
},
{
validator
:
checkCode
,
trigger
:
"
blur
"
},
],
});
const
orgRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
orgRef
)
return
;
await
orgRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
orgForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
orgRef
)
return
;
orgRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
orgForm
,
data
);
};
const
orgData
=
ref
([]);
const
treeProps
=
{
label
:
"
name
"
,
children
:
"
Child
"
,
value
:
"
organization_id
"
,
disabled
:
"
disabled
"
,
};
const
getOrgTree
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
orgDataTemp
=
res
.
data
.
data
||
[];
orgDataTemp
.
shift
();
orgData
.
value
=
filterOrg
(
orgDataTemp
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
filterOrg
=
(
data
)
=>
{
if
(
data
.
length
>
0
)
{
data
.
forEach
((
item
)
=>
{
item
.
disabled
=
item
.
data_type
===
0
?
false
:
true
;
if
(
item
.
Child
)
{
filterOrg
(
item
.
Child
);
}
else
{
return
;
}
});
}
return
data
;
};
const
isTop
=
(
data
)
=>
{
orgForm
.
p_organization_id
=
data
?
"
"
:
""
;
//空格绕过表单非空校验
};
onBeforeMount
(()
=>
{
getOrgTree
();
});
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/org-user/index.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<div
class=
"page_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"page_content flex_cloumn"
>
<div
class=
"content_top apaas_scroll"
>
<div
class=
"content_process"
>
<div>
<el-steps
:active=
"step"
>
<el-step
title=
""
:class=
"
{ process_complete: step > 1 }">
<template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 0"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
账号信息
</span>
</
template
>
</el-step>
<el-step
title=
""
:class=
"{ process_complete: step > 2 }"
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 1"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-staff"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
个人信息
</span>
</
template
>
</el-step>
<el-step
title=
""
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 2"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-success"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
完成
</span>
</
template
>
</el-step>
</el-steps>
</div>
</div>
<div
class=
"content_main"
>
<orgAccountForm
v-show=
"step === 1"
:form-type=
"route.query.id ? true : false"
:id=
"route.query.id"
ref=
"orgAccountRef"
@
action=
"getOrgAccountFormData"
></orgAccountForm>
<orgPersonForm
v-show=
"step === 2"
ref=
"orgPersonRef"
@
action=
"getOrgPersonFormData"
></orgPersonForm>
<div
class=
"process_end"
v-show=
"step === 3"
>
<div>
<div>
<img
v-if=
"successFlag"
src=
"@/assets/imgs/img_data-complete.png"
alt=
""
/>
<img
v-else
src=
"@/assets/imgs/img_data-fail.png"
alt=
""
/>
</div>
<div
class=
"font_bold"
>
{{
route.query.id
? successFlag
? "组织用户编辑成功"
: "组织用户编辑失败"
: successFlag
? "组织用户新增成功"
: "组织用户新增失败"
}}
</div>
<el-button
@
click=
"cancel"
>
返回列表
</el-button>
<el-button
v-if=
"!route.query.id"
type=
"primary"
@
click=
"continueCreate"
>
继续创建
</el-button>
</div>
</div>
</div>
</div>
<div
class=
"content_bottom"
v-if=
"step !== 3"
>
<div
v-show=
"step === 1"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"nextStep"
>
下一步
</el-button>
</div>
<div
v-show=
"step === 2"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"previousStep"
>
上一步
</el-button>
<el-button
type=
"primary"
@
click=
"submit"
>
提交
</el-button>
</div>
</div>
</div>
</div>
</template>
<
script
setup
>
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
;
import
orgAccountForm
from
"
./org-account-form.vue
"
;
import
orgPersonForm
from
"
./org-person-form.vue
"
;
import
{
reactive
,
ref
,
onBeforeMount
,
toRefs
,
computed
,
onBeforeUnmount
,
onMounted
}
from
"
vue
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
route
=
useRoute
();
const
router
=
useRouter
();
const
step
=
ref
(
1
);
const
orgAccountRef
=
ref
(
null
);
const
orgPersonRef
=
ref
(
null
);
const
formData
=
reactive
({
organization_id
:
""
,
select_role
:
""
,
logo
:
[],
system_account
:
""
,
contact_phone
:
""
,
password
:
""
,
confirm_password
:
""
,
state
:
1
,
contact_name
:
""
,
document_type
:
""
,
document_number
:
""
,
contact_email
:
""
,
remark
:
""
,
});
//账号信息表单+个人信息表单
const
successFlag
=
ref
(
false
);
const
orgId
=
ref
(
""
);
// 下一步
const
nextStep
=
()
=>
{
orgAccountRef
.
value
.
submitForm
();
};
//账号信息表单检验触发事件 data为null 校验失败
const
getOrgAccountFormData
=
(
data
)
=>
{
if
(
data
)
{
Object
.
assign
(
formData
,
data
);
step
.
value
=
2
;
}
else
{
}
};
//个人信息表单检验触发事件 data为null 校验失败
const
getOrgPersonFormData
=
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
Object
.
assign
(
formData
,
data
);
if
(
route
.
query
.
id
)
{
let
params
=
{
...
formData
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
};
params
.
document_type
=
params
.
document_type
==
""
?
0
:
params
.
document_type
;
axios
.
put
(
`/apaas/system/v5/org/update/user/
${
route
.
query
.
id
}
`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
else
{
const
params
=
{
...
formData
,
// organization_id: orgId.value,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
is_admin
:
2
,
password
:
CryptoJS
.
AES
.
encrypt
(
formData
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
};
params
.
document_type
=
params
.
document_type
==
""
?
0
:
params
.
document_type
;
axios
.
post
(
`/apaas/system/v5/org/add/user`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
}
}
};
//上一步
const
previousStep
=
()
=>
{
step
.
value
--
;
};
//提交表单
const
submit
=
()
=>
{
orgPersonRef
.
value
.
submitForm
();
};
//继续创建 清空表单
const
continueCreate
=
()
=>
{
orgAccountRef
.
value
.
clearForm
();
orgPersonRef
.
value
.
clearForm
();
step
.
value
=
1
;
successFlag
.
value
=
false
;
};
//取消
const
cancel
=
()
=>
{
router
.
push
({
path
:
"
/system/organization
"
,
query
:
{
id
:
route
.
query
.
orgId
,
},
});
};
const
getDetail
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/user/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
form
=
res
.
data
.
data
;
orgAccountRef
.
value
.
setForm
({
organization_id
:
form
.
organization_id
,
select_role
:
form
.
select_role
,
logo
:
form
.
logo
?
[{
url
:
form
.
logo
}]
:
[],
system_account
:
form
.
system_account
,
contact_phone
:
form
.
contact_phone
,
state
:
form
.
state
,
});
orgPersonRef
.
value
.
setForm
({
contact_name
:
form
.
contact_name
,
document_type
:
form
.
document_type
?
form
.
document_type
:
""
,
document_number
:
form
.
document_number
,
contact_email
:
form
.
contact_email
,
remark
:
form
.
remark
,
});
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
onBeforeMount
(()
=>
{
if
(
route
.
query
.
id
)
{
getDetail
();
}
});
onMounted
(()
=>
{});
</
script
>
<
style
scoped
>
.flex_cloumn
{
display
:
flex
;
flex-direction
:
column
;
}
.content_top
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
overflow
:
auto
;
}
/* .content_top::-webkit-scrollbar {
width: 5px;
height: 0px;
}
.content_top::-webkit-scrollbar-thumb {
background: #dedede;
border-radius: 10px;
height: 0px;
}
.content_top::-webkit-scrollbar-track {
background: transparent;
border-radius: 2px;
} */
.content_bottom
{
height
:
68px
;
line-height
:
68px
;
text-align
:
right
;
padding
:
0
20px
;
border-top
:
1px
solid
#e6e9ef
;
}
.content_process
{
border-bottom
:
1px
solid
#e6e9ef
;
padding
:
38px
16%
;
}
.content_main
{
flex
:
1
;
padding
:
30px
;
box-sizing
:
border-box
;
}
.process_desc
{
background-color
:
#fff
;
display
:
inline-block
;
position
:
absolute
;
padding
:
0
5px
;
font-size
:
18px
;
color
:
#202531
;
font-weight
:
bold
;
}
.process_desc
img
{
height
:
25px
;
width
:
25px
;
vertical-align
:
middle
;
}
.process_end
{
height
:
100%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.process_end
div
{
text-align
:
center
;
}
.step_icon
{
color
:
#fff
;
font-weight
:
600
;
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.icon_box
{
display
:
inline-block
;
background-color
:
#2b4695
;
width
:
48px
;
height
:
48px
;
border-radius
:
99px
;
position
:
relative
;
border
:
3px
solid
#b0bee8
;
vertical-align
:
middle
;
}
.circle
{
display
:
inline-block
;
background-color
:
#a9b1c7
;
width
:
24px
;
height
:
24px
;
border-radius
:
99px
;
position
:
relative
;
border
:
4px
solid
#e6e9ef
;
vertical-align
:
middle
;
}
.content_process
:deep
()
.el-step.is-horizontal
.el-step__line
{
height
:
4px
;
}
.content_process
:deep
()
.el-step__head.is-finish
.el-step__line
{
background
:
linear-gradient
(
to
right
,
#2b4695
50%
,
#e6e9ef
50%
);
}
.process_complete
:deep
()
.el-step__head.is-finish
.el-step__line
{
background
:
linear-gradient
(
to
right
,
#2b4695
100%
,
#e6e9ef
0%
);
}
</
style
>
src/page/main/system/organization/org-user/org-account-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"orgAccountForm"
:rules=
"orgAccountFormRules"
ref=
"orgformAccountRef"
style=
"max-width: 66%"
>
<el-form-item
label=
"所属组织"
prop=
"organization_id"
>
<el-tree-select
v-model=
"orgAccountForm.organization_id"
:data=
"orgData"
:props=
"treeProps"
:render-after-expand=
"false"
:disabled=
"true"
style=
"width: 100%"
/>
<!--
<el-input
v-model=
"orgAccountForm.organization_id"
/>
-->
</el-form-item>
<el-form-item
label=
"角色"
prop=
"select_role"
v-if=
"!formType"
>
<el-select
v-model=
"orgAccountForm.select_role"
multiple
placeholder=
"请选择角色"
:disabled=
"true"
style=
"width: 100%"
>
<el-option
v-for=
"item in roleList"
:key=
"item.role_id"
:label=
"item.role_name"
:value=
"item.role_id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"头像"
prop=
"logo"
>
<bg-upload-image
v-model=
"orgAccountForm.logo"
:showTips=
"true"
:limit=
"1"
:fileSize=
"500"
:fileSizeUnit=
"'KB'"
listType=
"picture-card"
:accept=
"['.jpg', '.jpeg', '.png']"
customTips=
"请选择图片上传:大小120 * 120像素支持jpg、png等格式,图片需小于500KB"
></bg-upload-image>
</el-form-item>
<el-form-item
label=
"账号"
prop=
"system_account"
>
<el-input
v-model=
"orgAccountForm.system_account"
/>
</el-form-item>
<el-form-item
label=
"手机号"
prop=
"contact_phone"
>
<el-input
v-model=
"orgAccountForm.contact_phone"
/>
</el-form-item>
<el-form-item
label=
"密码"
prop=
"password"
v-if=
"!formType"
>
<el-input
type=
"password"
v-model=
"orgAccountForm.password"
/>
</el-form-item>
<el-form-item
label=
"确认密码"
prop=
"confirm_password"
v-if=
"!formType"
>
<el-input
type=
"password"
v-model=
"orgAccountForm.confirm_password"
/>
</el-form-item>
<el-form-item
label=
"是否启用"
prop=
"state"
>
<bg-switch
:labels=
"['否', '是']"
:values=
"[0, 1]"
v-model=
"orgAccountForm.state"
></bg-switch>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
,
onBeforeMount
}
from
"
vue
"
;
import
{
useRoute
}
from
"
vue-router
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
const
route
=
useRoute
();
const
props
=
defineProps
({
formType
:
{
type
:
Boolean
,
default
:
false
,
//false 新增 true 编辑
},
id
:
{
type
:
String
,
default
:
""
,
},
});
const
orgAccountForm
=
reactive
({
organization_id
:
""
,
select_role
:
""
,
logo
:
[],
system_account
:
""
,
contact_phone
:
""
,
password
:
""
,
confirm_password
:
""
,
state
:
1
,
});
const
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
!==
orgAccountForm
.
password
)
{
callback
(
new
Error
(
"
密码输入不一致
"
));
}
else
{
callback
();
}
};
const
validateSystemAccount
=
(
rule
,
value
,
callback
)
=>
{
let
reg
=
/^
[
a-zA-Z0-9
]
+$/
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
"
只能输入字母和数字
"
));
}
else
{
let
params
=
null
;
if
(
props
.
id
)
{
params
=
{
id
:
parseInt
(
props
.
id
),
system_account
:
value
};
}
else
{
params
=
{
system_account
:
value
};
}
axios
.
post
(
`/apaas/system/v5/user/check/account`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
callback
();
}
else
{
callback
(
new
Error
(
res
.
data
.
data
));
}
});
}
};
const
checkPhone
=
(
rule
,
value
,
callback
)
=>
{
var
phone_ruler
=
/^
(?:(?:\+
|00
)
86
)?
1
[
3-9
]\d{9}
$/
;
setTimeout
(()
=>
{
if
(
!
phone_ruler
.
test
(
value
)
&&
value
.
length
!==
0
)
{
callback
(
new
Error
(
"
请输入正确的手机号码
"
));
}
else
{
callback
();
}
});
};
const
checkPhoneRepet
=
(
rule
,
value
,
callback
)
=>
{
let
params
=
null
;
if
(
props
.
id
)
{
params
=
{
id
:
parseInt
(
props
.
id
),
contact_phone
:
value
};
}
else
{
params
=
{
id
:
0
,
contact_phone
:
value
};
}
axios
.
post
(
`/apaas/system/v5/org/check`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
callback
();
}
else
{
callback
(
new
Error
(
res
.
data
.
data
));
}
});
};
const
orgAccountFormRules
=
reactive
({
organization_id
:
[{
required
:
true
,
message
:
"
请选择组织
"
,
trigger
:
"
blur
"
}],
select_role
:
[{
required
:
true
,
message
:
"
请选择角色
"
,
trigger
:
"
blur
"
}],
system_account
:
[
{
required
:
true
,
message
:
"
请输入账号
"
,
trigger
:
"
blur
"
},
{
min
:
4
,
message
:
"
帐号长度不得低于4个字符
"
,
trigger
:
"
blur
"
},
{
max
:
20
,
message
:
"
帐号最大长度为20个字符
"
,
trigger
:
"
blur
"
},
{
validator
:
validateSystemAccount
,
trigger
:
"
blur
"
},
],
contact_phone
:
[
{
required
:
true
,
message
:
"
请输入手机号
"
,
trigger
:
"
blur
"
},
{
validator
:
checkPhone
,
trigger
:
"
blur
"
},
{
validator
:
checkPhoneRepet
,
trigger
:
"
blur
"
},
],
password
:
[
{
required
:
true
,
message
:
"
请输入密码
"
,
trigger
:
"
blur
"
},
{
min
:
8
,
message
:
"
密码长度不得低于8位
"
,
trigger
:
"
blur
"
},
],
confirm_password
:
[
{
required
:
true
,
message
:
"
请确认密码
"
,
trigger
:
"
blur
"
},
{
validator
:
validatePass
,
trigger
:
"
blur
"
},
],
});
const
orgformAccountRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
roleList
=
ref
([]);
const
submitForm
=
async
()
=>
{
if
(
!
orgformAccountRef
)
return
;
await
orgformAccountRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
orgAccountForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
orgformAccountRef
)
return
;
orgformAccountRef
.
value
.
resetFields
();
orgAccountForm
.
select_role
=
[
roleList
.
value
[
0
].
role_id
];
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
orgAccountForm
,
data
);
};
const
orgData
=
ref
([]);
const
treeProps
=
{
label
:
"
name
"
,
children
:
"
Child
"
,
value
:
"
organization_id
"
,
};
const
getOrgTree
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
orgData
.
value
=
res
.
data
.
data
||
[];
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
getRoleList
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/select/role?is_admin=2`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
roleList
.
value
=
res
.
data
.
data
;
orgAccountForm
.
select_role
=
[
roleList
.
value
[
0
].
role_id
];
}
else
{
}
});
};
onBeforeMount
(()
=>
{
getOrgTree
();
getRoleList
();
orgAccountForm
.
organization_id
=
route
.
query
.
orgId
;
});
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/org-user/org-person-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"orgPersonForm"
:rules=
"orgPersonFormRules"
ref=
"orgPersonFormRef"
style=
"max-width: 66%"
>
<el-form-item
label=
"联系人姓名"
prop=
"contact_name"
>
<el-input
v-model=
"orgPersonForm.contact_name"
/>
</el-form-item>
<el-form-item
label=
"证件类型"
prop=
"document_type"
>
<el-select
v-model=
"orgPersonForm.document_type"
placeholder=
"请选择证件类型"
style=
"width: 100%"
>
<el-option
v-for=
"item in documentTypeList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"证件号"
prop=
"document_number"
>
<el-input
v-model=
"orgPersonForm.document_number"
/>
</el-form-item>
<el-form-item
label=
"联系人邮箱"
prop=
"contact_email"
>
<el-input
v-model=
"orgPersonForm.contact_email"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"orgPersonForm.remark"
/>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
}
from
"
vue
"
;
const
orgPersonForm
=
reactive
({
contact_name
:
""
,
document_type
:
""
,
document_number
:
""
,
contact_email
:
""
,
remark
:
""
,
});
const
documentTypeList
=
ref
([
{
label
:
"
身份证
"
,
value
:
1
,
},
]);
const
orgPersonFormRules
=
reactive
({
contact_email
:
[
// { required: true, message: '请输入手机号', trigger: 'blur' },
{
type
:
"
email
"
,
message
:
"
请输入正确的邮箱
"
,
trigger
:
"
blur
"
},
],
document_number
:
[
{
pattern
:
/
(
^
[
1-9
]\d{5}(
18|19|
([
23
]\d))\d{2}((
0
[
1-9
])
|
(
10|11|12
))(([
0-2
][
1-9
])
|10|20|30|31
)\d{3}[
0-9Xx
]
$
)
|
(
^
[
1-9
]\d{5}\d{2}((
0
[
1-9
])
|
(
10|11|12
))(([
0-2
][
1-9
])
|10|20|30|31
)\d{2}[
0-9Xx
]
$
)
/
,
message
:
"
请输入正确的身份证号
"
,
trigger
:
"
blur
"
,
},
],
});
const
orgPersonFormRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
orgPersonFormRef
)
return
;
await
orgPersonFormRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
orgPersonForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
orgPersonFormRef
)
return
;
orgPersonFormRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
orgPersonForm
,
data
);
};
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/platform-user/index.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<div
class=
"page_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"page_content flex_cloumn"
>
<div
class=
"content_top apaas_scroll"
>
<div
class=
"content_process"
v-if=
"!route.query.id"
>
<div>
<el-steps
:active=
"step"
>
<el-step
title=
""
:class=
"
{ process_complete: step > 1 }">
<template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 0"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
账号信息
</span>
</
template
>
</el-step>
<el-step
title=
""
:class=
"{ process_complete: step > 2 }"
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 1"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-staff"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
个人
</span>
</
template
>
</el-step>
<el-step
title=
""
>
<
template
#icon
>
<span
class=
"process_desc"
>
<span
class=
"icon_box"
v-if=
"step > 2"
><bg-icon
class=
"step_icon"
icon=
"#bg-ic-file-success"
></bg-icon
></span>
<span
class=
"circle"
v-else
></span>
完成
</span>
</
template
>
</el-step>
</el-steps>
</div>
</div>
<div
class=
"content_main"
>
<platformAccountForm
v-show=
"step === 1"
:form-type=
"route.query.id ? true : false"
:id=
"route.query.id"
ref=
"platformAccountFormRef"
@
action=
"getPlatformAccountFormData"
></platformAccountForm>
<platformPersonForm
v-show=
"step === 2"
ref=
"plplatformPersonFormRef"
@
action=
"getPlatformPersonFormData"
></platformPersonForm>
<div
class=
"process_end"
v-show=
"step === 3"
>
<div>
<div>
<img
v-if=
"successFlag"
src=
"@/assets/imgs/img_data-complete.png"
alt=
""
/>
<img
v-else
src=
"@/assets/imgs/img_data-fail.png"
alt=
""
/>
</div>
<div
class=
"font_bold"
>
{{
route.query.id
? successFlag
? "平台用户编辑成功"
: "平台用户编辑失败"
: successFlag
? "平台用户新增成功"
: "平台用户新增失败"
}}
</div>
<el-button
@
click=
"cancel"
>
返回列表
</el-button>
<el-button
v-if=
"!route.query.id"
type=
"primary"
@
click=
"continueCreate"
>
继续创建
</el-button>
</div>
</div>
</div>
</div>
<div
class=
"content_bottom"
v-if=
"step !== 3"
>
<div
v-show=
"!route.query.id && step === 1"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"nextStep"
>
下一步
</el-button>
</div>
<div
v-show=
"step === 2"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"previousStep"
>
上一步
</el-button>
<el-button
type=
"primary"
@
click=
"submit"
>
提交
</el-button>
</div>
<div
v-show=
"route.query.id"
>
<el-button
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"nextStep"
>
保存
</el-button>
</div>
</div>
</div>
</div>
</template>
<
script
setup
>
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
;
import
platformAccountForm
from
"
./platform-account-form.vue
"
;
import
platformPersonForm
from
"
./platform-person-form.vue
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
{
reactive
,
ref
,
onBeforeMount
,
toRefs
,
computed
,
onMounted
}
from
"
vue
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
route
=
useRoute
();
const
router
=
useRouter
();
const
step
=
ref
(
1
);
const
platformAccountFormRef
=
ref
(
null
);
const
plplatformPersonFormRef
=
ref
(
null
);
const
formData
=
reactive
({
logo
:
""
,
system_account
:
""
,
contact_phone
:
""
,
password
:
""
,
confirm_password
:
""
,
select_role
:
""
,
state
:
""
,
contact_name
:
""
,
contact_email
:
""
,
remark
:
""
,
});
//账号信息表单+个人信息表单
const
orgId
=
ref
(
null
);
const
successFlag
=
ref
(
false
);
// 下一步
const
nextStep
=
()
=>
{
platformAccountFormRef
.
value
.
submitForm
();
};
//账号信息表单检验触发事件 data为null 校验失败
const
getPlatformAccountFormData
=
(
data
)
=>
{
if
(
data
)
{
if
(
route
.
query
.
id
)
{
Object
.
assign
(
formData
,
data
);
let
params
=
{
...
formData
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
};
axios
.
put
(
`/apaas/system/v5/org/update/user/
${
route
.
query
.
id
}
`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
else
{
Object
.
assign
(
formData
,
data
);
step
.
value
=
2
;
}
}
else
{
}
};
//个人信息表单检验触发事件 data为null 校验失败
const
getPlatformPersonFormData
=
(
data
)
=>
{
if
(
data
)
{
Object
.
assign
(
formData
,
data
);
if
(
route
.
query
.
id
)
{
console
.
log
(
formData
);
// let params = {
// }
// axios.post(`/apaas/system/v5/org/update/user/${route.query.id}`,params)
// .then((res) => {
// if (res.data.code == 200) {
// successFlag.value = true;
// step.value = 3;
// }else {
// ElMessage.error(res.data.msg)
// }
// })
}
else
{
const
params
=
{
...
formData
,
organization_id
:
orgId
.
value
,
logo
:
formData
.
logo
&&
formData
.
logo
.
length
>
0
?
formData
.
logo
[
0
].
url
:
""
,
is_admin
:
3
,
password
:
CryptoJS
.
AES
.
encrypt
(
formData
.
password
,
"
swuE9cmCZQwrkYRV
"
).
toString
(),
};
axios
.
post
(
`/apaas/system/v5/org/add/user`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
successFlag
.
value
=
true
;
step
.
value
=
3
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
}
};
//上一步
const
previousStep
=
()
=>
{
step
.
value
--
;
};
//提交表单
const
submit
=
()
=>
{
plplatformPersonFormRef
.
value
.
submitForm
();
};
//继续创建 清空表单
const
continueCreate
=
()
=>
{
platformAccountFormRef
.
value
.
clearForm
();
plplatformPersonFormRef
.
value
.
clearForm
();
step
.
value
=
1
;
successFlag
.
value
=
false
;
};
//取消
const
cancel
=
()
=>
{
router
.
go
(
-
1
);
};
const
getOrgTree
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
orgId
.
value
=
res
.
data
.
data
[
0
].
organization_id
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
getDetail
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/user/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
form
=
res
.
data
.
data
;
console
.
log
(
form
);
platformAccountFormRef
.
value
.
setForm
({
logo
:
form
.
logo
?
[{
url
:
form
.
logo
}]
:
[],
system_account
:
form
.
system_account
,
contact_phone
:
form
.
contact_phone
,
state
:
form
.
state
,
contact_name
:
form
.
contact_name
,
contact_email
:
form
.
contact_email
,
remark
:
form
.
remark
,
select_role
:
form
.
select_role
,
});
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
onBeforeMount
(()
=>
{
getOrgTree
();
if
(
route
.
query
.
id
)
{
getDetail
();
}
});
onMounted
(()
=>
{});
</
script
>
<
style
scoped
>
.flex_cloumn
{
display
:
flex
;
flex-direction
:
column
;
}
.content_top
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
overflow
:
auto
;
}
/* .content_top::-webkit-scrollbar {
width: 5px;
height: 0px;
}
.content_top::-webkit-scrollbar-thumb {
background: #dedede;
border-radius: 10px;
height: 0px;
}
.content_top::-webkit-scrollbar-track {
background: transparent;
border-radius: 2px;
} */
.content_bottom
{
height
:
68px
;
line-height
:
68px
;
text-align
:
right
;
padding
:
0
20px
;
border-top
:
1px
solid
#e6e9ef
;
}
.content_process
{
border-bottom
:
1px
solid
#e6e9ef
;
padding
:
38px
16%
;
}
.content_main
{
flex
:
1
;
padding
:
30px
;
box-sizing
:
border-box
;
}
.process_desc
{
background-color
:
#fff
;
display
:
inline-block
;
position
:
absolute
;
padding
:
0
5px
;
font-size
:
18px
;
color
:
#202531
;
font-weight
:
bold
;
}
.process_desc
img
{
height
:
25px
;
width
:
25px
;
vertical-align
:
middle
;
}
.process_end
{
height
:
100%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.process_end
div
{
text-align
:
center
;
}
.step_icon
{
color
:
#fff
;
font-weight
:
600
;
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
.icon_box
{
display
:
inline-block
;
background-color
:
#2b4695
;
width
:
48px
;
height
:
48px
;
border-radius
:
99px
;
position
:
relative
;
border
:
3px
solid
#b0bee8
;
vertical-align
:
middle
;
}
.circle
{
display
:
inline-block
;
background-color
:
#a9b1c7
;
width
:
24px
;
height
:
24px
;
border-radius
:
99px
;
position
:
relative
;
border
:
4px
solid
#e6e9ef
;
vertical-align
:
middle
;
}
.content_process
:deep
()
.el-step.is-horizontal
.el-step__line
{
height
:
4px
;
}
.content_process
:deep
()
.el-step__head.is-finish
.el-step__line
{
background
:
linear-gradient
(
to
right
,
#2b4695
50%
,
#e6e9ef
50%
);
}
.process_complete
:deep
()
.el-step__head.is-finish
.el-step__line
{
background
:
linear-gradient
(
to
right
,
#2b4695
100%
,
#e6e9ef
0%
);
}
</
style
>
src/page/main/system/organization/platform-user/platform-account-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"platformAccountForm"
:rules=
"platformAccountFormRules"
ref=
"platformAccountRef"
style=
"max-width: 66%"
>
<el-form-item
label=
"头像"
prop=
"logo"
>
<bg-upload-image
v-model=
"platformAccountForm.logo"
:showTips=
"true"
:limit=
"1"
:fileSize=
"500"
:fileSizeUnit=
"'KB'"
listType=
"picture-card"
:accept=
"['.jpg', '.jpeg', '.png']"
customTips=
"请选择图片上传:大小120 * 120像素支持jpg、png等格式,图片需小于500KB"
></bg-upload-image>
</el-form-item>
<el-form-item
label=
"账号"
prop=
"system_account"
>
<el-input
v-model=
"platformAccountForm.system_account"
/>
</el-form-item>
<el-form-item
label=
"手机号"
prop=
"contact_phone"
>
<el-input
v-model=
"platformAccountForm.contact_phone"
/>
</el-form-item>
<el-form-item
v-if=
"!formType"
label=
"密码"
prop=
"password"
>
<el-input
type=
"password"
v-model=
"platformAccountForm.password"
/>
</el-form-item>
<el-form-item
v-if=
"!formType"
label=
"确认密码"
prop=
"confirm_password"
>
<el-input
type=
"password"
v-model=
"platformAccountForm.confirm_password"
/>
</el-form-item>
<el-form-item
label=
"角色授权"
prop=
"select_role"
>
<el-select
v-model=
"platformAccountForm.select_role"
multiple
placeholder=
"请选择角色"
style=
"width: 100%"
>
<el-option
v-for=
"item in roleList"
:key=
"item.role_id"
:label=
"item.role_name"
:value=
"item.role_id"
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"formType"
label=
"姓名"
prop=
"contact_name"
>
<el-input
v-model=
"platformAccountForm.contact_name"
/>
</el-form-item>
<el-form-item
v-if=
"formType"
label=
"邮箱"
prop=
"contact_email"
>
<el-input
v-model=
"platformAccountForm.contact_email"
/>
</el-form-item>
<el-form-item
v-if=
"formType"
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"platformAccountForm.remark"
/>
</el-form-item>
<el-form-item
label=
"是否启用"
prop=
"state"
>
<bg-switch
:labels=
"['否', '是']"
:values=
"[0, 1]"
v-model=
"platformAccountForm.state"
></bg-switch>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
,
onBeforeMount
}
from
"
vue
"
;
import
axios
from
"
@/request/http.js
"
;
const
props
=
defineProps
({
formType
:
{
type
:
Boolean
,
default
:
false
,
//false 新增 true 编辑
},
id
:
{
type
:
String
,
default
:
""
,
},
});
const
platformAccountForm
=
reactive
({
logo
:
[],
system_account
:
""
,
contact_phone
:
""
,
password
:
""
,
confirm_password
:
""
,
select_role
:
""
,
state
:
1
,
contact_name
:
""
,
contact_email
:
""
,
remark
:
""
,
});
const
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
!==
platformAccountForm
.
password
)
{
callback
(
new
Error
(
"
密码输入不一致
"
));
}
else
{
callback
();
}
};
const
checkPhone
=
(
rule
,
value
,
callback
)
=>
{
var
phone_ruler
=
/^
(?:(?:\+
|00
)
86
)?
1
[
3-9
]\d{9}
$/
;
setTimeout
(()
=>
{
if
(
!
phone_ruler
.
test
(
value
)
&&
value
.
length
!==
0
)
{
callback
(
new
Error
(
"
请输入正确的手机号码
"
));
}
else
{
callback
();
}
});
};
const
validateSystemAccount
=
(
rule
,
value
,
callback
)
=>
{
let
reg
=
/^
[
a-zA-Z0-9
]
+$/
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
"
只能输入字母和数字
"
));
}
else
{
let
params
=
null
;
if
(
props
.
id
)
{
params
=
{
id
:
parseInt
(
props
.
id
),
system_account
:
value
};
}
else
{
params
=
{
system_account
:
value
};
}
axios
.
post
(
`/apaas/system/v5/user/check/account`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
callback
();
}
else
{
callback
(
new
Error
(
res
.
data
.
data
));
}
});
}
};
const
checkPhoneRepet
=
(
rule
,
value
,
callback
)
=>
{
let
params
=
null
;
if
(
props
.
id
)
{
params
=
{
id
:
parseInt
(
props
.
id
),
contact_phone
:
value
};
}
else
{
params
=
{
id
:
0
,
contact_phone
:
value
};
}
axios
.
post
(
`/apaas/system/v5/org/check`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
callback
();
}
else
{
callback
(
new
Error
(
res
.
data
.
data
));
}
});
};
const
platformAccountFormRules
=
reactive
({
system_account
:
[
{
required
:
true
,
message
:
"
请输入账号
"
,
trigger
:
"
blur
"
},
{
min
:
4
,
message
:
"
帐号长度不得低于4个字符
"
,
trigger
:
"
blur
"
},
{
max
:
20
,
message
:
"
帐号最大长度为20个字符
"
,
trigger
:
"
blur
"
},
{
validator
:
validateSystemAccount
,
trigger
:
"
blur
"
},
],
contact_phone
:
[
{
required
:
true
,
message
:
"
请输入手机号
"
,
trigger
:
"
blur
"
},
{
validator
:
checkPhone
,
trigger
:
"
blur
"
},
{
validator
:
checkPhoneRepet
,
trigger
:
"
blur
"
},
],
select_role
:
[{
required
:
true
,
message
:
"
请选择角色
"
,
trigger
:
"
blur
"
}],
password
:
[
{
required
:
true
,
message
:
"
请输入密码
"
,
trigger
:
"
blur
"
},
{
min
:
8
,
message
:
"
密码长度不得低于8位
"
,
trigger
:
"
blur
"
},
],
confirm_password
:
[
{
required
:
true
,
message
:
"
请确认密码
"
,
trigger
:
"
blur
"
},
{
validator
:
validatePass
,
trigger
:
"
blur
"
},
],
contact_email
:
[{
type
:
"
email
"
,
message
:
"
请输入正确的邮箱
"
,
trigger
:
"
blur
"
}],
});
const
roleList
=
ref
([]);
const
platformAccountRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
platformAccountRef
)
return
;
await
platformAccountRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
platformAccountForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
platformAccountRef
)
return
;
platformAccountRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
platformAccountForm
,
data
);
};
const
getRoleList
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/select/role?is_admin=3`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
roleList
.
value
=
res
.
data
.
data
;
}
else
{
}
});
};
onBeforeMount
(()
=>
{
getRoleList
();
});
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/platform-user/platform-person-form.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-form
:label-position=
"'right'"
label-width=
"120px"
:model=
"platformPersonForm"
:rules=
"platformPersonFormRules"
ref=
"platformPersonFormRef"
style=
"max-width: 66%"
>
<el-form-item
label=
"姓名"
prop=
"contact_name"
>
<el-input
v-model=
"platformPersonForm.contact_name"
/>
</el-form-item>
<el-form-item
label=
"邮箱"
prop=
"contact_email"
>
<el-input
v-model=
"platformPersonForm.contact_email"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
type=
"textarea"
:rows=
"3"
v-model=
"platformPersonForm.remark"
/>
</el-form-item>
</el-form>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
onMounted
}
from
"
vue
"
;
const
platformPersonForm
=
reactive
({
contact_name
:
""
,
contact_email
:
""
,
remark
:
""
,
});
const
platformPersonFormRules
=
reactive
({
contact_email
:
[{
type
:
"
email
"
,
message
:
"
请输入正确的邮箱
"
,
trigger
:
"
blur
"
}],
});
const
platformPersonFormRef
=
ref
(
null
);
const
emit
=
defineEmits
([
"
action
"
]);
const
submitForm
=
async
()
=>
{
if
(
!
platformPersonFormRef
)
return
;
await
platformPersonFormRef
.
value
.
validate
((
valid
,
fields
)
=>
{
if
(
valid
)
{
emit
(
"
action
"
,
platformPersonForm
);
}
else
{
emit
(
"
action
"
,
null
);
}
});
};
const
clearForm
=
()
=>
{
if
(
!
platformPersonFormRef
)
return
;
platformPersonFormRef
.
value
.
resetFields
();
};
const
setForm
=
(
data
)
=>
{
Object
.
assign
(
platformPersonForm
,
data
);
};
onMounted
(()
=>
{});
defineExpose
({
submitForm
,
clearForm
,
setForm
});
</
script
>
src/page/main/system/organization/tree.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<el-tree
ref=
"treeRef"
class=
"file-tree"
:data=
"orgData"
:props=
"defaultProps"
@
node-click=
"handleNodeClick"
node-key=
"id"
:highlight-current=
"true"
:filter-node-method=
"filterNode"
:expand-on-click-node=
"false"
:default-expand-all=
"true"
>
<template
#default
="
{ node, data }">
<div
class=
"custom_tree_node"
>
<span
class=
"label-text"
:title=
"data.name"
>
{{
data
.
name
}}
</span>
<span
v-if=
"data.data_type === 2"
class=
"tree-action-box first_node"
:class=
"
{ first_node_focus: (selectData
&&
selectData.id === data.id) || !selectData }"
@click.stop="showAction($event, data, node)">
<bg-icon
class=
"tree-more"
icon=
"#bg-ic-s-more"
></bg-icon>
</span>
<span
v-else
class=
"tree-action-box"
@
click.stop=
"showAction($event, data, node)"
>
<bg-icon
class=
"tree-more"
icon=
"#bg-ic-s-more"
></bg-icon>
</span>
</div>
</
template
>
</el-tree>
<Teleport
to=
"body"
>
<div
ref=
"treeActionRef"
class=
"tree-action"
v-show=
"actionFlag"
:style=
"{ top: acTop, left: acLeft, bottom: acBottom }"
>
<!-- 平台用户组织 -->
<div
v-if=
"selectData && selectData.data_type === 2"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'create', target: null })"
>
新增目录
</div>
<div
v-if=
"selectData && selectData.data_type === 2"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'create', target: null })"
>
新增组织
</div>
<!-- 目录 -->
<div
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'create', target: 'local' })"
>
新增本级目录
</div>
<div
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'create', target: 'child' })"
>
新增下级目录
</div>
<div
v-if=
"selectData && selectData.data_type === 0 && selectData.level !== 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'create', target: 'local' })"
>
新增本级组织
</div>
<div
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'create', target: 'child' })"
>
新增下级组织
</div>
<div
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'edit', target: 'local' })"
>
编辑目录
</div>
<div
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'delete', target: 'local' })"
>
删除
</div>
<div
:class=
"{
disable:
mvDataParent.indexOf(selectData) === 0 ||
(mvDataParent.indexOf(selectData) === 1 && mvDataParent[0].data_type == 2),
}"
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'mvup', target: 'local' })"
>
上移
</div>
<div
:class=
"{ disable: mvDataParent.indexOf(selectData) === mvDataParent.length - 1 }"
v-if=
"selectData && selectData.data_type === 0"
class=
"action"
@
click=
"treeAction({ type: 'directory', action: 'mvdown', target: 'local' })"
>
下移
</div>
<!-- 组织 -->
<div
v-if=
"selectData && selectData.data_type === 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'create', target: 'local' })"
>
新增本级组织
</div>
<div
v-if=
"selectData && selectData.data_type === 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'edit', target: 'local' })"
>
编辑组织
</div>
<div
v-if=
"selectData && selectData.data_type === 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'delete', target: 'local' })"
>
删除
</div>
<div
:class=
"{ disable: mvDataParent.indexOf(selectData) === 0 }"
v-if=
"selectData && selectData.data_type === 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'mvup', target: 'local' })"
>
上移
</div>
<div
:class=
"{ disable: mvDataParent.indexOf(selectData) === mvDataParent.length - 1 }"
v-if=
"selectData && selectData.data_type === 1"
class=
"action"
@
click=
"treeAction({ type: 'org', action: 'mvdown', target: 'local' })"
>
下移
</div>
</div>
</Teleport>
</template>
<
script
setup
>
import
{
reactive
,
toRefs
,
ref
,
computed
,
onBeforeMount
,
onBeforeUnmount
,
watch
,
nextTick
}
from
"
vue
"
;
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
const
route
=
useRoute
();
const
acTop
=
ref
(
""
);
const
acLeft
=
ref
(
""
);
const
acBottom
=
ref
(
""
);
const
actionFlag
=
ref
(
false
);
const
selectData
=
ref
(
null
);
const
selectDataParent
=
ref
(
null
);
const
mvDataParent
=
ref
([]);
const
treeRef
=
ref
(
null
);
const
treeActionRef
=
ref
(
null
);
const
bottomGap
=
ref
(
30
);
//弹窗吸底高度
const
orgData
=
ref
([]);
const
selectNodeObj
=
ref
(
null
);
const
customNodeClass
=
(
data
,
node
)
=>
{
if
(
data
.
data_type
==
0
)
{
return
"
noFocus
"
;
}
else
{
return
""
;
}
};
const
defaultProps
=
{
label
:
"
name
"
,
children
:
"
Child
"
,
value
:
"
organization_id
"
,
class
:
customNodeClass
,
};
const
getOrgTree
=
(
data
)
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
orgData
.
value
=
res
.
data
.
data
||
[];
console
.
log
(
route
.
query
.
id
);
if
(
route
.
query
.
id
)
{
searchItem
(
orgData
.
value
,
route
.
query
.
id
);
data
=
selectNodeObj
.
value
;
}
if
(
data
)
{
nextTick
(()
=>
{
setCurrentNode
(
data
);
});
}
else
{
nextTick
(()
=>
{
setCurrentNode
(
orgData
.
value
[
0
].
id
);
});
}
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
searchItem
=
(
data
,
id
)
=>
{
data
.
forEach
((
e
)
=>
{
if
(
e
.
organization_id
==
id
)
{
selectNodeObj
.
value
=
e
;
}
else
{
if
(
e
.
Child
)
{
searchItem
(
e
.
Child
,
id
);
}
}
});
};
const
filterTree
=
(
val
)
=>
{
treeRef
.
value
.
filter
(
val
);
};
const
setCurrentNode
=
(
data
)
=>
{
if
(
data
)
{
treeRef
.
value
.
setCurrentKey
(
data
,
true
);
const
curNode
=
treeRef
.
value
.
getCurrentNode
();
selectData
.
value
=
curNode
;
emit
(
"
select
"
,
{
data
:
ref
(
curNode
),
type
:
"
click
"
});
}
else
{
treeRef
.
value
.
setCurrentKey
(
orgData
.
value
[
0
].
id
,
true
);
const
curNode
=
treeRef
.
value
.
getCurrentNode
();
selectData
.
value
=
curNode
;
emit
(
"
select
"
,
{
data
:
ref
(
curNode
),
type
:
"
click
"
});
}
};
const
filterNode
=
(
value
,
data
)
=>
{
if
(
!
value
)
return
true
;
return
data
.
name
.
includes
(
value
);
};
const
showAction
=
(
e
,
data
,
node
)
=>
{
acTop
.
value
=
""
;
acLeft
.
value
=
""
;
acBottom
.
value
=
""
;
var
allHeight
=
document
.
body
.
scrollHeight
;
actionFlag
.
value
=
true
;
selectData
.
value
=
data
;
selectDataParent
.
value
=
node
.
parent
.
data
.
name
?
node
.
parent
.
data
:
null
;
mvDataParent
.
value
=
node
.
parent
.
data
.
Child
?
node
.
parent
.
data
.
Child
:
node
.
parent
.
data
;
const
rect
=
e
.
target
.
getBoundingClientRect
();
//获取点击的dom的位置
nextTick
().
then
(()
=>
{
setTimeout
(()
=>
{
var
height
=
window
.
getComputedStyle
(
treeActionRef
.
value
).
height
;
height
=
parseInt
(
height
);
//判断弹窗位置是否超过屏幕,超过则吸底展示
if
(
height
+
rect
.
y
-
17
>
allHeight
-
bottomGap
.
value
)
{
acBottom
.
value
=
bottomGap
.
value
+
"
px
"
;
acLeft
.
value
=
rect
.
x
+
35
+
"
px
"
;
}
else
{
acTop
.
value
=
rect
.
y
-
17
+
"
px
"
;
acLeft
.
value
=
rect
.
x
+
35
+
"
px
"
;
}
});
});
// acTop.value = rect.y - 17 + "px";
// acLeft.value = rect.x + 35 + "px";
};
const
isSticky
=
(
data
)
=>
{
const
canvas
=
document
.
createElement
(
"
canvas
"
);
const
context
=
canvas
.
getContext
(
"
2d
"
);
context
.
font
=
"
14px MicrosoftYaHei
"
;
const
{
width
}
=
context
.
measureText
(
data
);
return
width
>
255
?
true
:
false
;
};
const
closeAction
=
()
=>
{
actionFlag
.
value
=
false
;
};
const
emit
=
defineEmits
([
"
action
"
,
"
select
"
]);
const
handleNodeClick
=
(
node
,
nodeAttr
,
treeNode
,
event
)
=>
{
if
(
node
.
data_type
!==
0
)
{
selectData
.
value
=
node
;
emit
(
"
select
"
,
{
data
:
selectData
,
type
:
"
click
"
});
}
else
{
nextTick
(()
=>
{
treeRef
.
value
.
setCurrentKey
(
null
);
});
}
//只读则无操作事件
closeAction
();
};
const
treeAction
=
(
params
)
=>
{
emit
(
"
select
"
,
{
data
:
selectData
,
type
:
"
action
"
});
let
data
=
null
;
if
(
params
.
action
===
"
create
"
)
{
if
(
params
.
target
===
"
local
"
)
{
data
=
selectDataParent
;
}
else
if
(
params
.
target
===
"
child
"
)
{
data
=
selectData
;
}
else
{
}
}
else
if
(
params
.
action
===
"
mvup
"
)
{
// 已经是第一个元素 或者上一个元素是平台组织 则不可上移 平台组织始终在第一个
if
(
mvDataParent
.
value
.
indexOf
(
selectData
.
value
)
===
0
||
(
mvDataParent
.
value
.
indexOf
(
selectData
.
value
)
===
1
&&
mvDataParent
.
value
[
0
].
data_type
==
2
)
)
{
// ElMessage.error('已经是第一个元素,不可上移')
return
0
;
}
else
{
let
brother
=
mvDataParent
.
value
[
mvDataParent
.
value
.
indexOf
(
selectData
.
value
)
-
1
];
data
=
[
{
id
:
selectData
.
value
.
id
,
sort
:
brother
.
sort
},
{
id
:
brother
.
id
,
sort
:
selectData
.
value
.
sort
},
];
}
}
else
if
(
params
.
action
===
"
mvdown
"
)
{
if
(
mvDataParent
.
value
.
indexOf
(
selectData
.
value
)
===
mvDataParent
.
value
.
length
-
1
)
{
// ElMessage.error('已经是最后一个元素,不可下移')
return
0
;
}
else
{
let
brother
=
mvDataParent
.
value
[
mvDataParent
.
value
.
indexOf
(
selectData
.
value
)
+
1
];
data
=
[
{
id
:
selectData
.
value
.
id
,
sort
:
brother
.
sort
},
{
id
:
brother
.
id
,
sort
:
selectData
.
value
.
sort
},
];
}
}
else
{
data
=
selectData
;
}
emit
(
"
action
"
,
{
type
:
params
.
type
,
action
:
params
.
action
,
data
:
data
});
};
onBeforeMount
(()
=>
{
//只读则无操作事件
window
.
addEventListener
(
"
click
"
,
closeAction
);
window
.
addEventListener
(
"
scroll
"
,
closeAction
,
true
);
getOrgTree
();
});
onBeforeUnmount
(()
=>
{
//只读则无操作事件
window
.
removeEventListener
(
"
click
"
,
closeAction
);
window
.
removeEventListener
(
"
scroll
"
,
closeAction
);
});
defineExpose
({
getOrgTree
,
filterTree
,
setCurrentNode
});
</
script
>
<
style
scoped
>
.tree-action-box
{
display
:
none
;
position
:
absolute
;
right
:
-5px
;
top
:
0px
;
width
:
44px
;
height
:
36px
;
line-height
:
36px
;
text-align
:
center
;
background-color
:
#f2f3f7
;
box-shadow
:
-3px
0px
8px
-3px
rgba
(
0
,
7
,
101
,
0.15
);
}
.position_sticky
{
position
:
sticky
;
position
:
-webkit-sticky
;
}
.tree-more
{
font-size
:
12px
;
color
:
#3759be
;
}
.file-tree
:deep
()
.el-tree-node__content
:hover
.tree-action-box
{
display
:
inline-block
;
}
.file-tree
:deep
()
.el-tree-node__content
:hover
+
.label-text
{
width
:
calc
(
100%
-
48px
);
}
.file-tree
:deep
()
.el-tree-node__content
.first_node
{
display
:
inline-block
;
background-color
:
#fff
;
box-shadow
:
none
;
}
.file-tree
:deep
()
.el-tree-node__content
.first_node_focus
{
background-color
:
#f2f3f7
;
box-shadow
:
-3px
0px
8px
-3px
rgba
(
0
,
7
,
101
,
0.15
);
}
.file-tree
:deep
()
.el-tree-node__content
:hover
.first_node
{
background-color
:
#f2f3f7
;
box-shadow
:
-3px
0px
8px
-3px
rgba
(
0
,
7
,
101
,
0.15
);
}
.file-tree
:deep
()
.el-tree-node
>
.el-tree-node__children
{
overflow
:
visible
;
}
.file-tree
:deep
()
.el-tree-node__content
{
position
:
relative
;
}
.action-box
:hover
.tree-action
{
display
:
block
;
}
.label-text
{
font-size
:
14px
;
color
:
#404a62
;
display
:
inline-block
;
width
:
calc
(
100%
-
24px
);
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.tree-action-box
:hover
+
.label-text
{
padding
:
8px
0
;
background-color
:
var
(
--el-tree-node-hover-bg-color
);
}
.label-text
:hover
{
padding
:
8px
0
;
/* background-color: var(--el-tree-node-hover-bg-color); */
width
:
calc
(
100%
-
48px
);
}
.is_active
{
padding
:
8px
0
;
background-color
:
var
(
--el-color-primary-light-9
);
}
.custom_tree_node
{
width
:
100%
;
font-size
:
14px
;
color
:
#202531
;
padding-right
:
16px
;
}
.text_clip
{
width
:
100%
;
display
:
inline-block
;
}
.tree-action
.action
{
width
:
100%
;
height
:
34px
;
line-height
:
34px
;
padding-left
:
16px
;
font-size
:
14px
;
color
:
#202531
;
cursor
:
pointer
;
}
.tree-action
:deep
()
.el-upload
{
width
:
100%
;
}
.tree-action
.action
:hover
{
background-color
:
#eff2fa
;
color
:
#3759be
;
}
.tree-action
.disable
{
cursor
:
not-allowed
;
color
:
#616f94
;
}
.tree-action
.disable
:hover
{
background-color
:
#fff
;
color
:
#616f94
;
}
.tree-action
{
/* display: none; */
width
:
144px
;
background-color
:
#ffffff
;
box-shadow
:
0px
1px
4px
0px
rgba
(
0
,
7
,
101
,
0.15
);
padding
:
4px
0
;
border-radius
:
4px
;
position
:
fixed
;
z-index
:
9
;
}
.file-tree
:deep
()
.el-tree-node__content
{
height
:
36px
!important
;
}
.tree-action
.disable
{
cursor
:
not-allowed
;
color
:
#616f94
;
}
.tree-action
.disable
:hover
{
background-color
:
#fff
;
color
:
#616f94
;
}
.file-tree
:deep
()
.noFocus
:focus
>
.el-tree-node__content
{
background-color
:
#fff
;
}
</
style
>
src/page/main/system/organization/user-detail/index.vue
deleted
100644 → 0
View file @
4a22f86a
<
template
>
<div
class=
"page_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"page_content apaas_scroll"
>
<div
class=
"info_row"
>
<div
class=
"title"
>
<div><span
class=
"icon_box"
></span>
账号信息
</div>
<div
class=
"dashed_line"
></div>
</div>
<div
class=
"info_content"
>
<div
class=
"img_box"
>
<img
v-if=
"logo"
:src=
"logo"
style=
"height: 96px; width: 96px; border-radius: 99px"
alt=
""
/>
<img
v-else
src=
"/src/assets/imgs/home_ic_user.png"
style=
"height: 96px; width: 96px; border-radius: 99px"
alt=
""
/>
</div>
<div
class=
"info_box"
>
<bg-info
:data=
"accountInfo"
></bg-info>
</div>
</div>
</div>
<div>
<div
class=
"title"
>
<div><span
class=
"icon_box"
></span>
个人信息
</div>
<div
class=
"dashed_line"
></div>
</div>
<div
class=
"info_content"
>
<div
class=
"img_box"
></div>
<div
class=
"info_box"
>
<bg-info
v-if=
"accountType === 2"
:data=
"personInfo"
></bg-info>
<bg-info
v-if=
"accountType === 3"
:data=
"personInfo2"
></bg-info>
</div>
</div>
</div>
</div>
</div>
</
template
>
<
script
setup
>
import
{
reactive
,
toRefs
,
ref
,
computed
,
onBeforeMount
}
from
"
vue
"
;
import
{
useRoute
}
from
"
vue-router
"
;
import
axios
from
"
@/request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
route
=
useRoute
();
const
accountInfo
=
reactive
([
{
name
:
"
手机号
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
账号
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
角色
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
所属组织
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
创建人
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
创建账号
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
最后编辑时间
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
创建时间
"
,
value
:
""
,
nameWidth
:
130
,
},
]);
const
personInfo
=
reactive
([
{
name
:
"
姓名
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
邮箱
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
证据类型
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
身份证号
"
,
value
:
""
,
idCard
:
true
,
nameWidth
:
130
,
},
{
name
:
"
备注
"
,
value
:
""
,
full
:
true
,
nameWidth
:
130
,
},
]);
const
personInfo2
=
reactive
([
{
name
:
"
姓名
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
邮箱
"
,
value
:
""
,
nameWidth
:
130
,
},
{
name
:
"
备注
"
,
value
:
""
,
full
:
true
,
nameWidth
:
130
,
},
]);
const
logo
=
ref
(
""
);
const
accountType
=
ref
(
2
);
//1.业务系统账号 2.组织管理员账号 3.平台用户账号
const
getDetail
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/user/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
detail
=
res
.
data
.
data
;
accountInfo
[
0
].
value
=
detail
.
contact_phone
;
accountInfo
[
1
].
value
=
detail
.
system_account
;
accountInfo
[
2
].
value
=
detail
.
system_role
&&
detail
.
system_role
.
length
>
0
?
detail
.
system_role
.
join
(
"
、
"
)
:
""
;
accountInfo
[
3
].
value
=
detail
.
organization
;
accountInfo
[
4
].
value
=
detail
.
created_by
;
accountInfo
[
5
].
value
=
detail
.
created_by_account
;
accountInfo
[
6
].
value
=
detail
.
updated_time
;
accountInfo
[
7
].
value
=
detail
.
created_time
;
personInfo
[
0
].
value
=
detail
.
contact_name
;
personInfo
[
1
].
value
=
detail
.
contact_email
;
personInfo
[
2
].
value
=
detail
.
document_type
===
1
?
"
身份证
"
:
""
;
personInfo
[
3
].
value
=
detail
.
document_number
;
personInfo
[
4
].
value
=
detail
.
remark
;
personInfo2
[
0
].
value
=
detail
.
contact_name
;
personInfo2
[
1
].
value
=
detail
.
contact_email
;
personInfo2
[
2
].
value
=
detail
.
remark
;
logo
.
value
=
detail
.
logo
;
accountType
.
value
=
detail
.
is_admin
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
onBeforeMount
(()
=>
{
if
(
route
.
query
.
id
)
{
getDetail
();
}
});
</
script
>
<
style
scoped
>
.page_content
{
padding
:
15px
;
overflow
:
auto
;
}
.info_content
{
display
:
flex
;
}
.info_row
{
margin-bottom
:
40px
;
}
.img_box
{
width
:
120px
;
}
.info_box
{
width
:
60%
;
}
.title
{
font-size
:
18px
;
color
:
#1a1a1a
;
font-weight
:
bold
;
margin-bottom
:
10px
;
display
:
flex
;
align-items
:
center
;
}
.dashed_line
{
flex
:
1
;
height
:
1px
;
margin
:
0
10px
;
border-bottom
:
dashed
1px
#dadee7
;
}
.icon_box
{
display
:
inline-block
;
width
:
4px
;
height
:
14px
;
background-color
:
#3759be
;
border-radius
:
2px
;
margin-right
:
5px
;
}
</
style
>
src/page/main/system/role/add/index.vue
deleted
100644 → 0
View file @
4a22f86a
<!-- 角色管理新增 -->
<
template
>
<role-form></role-form>
</
template
>
<
script
setup
>
import
roleForm
from
"
./role_form.vue
"
;
</
script
>
src/page/main/system/role/add/role_form.vue
deleted
100644 → 0
View file @
4a22f86a
<!-- 角色管理 -->
<
template
>
<div
class=
"detail_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"main_container"
>
<div
class=
"top_form bg-scroll"
>
<el-form
ref=
"form"
:rules=
"rules"
:model=
"formData"
class=
"role_form"
>
<el-form-item
prop=
"role_name"
label=
"角色名称"
>
<el-input
v-model.trim=
"formData.role_name"
maxlength=
"50"
show-word-limit
:disabled=
"rowType != 0"
/>
</el-form-item>
<el-form-item
prop=
"role_desc"
label=
"描述"
>
<el-input
class=
"decs_box"
type=
"textarea"
v-model=
"formData.role_desc"
maxlength=
"300"
show-word-limit
:autosize=
"
{ minRows: 5 }"
:disabled="rowType != 0">
</el-input>
</el-form-item>
<el-form-item
label=
"数据权限"
prop=
"data_purview"
>
<el-radio-group
v-model=
"formData.data_purview"
:disabled=
"rowType != 0"
>
<el-radio
:label=
"3"
>
全平台所有
</el-radio>
<el-radio
:label=
"2"
>
本组织所有
</el-radio>
<el-radio
:label=
"1"
>
仅自己
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"菜单功能权限"
prop=
"permission_arr"
>
<bg-permission
:values=
"formData.permission_arr"
:options=
"permissionData"
:props=
"defaultProps"
@
changeMenu=
"changeMenu"
/>
</el-form-item>
<el-form-item
label=
"是否启用"
prop=
"state"
class=
"state_item"
>
<el-switch
class=
"bg-switch-ele"
v-model=
"formData.state"
:active-value=
"1"
:inactive-value=
"0"
inline-prompt
active-text=
"是"
inactive-text=
"否"
:disabled=
"rowType != 0"
/>
</el-form-item>
</el-form>
</div>
<div
class=
"bottom_action"
>
<el-button
@
click=
"goList"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"saveRole"
>
保存
</el-button>
</div>
</div>
</div>
</
template
>
<
script
setup
>
import
{
reactive
,
toRefs
,
ref
,
onBeforeMount
,
nextTick
}
from
"
vue
"
;
import
axios
from
"
../../../../../request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
{
useRouter
,
useRoute
}
from
"
vue-router
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
router
=
useRouter
();
const
route
=
useRoute
();
const
form
=
ref
(
null
);
const
checkMenuLength
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
.
length
===
0
)
{
callback
(
new
Error
(
"
请选择所需菜单
"
));
}
else
{
callback
();
}
};
const
roleState
=
reactive
({
form
,
formData
:
{
role_name
:
""
,
role_desc
:
""
,
data_purview
:
3
,
state
:
1
,
permission_arr
:
[],
},
// 表单项
rules
:
{
role_name
:
[{
required
:
true
,
message
:
"
请输入角色名称
"
,
trigger
:
"
blur
"
}],
data_purview
:
[{
required
:
true
,
message
:
"
请选择数据权限
"
,
trigger
:
"
change
"
}],
state
:
[{
required
:
true
,
message
:
"
请选择是否启用
"
,
trigger
:
"
change
"
}],
permission_arr
:
[{
required
:
true
,
type
:
"
array
"
,
validator
:
checkMenuLength
,
trigger
:
"
change
"
}],
},
// 表单校验规则
defaultProps
:
{
name
:
"
menu_name
"
,
value
:
"
id
"
,
children
:
"
Child
"
,
remark
:
"
remark
"
,
},
// 菜单框默认配置
permissionData
:
[],
// 菜单数据
rowType
:
0
,
});
const
getMenuTree
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/menu/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
roleState
.
permissionData
=
res
.
data
.
data
||
[];
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
// 获取菜单数据
const
changeMenu
=
(
val
)
=>
{
roleState
.
formData
.
permission_arr
=
val
;
};
// 修改选中的菜单
const
getRoleDetail
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/role/detail/
${
route
.
query
.
id
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
{
role_name
,
role_desc
,
data_purview
,
state
,
menus
}
=
res
.
data
.
data
;
roleState
.
rowType
=
res
.
data
.
data
.
role_type
;
let
permission_arr
=
[];
if
(
menus
&&
menus
.
length
>
0
)
{
menus
.
forEach
((
e
)
=>
{
permission_arr
.
push
(
e
.
id
);
});
}
roleState
.
formData
=
{
role_name
,
role_desc
,
data_purview
,
state
,
permission_arr
:
[...
permission_arr
],
};
console
.
log
(
roleState
.
formData
.
permission_arr
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
// 获取角色详情
const
saveRole
=
()
=>
{
roleState
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
let
params
=
{
role_name
:
roleState
.
formData
.
role_name
,
role_desc
:
roleState
.
formData
.
role_desc
,
state
:
roleState
.
formData
.
state
,
data_purview
:
roleState
.
formData
.
data_purview
,
menu_ids
:
[...
roleState
.
formData
.
permission_arr
],
};
if
(
!
route
.
query
.
id
)
{
// 新增
axios
.
put
(
`/apaas/system/v5/role/create`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
router
.
push
(
"
/system/role
"
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
else
{
// 编辑
params
.
id
=
+
route
.
query
.
id
;
axios
.
post
(
`/apaas/system/v5/role/update`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
router
.
push
(
"
/system/role
"
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
}
}
});
};
// 新增或编辑角色的保存
const
goList
=
()
=>
{
router
.
push
(
"
/system/role
"
);
};
onBeforeMount
(()
=>
{
getMenuTree
();
if
(
route
.
query
.
id
)
{
// 有id表示是编辑,请求详情,回显
getRoleDetail
();
}
});
const
{
formData
,
rules
,
defaultProps
,
permissionData
,
rowType
}
=
toRefs
(
roleState
);
</
script
>
<
style
lang=
"scss"
scoped
>
.detail_container
{
width
:
100%
;
padding
:
0
24px
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
stretch
;
.main_container
{
flex-grow
:
1
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
stretch
;
background-color
:
#fff
;
box-shadow
:
0px
1px
4px
0px
rgba
(
0
,
7
,
101
,
0
.15
);
border-radius
:
6px
;
margin
:
0
0
16px
;
position
:
relative
;
height
:
calc
(
100%
-
62px
);
.top_form
{
height
:
calc
(
100%
-
68px
);
padding
:
30px
0
0
40px
;
.role_form
{
width
:
1048px
;
:deep
()
.el-form-item
{
display
:
block
;
margin-bottom
:
24px
;
.el-form-item__label
{
display
:
block
;
}
.el-input__count
{
bottom
:
-20px
;
right
:
4px
;
color
:
#a9b1c7
;
}
}
.state_item
{
display
:
flex
;
}
}
}
.bottom_action
{
height
:
68px
;
border-top
:
1px
solid
#e6e9ef
;
padding
:
16px
;
text-align
:
right
;
.el-button
{
width
:
92px
;
}
}
}
}
</
style
>
src/page/main/system/role/edit/index.vue
deleted
100644 → 0
View file @
4a22f86a
<!-- 角色管理编辑 -->
<
template
>
<role-form></role-form>
</
template
>
<
script
setup
>
import
roleForm
from
"
../add/role_form.vue
"
;
</
script
>
src/page/main/system/role/index.vue
deleted
100644 → 0
View file @
4a22f86a
<!-- 角色管理 -->
<
template
>
<div
class=
"detail_container"
>
<bg-breadcrumb></bg-breadcrumb>
<div
class=
"main_container"
>
<bg-filter-group
@
search=
"changeSearch"
v-model=
"filter.search"
placeholder=
"请输入角色名称"
>
<template
v-slot:left_action
>
<div
class=
"apaas_button"
>
<el-button
type=
"primary"
@
click=
"register"
>
<bg-icon
style=
"font-size: 12px; color: #fff; margin-right: 8px"
icon=
"#bg-ic-add"
></bg-icon>
新增
</el-button>
<el-button
type=
"primary"
@
click=
"deleteRows"
>
批量删除
</el-button>
<div
class=
"select_text"
>
<span>
已选择
</span>
<span
class=
"num"
>
{{
selection
.
length
}}
</span>
<span>
项
</span>
<span
class=
"can_click_text"
@
click=
"clearRoleSelection"
>
清空
</span>
</div>
</div>
</
template
>
</bg-filter-group>
<div
class=
"table_container"
>
<div
class=
"table bg-scroll"
>
<bg-table
ref=
"Bgtable"
:headers=
"headers"
:rows=
"tableRows"
:select=
"true"
:stripe=
"true"
canEdit
canEditFlag=
"state"
@
selectAc=
"selectRows"
>
<
template
v-slot:state=
"{ row }"
>
<bg-switch
@
click=
"changeUseRow(row)"
:labels=
"['否', '是']"
:values=
"[0, 1]"
v-model=
"row.state"
:disabled=
"row.role_type == 1 || row.role_type == 2"
/>
</
template
>
<
template
v-slot:created_time=
"{ row }"
>
{{
row
.
created_time
.
split
(
"
+
"
)[
0
].
replace
(
"
T
"
,
"
"
).
replace
(
"
Z
"
,
"
"
)
}}
</
template
>
<
template
v-slot:action=
"{ row }"
>
<bg-table-btn
class=
"can_click_text"
:click=
"
() =>
{
edit_row(row);
}
">
编辑
</bg-table-btn>
<bg-table-btn
class=
"can_click_text"
:click=
"
() =>
{
distribute_user(row);
}
"
:disabled="row.cant_allot == 1">
分配用户
</bg-table-btn>
<bg-table-btn
class=
"can_click_text"
:click=
"
() =>
{
delete_row(row);
}
"
:disabled="row.state == 1 || row.role_type == 1">
删除
</bg-table-btn>
</
template
>
</bg-table>
</div>
<bg-pagination
:page=
"filter.page"
:size=
"filter.limit"
:total=
"tableTotal"
@
change-page=
"changePage"
@
change-size=
"changeSize"
>
</bg-pagination>
</div>
</div>
<!-- 删除弹窗 -->
<el-dialog
class=
"dialog_box"
title=
"提示"
v-model=
"delDialog"
width=
"400px"
>
<div>
确定要删除选中的数据吗?
</div>
<
template
v-slot:footer
>
<div
class=
"apaas_button"
>
<el-button
type=
"default"
@
click=
"delDialog = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"deleteData"
>
确 定
</el-button>
</div>
</
template
>
</el-dialog>
<!-- 分配用户 -->
<el-dialog
class=
"distribute_dialog"
title=
"分配用户"
v-model=
"distributeDialog"
width=
"1062px"
>
<div
class=
"distribute_box"
>
<div
class=
"topFilter"
>
<div
class=
"left"
>
<span>
已选择
</span>
<span
class=
"num"
>
{{ userSelection.length }}
</span>
<span>
项
</span>
<span
class=
"can_click_text"
@
click=
"clearUserSelection"
>
清空
</span>
</div>
<div
class=
"right"
>
<el-select
v-model=
"userFilter.is_admin"
placeholder=
"请选择"
style=
"width: 200px"
>
<el-option
v-for=
"(item, index) in userTypeList"
:key=
"'pushOptions' + index"
:label=
"item.name"
:value=
"item.value"
>
</el-option>
</el-select>
<el-cascader
v-model=
"userFilter.organization_id"
:options=
"orgList"
placeholder=
"请选择组织"
:props=
"{
expandTrigger: 'hover',
label: 'name',
value: 'id',
emitPath: false,
checkStrictly: true,
children: 'Child',
}"
:clearable=
"true"
collapse-tags
style=
"width: 200px"
>
<
template
#default
="{
data
}"
>
<span>
{{
data
.
name
}}
</span>
</
template
>
</el-cascader>
<el-input
v-model.trim=
"userFilter.search"
placeholder=
"请输入内容"
style=
"width: 200px"
:prefix-icon=
"Search"
/>
<el-button
type=
"primary"
@
click=
"searchAction"
>
查询
</el-button>
<el-button
type=
"default"
@
click=
"clearAction"
>
重置
</el-button>
</div>
</div>
<div
class=
"table_box"
>
<div
class=
"user_table bg-scroll"
>
<bg-table
ref=
"userTable"
:headers=
"userHeaders"
:rows=
"userRows"
:select=
"true"
:stripe=
"true"
@
selectAc=
"selectUserRows"
>
<
template
v-slot:is_admin=
"{ row }"
>
{{
[
""
,
"
业务系统账号
"
,
"
组织管理员账号
"
,
"
平台用户账号
"
][
row
.
is_admin
]
}}
</
template
>
</bg-table>
</div>
<bg-pagination
:page=
"userFilter.page"
:size=
"userFilter.limit"
:total=
"total"
@
change-page=
"changeUserPage"
@
change-size=
"changeUserSize"
>
</bg-pagination>
</div>
</div>
<
template
v-slot:footer
>
<div
class=
"apaas_button"
>
<el-button
type=
"default"
@
click=
"distributeDialog = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"distribute"
>
确 定
</el-button>
</div>
</
template
>
</el-dialog>
</div>
</template>
<
script
setup
>
import
{
Search
}
from
"
@element-plus/icons-vue
"
;
import
{
reactive
,
toRefs
,
ref
,
onBeforeMount
,
nextTick
}
from
"
vue
"
;
import
axios
from
"
../../../../request/http.js
"
;
import
{
ElMessage
}
from
"
element-plus
"
;
import
{
useRouter
}
from
"
vue-router
"
;
import
bgBreadcrumb
from
"
@/components/bg-breadcrumb.vue
"
;
const
router
=
useRouter
();
const
Bgtable
=
ref
(
null
);
const
userTable
=
ref
(
null
);
const
state
=
reactive
({
filter
:
{
page
:
1
,
limit
:
10
,
search
:
""
,
},
headers
:
[
{
label
:
"
角色名
"
,
prop
:
"
role_name
"
,
width
:
220
,
},
{
label
:
"
创建人
"
,
prop
:
"
created_by
"
,
width
:
220
,
},
{
label
:
"
创建时间
"
,
prop
:
"
created_time
"
,
width
:
276
,
},
{
label
:
"
账号数
"
,
prop
:
"
user_count
"
,
},
{
label
:
"
描述
"
,
prop
:
"
role_desc
"
,
minWidth
:
346
,
},
{
label
:
"
是否启用
"
,
prop
:
"
state
"
,
width
:
95
,
},
{
label
:
"
操作
"
,
prop
:
"
action
"
,
width
:
220
,
fixed
:
"
right
"
,
},
],
tableRows
:
[],
tableTotal
:
0
,
actionRow
:
{},
selection
:
[],
delDialog
:
false
,
delType
:
1
,
// 删除类型 1-单条删除 2-批量删除
});
const
userState
=
reactive
({
userFilter
:
{
is_admin
:
""
,
organization_id
:
""
,
search
:
""
,
limit
:
10
,
page
:
1
,
},
userTypeList
:
[
{
name
:
"
全部类型
"
,
value
:
""
,
},
{
name
:
"
组织管理员账号
"
,
value
:
2
,
},
{
name
:
"
平台用户账号
"
,
value
:
3
,
},
],
orgList
:
[],
userHeaders
:
[
{
label
:
"
帐号
"
,
prop
:
"
system_account
"
,
},
{
label
:
"
类型
"
,
prop
:
"
is_admin
"
,
},
{
label
:
"
用户手机号
"
,
prop
:
"
contact_phone
"
,
},
{
label
:
"
所属组织
"
,
prop
:
"
organization_name
"
,
},
],
userRows
:
[],
total
:
0
,
userSelection
:
[],
distributeDialog
:
false
,
// 分配用户弹窗
});
const
getRoleRows
=
()
=>
{
let
params
=
{
...
state
.
filter
};
console
.
log
(
params
);
axios
.
get
(
`/apaas/system/v5/role/list`
,
{
params
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
state
.
tableRows
=
res
.
data
.
data
||
[];
state
.
tableTotal
=
res
.
data
.
total
;
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
// 获取角色列表
const
getOrgList
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/org/tree`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
console
.
log
(
res
.
data
.
data
);
userState
.
orgList
=
res
.
data
.
data
||
[];
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
// 获取组织列表
const
changePage
=
(
val
)
=>
{
state
.
filter
.
page
=
val
;
getRoleRows
();
};
// 改变页码
const
changeSize
=
(
val
)
=>
{
state
.
filter
.
limit
=
val
;
changePage
(
1
);
};
// 改变每页条数
const
changeSearch
=
(
val
)
=>
{
state
.
filter
.
search
=
val
;
changePage
(
1
);
};
// 表格关键字筛选
const
changeUseRow
=
(
row
)
=>
{
if
(
row
.
role_type
==
1
||
row
.
role_type
==
2
)
{
return
;
}
axios
.
post
(
`/apaas/system/v5/role/state/
${
row
.
id
}
/
${
row
.
state
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
changePage
(
1
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
row
.
state
=
row
.
state
==
0
?
1
:
0
;
}
});
};
// 更改启用禁用状态
const
selectRows
=
(
data
)
=>
{
state
.
selection
=
data
.
selection
;
};
// 表格多选
const
clearRoleSelection
=
()
=>
{
Bgtable
.
value
.
clearTable
();
};
const
register
=
()
=>
{
router
.
push
(
"
/system/role/add
"
);
};
// 新增角色
const
edit_row
=
(
row
)
=>
{
router
.
push
({
path
:
"
/system/role/edit
"
,
query
:
{
id
:
row
.
id
,
},
});
};
// 编辑角色
const
distribute_user
=
(
row
)
=>
{
clearAction
(
1
);
userState
.
distributeDialog
=
true
;
state
.
actionRow
=
row
;
getUserList
();
};
// 分配角色按钮
const
getUserList
=
()
=>
{
nextTick
(()
=>
{
clearUserSelection
();
});
let
params
=
{
limit
:
userState
.
userFilter
.
limit
,
page
:
userState
.
userFilter
.
page
,
search
:
userState
.
userFilter
.
search
,
organization_id
:
userState
.
userFilter
.
organization_id
,
is_admin
:
userState
.
userFilter
.
is_admin
,
role_id
:
state
.
actionRow
.
id
,
};
axios
.
get
(
`/apaas/system/v5/role/allotment/list`
,
{
params
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
console
.
log
(
res
.
data
.
data
);
userState
.
userRows
=
res
.
data
.
data
||
[];
userState
.
total
=
res
.
data
.
total
;
nextTick
(()
=>
{
userState
.
userRows
.
forEach
((
e
)
=>
{
if
(
e
.
is_bind
==
1
)
{
console
.
log
(
userTable
);
userTable
.
value
.
toggleRowSelection
(
e
,
true
);
}
});
});
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
changeUserPage
=
(
val
)
=>
{
userState
.
userFilter
.
page
=
val
;
getUserList
();
};
const
changeUserSize
=
(
val
)
=>
{
userState
.
userFilter
.
limit
=
val
;
changeUserPage
(
1
);
};
const
searchAction
=
()
=>
{
console
.
log
(
userState
.
userFilter
);
changeUserPage
(
1
);
};
const
clearAction
=
(
type
)
=>
{
userState
.
userFilter
=
{
is_admin
:
""
,
organization_id
:
""
,
search
:
""
,
limit
:
10
,
page
:
1
,
};
if
(
type
!=
1
)
{
changeUserPage
(
1
);
}
};
const
clearUserSelection
=
()
=>
{
console
.
log
(
userTable
.
value
);
userTable
.
value
.
clearTable
();
};
const
selectUserRows
=
(
data
)
=>
{
userState
.
userSelection
=
data
.
selection
;
};
const
distribute
=
()
=>
{
let
user_ids
=
[];
userState
.
userSelection
.
forEach
((
e
)
=>
{
user_ids
.
push
(
e
.
id
);
});
let
params
=
{
id
:
state
.
actionRow
.
id
,
user_ids
:
user_ids
,
};
axios
.
post
(
`/apaas/system/v5/role/allotment/user`
,
params
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
userState
.
distributeDialog
=
false
;
changePage
(
1
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
delete_row
=
(
row
)
=>
{
state
.
actionRow
=
row
;
state
.
delType
=
1
;
state
.
delDialog
=
true
;
};
// 删除角色
const
deleteRows
=
()
=>
{
if
(
state
.
selection
.
length
==
0
)
{
ElMessage
.
error
(
"
请先选择要删除的数据
"
);
}
else
{
state
.
delType
=
2
;
state
.
delDialog
=
true
;
}
};
// 批量删除按钮
const
deleteData
=
()
=>
{
let
ids
=
[];
if
(
state
.
delType
==
1
)
{
ids
.
push
(
state
.
actionRow
.
id
);
}
else
{
state
.
selection
.
forEach
((
e
)
=>
{
ids
.
push
(
e
.
id
);
});
}
let
params
=
{
ids
:
[...
ids
],
};
axios
.
delete
(
`/apaas/system/v5/role/delete`
,
{
data
:
{
ids
:
[...
ids
]
}
}).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
ElMessage
.
success
(
res
.
data
.
msg
);
state
.
delDialog
=
false
;
changePage
(
1
);
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
onBeforeMount
(()
=>
{
getRoleRows
();
getOrgList
();
});
const
{
filter
,
headers
,
tableRows
,
tableTotal
,
delDialog
,
selection
}
=
toRefs
(
state
);
const
{
userFilter
,
userTypeList
,
orgList
,
userHeaders
,
userRows
,
total
,
userSelection
,
distributeDialog
}
=
toRefs
(
userState
);
</
script
>
<
style
lang=
"scss"
scoped
>
.detail_container
{
width
:
100%
;
padding
:
0
24px
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
stretch
;
.main_container
{
flex-grow
:
1
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
stretch
;
background-color
:
#fff
;
box-shadow
:
0px
1px
4px
0px
rgba
(
0
,
7
,
101
,
0
.15
);
border-radius
:
6px
;
margin
:
0
0
16px
;
position
:
relative
;
height
:
calc
(
100%
-
62px
);
.table_container
{
height
:
calc
(
100%
-
70px
);
padding
:
0
16px
;
.table
{
max-height
:
calc
(
100%
-
64px
);
}
}
.select_text
{
display
:
inline-block
;
margin-left
:
40px
;
font-size
:
14px
;
color
:
#404a62
;
.num
{
color
:
#202531
;
font-weight
:
700
;
margin
:
0
3px
;
}
.can_click_text
{
margin-left
:
24px
;
}
}
}
.distribute_dialog
{
.distribute_box
{
width
:
100%
;
height
:
626px
;
.topFilter
{
height
:
68px
;
padding
:
16px
;
border-bottom
:
1px
solid
#e6e9ef
;
display
:
flex
;
text-align
:
left
;
font-size
:
14px
;
align-items
:
center
;
.left
{
width
:
240px
;
padding-left
:
15px
;
color
:
#404a62
;
.num
{
color
:
#202531
;
font-weight
:
700
;
margin
:
0
3px
;
}
.can_click_text
{
margin-left
:
24px
;
}
}
.right
{
flex
:
1
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
.el-button
{
margin
:
0
;
width
:
64px
;
}
}
}
.table_box
{
padding
:
10px
16px
;
height
:
calc
(
100%
-
68px
);
.user_table
{
max-height
:
calc
(
100%
-
48px
);
:deep
()
.bg-table
{
.el-scrollbar
{
--el-scrollbar-bg-color
:
#fff
;
}
.el-table__empty-block
{
.empty_container
{
height
:
calc
(
100%
-
45px
);
}
}
}
}
}
}
}
}
</
style
>
<
style
>
.distribute_dialog
.el-dialog__footer
{
padding
:
16px
!important
;
}
.distribute_dialog
.el-dialog__body
{
padding
:
0px
!important
;
}
.distribute_dialog
{
margin-top
:
130px
!important
;
}
</
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