封装请求字典数据方法
Showing
3 changed files
with
3 additions
and
20 deletions
... | @@ -5,31 +5,14 @@ | ... | @@ -5,31 +5,14 @@ |
5 | </template> | 5 | </template> |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | import { getDdicByMC } from "../src/api/common"; | ||
9 | export default { | 8 | export default { |
10 | mounted() { | 9 | mounted() { |
11 | this.getDic(); | ||
12 | window.addEventListener("unload", this.saveState); | 10 | window.addEventListener("unload", this.saveState); |
13 | }, | 11 | }, |
14 | methods: { | 12 | methods: { |
15 | saveState() { | 13 | saveState() { |
16 | sessionStorage.setItem("state", JSON.stringify(this.$store.state)); | 14 | sessionStorage.setItem("state", JSON.stringify(this.$store.state)); |
17 | }, | 15 | }, |
18 | //请求字典数据 | ||
19 | getDic() { | ||
20 | let s = this.$store.state; | ||
21 | s.zjzlList = s.zjzlList.length == 0 ? this.getDicData("证件种类") : s.zjzlList; | ||
22 | s.gjList = s.gjList.length == 0 ? this.getDicData("国家和地区") : s.gjList; | ||
23 | s.ssList = s.ssList.length == 0 ? this.getDicData("省市") : s.ssList; | ||
24 | s.qlrlxList = s.qlrlxList.length == 0 ? this.getDicData("权利人类型") : s.qlrlxList; | ||
25 | s.xbList = s.xbList.length == 0 ? this.getDicData("性别") : s.xbList; | ||
26 | s.sshyList = s.sshyList.length == 0 ? this.getDicData("国民经济行业分类代码") : s.sshyList; | ||
27 | }, | ||
28 | getDicData(name) { | ||
29 | getDdicByMC(name).then((res) => { | ||
30 | return res.result; | ||
31 | }); | ||
32 | }, | ||
33 | }, | 16 | }, |
34 | }; | 17 | }; |
35 | </script> | 18 | </script> | ... | ... |
... | @@ -10,15 +10,15 @@ Vue.use(Vuex) | ... | @@ -10,15 +10,15 @@ Vue.use(Vuex) |
10 | const store = new Vuex.Store({ | 10 | const store = new Vuex.Store({ |
11 | state: sessionStorage.getItem('state') ? JSON.parse(sessionStorage.getItem('state')) : { | 11 | state: sessionStorage.getItem('state') ? JSON.parse(sessionStorage.getItem('state')) : { |
12 | zdbsm: '', | 12 | zdbsm: '', |
13 | xzqList: [], | ||
14 | djqList: [], | ||
15 | djzqList: [], | ||
16 | zjzlList:[], | 13 | zjzlList:[], |
17 | gjList:[], | 14 | gjList:[], |
18 | ssList:[], | 15 | ssList:[], |
19 | qlrlxList:[], | 16 | qlrlxList:[], |
20 | xbList:[], | 17 | xbList:[], |
21 | sshyList:[], | 18 | sshyList:[], |
19 | xzqList: [], | ||
20 | djqList: [], | ||
21 | djzqList: [], | ||
22 | //创建自然幢时需要用到的临时存储信息 | 22 | //创建自然幢时需要用到的临时存储信息 |
23 | zrzbsm: '', | 23 | zrzbsm: '', |
24 | xmmc: '', | 24 | xmmc: '', | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment