176 lines
4.9 KiB
Vue
176 lines
4.9 KiB
Vue
<template>
|
|
<ai-list class="notice" isTabs>
|
|
<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>
|
|
<ai-download
|
|
v-if="permissions('app_appcontentinfo_export')"
|
|
:instance="instance"
|
|
url="/app/appcontentinfo/export"
|
|
:params="params"
|
|
fileName="数据列表"
|
|
:disabled="tableData.length == 0">
|
|
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
|
|
</ai-download>
|
|
<el-input
|
|
v-model="search.title"
|
|
class="search-input"
|
|
size="small"
|
|
v-throttle="() => {search.current = 1, 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="comment" label="评论数" align="center" v-if="permissions('app_appcontentcomment_detail')">
|
|
<template slot-scope="{ row }">
|
|
<div class="table-options">
|
|
<el-button type="text" @click="toComment(row.id)">{{ row.msgCount }}</el-button>
|
|
</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" @click="toAdd(row.id)">编辑</el-button>
|
|
<el-button type="text" @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,
|
|
moduleName: String,
|
|
areaId: String,
|
|
permissions: Function
|
|
},
|
|
|
|
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: 'left' },
|
|
{ prop: 'examineStatus', label: '状态', align: 'center', format: v => this.dict.getLabel('auditStatus', v) },
|
|
{ prop: 'examineOpinion', label: '审核意见', align: 'center' },
|
|
{ prop: 'viewCount', label: '浏览次数', align: 'center' },
|
|
{ slot: 'comment', label: '评论次数', align: 'center' },
|
|
{ prop: 'createUserName', label: '发布人', align: 'center' },
|
|
{ prop: 'createTime', label: '发布时间', align: 'center' }
|
|
],
|
|
areaName: '',
|
|
unitName: '',
|
|
tableData: []
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
...mapState(['user']),
|
|
|
|
params () {
|
|
return {
|
|
...this.search,
|
|
moduleId: this.$route.query.moduleId
|
|
}
|
|
}
|
|
},
|
|
|
|
created() {
|
|
this.dict.load('auditStatus').then(() => {
|
|
this.getList()
|
|
})
|
|
},
|
|
|
|
methods: {
|
|
getList() {
|
|
this.instance.post(`/app/appcontentinfo/list-web`, null, {
|
|
params: {
|
|
moduleId: this.$route.query.moduleId,
|
|
...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/appcontentinfo/delete?ids=${id}`).then(res => {
|
|
if (res.code == 0) {
|
|
this.$message.success('删除成功!')
|
|
this.getList()
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
toComment(id) {
|
|
this.$emit('change', {
|
|
type: 'Comment',
|
|
params: {
|
|
id
|
|
}
|
|
})
|
|
},
|
|
|
|
toAdd(id) {
|
|
this.$emit('change', {
|
|
type: 'Add',
|
|
params: {
|
|
id: id || ''
|
|
}
|
|
})
|
|
},
|
|
|
|
toDetail(id) {
|
|
this.$emit('change', {
|
|
type: 'Detail',
|
|
params: {
|
|
id: id || ''
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.notice {
|
|
}
|
|
</style>
|