城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

627 lines
17 KiB

<template>
<div class="g-main">
<div class="m-search">
<el-form :inline="true"
:model="formData"
ref="ref_searchform"
:label-width="'90px'">
<div>
<el-form-item label="所属组织"
prop="orgId">
<el-cascader class="customer_cascader"
ref="myCascader"
size="small"
v-model="agencyIdArray"
:options="orgOptions"
:props="orgOptionProps"
:show-all-levels="false"
@change="handleChangeAgency"></el-cascader>
</el-form-item>
<el-form-item label="所属房屋">
<el-form-item prop="neighborHoodId">
<el-select v-model.trim="formData.neighborHoodId"
placeholder="小区"
size="small"
clearable
class="item_width_2"
@change="handleChangeV">
<el-option v-for="item in optionsV"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="buildingId">
<el-select v-model.trim="formData.buildingId"
placeholder="楼号"
:disabled="!this.formData.neighborHoodId"
size="small"
clearable
class="item_width_2 item_width_2-middle item_width_2"
@change="handleChangeB">
<el-option v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unitId">
<el-select v-model.trim="formData.unitId"
placeholder="单元"
size="small"
:disabled="!this.formData.buildingId"
clearable
class="item_width_2 item_width_2-middle item_width_2"
@change="handleChangeD">
<el-option v-for="item in optionsD"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="houseId">
<el-select v-model.trim="formData.houseId"
placeholder="房号"
:disabled="!this.formData.unitId"
size="small"
clearable
class="item_width_2 item_width_2-middle item_width_2">
<el-option v-for="item in optionsH"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="姓名"
prop="name">
<el-input v-model="formData.name"
size="small"
class="item_width_2"
clearable
placeholder="请输入姓名">
</el-input>
</el-form-item>
<el-form-item label="手机号"
prop="mobile">
<el-input v-model="formData.mobile"
size="small"
class="item_width_2"
clearable
placeholder="请输入手机号">
</el-input>
</el-form-item>
<el-form-item label="证件号"
prop="mobile">
<el-input v-model="formData.idCard"
size="small"
class="item_width_2"
clearable
placeholder="请输入证件号">
</el-input>
</el-form-item>
<el-button style="margin-left:30px"
size="small"
class="diy-button--search"
@click="handleSearch">查询</el-button>
<el-button style="margin-left:10px"
size="small"
class="diy-button--reset"
@click="resetSearch">重置</el-button>
<el-button style="margin-left:10px"
class="diy-button--add"
size="small"
@click="handleExport">导出</el-button>
</div>
</el-form>
</div>
<div class="m-table">
<el-table ref="ref_table"
class="table"
:data="tableData"
border
:height="tableHeight"
v-loading="tableLoading"
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}"
style="width: 100%">
<el-table-column type="selection"
width="55"></el-table-column>
<el-table-column label="序号"
header-align="center"
align="center"
type="index"
width="50"></el-table-column>
<el-table-column prop="name"
header-align="center"
align="center"
label="姓名"
width="90">
</el-table-column>
<el-table-column prop="mobile"
header-align="center"
align="center"
label="手机号"
width="110">
</el-table-column>
<el-table-column prop="idCard"
header-align="center"
align="center"
label="证件号"
width="170">
</el-table-column>
<el-table-column prop="neighborHoodName"
header-align="center"
align="center"
label="所属小区"
min-width="200">
</el-table-column>
<el-table-column prop="age"
header-align="center"
align="center"
label="年龄"
width="80">
</el-table-column>
</el-table>
<div>
<el-pagination @size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="pageSize"
layout="sizes, prev, pager, next, total"
:total="total">
</el-pagination>
</div>
</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // 引入Loading服务
let loading // 加载动画
export default {
data () {
return {
loading: false,
total: 0,
pageSize: 20,
pageNo: 1,
tableLoading: false,
agencyId: '',
initLoading: false,
tableArray: [
],
formData: {
gridId: '',
agencyId: '',
orgId: '',
orgType: '',
ruleId: '',
ruleList: {},
name: '',
mobile: '',
idCard: '',
neighborHoodId: '',
buildingId: '',
unitId: '',
houseId: ''
},
optionsV: [],
optionsB: [],
optionsH: [],
optionsD: [],
optionsG: [],
orgOptions: [],
agencyIdArray: [],
tableData: [],
orgOptionProps: {
multiple: false,
value: 'agencyId',
label: 'agencyName',
children: 'subAgencyList',
checkStrictly: true
}
}
},
components: {
},
async created () {
},
activated () {
this.$refs['ref_table'].doLayout()
},
async mounted () {
this.getOrgTreeList()
await this.loadTable()
},
methods: {
handleSearch () {
this.loadTable()
},
async loadTable () {
this.tableLoading = true
const url = "/data/aggregator/icuser/listByPolicyRules"
// const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/icEpidemicSpecialAttention/list"
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
...this.formData,
ruleId: this.ruleId,
ruleList: this.ruleList
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.total = data.total
this.tableData = data.list
} else {
this.$message.error(msg)
}
this.tableLoading = false
},
handleChangeAgency (val) {
let obj = this.$refs["myCascader"].getCheckedNodes()[0].data
if (obj) {
if (obj.level === 'grid') {
this.formData.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.orgType = 'grid'
this.formData.gridId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.agencyId = ''
} else {
this.formData.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.orgType = 'agency'
this.formData.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.gridId = ''
}
} else {
this.formData.orgId = ''
this.formData.orgType = ''
this.formData.agencyId = ''
this.formData.gridId = ''
}
this.formData.neighborHoodId = ''
this.formData.buildingId = ''
this.formData.unitId = ''
this.formData.houseId = ''
this.getValiheList()
},
handleChangeV (val) {
console.log('val', val)
this.formData.buildingId = ''
this.formData.unitId = ''
this.formData.houseId = ''
this.getBuildList()
this.getUniList()
this.getHouseList()
},
handleChangeB (val) {
console.log('val', val)
this.formData.unitId = ''
this.formData.houseId = ''
this.getUniList()
this.getHouseList()
},
handleChangeD () {
this.formData.houseId = ''
this.getHouseList()
},
getOrgTreeList () {
const { user } = this.$store.state
this.$http
.post('/gov/org/customeragency/agencygridtree', {})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取组织树成功', res.data)
this.orgOptions = []
this.orgOptions.push(res.data)
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getValiheList () {
const { user } = this.$store.state
this.$http
.post('/actual/base/communityQuarters/listQuartersOptions', { gridId: this.formData.gridId, agencyId: this.formData.agencyId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsV = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getBuildList () {
this.$http
.post('/actual/base/communityBuilding/buildingoption', { quartersId: this.formData.neighborHoodId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsB = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getUniList () {
this.$http
.post('/actual/base/communityBuildingUnit/unitoption', { buildingId: this.formData.buildingId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsD = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getHouseList () {
this.$http
.post('/actual/base/communityHouse/houseoption', { unitId: this.formData.unitId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsH = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
//重置搜索条件
resetSearch () {
this.agencyIdArray = []
this.formData = {
orgId: '',
orgType: '',
ruleId: '',
ruleList: {},
name: '',
mobile: '',
idCard: '',
neighborHoodId: '',
buildingId: '',
unitId: '',
houseId: ''
}
this.pageNo = 1
this.loadTable()
},
handleSizeChange (val) {
this.pageSize = val
this.pageNo = 1
this.loadTable()
},
handleCurrentChange (val) {
this.pageNo = val
this.loadTable()
},
//导出表格
async handleExport () {
this.exportBtn = true
this.exportBtnTitle = '正在导出...'
let params = {
...this.formData,
ruleId: this.ruleId,
ruleList: this.ruleList
}
await this.$http({
method: 'POST',
url: '/data/aggregator/icuser/exportByPolicyRules',
responseType: 'blob',
data: params
})
.then(res => {
console.log('resllll', res)
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName)
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download', fileName)
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象
})
.catch((err) => {
console.log('获取导出情失败', err)
this.$message.error('获取导出失败')
})
this.exportBtnTitle = '导出'
this.exportBtn = false
},
// 下载文件
download (data, fileName) {
if (!data) {
return
}
var csvData = new Blob([data])
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(csvData, fileName);
}
// for Non-IE (chrome, firefox etc.)
else {
var a = document.createElement('a');
document.body.appendChild(a);
a.style = 'display: none';
var url = window.URL.createObjectURL(csvData);
a.href = url;
a.download = fileName;
a.click();
a.remove();
window.URL.revokeObjectURL(url);
}
},
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
computed: {
tableHeight () {
return 400
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
watch: {
},
props: {
ruleId: {
type: String,
required: ''
},
ruleList: {
type: Object,
default () {
return {}
}
},
}
}
</script>
<style lang="scss" scoped >
.g-main {
width: 100%;
.m-search {
background: #ffffff;
border-radius: 4px;
padding: 20px 20px 5px 15px;
.item_width_2 {
width: 160px;
}
}
}
.m-table {
background: #ffffff;
border-radius: 4px;
padding: 0 20px;
position: relative;
.table {
.img-voice {
width: 30px;
height: 30px;
}
}
.div_notice {
position: absolute;
left: 15px;
bottom: 0;
}
}
</style>