修改公告页城市列表逻辑-更换接口后的数据处理
This commit is contained in:
@ -49,3 +49,10 @@ export function getRead(params) {
|
||||
params
|
||||
});
|
||||
}
|
||||
// 根据level查询城市 1->省 2->市 3->合肥
|
||||
export function getCityByLevel(params) {
|
||||
return request({
|
||||
url: '/dict/getCityByLevel',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
target="_blank"
|
||||
:to="{
|
||||
path: '/portrait',
|
||||
query: { key: 'policyRead', val: '归口' },
|
||||
query: { key: 'policyRead', val: '归口' }
|
||||
}"
|
||||
>
|
||||
<div class="title_top_r pointer">
|
||||
@ -54,7 +54,7 @@
|
||||
target="_blank"
|
||||
:to="{
|
||||
path: '/result',
|
||||
query: { key: 'policyRead', id: item.id },
|
||||
query: { key: 'policyRead', id: item.id }
|
||||
}"
|
||||
>
|
||||
{{ item.title }}
|
||||
@ -93,7 +93,7 @@
|
||||
target="_blank"
|
||||
:to="{
|
||||
path: '/result',
|
||||
query: { key: 'policy', id: item.id },
|
||||
query: { key: 'policy', id: item.id }
|
||||
}"
|
||||
>
|
||||
{{ item.title }}
|
||||
@ -113,7 +113,7 @@
|
||||
target="_blank"
|
||||
:to="{
|
||||
path: '/portrait',
|
||||
query: { key: 'information', val: '' },
|
||||
query: { key: 'information', val: '' }
|
||||
}"
|
||||
>
|
||||
<div class="title_top_r pointer">
|
||||
@ -129,7 +129,7 @@
|
||||
target="_blank"
|
||||
:to="{
|
||||
path: '/result',
|
||||
query: { key: 'information', id: item.id },
|
||||
query: { key: 'information', id: item.id }
|
||||
}"
|
||||
>
|
||||
{{ item.title }}
|
||||
@ -146,7 +146,7 @@
|
||||
<div>
|
||||
<router-link
|
||||
target="_blank"
|
||||
:to="{ path: '/notice', query: { key: '1', val: '安徽' } }"
|
||||
:to="{ path: '/notice', query: { key: 'AH', val: '安徽' } }"
|
||||
>
|
||||
<img src="@/assets/image/city/01.png" alt="" />
|
||||
<span>安徽</span>
|
||||
@ -392,19 +392,19 @@ export default {
|
||||
return {
|
||||
bannerList: [logoImg1, logoImg2, logoImg3],
|
||||
queryParams: {
|
||||
labelId: '1415156808053559296',
|
||||
labelId: '1415156808053559296'
|
||||
},
|
||||
queryParams2: {
|
||||
attributeId: 'JXJ',
|
||||
attributeId: 'JXJ'
|
||||
},
|
||||
queryParams3: {
|
||||
pageNum: 1,
|
||||
pageSize: 7,
|
||||
pageSize: 7
|
||||
},
|
||||
date: this.parseTime(new Date(), '{y}-{m}-{d}'),
|
||||
list: [],
|
||||
list2: [],
|
||||
list3: [],
|
||||
list3: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -419,7 +419,7 @@ export default {
|
||||
getPolicyRead(this.queryParams2).then(({ data }) => {
|
||||
this.list2 = data.list;
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.handleClick();
|
||||
@ -427,7 +427,7 @@ export default {
|
||||
getInformation(this.queryParams3).then(({ data }) => {
|
||||
this.list3 = data.list;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -42,11 +42,11 @@
|
||||
<div class="screen_l_t_item" v-if="city == 2 || city == 3">
|
||||
<el-radio-group v-model="queryParams.city" size="medium">
|
||||
<el-radio-button
|
||||
:label="item.id"
|
||||
:label="item.value"
|
||||
v-for="item in levelList_2"
|
||||
:key="item.id"
|
||||
:key="item.value"
|
||||
>
|
||||
{{ item.name }}
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
@ -196,6 +196,7 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import {
|
||||
getDictListByStatus,
|
||||
getCityByLevel,
|
||||
getLabel,
|
||||
getPolicyList,
|
||||
getPolicyMatch
|
||||
@ -221,7 +222,7 @@ export default {
|
||||
dataList: [],
|
||||
levelList: [
|
||||
{
|
||||
label: '1',
|
||||
label: 'AH',
|
||||
name: '安徽省'
|
||||
},
|
||||
{
|
||||
@ -266,17 +267,19 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
city(a, b) {
|
||||
if (a == '' || a == 1) {
|
||||
if (a == '' || a == 'AH') {
|
||||
this.queryParams.city = this.city;
|
||||
this.getList();
|
||||
} else if (a == 2) {
|
||||
this.levelList_2 = this.levelList_3;
|
||||
this.queryParams.city = this.activeID || this.levelList_2[0].id;
|
||||
this.queryParams.city = this.activeID || this.levelList_2[0].value;
|
||||
} else if (a == 3) {
|
||||
this.levelList_2 = this.levelList_4;
|
||||
this.queryParams.city = this.levelList_2[0].id;
|
||||
this.queryParams.city = this.levelList_2[0].value;
|
||||
}
|
||||
},
|
||||
'queryParams.city'() {
|
||||
this.getList();
|
||||
},
|
||||
'queryParams.attribute'() {
|
||||
this.getList();
|
||||
},
|
||||
@ -324,10 +327,16 @@ export default {
|
||||
},
|
||||
// 获取所有城市列表
|
||||
getCityList() {
|
||||
getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// this.levelList_3 = data;
|
||||
// });
|
||||
// getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
// this.levelList_4 = data;
|
||||
// });
|
||||
getCityByLevel({ level: 2 }).then(({ data }) => {
|
||||
this.levelList_3 = data;
|
||||
});
|
||||
getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
getCityByLevel({ level: 3 }).then(({ data }) => {
|
||||
this.levelList_4 = data;
|
||||
});
|
||||
}
|
||||
@ -341,23 +350,43 @@ export default {
|
||||
this.queryParams.labelIds.push('');
|
||||
}
|
||||
if (key == 2) {
|
||||
getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// this.levelList_3 = data;
|
||||
// this.city = key;
|
||||
// this.activeID =
|
||||
// data.find(item => {
|
||||
// return item.name.indexOf(val) != -1;
|
||||
// }).id || '';
|
||||
// this.getList();
|
||||
// });
|
||||
// getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
// this.levelList_4 = data;
|
||||
// });
|
||||
getCityByLevel({ level: 2 }).then(({ data }) => {
|
||||
this.levelList_3 = data;
|
||||
this.city = key;
|
||||
this.activeID =
|
||||
data.find(item => {
|
||||
return item.name.indexOf(val) != -1;
|
||||
}).id || '';
|
||||
return item.label.indexOf(val) != -1;
|
||||
}).value || '';
|
||||
this.getList();
|
||||
});
|
||||
getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
getCityByLevel({ level: 3 }).then(({ data }) => {
|
||||
this.levelList_4 = data;
|
||||
});
|
||||
} else if (key == 3) {
|
||||
getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// getDictListByStatus({ type: 5 }).then(({ data }) => {
|
||||
// this.levelList_3 = data;
|
||||
// });
|
||||
// getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
// this.levelList_4 = data;
|
||||
// this.city = key;
|
||||
// this.getList();
|
||||
// });
|
||||
getCityByLevel({ level: 2 }).then(({ data }) => {
|
||||
this.levelList_3 = data;
|
||||
});
|
||||
getDictListByStatus({ type: 6 }).then(({ data }) => {
|
||||
getCityByLevel({ level: 2 }).then(({ data }) => {
|
||||
this.levelList_4 = data;
|
||||
this.city = key;
|
||||
this.getList();
|
||||
|
Reference in New Issue
Block a user