Browse Source

居民画像

dev
tianq 3 years ago
parent
commit
003612e793
  1. 5
      src/views/modules/census/census-houseList.vue
  2. 370
      src/views/modules/census/census-residentList.vue

5
src/views/modules/census/census-houseList.vue

@ -681,10 +681,7 @@ export default {
handleChangeAgency(val) {
// let obj = this.$refs['myCascader'].getCheckedNodes()[0].data;
let tmp = this.formData.orgId;
console.log('!tmp', !tmp);
console.log("typeof tmp != 'undefined'", typeof tmp != 'undefined');
console.log('tmp != 0', tmp != 0);
console.log('tmp != null', tmp != null);
if (tmp && typeof tmp != 'undefined' && tmp != 0 && tmp != null) {
this.orgId = this.formData.orgId;

370
src/views/modules/census/census-residentList.vue

@ -4,11 +4,10 @@
<div class="div_search">
<el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'80px'">
<div>
<el-form-item label="所属组织" prop="gridId">
<el-form-item label="所属组织" prop="orgId">
<el-cascader
class="customer_cascader"
ref="myCascader"
filterable
clearable
v-model="formData.orgId"
:options="orgOptions"
@ -17,29 +16,7 @@
@change="handleChangeAgency"
></el-cascader>
</el-form-item>
<el-form-item label="上报时间" prop="startTime">
<el-date-picker
v-model="formData.startDate"
:picker-options="startPickerOptions"
class="item_width_2"
size="small"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
value="yyyy-MM-dd"
placeholder="开始时间"
></el-date-picker>
<span class="data-tag"></span>
<el-date-picker
v-model="formData.endDate"
:picker-options="endPickerOptions"
class="item_width_2 data-tag"
size="small"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
value="yyyy-MM-dd"
placeholder="结束时间"
></el-date-picker>
</el-form-item>
<el-button class="btnSearch" size="small" @click="handleSearch">查询</el-button>
</div>
</el-form>
@ -47,10 +24,10 @@
<div class="div_table">
<el-row :gutter="20">
<el-col :span="12">
<div class="div_table_title">房屋用途统计</div>
<div class="div_table_title">居民年龄统计</div>
<el-row>
<el-col :span="12">
<div :style="'height:' + TableHeight + 'px;margin-top:20px'">
<div :style="'height:220px;margin-top:20px'">
<screen-echarts-frame
@handelClickMyPei="handelClickMyPei"
:style="{ width: '100%', height: '100%' }"
@ -60,7 +37,7 @@
</div>
</el-col>
<el-col :span="12">
<div :style="'height:' + TableHeight + 'px;margin-top:20px;display:flex;align-items: center;'">
<div :style="'height:220px;margin-top:20px;display:flex;align-items: center;'">
<div class="legend">
<div class="legend-row" :key="item.name" v-for="(item, index) in chartData.data" @click="handleClickItem(item)">
<div class="kuai" :style="{ backgroundColor: color[index] }"></div>
@ -76,10 +53,10 @@
</el-row>
</el-col>
<el-col :span="12">
<div class="div_table_title">房屋状态统计</div>
<div class="div_table_title">居民学历统计</div>
<el-row>
<el-col :span="12">
<div :style="'height:' + TableHeight + 'px;margin-top:20px'">
<div :style="'height:220px;margin-top:20px'">
<screen-echarts-frame2
@handelClickMyPei="handelClickMyPei2"
:style="{ width: '100%', height: '100%' }"
@ -89,13 +66,10 @@
</div>
</el-col>
<el-col :span="12">
<div :style="'height:' + TableHeight + 'px;margin-top:20px;display:flex;align-items: center;'">
<div class="legend2">
<div :style="'height:220px;margin-top:20px;display:flex;align-items: center;'">
<div class="legend">
<div class="legend-row" :key="item.name" v-for="(item, index) in chartData2.data" @click="handleClickItem(item)">
<div class="kuai" v-if="item.name == '自住'"><img src="../../../assets/img/census/自住.png" /></div>
<div class="kuai" v-if="item.name == '出租'"><img src="../../../assets/img/census/出租.png" /></div>
<div class="kuai" v-if="item.name == '闲置'"><img src="../../../assets/img/census/闲置.png" /></div>
<div class="kuai" v-if="item.name == '未售出'"><img src="../../../assets/img/census/未售出.png" /></div>
<div class="kuai" :style="{ backgroundColor: color[index] }"></div>
<div class="content">
<div class="name">{{ item.name }}</div>
<div class="num">{{ item.value }}</div>
@ -123,13 +97,12 @@
:height="maxTableHeight"
>
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
<el-table-column prop="streetName" label="镇街" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="districtName" label="区县" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="社区" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="网格" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="房屋名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="房屋用途" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="房屋状态" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="streetName" label="姓名" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="districtName" label="手机号" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="证件号" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="性别" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="年龄" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="agencyName" align="center" label="学历" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="count" align="center" width="110" label="操作" :show-overflow-tooltip="true"></el-table-column>
</el-table>
@ -181,7 +154,9 @@ export default {
user: {},
gridList: [], //list--
tableData: [],
formData: {},
formData: {
orgId: ''
},
pageNo: 1,
pageSize: window.localStorage.getItem('pageSize') || 20,
total: 1,
@ -202,6 +177,7 @@ export default {
value: 'agencyId',
label: 'agencyName',
children: 'subAgencyList',
emitPath: false,
checkStrictly: true
},
TableHeight: '',
@ -212,7 +188,11 @@ export default {
color: ['#3C94FE', '#A17AFA', '#A19FFF', '#22C1C3', '#6FC364', '#F0D915', '#FEB349', '#FE6252', '#F44230', '#5DC7F0'],
chartData: [],
chartData2: [],
pieData: []
pieData: [],
pieData2: [],
orgId: '',
orgType: '',
code: ''
};
},
computed: {
@ -234,27 +214,25 @@ export default {
console.log(this.$store.state);
this.user = this.$store.state.user;
this.agencyId = this.user.agencyId;
this.orgId = this.agencyId;
this.getOrgTreeList();
this.getTableData();
this.getPie();
this.getPie2();
// this.getTableData();
this.getsubData();
this.getsubData2();
},
methods: {
handleSearch(val) {
console.log(this.formData);
this.pageNo = 1;
this.getTableData();
},
async getTableData() {
this.tableLoading = true;
// const url = '/gov/org/staffLoginLog/community-count';
const url = 'http://yapi.elinkservice.cn/mock/356/gov/org/staffLoginLog/community-count';
const url = '/epmetuser/icresiuser/portrayal-list';
const { pageSize, pageNo, formData } = this;
const { data, code, msg } = await requestPost(url, {
pageSize,
pageNo,
...formData
orgId: this.orgId,
orgType: this.orgType,
code: this.code
});
this.tableLoading = false;
@ -280,20 +258,32 @@ export default {
},
async getsubData() {
this.$refs.pieChart.showLoading();
let url = '/gov/org/staffLoginLog/sub-count';
let url = '/epmetuser/icresiuser/age-distribute';
let param = {
orgId: this.formData.orgId,
level: this.formData.level,
startDate: this.formData.startDate,
endDate: this.formData.endDate
orgId: this.orgId,
orgType: this.orgType
};
const { data, code, msg } = await requestPost(url, param);
this.$refs.pieChart.hideLoading();
if (code === 0) {
this.pieData = data.list;
console.log('this.pieData ', this.pieData);
this.pieData = data;
this.getPie();
} else {
this.$message.error(msg);
}
},
async getsubData2() {
this.$refs.pieChart2.showLoading();
let url = '/epmetuser/icresiuser/education-distribute';
let param = {
orgId: this.orgId,
orgType: this.orgType
};
const { data, code, msg } = await requestPost(url, param);
this.$refs.pieChart2.hideLoading();
if (code === 0) {
this.pieData2 = data;
console.log('this.pieData2', this.pieData2);
this.getPie2();
} else {
this.$message.error(msg);
@ -303,9 +293,7 @@ export default {
this.pieInitState = true;
},
pieInitOk2() {
console.log('2333erwewrwe33333', this.pieInitState2);
this.pieInitState2 = true;
console.log('2333erwewrwe333335476754765', this.pieInitState2);
},
getPie() {
if (this.pieInitState) {
@ -318,7 +306,6 @@ export default {
},
getPie2() {
if (this.pieInitState2) {
console.log('233333333');
this.setPieData2();
} else {
setTimeout(() => {
@ -327,45 +314,66 @@ export default {
}
},
setPieData() {
// let data = [...this.pieData];
// console.log('data', data);
let chartData = {
name: ['反骨', '反骨2', '反骨3', '反骨4'],
data: [{ value: 62, name: '反骨' }, { value: 44, name: '反骨2' }, { value: 123, name: '反骨3' }, { value: 232, name: '反骨4' }]
let data = [...this.pieData];
let type = {
0: '50岁以下',
1: '50-59岁',
2: '60-69岁',
3: '70-79岁',
4: '80岁以上'
};
this.chartData = chartData;
// chartData.name = data.map(item => item.agencyName);
// chartData.data = data.map(item => {
// return { value: item.count, id: item.agencyId, level: item.agencyLevel, name: item.agencyName };
// });
console.log('chartData', chartData);
this.iniPieChart(chartData);
this.chartData.name = data.map(item => type[item.code]);
this.chartData.data = data.map(item => {
return {
value: item.totalResi,
name: type[item.code],
code: item.code,
radio: item.totalResi == 0 ? '0' : ((item.totalResi / 100) * 100).toFixed(2)
};
});
console.log('chartData', this.chartData);
this.iniPieChart(this.chartData);
},
setPieData2() {
console.log('dddddddddddd');
// let data = [...this.pieData];
// console.log('data', data);
let chartData = {
name: ['自住', '出租', '闲置', '未售出'],
data: [{ value: 62, name: '自住' }, { value: 243, name: '出租' }, { value: 243, name: '闲置' }, { value: 243, name: '未售出' }]
let data = [...this.pieData2.list];
let type = {
1: '本科',
0: '硕士',
2: '博士',
3: '博士后'
};
this.chartData2 = chartData;
// chartData.name = data.map(item => item.agencyName);
// chartData.data = data.map(item => {
// return { value: item.count, id: item.agencyId, level: item.agencyLevel, name: item.agencyName };
// });
console.log('chartData', chartData);
this.iniPieChart2(chartData);
this.chartData2.name = data.map(item => type[item.code]);
this.chartData2.data = data.map(item => {
return {
value: item.totalResi,
name: type[item.code],
code: item.code,
radio: item.totalResi == 0 ? '0' : ((item.totalResi / this.pieData2.total) * 100).toFixed(2)
};
});
console.log('chartData', this.chartData2);
this.iniPieChart2(this.chartData2);
},
//
async iniPieChart(chartData) {
this.$refs.pieChart.clear();
// pieChart
this.pieOption = {
tooltip: {
trigger: 'item',
formatter: '{b}<br/>总数 : {c}<br/> 占比 : {d}%',
backgroundColor: 'rgb(134,134,134)',
borderColor: 'rgb(134,134,134)',
textStyle: {
color: '#fff'
}
},
color: this.color,
title: {
text: '12345',
subtext: '房屋总数(分)',
text: this.pieData.total,
subtext: '总数',
x: 'center',
y: 'center',
textStyle: {
@ -382,7 +390,21 @@ export default {
series: [
{
type: 'pie',
radius: ['60%', '85%'],
radius: ['65%', '80%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
tooltip: {
show: true
},
data: chartData.data
},
{
type: 'pie',
radius: ['60%', '65%'],
center: ['50%', '50%'],
selectedMode: false,
hoverAnimation: false,
@ -407,19 +429,32 @@ export default {
}
}
},
{
type: 'pie',
radius: ['65%', '80%'],
avoidLabelOverlap: false,
radius: ['80%', '85%'],
center: ['50%', '50%'],
selectedMode: false,
hoverAnimation: false,
data: [{ value: 1, name: '' }],
itemStyle: {
color: '#f7f7f7'
},
label: {
show: false,
position: 'center'
show: false
},
labelLine: {
show: false
},
tooltip: {
show: true
show: false
},
data: chartData.data
animation: false,
cursor: 'auto',
emphasis: {
itemStyle: {
color: '#f7f7f7'
}
}
}
]
};
@ -430,10 +465,19 @@ export default {
// pieChart
this.pieOption2 = {
tooltip: {
trigger: 'item',
formatter: '{b}<br/>总数 : {c}<br/> 占比 : {d}%',
backgroundColor: 'rgb(134,134,134)',
borderColor: 'rgb(134,134,134)',
textStyle: {
color: '#fff'
}
},
color: this.color,
title: {
text: '12345',
subtext: '房屋总数(分)',
text: this.pieData.total,
subtext: '总数',
x: 'center',
y: 'center',
textStyle: {
@ -459,12 +503,39 @@ export default {
tooltip: {
show: true
},
z: 9999,
data: chartData.data
},
{
type: 'pie',
radius: ['60%', '85%'],
radius: ['60%', '65%'],
center: ['50%', '50%'],
selectedMode: false,
hoverAnimation: false,
data: [{ value: 1, name: '' }],
itemStyle: {
color: '#f7f7f7'
},
label: {
show: false
},
labelLine: {
show: false
},
tooltip: {
show: false
},
animation: false,
cursor: 'auto',
emphasis: {
itemStyle: {
color: '#f7f7f7'
}
}
},
{
type: 'pie',
radius: ['80%', '85%'],
center: ['50%', '50%'],
selectedMode: false,
hoverAnimation: false,
@ -502,39 +573,51 @@ export default {
this.orgType = 'community';
}
this.orgId = param.data.id;
this.orgName = param.data.name;
this.pageNo = 1;
this.showNext();
this.dialogVisible = true;
this.code = param.data.code;
this.getTableData();
// this.orgName = param.data.name;
// this.pageNo = 1;
// this.showNext();
// this.dialogVisible = true;
}
},
handelClickMyPei2(param) {
if (param.data.level != 'community') {
if (param.data.level == 'district') {
this.orgType = 'street';
}
if (param.data.level == 'street') {
this.orgType = 'community';
}
// if (param.data.level != 'community') {
// if (param.data.level == 'district') {
// this.orgType = 'street';
// }
// if (param.data.level == 'street') {
// this.orgType = 'community';
// }
this.orgId = param.data.id;
this.orgName = param.data.name;
this.pageNo = 1;
this.showNext();
this.dialogVisible = true;
}
// this.orgId = param.data.id;
// this.orgName = param.data.name;
// this.pageNo = 1;
// this.showNext();
// this.dialogVisible = true;
// }
this.code = param.data.code;
this.getTableData();
},
async handleExport() {
const url = '/gov/project/icEvent/export';
const url = '/epmetuser/icresiuser/portrayal-listexport';
const { pageSize, pageNo, formData } = this;
let tmp = this.formData.orgId;
if (!(tmp && typeof tmp != 'undefined' && tmp != 0 && tmp != null)) {
this.formData.orgId = '';
this.orgType = '';
this.code="";
}
axios({
url: window.SITE_CONFIG['apiURL'] + url,
method: 'post',
data: {
pageSize,
pageNo,
...formData
orgId: this.orgId,
orgType: this.orgType,
code:this.code
},
responseType: 'blob'
})
@ -560,26 +643,47 @@ export default {
getOrgTreeList() {
const { user } = this.$store.state;
this.$http
.post('gov/org/customeragency/staffinagencylist', {})
.post('/gov/org/customeragency/agencygridtree', {})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log('获取组织树成功', res.data);
let { agencyList, subAgencyList } = res.data;
const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }];
this.orgOptions = this.deepTree(_arr);
// let { agencyList, subAgencyList } = res.data;
// const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }];
// this.orgOptions = this.deepTree(_arr);
this.orgOptions = [];
this.orgOptions.push(res.data);
}
})
.catch(() => {
return this.$message.error('网络错误');
});
},
handleSearch(val) {
this.pageNo = 1;
this.code = '';
this.getTableData();
this.getsubData();
this.getsubData2();
},
handleChangeAgency(val) {
let obj = this.$refs['myCascader'].getCheckedNodes()[0].data;
console.log(obj);
this.formData.orgId = obj.agencyId;
this.formData.level = obj.level;
if (obj) {
this.orgType = obj.level === 'grid' ? 'grid' : 'agency';
} else {
this.orgType = '';
}
let tmp = this.formData.orgId;
if (tmp && typeof tmp != 'undefined' && tmp != 0 && tmp != null) {
this.orgId = this.formData.orgId;
} else {
this.orgId = '';
}
console.log('this.orgId', this.orgId);
},
deepTree(arr) {
if (Array.isArray(arr)) {
@ -690,7 +794,7 @@ export default {
justify-content: space-between;
align-items: flex-end;
margin-bottom:0px;
margin-bottom: 0px;
margin-top: 0px;
.census_searchcensus_box {
align-items: flex-end;

Loading…
Cancel
Save