活动管理

This commit is contained in:
shijingjing
2022-11-02 15:16:14 +08:00
parent 48dc4a3d33
commit cb2d64f92a
2 changed files with 74 additions and 93 deletions

View File

@@ -12,7 +12,7 @@
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{ row }">
<el-button type="text" @click.native="toAdd(row.id)">详情</el-button>
<el-button type="text" v-show="row.status!=2" :disabled="row.status==2" @click.native="startEnd(row.id, row.status)">{{row.status == 0? '开启':'结束'}}</el-button>
<el-button type="text" :disabled="row.status ==2" @click.native="stopBtn(row.id)">结束</el-button>
<el-button type="text" @click.native="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
@@ -40,7 +40,7 @@ export default {
}
},
created () {
this.$dict.load('electionStatus', 'electionMethod').then(()=> {
this.$dict.load('activityStatus').then(()=> {
this.getList()
})
},
@@ -51,7 +51,7 @@ export default {
{prop: "createUserName", label: "创建人", align: "center"},
{prop: "intoBegintime", label: "开始结束时间", align: "center", render: (h, {row}) => h('p',{textAlign:'center'},
`${row.intoBegintime}${row.exitEndtime}`)},
{prop: "status", label: "活动状态", align: "center",dict:"electionMethod"},
{prop: "status", label: "活动状态", align: "center",dict:"activityStatus"},
{ slot: "options", },
]
}
@@ -78,7 +78,7 @@ export default {
})
},
handleDelete(id) {
this.$confirm('确定删除该数据').then(() => {
this.$confirm('确定删除该活动').then(() => {
this.instance.post(`/appactivityinfo/delete?ids=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success('删除成功!')
@@ -87,24 +87,12 @@ export default {
})
})
},
// 开启、结束
startEnd(id, status) {
let title = ''
let bool = null
let tips = ''
if(status == 0) {
title = '未到投票开始时间,确定要提前开始吗?'
bool = true
tips = '开启成功'
} else if(status == 1) {
title = '投票正在进行中,确定要提前结束吗?'
bool = false
tips = '结束成功'
}
this.$confirm(title).then(() => {
this.instance.post(`/app/appgeneralelectioninfo/start-end?id=${id}&start=${bool}`).then(res=>{
// 结束
stopBtn(id) {
this.$confirm('确定要结束该活动吗?').then(() => {
this.instance.post(`/appactivityinfo/stop?id=${id}`).then(res=>{
if(res.code == 0) {
this.$message.success(tips)
this.$message.success('结束成功!')
this.getList()
}
})