初始化
This commit is contained in:
197
packages/wechat/AppProjectActivities/components/Event.vue
Normal file
197
packages/wechat/AppProjectActivities/components/Event.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<ai-list class="join-event" :isTabs="true">
|
||||
<template slot="content">
|
||||
<ai-search-bar>
|
||||
<template slot="left">
|
||||
<el-button :disabled="!permissions('app_appactivity_edit')" icon="iconfont iconAdd" type="primary" size="small" @click="add">添加</el-button>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input
|
||||
placeholder="请输入标题"
|
||||
size="small"
|
||||
clearable
|
||||
v-model="search.title"
|
||||
@keyup.enter.native="search.current = 1, getList()"
|
||||
@clear="search.current = 1, search.title = '', getList()"
|
||||
suffix-icon="iconfont iconSearch" />
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<div class="ai-table">
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" label="操作" align="center" width="250" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="publish(row)"
|
||||
:title="row.status === '1' ? '取消发布' : '发布'"
|
||||
:disabled="!permissions('app_appvillageinfo_edit')">
|
||||
{{ row.status === '1' ? '取消发布' : '发布' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
title="详情"
|
||||
@click="toDetail(row.id)"
|
||||
:disabled="!permissions('app_appactivity_detail')">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
title="编辑"
|
||||
@click="toAdd(row.id)"
|
||||
:disabled="!permissions('app_appactivity_edit')">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="remove(row.id)"
|
||||
type="text"
|
||||
title="删除"
|
||||
:disabled="!permissions('app_appactivity_del')">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</div>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ReportEvent',
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
areaId: String,
|
||||
permissions: Function
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
colConfigs() {
|
||||
return [
|
||||
{ prop: 'title', label: '标题'},
|
||||
{ prop: 'type', label: '活动名称',render:(h,{row})=>[<span>{this.dict.getLabel('activityAirticleType', row.type)}</span>]},
|
||||
{ prop: 'readCount', label: '浏览数', align: 'center' },
|
||||
{ prop: 'commentCount', label: '评论数', align: 'center' },
|
||||
{ prop: 'createDate', label: '创建时间'},
|
||||
{ prop: 'status', label: '发布状态',render:(h,{row})=>[<span>{this.dict.getLabel('villInfoStatus', row.status)}</span>]},
|
||||
{ slot: 'options', label: '操作' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
title: ''
|
||||
},
|
||||
total: 0,
|
||||
ids: [],
|
||||
tableData: [],
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.dict.load("activityAirticleType",'villInfoStatus').then(() => this.getList())
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.instance.post(`/app/appactivity/list`, null, {
|
||||
params: {
|
||||
...this.search,
|
||||
areaId: this.areaId
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
publish (params) {
|
||||
this.$confirm(`是否${params.status === '1' ? '取消发布' : '发布'}该条数据?`).then(() => {
|
||||
this.instance.post(`/app/appactivity/updateCountYardstatus`, {
|
||||
id: params.id,
|
||||
status: params.status === '1' ? 0 : 1
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success(`${params.status === '1' ? '取消发布' : '发布'}成功!`)
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
toAdd (id) {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
add () {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
id: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toEdit (id) {
|
||||
this.$emit('change', {
|
||||
type: 'add',
|
||||
params: {
|
||||
type: 'ReportAdd',
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toDetail (id) {
|
||||
this.$emit('change', {
|
||||
type: 'detail',
|
||||
params: {
|
||||
type: 'eventDetail',
|
||||
id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appactivity/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.join-event {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user