This commit is contained in:
yanran200730
2021-12-22 19:04:41 +08:00
parent 87deb83ed5
commit 1553352c88
3 changed files with 29 additions and 31 deletions

View File

@@ -1,12 +1,12 @@
<template>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="居民活动" :isShowBottomBorder="false"></ai-title>
<ai-title title="居民活动" :isShowBottomBorder="false" :isShowArea="currIndex === '0'" v-model="areaId" :instance="instance" @change="onAreaChange"></ai-title>
</template>
<template slot="tabs">
<el-tabs v-model="currIndex">
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
<component :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
<component :areaId="areaId" :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/>
</el-tab-pane>
</el-tabs>
</template>
@@ -60,11 +60,13 @@
currIndex: '0',
componentName: '',
params: {},
areaId: '',
isShowDetail: false
}
},
created () {
this.areaId = this.user.info.areaId
if (this.$route.query.id) {
this.componentName = this.$route.query?.type
this.params = {id: this.$route.query?.id}
@@ -73,6 +75,14 @@
},
methods: {
onAreaChange () {
if (this.currIndex === '0') {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
}
},
onChange (data) {
if (data.type === 'list') {
this.componentName = 'List'

View File

@@ -56,7 +56,8 @@
props: {
instance: Function,
dict: Object
dict: Object,
areaId: String
},
data () {
@@ -115,7 +116,8 @@
getList() {
this.instance.post(`/app/appvillageactivityinfo/list`, null, {
params: {
...this.search
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {

View File

@@ -23,7 +23,7 @@
node-key="id"
:data="areaTree"
highlight-current
:current-node-key="search.areaId"
:current-node-key="areaId"
:default-expanded-keys="defaultExpanded"
:default-checked-keys="defaultChecked"
@current-change="onTreeChange">
@@ -107,19 +107,9 @@
:total="total"
:tableData="list"
:col-configs="colConfigs"
:current.sync="search.current"
:size.sync="search.size"
:isShowPagination="false"
:stripe="false"
@getList="getInfo">
<el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="id = row.id, form.categoryName = row.categoryName">编辑</el-button>
<el-button type="text" @click="removeCate(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-card>
@@ -154,24 +144,18 @@
total: 0,
colConfigs: [
{ prop: 'name', label: '姓名', align: 'left' },
{ prop: 'gender', label: '性别', align: 'center' },
{ prop: 'number1', label: '报名次数', align: 'center' },
{ prop: 'number2', label: '发布动态条数', align: 'center' }
{ prop: 'gender', label: '性别', align: 'center', formart: v => this.dict.getLabel('sex', v) },
{ prop: 'num1', label: '报名次数', align: 'center' },
{ prop: 'num2', label: '发布动态条数', align: 'center' }
],
time1: '',
time2: '',
chart2: '',
areaId: '',
currIndex: -1,
list: [],
areaList: [],
unitName: '',
search: {
current: 1,
areaId: '',
size: 10,
name: ''
}
areaId: ''
}
},
@@ -186,7 +170,7 @@
},
mounted () {
this.search.areaId = this.user.info.areaId
this.areaId = this.user.info.areaId
this.areaName = this.user.info.areaName
this.getTree()
this.getAreaList()
@@ -195,7 +179,10 @@
this.chart1 = echarts.init(document.querySelector('.chart1'))
this.chart2 = echarts.init(document.querySelector('.chart2'))
window.addEventListener('resize', this.onResize)
this.getInfo()
this.dict.load('sex').then(() => {
this.getInfo()
})
})
},
@@ -209,9 +196,8 @@
},
onTreeChange (e) {
this.search.areaId = e.id
this.areaId = e.id
this.areaName = e.name
this.search.current = 1
this.$nextTick(() => {
this.getInfo()
@@ -234,7 +220,7 @@
}).filter(e => !e.parentid)[0]
this.defaultExpanded = [parent.id]
this.defaultChecked = [parent.id]
this.search.areaId = parent.id
this.areaId = parent.id
this.addChild(parent, res.data)
this.areaTree = [parent]
@@ -267,7 +253,7 @@
getInfo () {
this.loading = true
this.instance.post(`/app/appvillageactivityinfo/statistic?time1=${this.time1}&time2=${this.time2}`).then(res => {
this.instance.post(`/app/appvillageactivityinfo/statistic?areaId=${this.areaId}&time1=${this.time1 || ''}&time2=${this.time2 || '-'}`).then(res => {
if (res.code == 0) {
this.info = res.data.total
this.initChart1(res.data.twelve)