Browse Source

更换居民分类统计列表接口

v1.1
战立标 2 years ago
parent
commit
42b85fac36
  1. 648
      src/views/dataBoard/renfang/resi/class.vue

648
src/views/dataBoard/renfang/resi/class.vue

@ -1,344 +1,330 @@
<template>
<div class="g-pgi">
<!-- 组织路由 -->
<cpt-bread :separator="'/'" @tap="handleClickBreadItem" :breadList="breadList"></cpt-bread>
<div class="m-title">
<img class="title_img" src="@/assets/images/index/list-logo.png" alt />
<div class="tip_title">{{ tableTitle }}</div>
<div class="title_line"></div>
<div class="second-select" v-if="type_id == 'special_popu'">
<el-select v-model="subclassId" :popper-append-to-body="false" placeholder="请选择">
<el-option v-for="item in subclassList" :key="item.value" :label="item.label" :value="item.value" @click.native="handleChangeDate(item.value)"></el-option>
</el-select>
</div>
</div>
<div class="g-listbox">
<cpt-tb
:col-list="colList"
:loading="loading"
:header="header"
:list="list"
:total="total"
@handleSizeChange="handleSizeChange"
@handlePageNoChange="handlePageNoChange"
@operate="showInfo"
></cpt-tb>
</div>
<resi-details @close="displayedResiId = ''" :resi-id="displayedResiId" :popupShow="popupShow" v-if="displayedResiId" />
</div>
<div class="g-pgi">
<!-- 组织路由 -->
<cpt-bread :breadList="breadList" :separator="'/'" @tap="handleClickBreadItem"></cpt-bread>
<div class="m-title">
<img alt class="title_img" src="@/assets/images/index/list-logo.png"/>
<div class="tip_title">{{ tableTitle }}</div>
<div class="title_line"></div>
<div v-if="type_id == 'special_popu'" class="second-select">
<el-select v-model="subclassId" :popper-append-to-body="false" placeholder="请选择">
<el-option v-for="item in subclassList" :key="item.value" :label="item.label" :value="item.value"
@click.native="handleChangeDate(item.value)"></el-option>
</el-select>
</div>
</div>
<div class="g-listbox">
<cpt-tb
:col-list="colList"
:header="header"
:list="list"
:loading="loading"
:total="total"
@handlePageNoChange="handlePageNoChange"
@handleSizeChange="handleSizeChange"
@operate="showInfo"
></cpt-tb>
</div>
<resi-details v-if="displayedResiId" :popupShow="popupShow" :resi-id="displayedResiId"
@close="displayedResiId = ''"/>
</div>
</template>
<script>
import cptTb from '@/views/dataBoard/cpts/tb';
import cptBread from '@/views/dataBoard/renfang/cpts/bread';
import resiDetails from '@/views/dataBoard/cpts/resi-details';
import { requestPostBi } from '@/js/dai/request-bipass';
// import { requestPostBi } from '@/js/dai/request-bipass';
import getQueryPara from 'dai-js/modules/getQueryPara';
import {requestPost} from "@/js/dai/request";
export default {
name: 'resi-list',
components: {
cptTb,
cptBread,
resiDetails
},
data() {
return {
breadList: [
{
type: 'back',
meta: {
title: '人房总览'
}
},
{
meta: {
title: '居民类别'
}
}
],
tableTitle: '居民类别',
searchName: '',
pageType: '',
orgLevel: '',
org_id: '',
type_id: '', //
type_name: '',
loading: true,
pageSize: parseInt(localStorage.getItem('dataBoard_PageSize')) || 20,
pageNo: 1,
total: 0,
srcTableData: [],
list: [],
colList: [
{
align: 'left',
width: '5%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '20%'
},
{
align: 'left',
width: '20%'
},
{
align: 'left',
width: '15%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '5%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '10%'
}
],
header: ['序号', '姓名', '所属网格', '所属房屋', '联系电话', '证件号', '性别', '出生日期', '操作'],
displayedResiId: '',
subclassList: [],
subclassId: '',
popupShow:false
};
},
activated() {
this.org_id = getQueryPara('org_id');
this.type_id = getQueryPara('type_id');
this.pageType = getQueryPara('pageType');
this.type_name = getQueryPara('type_name');
const type_name = getQueryPara('type_name');
this.breadList[1].meta.title = type_name + '居民列表';
this.tableTitle = type_name + '居民列表';
this.pageNo = 1;
this.getList();
this.getCount();
if (this.type_id == 'special_popu') {
this.getSubclass();
}
},
created() {
this.pageNo = 1;
},
watch: {
$route(to, from) {
this.$router.go(0);
},
subclassId: {
handler(newVal, oldVal) {
this.pageNo = 1;
this.getList();
this.getCount();
}
}
},
methods: {
handleClickBreadItem({ item }) {
if (item.type == 'back') {
this.$router.back();
}
},
handleSearch() {},
showInfo(index) {
let item = this.srcTableData[index];
this.displayedResiId = item.user_id;
this.popupShow = true;
},
handlePageNoChange(pageNo) {
this.pageNo = pageNo;
this.getList();
},
handleSizeChange(pageSize) {
localStorage.setItem('dataBoard_PageSize', pageSize);
this.pageSize = pageSize;
this.getList();
},
async getSubclass() {
console.log('=================getSubclass');
const { org_id, type_id } = this;
this.loading = true;
const url = 'special_type_list';
const { data, code, msg } = await requestPostBi(
url,
{
queryParam: {
org_id,
type_id
}
},
{
// mockId: 62648939,
}
);
this.loading = false;
if (code === 0) {
this.subclassList = data.map((item, index) => {
return {
label: item.type_name,
value: item.type_id
};
});
} else {
this.$message.error(msg);
}
},
async getList() {
const { org_id, type_id, subclassId, pageNo, pageSize } = this;
this.loading = true;
let url = '';
let queryParam = {};
if (this.pageType == 'normal') {
url = 'resident_class_list';
queryParam = {
org_id,
type_id: subclassId || type_id,
pageNo,
pageSize
};
} else {
url = 'resident_class_predict_list';
queryParam = {
org_id,
resi_class_name: this.type_name,
page_num: pageNo,
page_size: pageSize
};
}
const { data, code, msg } = await requestPostBi(
url,
{
queryParam
},
{
// mockId: 60069169,
}
);
this.loading = false;
if (code === 0) {
this.srcTableData = data;
// this.total = data.total;
if (this.pageType == 'normal') {
this.list = data.map((item, index) => {
return [
index + 1,
item.user_name ? item.user_name : '--',
item.grid ? item.grid : '--',
item.house ? item.house : '--',
item.telephone ? item.telephone : '--',
item.idcard ? item.idcard : '--',
item.gender ? item.gender : '--',
item.birthday ? item.birthday : '--',
{ type: 'operate', list: ['查看'] }
];
});
} else {
this.list = data.map((item, index) => {
return [
index + 1,
item.name ? item.name : '--',
item.grid ? item.grid : '--',
item.room ? item.room : '--',
item.telephone ? item.telephone : '--',
item.idcard ? item.idcard : '--',
item.gender ? item.gender : '--',
item.birthday ? item.birthday : '--',
{ type: 'operate', list: ['查看'] }
];
});
}
} else {
this.$message.error(msg);
}
},
async getCount() {
const { org_id, type_id, subclassId, pageNo, pageSize } = this;
let url = '';
let queryParam = {};
if (this.pageType == 'normal') {
url = 'resident_class_list_total';
queryParam = {
org_id,
type_id: subclassId || type_id,
pageNo,
pageSize
};
} else {
url = 'resident_class_predict_total';
queryParam = {
org_id,
resi_class_name: this.type_name,
page_num: pageNo,
page_size: pageSize
};
}
const { data, code, msg } = await requestPostBi(
url,
{
queryParam
},
{
// mockId: 63070913,
}
);
if (code === 0) {
this.total = parseInt(data[0].count);
} else {
this.$message.error(msg);
}
}
},
destroyed() {
console.log('我已经离开了!');
}
name: 'resi-list',
components: {
cptTb,
cptBread,
resiDetails
},
data() {
return {
breadList: [
{
type: 'back',
meta: {
title: '人房总览'
}
},
{
meta: {
title: '居民类别'
}
}
],
tableTitle: '居民类别',
searchName: '',
pageType: '',
orgLevel: '',
org_id: '',
type_id: '', //
type_name: '',
loading: true,
pageSize: parseInt(localStorage.getItem('dataBoard_PageSize')) || 20,
pageNo: 1,
total: 0,
srcTableData: [],
list: [],
colList: [
{
align: 'left',
width: '5%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '20%'
},
{
align: 'left',
width: '20%'
},
{
align: 'left',
width: '15%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '5%'
},
{
align: 'left',
width: '10%'
},
{
align: 'left',
width: '10%'
}
],
header: ['序号', '姓名', '所属网格', '所属房屋', '联系电话', '证件号', '性别', '出生日期', '操作'],
displayedResiId: '',
subclassList: [],
subclassId: '',
popupShow: false
};
},
activated() {
this.org_id = getQueryPara('org_id');
this.type_id = getQueryPara('type_id');
this.pageType = getQueryPara('pageType');
this.type_name = getQueryPara('type_name');
const type_name = getQueryPara('type_name');
this.breadList[1].meta.title = type_name + '居民列表';
this.tableTitle = type_name + '居民列表';
this.pageNo = 1;
this.getList();
// this.getCount();
if (this.type_id == 'special_popu') {
this.getSubclass();
}
},
created() {
this.pageNo = 1;
},
watch: {
$route(to, from) {
this.$router.go(0);
},
subclassId: {
handler(newVal, oldVal) {
this.pageNo = 1;
this.getList();
this.getCount();
}
}
},
methods: {
handleClickBreadItem({item}) {
if (item.type == 'back') {
this.$router.back();
}
},
handleSearch() {
},
showInfo(index) {
let item = this.srcTableData[index];
this.displayedResiId = item.resiId;
this.popupShow = true;
},
handlePageNoChange(pageNo) {
this.pageNo = pageNo;
this.getList();
},
handleSizeChange(pageSize) {
localStorage.setItem('dataBoard_PageSize', pageSize);
this.pageSize = pageSize;
this.getList();
},
async getSubclass() {
console.log('=================getSubclass');
const {org_id, type_id} = this;
this.loading = true;
const url = 'special_type_list';
const {data, code, msg} = await requestPostBi(
url,
{
queryParam: {
org_id,
type_id
}
},
{
// mockId: 62648939,
}
);
this.loading = false;
if (code === 0) {
this.subclassList = data.map((item, index) => {
return {
label: item.type_name,
value: item.type_id
};
});
} else {
this.$message.error(msg);
}
},
async getList() {
const {org_id, type_id, subclassId, pageNo, pageSize} = this;
this.loading = true;
let url = '/actual/base/residentBaseInfo/page';
let queryParam = {
org_id,
categoryKey: subclassId || type_id,
pageNo,
pageSize
};
/* if (this.pageType == 'normal') {
url = 'resident_class_list';
queryParam = {
org_id,
type_id: subclassId || type_id,
pageNo,
pageSize
};
} else {
url = 'resident_class_predict_list';
queryParam = {
org_id,
resi_class_name: this.type_name,
page_num: pageNo,
page_size: pageSize
};
}*/
const {data, code, msg} = await requestPost(
url,
queryParam
);
this.loading = false;
if (code === 0) {
this.srcTableData = data.list;
this.total = data.total;
this.list = data.list.map((item, index) => {
return [
index + 1,
item.name ? item.name : '--',
item.gridName ? item.gridName : '--',
item.homeName ? item.homeName : '--',
item.mobile ? item.mobile : '--',
item.idNum ? item.idNum : '--',
item.gender == 1 ? '男' : item.gender == '2' ? '女' : '--',
item.birthday ? item.birthday : '--',
{type: 'operate', list: ['查看']}
];
});
} else {
this.$message.error(msg);
}
},
async getCount() {
const {org_id, type_id, subclassId, pageNo, pageSize} = this;
let url = '';
let queryParam = {};
if (this.pageType == 'normal') {
url = 'resident_class_list_total';
queryParam = {
org_id,
type_id: subclassId || type_id,
pageNo,
pageSize
};
} else {
url = 'resident_class_predict_total';
queryParam = {
org_id,
resi_class_name: this.type_name,
page_num: pageNo,
page_size: pageSize
};
}
const {data, code, msg} = await requestPostBi(
url,
{
queryParam
},
{
// mockId: 63070913,
}
);
if (code === 0) {
this.total = parseInt(data[0].count);
} else {
this.$message.error(msg);
}
}
},
destroyed() {
console.log('我已经离开了!');
}
};
</script>
<style lang="scss" src="@/assets/scss/dataBoard/listBox.scss" scoped></style>
<style lang="scss" scoped src="@/assets/scss/dataBoard/listBox.scss"></style>

Loading…
Cancel
Save