Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.CadastralSystem
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5636b7b0
authored
2020-10-22 16:40:24 +0800
by
杨威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
封装请求字典数据方法
1 parent
92b7581b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
47 deletions
src/App.vue
src/store/index.js
src/views/Home.vue
src/App.vue
View file @
5636b7b
...
...
@@ -5,31 +5,14 @@
</
template
>
<
script
>
import
{
getDdicByMC
}
from
"../src/api/common"
;
export
default
{
mounted
()
{
this
.
getDic
();
window
.
addEventListener
(
"unload"
,
this
.
saveState
);
},
methods
:
{
saveState
()
{
sessionStorage
.
setItem
(
"state"
,
JSON
.
stringify
(
this
.
$store
.
state
));
},
//请求字典数据
getDic
()
{
let
s
=
this
.
$store
.
state
;
s
.
zjzlList
=
s
.
zjzlList
.
length
==
0
?
this
.
getDicData
(
"证件种类"
)
:
s
.
zjzlList
;
s
.
gjList
=
s
.
gjList
.
length
==
0
?
this
.
getDicData
(
"国家和地区"
)
:
s
.
gjList
;
s
.
ssList
=
s
.
ssList
.
length
==
0
?
this
.
getDicData
(
"省市"
)
:
s
.
ssList
;
s
.
qlrlxList
=
s
.
qlrlxList
.
length
==
0
?
this
.
getDicData
(
"权利人类型"
)
:
s
.
qlrlxList
;
s
.
xbList
=
s
.
xbList
.
length
==
0
?
this
.
getDicData
(
"性别"
)
:
s
.
xbList
;
s
.
sshyList
=
s
.
sshyList
.
length
==
0
?
this
.
getDicData
(
"国民经济行业分类代码"
)
:
s
.
sshyList
;
},
getDicData
(
name
)
{
getDdicByMC
(
name
).
then
((
res
)
=>
{
return
res
.
result
;
});
},
},
};
</
script
>
...
...
src/store/index.js
View file @
5636b7b
...
...
@@ -10,15 +10,15 @@ Vue.use(Vuex)
const
store
=
new
Vuex
.
Store
({
state
:
sessionStorage
.
getItem
(
'state'
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
'state'
))
:
{
zdbsm
:
''
,
xzqList
:
[],
djqList
:
[],
djzqList
:
[],
zjzlList
:[],
gjList
:[],
ssList
:[],
qlrlxList
:[],
xbList
:[],
sshyList
:[],
xzqList
:
[],
djqList
:
[],
djzqList
:
[],
//创建自然幢时需要用到的临时存储信息
zrzbsm
:
''
,
xmmc
:
''
,
...
...
src/views/Home.vue
View file @
5636b7b
...
...
@@ -35,30 +35,26 @@
<div
class=
"header-bottom"
>
<Navigation
ref=
"navigation"
></Navigation>
</div>
<el-dialog
title=
"新建"
:visible
.
sync=
"dialogVisible"
width=
"40%"
>
<el-dialog
title=
"新建"
:visible
.
sync=
"dialogVisible"
width=
"40%"
>
<Create
@
closeDialog=
"closeDialog"
></Create>
</el-dialog>
</el-header>
<el-main>
<router-view
/>
<router-view
/>
</el-main>
</el-container>
</el-container>
</div>
</
template
>
<
script
>
import
util
from
"@/libs/util.js"
;
import
Navigation
from
"../components/IvyElement/navigation"
;
import
Create
from
"./panel/create/index"
;
import
LineTree
from
"../components/lineTree/lineTree"
;
import
{
setTimeout
}
from
"timers"
;
import
{
getTree
}
from
"../api/common"
import
util
from
"@/libs/util.js"
;
import
Navigation
from
"../components/IvyElement/navigation"
;
import
Create
from
"./panel/create/index"
;
import
LineTree
from
"../components/lineTree/lineTree"
;
import
{
setTimeout
}
from
"timers"
;
import
{
getTree
,
getDdicByMC
}
from
"../api/common"
;
export
default
{
export
default
{
components
:
{
Navigation
,
LineTree
,
...
...
@@ -187,7 +183,7 @@
},
},
watch
:
{
"$route.path"
:
function
(
newPath
)
{
"$route.path"
:
function
(
newPath
)
{
//监测路由变化,高亮顶部导航
this
.
headTop
.
forEach
((
item
,
index
)
=>
{
item
.
select
=
false
;
...
...
@@ -195,13 +191,13 @@
item
.
select
=
true
;
}
});
if
(
newPath
==
'/zd'
)
{
this
.
getRightTree
(
this
.
$store
.
state
.
zdbsm
)
if
(
newPath
==
"/zd"
)
{
this
.
getRightTree
(
this
.
$store
.
state
.
zdbsm
);
}
},
"$store.state.zdbsm"
:
function
(
bsm
)
{
this
.
getRightTree
(
bsm
)
}
"$store.state.zdbsm"
:
function
(
bsm
)
{
this
.
getRightTree
(
bsm
);
},
},
created
()
{
if
(
this
.
$route
.
meta
)
{
...
...
@@ -223,7 +219,7 @@
icon
:
"fa fa-address-card-o"
,
path
:
"/add"
,
},
{
name
:
"更正"
,
icon
:
"fa fa-address-card-o"
,
path
:
"/modify"
},
{
name
:
"更正"
,
icon
:
"fa fa-address-card-o"
,
path
:
"/modify"
},
{
name
:
"变更"
,
icon
:
"fa fa-address-card-o"
,
...
...
@@ -243,14 +239,30 @@
// this.navSelect(indId);
// this.sortNavigation(this.navigationList, indId);
// }
this
.
getDic
();
},
methods
:
{
//请求字典数据
async
getDic
()
{
let
s
=
this
.
$store
.
state
;
s
.
zjzlList
=
s
.
zjzlList
.
length
==
0
?
await
this
.
getDicData
(
"证件种类"
)
:
s
.
zjzlList
;
s
.
gjList
=
s
.
gjList
.
length
==
0
?
await
this
.
getDicData
(
"国家和地区"
)
:
s
.
gjList
;
s
.
ssList
=
s
.
ssList
.
length
==
0
?
await
this
.
getDicData
(
"省市"
)
:
s
.
ssList
;
s
.
qlrlxList
=
s
.
qlrlxList
.
length
==
0
?
await
this
.
getDicData
(
"权利人类型"
)
:
s
.
qlrlxList
;
s
.
xbList
=
s
.
xbList
.
length
==
0
?
await
this
.
getDicData
(
"性别"
)
:
s
.
xbList
;
s
.
sshyList
=
s
.
sshyList
.
length
==
0
?
await
this
.
getDicData
(
"国民经济行业分类代码"
)
:
s
.
sshyList
;
},
async
getDicData
(
name
)
{
return
await
getDdicByMC
(
name
).
then
((
res
)
=>
{
return
res
.
result
});
},
getRightTree
(
bsm
)
{
getTree
(
bsm
).
then
(
res
=>
{
getTree
(
bsm
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
pd
=
res
.
result
this
.
pd
=
res
.
result
;
}
})
});
},
sortNavigation
(
data
,
selectId
)
{
let
headTop
=
this
.
headTop
;
...
...
@@ -309,12 +321,12 @@
//关闭新建子组件弹框
closeDialog
()
{
this
.
dialogVisible
=
false
;
}
},
};
},
};
</
script
>
<
style
lang=
"less"
scoped
>
.home-box
{
.home-box
{
width
:
100%
;
height
:
100vh
;
.el-container
{
...
...
@@ -419,5 +431,5 @@
//
line-height
:
160px
;
padding
:
0
;
}
}
}
</
style
>
...
...
Please
register
or
sign in
to post a comment