Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
SHR
/
tFIMS
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fe04a447
authored
Sep 04, 2019
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改基础数据获取
1 parent
eab908e0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
55 deletions
src/api/sys.base.js
src/common/constants.js
src/components/d2-auth/d2-auth-btn.js
src/store/modules/d2admin/modules/base.js
src/views/system/login/dialogReg.vue
src/api/sys.base.js
View file @
fe04a44
...
@@ -53,3 +53,12 @@ export function PostList (data = {}) {
...
@@ -53,3 +53,12 @@ export function PostList (data = {}) {
data
.
method
=
`
${
path
}
post`
data
.
method
=
`
${
path
}
post`
return
request
(
data
,
RequestMethods
.
GET
)
return
request
(
data
,
RequestMethods
.
GET
)
}
}
/**
* 获取基础数据
* @param {*} data 参数
*/
export
function
BaseDataApi
(
data
=
{})
{
data
.
method
=
`fims.configuration.from.conftype`
return
request
(
data
,
RequestMethods
.
GET
)
}
src/common/constants.js
View file @
fe04a44
...
@@ -2,13 +2,30 @@
...
@@ -2,13 +2,30 @@
* @Author: limin
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @Date: 2019-09-01 19:06:01
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
2 10:52:44
* @Last Modified time: 2019-09-0
4 12:11:33
*/
*/
/**
* 前端基础数据管理对应的接口名称的key
*/
export
const
TYPE_NAME
=
'confType'
/**
* 后台提供一个接 通过类型获取对应数据
* 此处定义类型
*/
export
const
ConfigType
=
{
STATION
:
'STATION_TYPE'
,
POST
:
'POST_TYPE'
,
SUBSYS
:
'SUBSYSTEM_TYPE'
}
export
const
BaseData
=
{
export
const
BaseData
=
{
ROLE
:
'role'
,
ROLE
:
{
KEY
:
'role'
,
TYPE
:
''
},
COMPANY
:
'company'
,
// COMPANY: 'company',
DEPART
:
'depart'
,
// DEPART: 'depart',
STATION
:
'station'
,
STATION
:
{
KEY
:
'station'
,
TYPE
:
ConfigType
.
STATION
},
POST
:
'post'
POST
:{
KEY
:
'post'
,
TYPE
:
ConfigType
.
POST
},
SUBSYS
:{
KEY
:
'subsys'
,
TYPE
:
ConfigType
.
SUBSYS
}
}
}
src/components/d2-auth/d2-auth-btn.js
View file @
fe04a44
...
@@ -58,8 +58,9 @@ export default {
...
@@ -58,8 +58,9 @@ export default {
*/
*/
const
filter
=
btn
=>
mapping
?
mapping
[
data
[
mapping
[
'field'
]]].
includes
(
btn
.
label
):
true
const
filter
=
btn
=>
mapping
?
mapping
[
data
[
mapping
[
'field'
]]].
includes
(
btn
.
label
):
true
const
$store
=
_this
.
$store
.
getters
[
'd2admin/auth/curBtns'
]
const
$store
=
_this
.
$store
.
getters
[
'd2admin/auth/curBtns'
]
if
(
!
$store
)
return
h
(
'div'
)
if
(
label
){
//指定label
if
(
label
){
//指定label
const
__item
=
$store
&&
$store
.
find
(
btn
=>
(
btn
.
label
===
label
)
&&
filter
(
btn
))
const
__item
=
$store
.
find
(
btn
=>
(
btn
.
label
===
label
)
&&
filter
(
btn
))
__item
&&
curBtns
.
push
(
__item
)
__item
&&
curBtns
.
push
(
__item
)
}
else
{
}
else
{
/**
/**
...
...
src/store/modules/d2admin/modules/base.js
View file @
fe04a44
...
@@ -2,31 +2,30 @@
...
@@ -2,31 +2,30 @@
* @Author: limin
* @Author: limin
* @Date: 2019-09-01 17:56:57
* @Date: 2019-09-01 17:56:57
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
2 11:20:15
* @Last Modified time: 2019-09-0
4 14:06:32
*/
*/
import
{
FetchRoleList
,
CompanyList
,
DepartList
,
StationList
,
PostList
}
from
'@/api/sys.base'
import
{
FetchRoleList
,
CompanyList
,
DepartList
,
StationList
,
PostList
,
BaseDataApi
}
from
'@/api/sys.base'
import
{
BaseData
}
from
'@/common/constants'
import
{
BaseData
,
TYPE_NAME
,
ConfigType
}
from
'@/common/constants'
const
map
=
{
const
map
=
{
[
BaseData
.
ROLE
]:
FetchRoleList
,
[
BaseData
.
ROLE
.
KEY
]:
FetchRoleList
,
[
BaseData
.
COMPANY
]:
CompanyList
,
// [BaseData.COMPANY]: CompanyList,
[
BaseData
.
DEPART
]:
DepartList
,
// [BaseData.DEPART.KEY]: DepartList,
[
BaseData
.
STATION
]:
StationList
,
[
BaseData
.
STATION
.
KEY
]:
BaseDataApi
,
[
BaseData
.
POST
]:
PostList
[
BaseData
.
POST
.
KEY
]:
BaseDataApi
,
[
BaseData
.
SUBSYS
.
KEY
]:
BaseDataApi
}
}
export
default
{
export
default
{
namespaced
:
true
,
namespaced
:
true
,
state
:
{
state
:
{
// 所属公司
company
:
[],
// 角色
// 角色
role
:
[],
role
:
[],
// 部门
depart
:
[],
// 站点
// 站点
station
:
[],
station
:
[],
//职务
//职务
post
:[]
post
:[],
//子系统
subsys
:[]
},
},
actions
:
{
actions
:
{
/**
/**
...
@@ -38,18 +37,19 @@ export default {
...
@@ -38,18 +37,19 @@ export default {
return
new
Promise
(
async
resolve
=>
{
return
new
Promise
(
async
resolve
=>
{
Promise
.
all
([
Promise
.
all
([
FetchRoleList
(),
FetchRoleList
(),
CompanyList
(),
// CompanyList(),
DepartList
(),
// DepartList(),
StationList
(),
BaseDataApi
({[
TYPE_NAME
]:
ConfigType
.
STATION
}),
PostList
()
BaseDataApi
({[
TYPE_NAME
]:
ConfigType
.
POST
}),
]).
then
(
async
([
role
,
company
,
depart
,
station
,
post
]
=
res
)
=>
{
BaseDataApi
({[
TYPE_NAME
]:
ConfigType
.
SUBSYS
})
]).
then
(
async
([
role
,
station
,
post
,
subsys
]
=
res
)
=>
{
state
.
role
=
role
state
.
role
=
role
state
.
station
=
station
state
.
station
=
station
state
.
depart
=
depart
state
.
subsys
=
subsys
state
.
company
=
company
state
.
post
=
post
state
.
post
=
post
await
dispatch
(
'save2db'
,
{
path
:
`base`
,
value
:
{
role
,
company
,
depart
,
station
,
post
}})
await
dispatch
(
'save2db'
,
{
path
:
`base`
,
value
:
{
role
,
station
,
post
,
subsys
}})
resolve
({
role
,
company
,
depart
,
station
,
post
})
resolve
({
role
,
station
,
post
,
subsys
})
})
})
})
})
},
},
...
@@ -82,8 +82,8 @@ export default {
...
@@ -82,8 +82,8 @@ export default {
if
(
state
.
role
.
length
===
0
)
{
if
(
state
.
role
.
length
===
0
)
{
state
=
await
dispatch
(
'getFromdb'
,
'base'
)
||
await
dispatch
(
'init'
)
state
=
await
dispatch
(
'getFromdb'
,
'base'
)
||
await
dispatch
(
'init'
)
}
}
const
{
role
,
company
,
depart
,
station
,
post
}
=
state
const
{
role
,
station
,
post
,
subsys
}
=
state
resolve
({
role
,
company
,
depart
,
station
,
post
})
resolve
({
role
,
station
,
post
,
subsys
})
})
})
},
},
/**
/**
...
@@ -125,7 +125,7 @@ export default {
...
@@ -125,7 +125,7 @@ export default {
*/
*/
getFromAjax
({
state
,
dispatch
,
commit
},
name
)
{
getFromAjax
({
state
,
dispatch
,
commit
},
name
)
{
return
new
Promise
(
async
resolve
=>
{
return
new
Promise
(
async
resolve
=>
{
const
value
=
await
map
[
name
]()
const
value
=
await
map
[
name
](
{[
TYPE_NAME
]:
BaseData
.
find
(
data
=>
data
.
KEY
===
name
).
TYPE
}
)
resolve
(
value
)
resolve
(
value
)
})
})
}
}
...
...
src/views/system/login/dialogReg.vue
View file @
fe04a44
...
@@ -35,35 +35,21 @@
...
@@ -35,35 +35,21 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
<el-form-item
label=
"所属公司:"
prop=
"companyCode"
>
<el-form-item
label=
"所属公司:"
prop=
"companyName"
>
<el-select
v-model=
"regForm.companyCode"
placeholder=
"请选择"
class=
"sigle-select"
>
<el-input
v-model=
"regForm.companyName"
placeholder=
"请输入公司名称"
></el-input>
<el-option
:label=
"company.companyName"
:value=
"company.companyCode"
v-for=
"(company,index) in baseData.companys"
:key=
"index"
></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"部门:"
prop=
"departCode"
>
<el-form-item
label=
"部门:"
prop=
"departName"
>
<el-select
v-model=
"regForm.departCode"
placeholder=
"请选择"
>
<el-input
v-model=
"regForm.departName"
placeholder=
"请输入部门名称"
></el-input>
<el-option
:label=
"depart.departName"
:value=
"depart.departCode"
v-for=
"(depart,index) in baseData.departs"
:key=
"index"
></el-option>
</el-select>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"职务:"
prop=
"postCode"
>
<el-form-item
label=
"职务:"
prop=
"postCode"
>
<el-select
v-model=
"regForm.postCode"
placeholder=
"请选择"
>
<el-select
v-model=
"regForm.postCode"
placeholder=
"请选择"
>
<el-option
<el-option
:label=
"post.
postNam
e"
:label=
"post.
confValu
e"
:value=
"post.
post
Code"
:value=
"post.
conf
Code"
v-for=
"(post,index) in baseData.posts"
v-for=
"(post,index) in baseData.posts"
:key=
"index"
:key=
"index"
></el-option>
></el-option>
...
@@ -74,8 +60,8 @@
...
@@ -74,8 +60,8 @@
<el-form-item
label=
"所属站点:"
prop=
"stationCode"
>
<el-form-item
label=
"所属站点:"
prop=
"stationCode"
>
<el-select
v-model=
"regForm.stationCode"
placeholder=
"请选择"
class=
"sigle-select"
>
<el-select
v-model=
"regForm.stationCode"
placeholder=
"请选择"
class=
"sigle-select"
>
<el-option
<el-option
:label=
"station.
stationNam
e"
:label=
"station.
confValu
e"
:value=
"station.
station
Code"
:value=
"station.
conf
Code"
v-for=
"(station,index) in baseData.stations"
v-for=
"(station,index) in baseData.stations"
:key=
"index"
:key=
"index"
></el-option>
></el-option>
...
@@ -114,7 +100,7 @@ export default {
...
@@ -114,7 +100,7 @@ export default {
confirm
:
''
,
confirm
:
''
,
userName
:
''
,
userName
:
''
,
mobile
:
''
,
mobile
:
''
,
company
Cod
e
:
[],
company
Nam
e
:
[],
departName
:
''
,
departName
:
''
,
postCode
:
''
,
postCode
:
''
,
stationCode
:
''
stationCode
:
''
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment