Browse Source

Merge branch 'dev-0420' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev-0420

shibei_master
dai 3 years ago
parent
commit
61a99b7500
  1. 78
      src/views/components/checkBox.vue
  2. 94
      src/views/components/dragItem.vue
  3. 463
      src/views/modules/base/diyInfo.vue
  4. 73
      src/views/modules/base/resi.vue
  5. 117
      src/views/modules/visual/basicinfo/houseStatic/houseStatic.vue
  6. 4
      src/views/modules/visual/basicinfo/houseStatic/options.js
  7. 6
      src/views/modules/visual/basicinfo/houseStatic/userOptions.js

78
src/views/components/checkBox.vue

@ -0,0 +1,78 @@
<template>
<div>
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
@change="handleCheckAllChange">全选</el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="checkedList" @change="handleChange">
<div v-for="n in boxList" :key="n.itemId" class="mb10">
<el-checkbox :label="n.itemId">{{n.label}}</el-checkbox>
</div>
</el-checkbox-group>
</div>
</template>
<script>
export default {
name: 'checkBox',
model: {
prop: 'value',
event: 'change'
},
props: {
value: {
type: Array,
default: () => []
},
list: {
type: Array,
default: () => []
}
},
data() {
return {
boxList: [],
checkAll: false,
checkedList: [],
isIndeterminate: false,
pid: '',
}
},
created() {
this.boxList = this.list.filter(item => item.itemType != 'inputRange')
console.log('cehck-bo----', this.list)
this.pid = this.list[0].itemGroupId
},
methods: {
handleCheckAllChange(val) {
this.checkedList = val ? this.boxList.map(item => item.itemId) : [];
this.isIndeterminate = false;
this.$emit('change', { list: this.filterArr(this.checkedList), pid: this.pid })
},
handleChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.list.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.boxList.length;
this.$emit('change', { list: this.filterArr(this.checkedList), pid: this.pid })
},
filterArr(arr) {
let list = []
arr.forEach(item => {
this.boxList.forEach(n => {
if (item === n.itemId) list.push(n)
})
})
return list
}
}
}
</script>
<style lang="scss" scoped>
.mb10 {
margin-bottom: 10px;
}
</style>

94
src/views/components/dragItem.vue

@ -0,0 +1,94 @@
<template>
<div class="right-wr scroll-h" :id="'wrItems' + id">
<div v-for="(n, i) in list" :key="n.itemId" class="right-item">
<div class="item-label">{{ n.label }}</div>
<div class="item-btn">
<el-tag type="danger" class="mr10" @click="handleDelItem(n, i)">
<i class="el-icon-delete"></i>
</el-tag>
<el-tag type="primary">
<i class="el-icon-rank"></i>
</el-tag>
</div>
</div>
</div>
</template>
<script>
import Sortable from 'sortablejs'
export default {
name: 'DragItems',
props: {
list: {
type: Array,
default: () => []
},
id: {
type: String,
default: ''
}
},
data() {
return {
dragList: []
}
},
mounted() {
// this.dragSort()
},
watch: {
list: {
handler(val) {
this.dragList = val.filter(item => item.itemType != 'inputRange')
},
deep: true
}
},
methods: {
handleDelItem(item, i) {
this.$emit('del', { item, index: i})
},
dragSort () {
const el = document.getElementById(`wrItems${this.id}`)
this.sortTable = Sortable.create(el, {
group: 'right-item',
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
chosenClass: 'sortable-choose',
animation: 500,
delay: 0,
onEnd: evt => {
console.log('evt----', evt)
const targetRow = this.list.splice(evt.oldIndex, 1)[0]
this.list.splice(evt.newIndex, 0, targetRow)
this.$emit('drag', this.list)
}
})
},
}
}
</script>
<style lang="scss" scoped>
.right-wr {
max-height: calc(80vh - 270px);
overflow: auto;
.right-item {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
padding: 10px 30px;
}
}
.sortable-choose {
background: #eee;
}
.mr10 {
margin-right: 10px;
}
.mb10 {
margin-bottom: 10px;
}
</style>

463
src/views/modules/base/diyInfo.vue

@ -0,0 +1,463 @@
<template>
<div v-if="list.length > 0" class="diy-container">
<el-tabs v-model="activeName">
<el-tab-pane label="自定义模板" name="first">
<div class="diy-wr">
<div class="left">
<el-tabs tab-position="left" class="left-h">
<el-tab-pane v-for="item in list" :key="item.id" :label="item.label">
<div class="pd10 dialog-h-content scroll-h">
<checkBox v-if="item.queryItemList" :ref="'checkbox' + item.id"
:list="item.queryItemList" @change="handleChangeBox" />
</div>
</el-tab-pane>
</el-tabs>
</div>
<div class="right">
<div class="right-header">
<div class="title">导出信息</div>
<el-button plain @click="handlePreview('')">预览</el-button>
</div>
<div>
<el-collapse v-model="activeCollapse" id="collapsWr">
<el-collapse-item v-for="item in rightList" :key="item.id"
:title="item.label" :name="item.id" class="col-h">
<dragItem :ref="'drag' + item.id" :list="item.queryItemList" :id="item.id"
@del="handleDelItem"
@drag="handleDrag($event, item)"></dragItem>
</el-collapse-item>
</el-collapse>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="模板列表" name="second">
<el-table
:data="tableData"
height="calc(80vh - 140px)"
style="width: 100%">
<el-table-column
type="index"
label="序号"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="name"
label="模板名称"
align="center"
min-width="180">
</el-table-column>
<el-table-column
prop="createdBy"
align="center"
label="创建者"
width="180">
</el-table-column>
<el-table-column
align="center"
prop="createdTime"
label="创建时间"
width="180">
</el-table-column>
<el-table-column
align="center"
label="操作"
width="160">
<template slot-scope="scope">
<el-button v-if="scope.row.isSelf" type="text" size="small" class="div-table-button--delete"
@click="handleDeltemplate(scope.row.id)">删除</el-button>
<el-button type="text" size="small" class="div-table-button--detail"
@click="handlePreview(scope.row.id)">预览</el-button>
<el-button
type="text"
size="small"
class="div-table-button--edit" @click="handleExportTemplate(scope.row.id)">导出</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<div v-if="activeName == 'first'" class="diy-footer">
<div class="left">
<div class="flex-div">
<div>模板名称</div>
<el-input v-model="form.name" class="wd200 mr10" />
<el-checkbox v-model="form.isSaveTemp">保存为常用模板</el-checkbox>
</div>
</div>
<el-button class="diy-button--delete" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<el-dialog :visible.sync="diyDialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="1150px"
append-to-body
top="5vh"
class="dialog-h"
@close="handleClose"
>
<div style="padding: 20px;">
<el-table
:data="tableData"
height="calc(80vh - 140px)"
style="width: 100%">
<el-table-column
v-for="(item, index) in previewList"
:label="item.label"
:key="index"
align="center"
min-width="120">
<el-table-column
v-for="(n, i) in item.children"
:label="n.label"
:key="i"
align="center"
min-width="120">
</el-table-column>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import checkBox from '../../components/checkBox.vue'
import dragItem from '../../components/dragItem.vue'
import Sortable from 'sortablejs'
export default {
props: {
list: {
type: Array,
default: () => []
},
search: {
type: Object,
default: () => {}
}
},
components: {
checkBox,
dragItem
},
data() {
return {
exportLoading: false,
activeCollapse: ['1'],
activeName: 'first',
info: {},
rightList: [],
form: {
isSaveTemp: false,
name: '',
itemList: []
},
tableData: [],
previewList: [],
diyDialog: false,
}
},
created() {
this.list.forEach(item => {
this.$set(this.info, item.id, [])
})
console.log('infodiy----', this.list)
this.getTemplateList()
},
watch: {
rightList: {
handler(val) {
if (val.length > 0) this.dragSort()
},
deep: true
}
},
methods: {
handleChangeBox({list, pid}) {
console.log('ccccc----', list)
// if (list.length == 0) return
let obj = {}
this.list.forEach(item =>{
if (item.id == pid) obj = { ...item, queryItemList: [...list] }
})
const groups = this.rightList.map(item => item.id)
if (groups.includes(pid)) {
this.rightList.forEach((item, i) => {
if (item.id == pid ) {
item.queryItemList = [...list]
if (list.length == 0) this.rightList.splice(i, 1)
}
})
} else {
this.rightList.push(obj)
this.$nextTick(() => {
console.log('itemttt------', this.$refs[`drag${pid}`])
this.$refs[`drag${pid}`][0].dragSort()
})
}
this.activeCollapse = [...this.activeCollapse, pid]
},
handleDelItem(val) {
const { item, index } = val
console.log('item------', item, this.$refs[`checkbox${item.itemGroupId}`])
const checkList = this.$refs[`checkbox${item.itemGroupId}`][0].checkedList
checkList.forEach((n, i) => {
if (n == item.itemId) this.$refs[`checkbox${item.itemGroupId}`][0].checkedList.splice(i, 1)
})
this.rightList.forEach((n, i) => {
if (n.id === item.itemGroupId) {
n.queryItemList.splice(index, 1)
if (n.queryItemList.length === 0) this.rightList.splice(i, 1)
}
})
},
dragSort() {
const el = document.getElementById('collapsWr')
this.sortTable = Sortable.create(el, {
group: 'el-collapse-item',
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
animation: 500,
delay: 0,
onEnd: evt => {
console.log('evt----', evt)
const targetRow = this.rightList.splice(evt.oldIndex, 1)[0]
this.rightList.splice(evt.newIndex, 0, targetRow)
}
})
},
handleDrag(val, item) {
console.log('drag-----', val)
console.log('drag-----', item)
this.rightList.forEach((n, i) => {
if (item.id == n.id) n.queryItemList = [...val]
})
},
handleClose() {
this.previewList = []
this.diyDialog = false
},
handleDeltemplate(id) {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.delTemplate(id)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
})
},
handlePreview(id) {
if (id) this.getPreview(id)
else {
if (this.rightList.length == 0) return this.$message.error('请选择导出信息')
this.previewList = this.rightList.map(item => {
return {
label: item.label,
children: item.queryItemList
}
})
}
this.diyDialog = true
},
handleExport() {
if (this.rightList.length === 0) return this.$message.error('请选择导出信息')
if (this.form.isSaveTemp && !this.form.name) return this.$message.error('请输入模板名称')
this.exportLoading = true
this.exportTemplate()
},
handleExportTemplate(id) {
this.exportTemplate(id)
},
async exportTemplate(id) {
let url = "/epmetuser/icresiuser/exportExcelCustom"
let params = {
templateId: id || '',
searchForm: {...this.search},
exportConfig: {
...this.form,
formCode: 'resi_base_info',
itemList: this.rightList.map(item => {
return {
itemId: item.id,
label: item.label,
tableName: item.queryItemList[0].tableName,
children: item.queryItemList,
supportAdd: item.supportAdd
}
})
}
}
await this.$http({
method: 'POST',
url,
responseType: 'blob',
data: params
})
.then(res => {
console.log('res----dddd', res)
// this.download(res.data, title + '.xls')
this.getTemplateList()
if (res.headers["content-disposition"]) {
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
this.$message.success('导出成功')
this.$emit('close')
} else this.$message.error('下载失败')
this.exportLoading = false
})
.catch(err => {
console.log('err', err)
this.exportLoading = false
return this.$message.error('网络错误')
})
},
async getTemplateList () {
let params = {
formCode: 'resi_base_info'
}
await this.$http
.post('/oper/customize/icExportTemplate/templateList', params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.tableData = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
async getPreview (id) {
let params = {
id: id || ''
}
await this.$http
.post('/oper/customize/icExportTemplate/templateDetail', params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.previewList = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
async delTemplate(id) {
let params = [id]
await this.$http
.post('/oper/customize/icExportTemplate/delete', params)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getTemplateList()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
}
}
</script>
<style lang="scss" scoped>
.diy-container {
padding: 20px 20px 0 20px;
}
.diy-wr {
display: flex;
width: 100%;
height: calc(80vh - 120px);
.left {
width: 49%;
}
.right {
flex-shrink: 0;
width: 50%;
height: 100%;
box-sizing: border-box;
margin-left: 20px;
padding: 0 20px;
border-left: 1px solid #eee;
.right-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 10px;
// border-bottom: 1px solid #eee;
.title {
font-weight: 500;
}
}
}
}
.diy-footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10px;
}
.left-h {
::v-deep .el-tabs__header.is-left,
::v-deep .el-tabs__nav-wrap.is-left::after {
height: calc(80vh - 120px);
}
}
.flex-div {
display: flex;
align-items: center;
}
// #collapsWr {
// .col-h {
// ::v-deep .el-collapse-item__wrap {
// max-height: calc(80vh - 220px);
// // overflow: auto;
// }
// }
// }
.mb10 {
margin-bottom: 10px;
}
.pd10 {
padding: 10px;
}
.mr10 {
margin-right: 10px;
}
.wd200 {
width: 200px;
}
</style>

73
src/views/modules/base/resi.vue

@ -63,6 +63,10 @@
class="diy-button--reset"
:loading="exportBtn"
@click="handleExport">{{exportBtnTitle}}</el-button>
<el-button
class="diy-button--add"
size="small"
@click="diyExport">自定义导出</el-button>
<el-button
class="diy-button--add"
size="small"
@ -288,6 +292,20 @@
@closed="diaClose">
<resi-change-record ref="ref_changerecord"></resi-change-record>
</el-dialog>
<el-dialog :visible.sync="diyDialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="1150px"
top="5vh"
class="dialog-h"
>
<diy-info v-if="diyDialog" ref="ref_diy" :list="exportList" :search="{
formCode: 'resi_base_info',
pageNo: currentPage,
pageSize: pageSize,
conditions: conditions
}" @close="handleDiyClose"></diy-info>
</el-dialog>
<people-more v-if="showedPeopleMoreInfo && lookInfo.userId"
:userId="lookInfo.userId"
:gridName="lookInfo.gridName"
@ -306,7 +324,8 @@ import { mapGetters } from 'vuex'
import resiTransfer from '../../components/resiTransfer.vue'
import resiChangeRecord from '../../components/resiChangeRecord.vue'
import peopleMore from "@/views/modules/shequ/cpts/people-more";
import { listen } from 'ol/events'
import diyInfo from './diyInfo.vue'
import { requestPost } from "@/js/dai/request";
export default {
components: {
@ -315,11 +334,13 @@ export default {
editResi,
resiTransfer,
resiChangeRecord,
peopleMore
peopleMore,
diyInfo
},
data () {
return {
activeNames: [],
diyDialog: false,
openSearch: false,
exportBtn: false,
exportBtnTitle: '导出',
@ -346,6 +367,7 @@ export default {
activeName: '',
tableData: [],
searchList: [],
exportList: [],
editAgencyId: '',
editForm: {
GRID_ID: '',
@ -452,10 +474,18 @@ export default {
this.tranferShow = false
this.getTableData()
},
handleDiyClose() {
this.diyDialog = false
},
handleOpenSearch() {
if (!this.openSearch) this.activeNames = [this.searchList[0].itemGroupId]
this.openSearch = !this.openSearch
},
async diyExport() {
await this.getExportList()
},
computedWidth (label, type) {
@ -1218,6 +1248,45 @@ export default {
return this.$message.error('网络错误')
})
},
async getExportList (type) {
const url = '/oper/customize//icformitemgroup/list'
let params = {
formCode: 'resi_base_info'
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
data.forEach(item => {
(async (id) => {
item.queryItemList = await this.getExportChildList(id)
})(item.id)
})
this.exportList = [...data]
this.$nextTick(() => {
this.diyDialog = true
})
console.log('获取详情成功getExportList----', this.exportList)
} else {
this.$message.error(msg)
}
},
async getExportChildList (groupId) {
const url = `/oper/customize/icformitem/getItemList/${groupId}`
let params = {}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
return data
} else {
this.$message.error(msg)
}
},
async deleteresiBatch () {
if (this.selection.length === 0) return this.$message.error('请选择之后进行操作')
let userIds = this.selection.map(item => item.icResiUserId)

117
src/views/modules/visual/basicinfo/houseStatic/houseStatic.vue

@ -17,7 +17,7 @@
<img class="title-icon"
src="@/assets/img/shuju/title-tip.png" />
<div class="title-label">
人房概览统计
人房概览数据统计
</div>
</div>
@ -116,70 +116,73 @@
</div>
</div>
<div class="card-left-title">下级人房概览数据统计</div>
<div v-if="subList.length>0"
class="card-table">
<div v-for="(item,index) in subList"
:key="index"
:class="['table_item',index%2 === 0?'item_dark':'']">
<div class="item_name"
@click="handleToSubAgency(item)">
<img src="@/assets/img/shuju/logo1.png" />
<span>{{item.orgName}}</span>
</div>
<div class="item_data">
<div class="item_left">
<div class="pie-table-total">
<div class="pie-table-total-count">{{item.houseTotal}}</div>
<div class="pie-table-title">房屋总数</div>
</div>
<div class="pie-table-line"></div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.zzHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.zzHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">自住房屋数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.czHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.czHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">出租房屋数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.xzHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.xzHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">闲置房屋数</div>
</div>
<div v-if="orgType!=='village'">
<div class="card-left-title">下级人房概览数据统计</div>
<div v-if="subList.length>0"
class="card-table">
<div v-for="(item,index) in subList"
:key="index"
:class="['table_item',index%2 === 0?'item_dark':'']">
<div class="item_name"
@click="handleToSubAgency(item)">
<img src="@/assets/img/shuju/logo1.png" />
<span>{{item.orgName}}</span>
</div>
<div class="item_right">
<div class="pie-table-total">
<div class="pie-table-total-count">{{item.userTotal}}</div>
<div class="pie-table-title">居民总数</div>
</div>
<div class="pie-table-line"></div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.czUserTotal}}</div>
<div class="pie-table-title table-table-title">{{item.czUserRatio+'%'}}</div>
<div class="pie-table-title table-table-title">常住人口数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.ldUserTotal}}</div>
<div class="pie-table-title table-table-title">{{item.ldUserRatio+'%'}}</div>
<div class="pie-table-title table-table-title">流动人口数</div>
<div class="item_data">
<div class="item_left">
<div class="pie-table-total">
<div class="pie-table-total-count">{{item.houseTotal}}</div>
<div class="pie-table-title">房屋总数</div>
</div>
<div class="pie-table-line"></div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.zzHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.zzHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">自住房屋数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.czHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.czHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">出租房屋数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.xzHouseTotal}}</div>
<div class="pie-table-title table-table-title">{{item.xzHouseRatio+'%'}}</div>
<div class="pie-table-title table-table-title">闲置房屋数</div>
</div>
</div>
<div class="item_right">
<div class="pie-table-total">
<div class="pie-table-total-count">{{item.userTotal}}</div>
<div class="pie-table-title">居民总数</div>
</div>
<div class="pie-table-line"></div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.czUserTotal}}</div>
<div class="pie-table-title table-table-title">{{item.czUserRatio+'%'}}</div>
<div class="pie-table-title table-table-title">常住人口数</div>
</div>
<div class="pie-table-total ">
<div class="pie-table-total-count colorwhite">{{item.ldUserTotal}}</div>
<div class="pie-table-title table-table-title">{{item.ldUserRatio+'%'}}</div>
<div class="pie-table-title table-table-title">流动人口数</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="subList.length===0"
class="no-data">
<div v-if="subList.length===0"
class="no-data">
<img src="@/assets/img/modules/visual/noData.png"
class="no-data-img" />
<img src="@/assets/img/modules/visual/noData.png"
class="no-data-img" />
</div>
</div>

4
src/views/modules/visual/basicinfo/houseStatic/options.js

@ -1,10 +1,10 @@
export function housePieOption (_charts) {
const center= ['50%', '150px']
const center= ['50%', '200px']
return {
title: {
text: '0',
top: 120,
top: 170,
left: 'center',
textStyle: {
width: '100%',

6
src/views/modules/visual/basicinfo/houseStatic/userOptions.js

@ -1,10 +1,10 @@
export function userPieOption (_charts) {
const center= ['50%', '150px']
const center= ['50%', '200px']
return {
title: {
text: '0',
top: 120,
top: 170,
left: 'center',
textStyle: {
width: '100%',
@ -13,7 +13,7 @@ export function userPieOption (_charts) {
fontWeight: 400
},
itemGap: 5,
subtext: '房屋总数',
subtext: '居民总数',
subtextStyle: {
fontSize: 20,
color: '#fff',

Loading…
Cancel
Save