村民议事
This commit is contained in:
194
packages/3.0.0/AppVillagerDiscussion/components/Add.vue
vendored
Normal file
194
packages/3.0.0/AppVillagerDiscussion/components/Add.vue
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<ai-detail>
|
||||
<template slot="title">
|
||||
<ai-title :title="params.id ? '编辑本村简介' : '添加本村简介'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
||||
</ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-card title="基本信息">
|
||||
<template #content>
|
||||
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
||||
<el-form-item label="主题" style="width: 100%;" prop="title" :rules="[{required: true, message: '请输入主题', trigger: 'blur'}]">
|
||||
<el-input type="textarea" :rows="5" v-model="form.title" clearable placeholder="请输入主题..." maxlength="30" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="areaId" style="width: 100%;" label="发布地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]">
|
||||
<ai-area-select clearable always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="议事截止时间" prop="date" :rules="[{required: true, message: '请选择议事截止时间', trigger: 'change'}]">
|
||||
<el-date-picker
|
||||
v-model="form.date"
|
||||
type="datetime"
|
||||
style="width: 100%;"
|
||||
size="small"
|
||||
placeholder="选择议事截止时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="公示截止时间" prop="time" :rules="[{required: true, message: '请选择公示截止时间', trigger: 'change'}]">
|
||||
<el-date-picker
|
||||
v-model="form.time"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
type="datetime"
|
||||
placeholder="选择公示截止时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="议事类型" prop="type" :rules="[{required: true, message: '请选择议事类型', trigger: 'change'}]">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio label="0">意见征集</el-radio>
|
||||
<el-radio label="1">投票表决</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item class="vite-form__item" style="width: 100%;" label="投票选项" prop="type" :rules="[{required: true, message: '请添加投票选项', trigger: 'change'}]">
|
||||
<el-form-item label-width="80px" :label="'选项' + index" v-for="(item, index) in form.voteList" :key="index + item.name">
|
||||
<div class="form-flex">
|
||||
<el-input v-model="item.name" size="small" clearable placeholder="请输入选项"></el-input>
|
||||
<el-button type="danger" size="small" @click="removeVote(index)">删除</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-button type="primary" size="small" @click="addVote">添加选项</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否匿名投票" prop="anonymity" :rules="[{required: true, message: '请选择是否匿名投票', trigger: 'change'}]">
|
||||
<el-switch
|
||||
v-model="form.anonymity"
|
||||
active-value="1"
|
||||
inactive-value="0">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="投票方式" prop="type" :rules="[{required: true, message: '请选择投票方式', trigger: 'change'}]">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio label="0">单选</el-radio>
|
||||
<el-radio label="1">多选</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" style="width: 100%;" prop="thumbUrl">
|
||||
<ai-uploader
|
||||
:instance="instance"
|
||||
isShowTip
|
||||
v-model="form.thumbUrl"
|
||||
:limit="9">
|
||||
</ai-uploader>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">提交</el-button>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
name: 'Add',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
info: {},
|
||||
form: {
|
||||
title: '',
|
||||
content: '',
|
||||
areaId: '',
|
||||
date: '',
|
||||
type: '',
|
||||
voteList: [],
|
||||
time: '',
|
||||
anonymity: '1',
|
||||
createUnitName: '',
|
||||
createUserName: '',
|
||||
status: '',
|
||||
thumbUrl: []
|
||||
},
|
||||
id: ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
|
||||
created () {
|
||||
this.form.areaId = this.user.info.areaId
|
||||
this.disabledLevel = this.user.info.areaList.length
|
||||
if (this.params && this.params.id) {
|
||||
this.id = this.params.id
|
||||
this.getInfo(this.params.id)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo (id) {
|
||||
this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.form = res.data
|
||||
this.form.thumbUrl = res.data.thumbUrl ? JSON.parse(res.data.thumbUrl) : []
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
addVote () {
|
||||
this.form.voteList.push({
|
||||
name: ''
|
||||
})
|
||||
},
|
||||
|
||||
removeVote (index) {
|
||||
this.form.voteList.splice(index, 1)
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/appcountrysidetourism/addOrUpdate`, {
|
||||
...this.form,
|
||||
type: 0,
|
||||
createUserName: this.user.info.name,
|
||||
thumbUrl: this.form.thumbUrl.length ? JSON.stringify([{
|
||||
url: this.form.thumbUrl[0].url
|
||||
}]) : ''
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'list',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vite-form__item {
|
||||
.form-flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.el-button {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
::v-deep .el-form-item__content {
|
||||
margin-left: 0!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
241
packages/3.0.0/AppVillagerDiscussion/components/Detail.vue
vendored
Normal file
241
packages/3.0.0/AppVillagerDiscussion/components/Detail.vue
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<ai-detail>
|
||||
<template slot="title">
|
||||
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
||||
</ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<AiSidebar :tabTitle="tabList" v-model="currIndex"></AiSidebar>
|
||||
<ai-card title="议题信息" v-show="currIndex === 0">
|
||||
<template #content>
|
||||
<ai-wrapper>
|
||||
<ai-info-item label="主题" value="主题"></ai-info-item>
|
||||
</ai-wrapper>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="意见征集" v-if="false" v-show="currIndex === 1">
|
||||
<template #right>
|
||||
<el-button type="primary" size="small" @click="isShowAdd = true">发表意见</el-button>
|
||||
</template>
|
||||
<template #content>
|
||||
<ai-table
|
||||
class="detail-table__table"
|
||||
:border="true"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
:stripe="false"
|
||||
@getList="getList">
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="投票统计" v-show="currIndex === 1">
|
||||
<template #content>
|
||||
<div id="chart"></div>
|
||||
<ai-table
|
||||
class="detail-table__table"
|
||||
:border="true"
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
:stripe="false"
|
||||
@getList="getList">
|
||||
</ai-table>
|
||||
</template>
|
||||
</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="name" style="width: 100%;" :rules="[{ required: true, message: '请发表你的观点和意见', trigger: 'blur' }]">
|
||||
<el-input size="small" type="textarea" :rows="5" placeholder="请发表你的观点和意见" v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Detail',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
info: {},
|
||||
id: '',
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
isShowAdd: false,
|
||||
form: {
|
||||
name: ''
|
||||
},
|
||||
total: 0,
|
||||
currIndex: 0,
|
||||
tableData: [],
|
||||
colConfigs: [
|
||||
{slot: 'userinfo'},
|
||||
{prop: 'addWay', label: '客户来源', align: 'center', formart: v => this.dict.getLabel('wxCustomerAddWay', v)},
|
||||
{prop: 'createTime', label: '添加时间', align: 'center'}
|
||||
],
|
||||
tabList: ['议题信息', '意见征集']
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
if (this.params && this.params.id) {
|
||||
this.id = this.params.id
|
||||
this.getInfo(this.params.id)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo (id) {
|
||||
this.instance.post(`/app/appeveryvillagecode/queryDetailById?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
// this.form = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
initChart(data) {
|
||||
const y = data.map(v => this.$dict.getLabel('fpRiskType', v.risk_type) || '其他')
|
||||
const v = data.map(v => v.c)
|
||||
const option = {
|
||||
tooltip: {},
|
||||
color: ['#2896FF', '#09DBFE', '#61FDB9', '#FFBB69', '#8429FF', '#ea7ccc'],
|
||||
grid: {
|
||||
top: '4%',
|
||||
left: '4%',
|
||||
right: '6%',
|
||||
bottom: '0%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid',
|
||||
color: '#f5f5f5'
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
length: 1,
|
||||
show: true
|
||||
},
|
||||
axisLabel: {
|
||||
align: 'center',
|
||||
padding: [2, 0, 0, 0],
|
||||
interval: 0,
|
||||
fontSize: 14,
|
||||
color: '#999'
|
||||
},
|
||||
boundaryGap: true,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid',
|
||||
color: '#aaa'
|
||||
}
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: y,
|
||||
boundaryGap: true,
|
||||
axisTick: {
|
||||
length: 0,
|
||||
show: false
|
||||
},
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: ['#e9e9e9'],
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
},
|
||||
nameTextStyle: {
|
||||
color: '#999',
|
||||
align: 'left'
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid',
|
||||
color: '#aaa'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#999'
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '2011',
|
||||
type: 'bar',
|
||||
data: v
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
this.chart.setOption(option)
|
||||
},
|
||||
|
||||
onConfirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/appminihomeconfig/addOrUpdate`, {
|
||||
...this.form
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('添加成功')
|
||||
this.isShowAdd = false
|
||||
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getList () {
|
||||
|
||||
},
|
||||
|
||||
onClose () {
|
||||
|
||||
},
|
||||
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'list',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
162
packages/3.0.0/AppVillagerDiscussion/components/List.vue
vendored
Normal file
162
packages/3.0.0/AppVillagerDiscussion/components/List.vue
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<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>
|
||||
<template slot="content">
|
||||
<ai-search-bar class="search-bar">
|
||||
<template #left>
|
||||
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">发布议事</el-button>
|
||||
</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="240px" 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="row.status == 1 ? '取消发布' : '发布'" @click="changeStatus(row)">{{ row.status == 1 ? '取消发布' : '发布' }}</el-button>
|
||||
<el-button type="text" @click="toAdd(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: 'List',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
title: ''
|
||||
},
|
||||
currIndex: -1,
|
||||
areaList: [],
|
||||
total: 10,
|
||||
colConfigs: [
|
||||
{ prop: 'title', label: '议事主题', align: 'left', width: '200px' },
|
||||
{ prop: 'areaName', label: '议事类型', align: 'center' },
|
||||
{ prop: 'createUnitName', label: '话事人', align: 'center' },
|
||||
{ prop: 'createUserName', label: '观点数量', align: 'center' },
|
||||
{ prop: 'createUserName', label: '投票数量', align: 'center' },
|
||||
{ prop: 'status', label: '发布状态', align: 'center', formart: v => v === '1' ? '已发布' : '未发布' },
|
||||
{ prop: 'createDate', label: '发布时间', align: 'center' },
|
||||
{ slot: 'options', label: '操作', align: 'center' }
|
||||
],
|
||||
areaName: '',
|
||||
unitName: '',
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.search.areaId = this.user.info.areaId
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList() {
|
||||
this.instance.post(`/app/appcountrysidetourism/list`, null, {
|
||||
params: {
|
||||
type: 0,
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
changeStatus (item) {
|
||||
let title = item.status == '1' ? '是否要取消发布?' : '是否要发布?';
|
||||
this.$confirm(title, {type: 'warning'}).then(() => {
|
||||
item.status = item.status == '1' ? '0' : '1'
|
||||
this.instance.post('/app/appcountrysidetourism/addOrUpdate', item).then(res => {
|
||||
if (res && res.code == 0) {
|
||||
title == '是否要发布?' ? this.$message.success('发布成功') : this.$message.success('取消发布成功')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
remove(id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appcountrysidetourism/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
toDetail (id) {
|
||||
this.$emit('change', {
|
||||
type: 'Detail',
|
||||
params: {
|
||||
id: id || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toAdd(id) {
|
||||
this.$emit('change', {
|
||||
type: 'Add',
|
||||
params: {
|
||||
id: id || ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.notice {
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user