村民圈

This commit is contained in:
yanran200730
2022-02-17 16:25:45 +08:00
parent 512e30a84b
commit c80ef26ad5
5 changed files with 329 additions and 73 deletions

View File

@@ -1,66 +1,105 @@
<template>
<div class="doc-circulation ailist-wrapper">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
<ai-list v-if="!isShowDetail">
<template slot="title">
<ai-title title="村民圈" :isShowBottomBorder="false" :instance="instance" v-model="areaId" @change="changeArea"></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 :areaId="areaId" :ref="tab.name" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" />
</el-tab-pane>
</el-tabs>
</template>
</ai-list>
<Detail v-else-if="componentName === 'Detail'" :params="params" :instance="instance" :dict="dict" @change="onChange"></Detail>
<CommentsDetail v-else-if="componentName === 'CommentsDetail'" :areaId="areaId" :params="params" :instance="instance" :dict="dict" @change="onChange"></CommentsDetail>
</template>
<script>
import List from './components/List'
import List from './components/List.vue'
import CommentsList from './components/CommentsList'
import CommentsDetail from './components/CommentsDetail'
import Detail from './components/Detail'
import { mapState } from 'vuex'
export default {
name: 'AppVillagersCircle',
label: '村民圈',
props: {
instance: Function,
dict: Object
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
CommentsDetail,
CommentsList,
List,
Detail
},
mounted () {
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
tabs () {
const tabList = [
{label: '村民圈列表', name: 'List', comp: List, permission: ''},
{label: '评论列表', name: 'CommentsList', comp: CommentsList, permission: ''}
]
return tabList
}
},
data () {
return {
currIndex: '0',
componentName: '',
params: {},
areaId: '',
isShowDetail: false
}
},
created() {
this.areaId = this.user.info.areaId
},
methods: {
changeArea () {
this.$nextTick(() => {
this.$refs[this.tabs[Number(this.currIndex)].name][0].getList()
})
},
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
if (data.type === 'List') {
this.componentName = 'List'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'CommentsList') {
this.componentName = 'CommentsList'
this.isShowDetail = false
this.params = data.params
}
if (data.type === 'list') {
this.component = 'List'
if (data.type === 'Detail') {
this.componentName = 'Detail'
this.isShowDetail = true
this.params = data.params
}
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
if (data.type === 'CommentsDetail') {
this.componentName = 'Statistics'
this.isShowDetail = true
this.params = data.params
}
}
}
}
</script>
<style lang="scss">
.doc-circulation {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,105 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="村民圈详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基础信息">
<ai-wrapper slot="content">
<ai-info-item label="主题" :value="info.content" isLine></ai-info-item>
<ai-info-item label="发布地区" :value="info.areaName" isLine></ai-info-item>
<ai-info-item label="议事截止时间" :value="info.discussDeadline"></ai-info-item>
<ai-info-item label="公示截止时间" :value="info.publicityDeadline"></ai-info-item>
<ai-info-item label="议事类型" :value="dict.getLabel('discussType', info.type)" isLine></ai-info-item>
<ai-info-item label="是否匿名投票" v-if="info.type === '1'" :value="info.anonymous === '1' ? '是' : '否'"></ai-info-item>
<ai-info-item label="投票方式" v-if="info.type === '1'" :value="info.voteType === '0' ? '单选' : '多选'"></ai-info-item>
<ai-info-item label="图片" isLine>
<ai-uploader
:instance="instance"
disabled
v-model="info.images"
:limit="9">
</ai-uploader>
</ai-info-item>
</ai-wrapper>
</ai-card>
<ai-dialog
:visible.sync="isShowAdd"
width="680px"
height="580px"
title="发表意见"
@close="onClose"
@onConfirm="onConfirm">
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="发表意见" prop="content" style="width: 100%;" :rules="[{ required: true, message: '请发表你的观点和意见', trigger: 'blur' }]">
<el-input size="small" type="textarea" :rows="5" show-word-limit :maxlength="140" placeholder="请发表你的观点和意见" v-model="form.content"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-detail>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'CommentsDetail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: '',
search: {
current: 1,
size: 10
},
isShowAdd: false,
form: {
content: ''
},
type: ''
}
},
computed: {
...mapState(['user'])
},
created () {
this.getInfo(this.params.id)
},
methods: {
getInfo (id) {
this.instance.post(`/app/appvillagediscuss/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.images = res.data.images ? JSON.parse(res.data.images) : []
this.type = res.data.type
}
})
},
onClose () {
this.form.content = ''
},
cancel (isRefresh) {
this.$emit('change', {
type: 'CommentsList',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,146 @@
<template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-select placeholder="请选择状态" v-model="search.type" clearable @change="search.current = 1, getList()" :selectList="dict.getDict('discussType')"></ai-select>
<ai-select placeholder="请选择话题" v-model="search.status" clearable @change="search.current = 1, getList()" :selectList="dict.getDict('discussStatus')"></ai-select>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
@keyup.enter.native="search.current = 1, search.title, getList()"
placeholder="请输入发布人姓名"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="详情" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'CommentsList',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
status: '',
type: '',
title: '',
areaId: ''
},
currIndex: -1,
areaList: [],
total: 10,
colConfigs: [
{ prop: 'content', label: '议事主题', align: 'left', width: '200px' },
{ prop: 'type', label: '议事类型', align: 'center', formart: v => this.dict.getLabel('discussType', v) },
{ prop: 'createUserName', label: '话事人', align: 'center' },
{ prop: 'msgCountTotal', label: '观点数量', align: 'center', formart: v => v === 0 ? '-' : v },
{ prop: 'voteCount', label: '投票数量', align: 'center', formart: v => v === 0 ? '-' : v },
{ prop: 'status', label: '发布状态', align: 'center', formart: v => this.dict.getLabel('discussStatus', v) },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
areaName: '',
unitName: '',
tableData: []
}
},
computed: {
...mapState(['user'])
},
created () {
this.search.areaId = this.user.info.areaId
this.dict.load(['discussType', 'discussStatus']).then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appvillagercirclecomment/list`, null, {
params: {
type: 0,
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records.map(v => {
return {
...v,
content: v.content || v.title
}
})
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillagercirclecomment/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'CommentsDetail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
.notice {
}
</style>

View File

@@ -93,7 +93,7 @@
cancel (isRefresh) {
this.$emit('change', {
type: 'list',
type: 'List',
isRefresh: !!isRefresh
})
}

View File

@@ -1,8 +1,5 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="村民圈" isShowBottomBorder isShowArea v-model="search.areaId" :instance="instance" @change="search.current = 1, getList()"></ai-title>
</template>
<ai-list class="notice" isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
@@ -30,18 +27,10 @@
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="tags" label="标签">
<template slot-scope="{ row }">
<div class="table-tags">
<el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" title="详情" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" title="取消公示" @click="changeStatus(row)" :disabled="row.status !== '1'">结束公示</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
@@ -103,7 +92,7 @@
methods: {
getList() {
this.instance.post(`/app/appvillagediscuss/listUp`, null, {
this.instance.post(`/app/appvillagercircleinfo/list`, null, {
params: {
type: 0,
...this.search
@@ -121,23 +110,9 @@
})
},
changeStatus (item) {
this.$confirm('是否要结束公示', {type: 'warning'}).then(() => {
this.instance.post('/app/appvillagediscuss/finishPublic', {
status: '2',
id: item.id
}).then(res => {
if (res && res.code == 0) {
this.$message.success('结束公示成功')
this.getList()
}
})
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillagediscuss/delete?ids=${id}`).then(res => {
this.instance.post(`/app/appvillagercircleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
@@ -153,15 +128,6 @@
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}