Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZiBoYingJI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kimber
ZiBoYingJI
Commits
75619be6
Commit
75619be6
authored
Jul 19, 2024
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录 中间页 用户信息
parent
7b81a862
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
38 deletions
+101
-38
user.js
src/api/system/user.js
+9
-0
home4Index.vue
src/views/home4Index.vue
+1
-21
login.vue
src/views/login.vue
+2
-1
index.vue
src/views/system/user/index.vue
+89
-16
No files found.
src/api/system/user.js
View file @
75619be6
import
request
from
'
@/utils/request
'
import
{
encrypt
}
from
'
@/utils/rsaEncrypt
'
export
function
getCompanyList
(
data
)
{
return
request
({
url
:
'
api/enterprise/auth/enterpriseList
'
,
method
:
'
get
'
,
data
})
}
export
function
add
(
data
)
{
return
request
({
url
:
'
api/users
'
,
...
...
src/views/home4Index.vue
View file @
75619be6
...
...
@@ -58,27 +58,7 @@ export default {
},
},
created
()
{
/**
* 矿产信息固定值
*/
localStorage
.
setItem
(
"
kd.selected.mine
"
,
JSON
.
stringify
({
address
:
"
测试地址
"
,
code
:
"
1452562
"
,
enterpriseId
:
1
,
hasEnable
:
true
,
id
:
1
,
latitude
:
"
37.05
"
,
liablePerson
:
"
人员
"
,
liablePersonPhone
:
"
15455248718
"
,
longitude
:
"
117.74
"
,
mineType
:
1
,
name
:
"
测试地下矿山
"
,
runState
:
null
,
})
);
// 按照不同域名加载不同页面样式(企业、应急局),加载完毕后再显示页面
const
host
=
window
.
location
.
host
;
...
...
src/views/login.vue
View file @
75619be6
...
...
@@ -187,7 +187,8 @@ export default {
return
}
}
this
.
$router
.
push
({
path
:
/* 记住上次退出时的页面 */
/* this.redirect || */
'
/home4Login
'
})
// this.$router.push({ path: /* 记住上次退出时的页面 */ /* this.redirect || */'/home4Login' })
this
.
$router
.
push
({
path
:
'
login4Index
'
})
}).
catch
(()
=>
{
this
.
loading
=
false
this
.
getCode
()
...
...
src/views/system/user/index.vue
View file @
75619be6
...
...
@@ -55,19 +55,37 @@
<el-radio
label=
"女"
>
女
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-radio-group
v-model=
"form.enabled"
:disabled=
"form.id === user.id"
>
<el-radio-button
v-for=
"item in user_status"
:key=
"item.value"
:label=
"item.value"
>
{{
item
.
label
}}
</el-radio-button>
</el-radio-group>
<el-form-item
label=
"区域"
prop=
"depts"
>
<el-cascader
v-model=
"form.dept"
:options=
"data"
:props=
"
{ checkStrictly: true, value: 'id' }"
:show-all-levels="false"
@change="deptChange"
>
</el-cascader>
</el-form-item>
<el-form-item
label=
"企业"
prop=
"enterpriseIdList"
>
<el-select
v-model=
"form.enterpriseIdList"
placeholder=
"请输入企业"
:multiple=
"true"
>
<el-option
v-for=
"item in options4enterpriseIdList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
style=
"margin-bottom: 0;"
label=
"角色"
prop=
"roles"
>
<el-select
v-model=
"roleDatas"
style=
"width:
4
37px"
style=
"width:
2
37px"
multiple
placeholder=
"请选择"
@
remove-tag=
"deleteTag"
...
...
@@ -76,11 +94,20 @@
<el-option
v-for=
"item in canChoosedRoles"
:key=
"item.name"
:disabled=
"item.level
<
=
1
||
item
.
level
<
level
"
:disabled=
"item.level
<
=
1
||
item
.
level
<
=
level
"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
<el-form-item
label=
"状态"
>
<el-radio-group
v-model=
"form.enabled"
:disabled=
"form.id === user.id"
>
<el-radio-button
v-for=
"item in user_status"
:key=
"item.value"
:label=
"item.value"
>
{{
item
.
label
}}
</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -132,8 +159,10 @@
<
script
>
import
crudUser
from
'
@/api/system/user
'
import
{
getCompanyList
}
from
'
@/api/system/user
'
import
{
isvalidPhone
}
from
'
@/utils/validate
'
// import { getDepts
, getDeptSuperior } from '@/api/system/dept'
import
{
getDeptList
,
getDeptSuperior
}
from
'
@/api/system/dept
'
import
{
getAll
,
getLevel
}
from
'
@/api/system/role
'
import
{
getAllJob
}
from
'
@/api/system/job
'
import
CRUD
,
{
presenter
,
header
,
form
,
crud
}
from
'
@crud/crud
'
...
...
@@ -146,7 +175,8 @@ import { mapGetters } from 'vuex'
import
'
@riophae/vue-treeselect/dist/vue-treeselect.css
'
let
userRoles
=
[]
let
userJobs
=
[]
const
defaultForm
=
{
id
:
null
,
username
:
null
,
nickName
:
null
,
gender
:
'
男
'
,
email
:
null
,
enabled
:
'
false
'
,
roles
:
[],
jobs
:
[],
dept
:
{
id
:
null
},
phone
:
null
}
const
defaultForm
=
{
id
:
null
,
username
:
null
,
nickName
:
null
,
gender
:
'
男
'
,
email
:
null
,
enabled
:
'
false
'
,
roles
:
[],
jobs
:
[],
dept
:
[],
phone
:
null
,
enterpriseIdList
:[]}
export
default
{
name
:
'
User
'
,
components
:
{
crudOperation
,
rrOperation
,
udOperation
,
pagination
,
DateRangePicker
},
...
...
@@ -172,6 +202,7 @@ export default {
height
:
document
.
documentElement
.
clientHeight
-
180
+
'
px;
'
,
deptName
:
''
,
depts
:
[],
deptDatas
:
[],
jobs
:
[],
level
:
3
,
roles
:
[],
jobDatas
:
[],
roleDatas
:
[],
// 多选时使用
options4enterpriseIdList
:
[],
defaultProps
:
{
children
:
'
children
'
,
label
:
'
name
'
,
isLeaf
:
'
leaf
'
},
permission
:
{
add
:
[
'
admin
'
,
'
user:add
'
],
...
...
@@ -183,6 +214,7 @@ export default {
{
key
:
'
false
'
,
display_name
:
'
禁用
'
}
],
rules
:
{
username
:
[
{
required
:
true
,
message
:
'
请输入用户名
'
,
trigger
:
'
blur
'
},
{
min
:
2
,
max
:
20
,
message
:
'
长度在 2 到 20 个字符
'
,
trigger
:
'
blur
'
}
...
...
@@ -193,7 +225,11 @@ export default {
],
phone
:
[
{
required
:
true
,
trigger
:
'
blur
'
,
validator
:
validPhone
}
]
],
dept
:
[
{
required
:
true
,
message
:
'
请选择部门
'
,
trigger
:
'
blur
'
}
],
}
}
},
...
...
@@ -202,9 +238,10 @@ export default {
'
user
'
]),
canChoosedRoles
()
{
return
this
.
roles
.
filter
(
r
=>
{
return
r
.
enterpriseId
===
this
.
user
.
enterpriseId
})
// return this.roles.filter(r => {
// return r.enterpriseId === this.user.enterpriseId
// })
return
this
.
roles
}
},
created
()
{
...
...
@@ -215,8 +252,29 @@ export default {
window
.
onresize
=
function
temp
()
{
that
.
height
=
document
.
documentElement
.
clientHeight
-
180
+
'
px;
'
}
this
.
getDeptList
()
},
methods
:
{
getCompanyList
(
deptId
){
getCompanyList
({
deptId
:
deptId
.
length
>
1
?
deptId
[
deptId
.
length
-
1
]
:
deptId
[
0
]
})
.
then
((
res
)
=>
{
this
.
options4enterpriseIdList
=
res
.
body
;
});
},
deptChange
(
value
){
console
.
log
(
'
value
'
,
value
)
this
.
getCompanyList
(
value
)
},
getDeptList
()
{
getDeptList
({
}).
then
((
res
)
=>
{
this
.
data
=
res
.
body
.
content
;
});
},
// 禁止输入空格
keydown
(
e
)
{
if
(
e
.
keyCode
===
32
)
{
...
...
@@ -260,14 +318,18 @@ export default {
[
CRUD
.
HOOK
.
beforeToAdd
]()
{
this
.
jobDatas
=
[]
this
.
roleDatas
=
[]
this
.
form
.
dept
=
[]
},
// 初始化编辑时候的角色与岗位
[
CRUD
.
HOOK
.
beforeToEdit
](
crud
,
form
)
{
// this.getJobs(this.form.dept.id)
this
.
jobDatas
=
[]
this
.
roleDatas
=
[]
this
.
form
.
dept
=
[]
userRoles
=
[]
userJobs
=
[]
const
_this
=
this
form
.
roles
.
forEach
(
function
(
role
,
index
)
{
_this
.
roleDatas
.
push
(
role
.
id
)
...
...
@@ -289,8 +351,19 @@ export default {
})
return
false
}
if
(
!
this
.
form
.
dept
.
length
){
this
.
$message
({
message
:
'
部门不能为空
'
,
type
:
'
warning
'
})
return
false
}
crud
.
form
.
roles
=
userRoles
crud
.
form
.
jobs
=
userJobs
crud
.
form
.
dept
=
{
id
:
this
.
form
.
dept
[
this
.
form
.
dept
.
length
-
1
]}
return
true
},
// getDepts() {
...
...
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