Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Y
yishuju-ui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何远江
yishuju-ui
Commits
3345e698
Commit
3345e698
authored
Mar 19, 2025
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账号管理
parent
2329acd1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
47 deletions
+126
-47
index.vue
src/components/ProTable/index.vue
+1
-0
AccountFormModal.vue
...iews/system/accountManage/components/AccountFormModal.vue
+76
-4
index.vue
src/views/system/accountManage/index.vue
+16
-0
DepartmentFormModal.vue
...ystem/departmentManage/components/DepartmentFormModal.vue
+2
-2
index.vue
src/views/system/departmentManage/index.vue
+31
-41
No files found.
src/components/ProTable/index.vue
View file @
3345e698
...
@@ -184,6 +184,7 @@
...
@@ -184,6 +184,7 @@
const
_search
=
()
=>
{
const
_search
=
()
=>
{
search
();
search
();
emit
(
'search'
,
searchParam
.
value
);
};
};
const
_reset
=
()
=>
{
const
_reset
=
()
=>
{
...
...
src/views/system/accountManage/components/AccountFormModal.vue
View file @
3345e698
...
@@ -25,6 +25,31 @@
...
@@ -25,6 +25,31 @@
<el-input
v-model=
"form.username"
placeholder=
"请输入用户名称"
/>
<el-input
v-model=
"form.username"
placeholder=
"请输入用户名称"
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"24"
>
<el-form-item
class=
"w-full"
label=
"调解中心"
>
<el-select
v-model=
"form.tenant"
placeholder=
"请选择调解中心"
>
<el-option
v-for=
"item in Tenantlist"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"24"
>
<el-form-item
class=
"w-full"
label=
"部门"
>
<el-tree-select
placeholder=
"请选择部门"
v-model=
"form.departmentId"
ref=
"treeselect"
:props=
"
{ value: 'id', label: 'name', children: 'children' }"
:data="departlist"
:render-after-expand="false"
/>
</el-form-item>
</el-col>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<el-form-item
class=
"w-full"
label=
"角色"
prop=
"roles"
>
<el-form-item
class=
"w-full"
label=
"角色"
prop=
"roles"
>
<el-select
v-model=
"form.roles"
multiple
collapse-tags
placeholder=
"请选择角色"
>
<el-select
v-model=
"form.roles"
multiple
collapse-tags
placeholder=
"请选择角色"
>
...
@@ -61,19 +86,28 @@
...
@@ -61,19 +86,28 @@
import
{
saveUser
}
from
'@/api/user'
;
import
{
saveUser
}
from
'@/api/user'
;
import
{
getDefualtRoles
}
from
'@/api/role'
;
import
{
getDefualtRoles
}
from
'@/api/role'
;
import
{
ElMessage
}
from
'element-plus'
;
import
{
ElMessage
}
from
'element-plus'
;
import
{
getTenantPage
}
from
'@/api/tenant'
;
import
{
getdepartmentTree
}
from
'@/api/departmentManage'
;
const
emits
=
defineEmits
([
'success'
]);
const
emits
=
defineEmits
([
'success'
]);
const
formRef
=
ref
();
const
formRef
=
ref
();
const
treeselect
=
ref
();
const
showModal
=
ref
(
false
);
const
showModal
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
form
=
ref
({
const
form
=
ref
({
username
:
''
,
username
:
''
,
roles
:
[],
roles
:
[],
departmentCode
:
''
,
departmentName
:
''
,
password
:
''
,
password
:
''
,
phone
:
''
,
phone
:
''
,
departmentId
:
''
,
tenant
:
''
,
status
:
'enable'
,
status
:
'enable'
,
});
});
const
options
=
ref
([]);
const
options
=
ref
([]);
const
departlist
=
ref
([]);
const
Tenantlist
=
ref
([]);
const
validatePhone
=
(
rule
,
value
,
callback
)
=>
{
const
validatePhone
=
(
rule
,
value
,
callback
)
=>
{
const
reg
=
/^1
[
3-9
]\d{9}
$/
;
const
reg
=
/^1
[
3-9
]\d{9}
$/
;
if
(
!
value
)
{
if
(
!
value
)
{
...
@@ -96,14 +130,32 @@
...
@@ -96,14 +130,32 @@
const
currentAccount
=
ref
(
null
);
const
currentAccount
=
ref
(
null
);
const
isEdit
=
computed
(()
=>
!!
currentAccount
.
value
);
const
isEdit
=
computed
(()
=>
!!
currentAccount
.
value
);
const
modalTitle
=
computed
(()
=>
(
isEdit
.
value
?
'编辑账号'
:
'新增账号'
));
const
modalTitle
=
computed
(()
=>
(
isEdit
.
value
?
'编辑账号'
:
'新增账号'
));
const
treeToArray
=
(
tree
)
=>
{
return
tree
.
reduce
((
res
,
item
)
=>
{
const
{
children
,
...
i
}
=
item
;
return
res
.
concat
(
i
,
children
&&
children
.
length
?
treeToArray
(
children
)
:
[]);
},
[]);
}
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
try
{
try
{
await
formRef
.
value
.
validate
();
await
formRef
.
value
.
validate
();
loading
.
value
=
true
;
loading
.
value
=
true
;
form
.
value
.
departmentName
=
''
form
.
value
.
departmentCode
=
''
if
(
form
.
value
.
tenant
)
{
console
.
log
(
form
.
value
.
tenant
,
Tenantlist
.
value
)
const
item
=
Tenantlist
.
value
.
find
(
v
=>
v
.
id
===
form
.
value
.
tenant
)
form
.
value
.
tenant
=
item
}
if
(
form
.
value
.
departmentId
)
{
const
list
=
treeToArray
(
departlist
.
value
)
const
item
=
list
.
find
(
v
=>
v
.
id
===
form
.
value
.
departmentId
)
if
(
item
)
{
form
.
value
.
departmentName
=
item
.
name
form
.
value
.
departmentCode
=
item
.
departmentCode
}
}
await
saveUser
(
form
.
value
);
await
saveUser
(
form
.
value
);
ElMessage
({
ElMessage
({
type
:
'success'
,
type
:
'success'
,
message
:
isEdit
.
value
?
'修改成功!'
:
'添加成功!'
,
message
:
isEdit
.
value
?
'修改成功!'
:
'添加成功!'
,
...
@@ -118,20 +170,40 @@
...
@@ -118,20 +170,40 @@
const
onHide
=
()
=>
{
const
onHide
=
()
=>
{
form
.
value
=
{
form
.
value
=
{
username
:
''
,
username
:
''
,
departmentCode
:
''
,
departmentName
:
''
,
roles
:
[],
roles
:
[],
password
:
''
,
password
:
''
,
phone
:
''
,
phone
:
''
,
departmentId
:
''
,
tenant
:
''
,
status
:
'enable'
,
status
:
'enable'
,
};
};
formRef
.
value
.
clearValidate
();
formRef
.
value
.
clearValidate
();
currentAccount
.
value
=
null
;
currentAccount
.
value
=
null
;
showModal
.
value
=
false
;
showModal
.
value
=
false
;
};
};
const
openModal
=
(
account
)
=>
{
const
openModal
=
(
account
)
=>
{
account
&&
(
form
.
value
=
account
);
if
(
account
){
form
.
value
=
account
if
(
account
.
tenant
)
{
form
.
value
.
tenant
=
account
.
tenant
.
id
}
}
getDefualtRoles
().
then
((
res
)
=>
{
getDefualtRoles
().
then
((
res
)
=>
{
options
.
value
=
res
.
result
;
options
.
value
=
res
.
result
;
});
});
getTenantPage
({
current
:
1
,
size
:
9999999
,
status
:
'enable'
}).
then
(
res
=>
{
if
(
res
.
success
)
{
Tenantlist
.
value
=
res
.
result
.
content
}
})
getdepartmentTree
().
then
(
res
=>
{
if
(
res
.
success
)
{
departlist
.
value
=
res
.
result
}
})
currentAccount
.
value
=
account
;
currentAccount
.
value
=
account
;
showModal
.
value
=
true
;
showModal
.
value
=
true
;
};
};
...
...
src/views/system/accountManage/index.vue
View file @
3345e698
...
@@ -29,12 +29,14 @@
...
@@ -29,12 +29,14 @@
import
{
useDict
}
from
'@/hooks/useDict'
;
import
{
useDict
}
from
'@/hooks/useDict'
;
import
{
onMounted
}
from
'vue'
;
import
{
onMounted
}
from
'vue'
;
import
{
getTenantPage
}
from
'@/api/tenant'
;
import
{
getTenantPage
}
from
'@/api/tenant'
;
import
{
getdepartmentTree
}
from
'@/api/departmentManage'
;
import
{
getRolePage
}
from
'@/api/role'
;
import
{
getRolePage
}
from
'@/api/role'
;
const
{
Status
}
=
useDict
(
"Status"
);
const
{
Status
}
=
useDict
(
"Status"
);
const
proTable
=
ref
();
const
proTable
=
ref
();
const
accountFormModalRef
=
ref
();
const
accountFormModalRef
=
ref
();
const
Rolelist
=
ref
([]);
const
Rolelist
=
ref
([]);
const
departlist
=
ref
([]);
const
Tenantlist
=
ref
([]);
const
Tenantlist
=
ref
([]);
const
config
=
reactive
({
const
config
=
reactive
({
columns
:
[
columns
:
[
...
@@ -70,6 +72,15 @@
...
@@ -70,6 +72,15 @@
fieldNames
:
{
label
:
'roleName'
,
value
:
'roleCode'
},
fieldNames
:
{
label
:
'roleName'
,
value
:
'roleCode'
},
title
:
'角色'
title
:
'角色'
},
},
{
field
:
'departmentName'
,
title
:
'部门'
,
width
:
160
,
enum
:
departlist
,
fieldNames
:
{
label
:
'name'
,
value
:
'id'
},
search
:
{
el
:
'tree-select'
,
props
:
{
filterable
:
true
},
labelWidth
:
85
,
key
:
'departmentId'
},
},
{
{
field
:
'phone'
,
field
:
'phone'
,
title
:
'手机号'
,
title
:
'手机号'
,
...
@@ -187,6 +198,11 @@
...
@@ -187,6 +198,11 @@
console
.
log
(
'Tenantlist.value'
,
Tenantlist
.
value
)
console
.
log
(
'Tenantlist.value'
,
Tenantlist
.
value
)
}
}
})
})
getdepartmentTree
().
then
(
res
=>
{
if
(
res
.
success
)
{
departlist
.
value
=
res
.
result
}
})
});
});
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
<
style
lang=
"scss"
scoped
></
style
>
src/views/system/departmentManage/components/DepartmentFormModal.vue
View file @
3345e698
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
const
form
=
ref
({
const
form
=
ref
({
// code: '',
// code: '',
name
:
''
,
name
:
''
,
parent
:
{}
parent
:
null
});
});
const
rules
=
ref
({
const
rules
=
ref
({
// code: { required: true, message: '请输入部门编码', trigger: 'blur' },
// code: { required: true, message: '请输入部门编码', trigger: 'blur' },
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
const
openModal
=
(
type
,
department
)
=>
{
const
openModal
=
(
type
,
department
)
=>
{
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
department
&&
(
form
.
value
.
parent
=
department
);
department
&&
(
form
.
value
.
parent
=
department
);
!
department
&&
(
form
.
value
.
parent
=
{}
);
!
department
&&
(
form
.
value
.
parent
=
null
);
currentdepartment
.
value
=
null
;
currentdepartment
.
value
=
null
;
}
else
{
}
else
{
department
&&
(
form
.
value
=
department
);
department
&&
(
form
.
value
=
department
);
...
...
src/views/system/departmentManage/index.vue
View file @
3345e698
<
template
>
<
template
>
<div>
<div>
<ProTable
ref=
"proTable"
:config=
"config"
:api=
"getdepartmentTree"
:paramCallback=
"paramCallback"
>
<ProTable
ref=
"proTable"
:config=
"config"
:show-pagination=
"false"
@
search=
"handleSearch"
:data=
"tableData"
>
<template
#
left_buttons
>
<template
#
left_buttons
>
<!-- v-permission="'risk_member_add'" -->
<!-- v-permission="'risk_member_add'" -->
<el-button
<el-button
...
@@ -14,7 +16,7 @@
...
@@ -14,7 +16,7 @@
>
-->
>
-->
</
template
>
</
template
>
</ProTable>
</ProTable>
<DepartmentFormModal
ref=
"DepartmentFormModalRef"
@
success=
"
query
"
/>
<DepartmentFormModal
ref=
"DepartmentFormModalRef"
@
success=
"
handleSearch
"
/>
</div>
</div>
</template>
</template>
...
@@ -23,18 +25,15 @@
...
@@ -23,18 +25,15 @@
import
DepartmentFormModal
from
'./components/DepartmentFormModal.vue'
;
import
DepartmentFormModal
from
'./components/DepartmentFormModal.vue'
;
import
{
Delete
,
Edit
,
Plus
}
from
'@element-plus/icons-vue'
;
import
{
Delete
,
Edit
,
Plus
}
from
'@element-plus/icons-vue'
;
import
{
ref
,
reactive
}
from
'vue'
;
import
{
ref
,
reactive
}
from
'vue'
;
import
{
ElButton
,
ElMessage
,
ElMessageBox
}
from
'element-plus'
;
import
{
onMounted
}
from
'vue'
;
import
{
onMounted
}
from
'vue'
;
import
{
saveDepartment
,
getdepartmentTree
,
batchDeleteByIds
}
from
'@/api/departmentManage'
;
import
{
saveDepartment
,
getdepartmentTree
,
batchDeleteByIds
}
from
'@/api/departmentManage'
;
const
proTable
=
ref
();
const
proTable
=
ref
();
const
tableData
=
ref
([]);
const
DepartmentFormModalRef
=
ref
();
const
DepartmentFormModalRef
=
ref
();
const
current
=
ref
();
const
current
=
ref
();
const
query
=
()
=>
proTable
.
value
?.
search
();
const
paramCallback
=
(
param
)
=>
{
const
obj
=
JSON
.
parse
(
JSON
.
stringify
(
param
));
obj
[
'staffRole'
]
=
'risk_control_commissioner'
return
obj
;
};
const
onRadioChange
=
({
newValue
})
=>
{
const
onRadioChange
=
({
newValue
})
=>
{
console
.
log
(
'onRadioChange'
,
newValue
)
current
.
value
=
newValue
current
.
value
=
newValue
}
}
const
addDeparment
=
()
=>
{
const
addDeparment
=
()
=>
{
...
@@ -43,10 +42,30 @@ const addDeparment = () => {
...
@@ -43,10 +42,30 @@ const addDeparment = () => {
const
editDepartment
=
(
row
)
=>
{
const
editDepartment
=
(
row
)
=>
{
DepartmentFormModalRef
.
value
?.
openModal
(
'edit'
,
row
)
DepartmentFormModalRef
.
value
?.
openModal
(
'edit'
,
row
)
}
}
const
handleDelete
=
()
=>
{
const
handleDelete
=
async
(
row
)
=>
{
await
ElMessageBox
.
confirm
(
'是否确认删除该菜单?'
,
'提示'
,
{
confirmButtonText
:
'确认'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
});
await
batchDeleteByIds
(
row
.
id
);
ElMessage
({
type
:
'success'
,
message
:
'删除成功!'
,
plain
:
true
,
});
handleSearch
();
}
}
const
handleSearch
=
async
(
params
)
=>
{
current
.
value
=
null
const
{
result
}
=
await
getdepartmentTree
(
params
??
{});
tableData
.
value
=
result
;
};
const
config
=
reactive
({
const
config
=
reactive
({
stripe
:
false
,
// tree 不支持 stripe
radioConfig
:
{
strict
:
false
},
onRadioChange
:
onRadioChange
,
onRadioChange
:
onRadioChange
,
treeConfig
:
{
treeConfig
:
{
rowField
:
'id'
,
rowField
:
'id'
,
...
@@ -54,7 +73,7 @@ const config = reactive({
...
@@ -54,7 +73,7 @@ const config = reactive({
},
},
columns
:
[
columns
:
[
{
type
:
'radio'
,
width
:
60
,
fixed
:
'left'
},
{
type
:
'radio'
,
width
:
60
,
fixed
:
'left'
},
{
field
:
'name'
,
title
:
'部门名称'
,
search
:
{
el
:
'input'
,
labelWidth
:
85
}
},
{
field
:
'name'
,
title
:
'部门名称'
,
treeNode
:
true
},
// { field: 'code', title: '部门编码', search: { el: 'input', labelWidth: 85 } },
// { field: 'code', title: '部门编码', search: { el: 'input', labelWidth: 85 } },
{
{
field
:
'action'
,
field
:
'action'
,
...
@@ -78,36 +97,7 @@ const config = reactive({
...
@@ -78,36 +97,7 @@ const config = reactive({
],
],
});
});
// 添加
function
append
(
data
)
{
const
newChild
=
{
id
:
id
++
,
label
:
'testtest'
,
children
:
[]
};
if
(
!
data
.
children
)
{
data
.
children
=
[]
}
data
.
children
.
push
(
newChild
);
}
// 删除
function
remove
(
node
,
data
)
{
const
parent
=
node
.
parent
;
const
children
=
parent
.
data
.
children
||
parent
.
data
;
const
index
=
children
.
findIndex
(
d
=>
d
.
id
===
data
.
id
);
children
.
splice
(
index
,
1
);
}
// 编辑
function
edit
(
data
)
{
ElMessageBox
.
prompt
(
'请输入标题'
,
'编辑'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
}).
then
(({
value
})
=>
{
if
(
value
!=
null
)
{
data
.
label
=
value
;
}
}).
catch
(()
=>
{
});
}
onMounted
(()
=>
{
onMounted
(()
=>
{
query
();
handleSearch
();
});
});
</
script
>
</
script
>
\ No newline at end of file
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