Files
dvcp_v2_webapp/packages/shandong/AppVillagersCircle/components/List.vue
yanran200730 fd76ce7ac1 表单
2022-02-18 13:44:25 +08:00

142 lines
4.0 KiB
Vue

<template>
<ai-list isTabs>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-select
placeholder="请选择状态"
v-model="search.status"
clearable
@change="search.current = 1, getList()"
:selectList="dict.getDict('auditStatus')">
</ai-select>
<ai-select
placeholder="请选择话题"
v-model="search.topic"
clearable
@change="search.current = 1, getList()"
:selectList="dict.getDict('villagerCircleTopic')">
</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="options" width="120px" 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: 'List',
props: {
instance: Function,
dict: Object,
areaId: String
},
data() {
return {
search: {
current: 1,
size: 10,
status: '',
topic: '',
title: '',
areaId: ''
},
total: 0,
colConfigs: [
{ prop: 'createUserName', label: '发布人', align: 'left' },
{ prop: 'createTime', label: '发布时间', align: 'center' },
{ prop: 'content', label: '发布内容', align: 'center' },
{ prop: 'topic', label: '话题类型', align: 'center', formart: v => this.dict.getLabel('villagerCircleTopic', v) },
{ prop: 'status', label: '状态', align: 'center', formart: v => this.dict.getLabel('auditStatus', v) },
{ prop: 'auditUserName', label: '审核人', align: 'center' },
{ prop: 'auditTime', label: '审核时间', align: 'center' },
{ slot: 'options', label: '操作', align: 'center' }
],
tableData: []
}
},
computed: {
...mapState(['user'])
},
created () {
this.search.areaId = this.user.info.areaId
this.dict.load(['villagerCircleTopic', 'auditStatus']).then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance.post(`/app/appvillagercircleinfo/list`, null, {
params: {
...this.search,
areaId: this.areaId
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appvillagercircleinfo/delete?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>