Browse Source

选民登记管理功能所属小组根据所属选区联动

master
liuchuang 4 years ago
parent
commit
6fb97203a5
  1. 22
      src/views/modules/custom/voterregistration.vue

22
src/views/modules/custom/voterregistration.vue

@ -3,7 +3,7 @@
<div class="mod-news__voterregistration}"> <div class="mod-news__voterregistration}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="所属选区"> <el-form-item label="所属选区">
<el-select style="width: 150px" v-model="dataForm.constituencyCode" placeholder="请选择" clearable> <el-select @change="getGroupList($event)" style="width: 150px" v-model="dataForm.constituencyCode" placeholder="请选择" clearable>
<el-option <el-option
v-for="item in constituencyList" v-for="item in constituencyList"
:key="item.configCode" :key="item.configCode"
@ -150,20 +150,30 @@ export default {
}, },
created () { created () {
this.getConstituencyList() this.getConstituencyList()
this.getGroupList() this.groupList = []
this.getParticipationPrincipleList() this.getParticipationPrincipleList()
}, },
methods: { methods: {
getConstituencyList () { getConstituencyList () {
this.$http.get(`/custom/voterregistrationconfig/getConfigByType/0`).then(({ data: res }) => { this.$http.get(`/custom/voterregistrationconfig/getConfigByType`, { params: { configType: '0', pid: '' } }).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.constituencyList = res.data this.constituencyList = res.data
}).catch(() => {}) }).catch(() => {})
}, },
getGroupList () { getGroupList (code) {
this.$http.get(`/custom/voterregistrationconfig/getConfigByType/1`).then(({ data: res }) => { let pid = ''
this.constituencyList.find((item) => {
if (item.configCode === code) {
pid = item.id
}
})
if (pid === '') {
this.groupList = []
return
}
this.$http.get(`/custom/voterregistrationconfig/getConfigByType`, { params: { configType: '', pid: pid } }).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -171,7 +181,7 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
getParticipationPrincipleList () { getParticipationPrincipleList () {
this.$http.get(`/custom/voterregistrationconfig/getConfigByType/2`).then(({ data: res }) => { this.$http.get(`/custom/voterregistrationconfig/getConfigByType`, { params: { configType: '2', pid: '' } }).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

Loading…
Cancel
Save