|
|
@@ -4,9 +4,19 @@
|
|
|
<div slot="header">
|
|
|
<span>活动管理</span>
|
|
|
<div style="float:right">
|
|
|
- <div class="status-tabs" style="display:inline-block;margin-right:12px;">
|
|
|
- <el-button v-for="tab in statusTabs" :key="tab.value" :type="filter.status === tab.value ? 'primary' : 'default'" size="mini" @click="filter.status = tab.value; filter.page = 1; loadActivities()">{{ tab.label }}</el-button>
|
|
|
- </div>
|
|
|
+ <el-select
|
|
|
+ v-model="filter.status"
|
|
|
+ placeholder="状态筛选"
|
|
|
+ size="mini"
|
|
|
+ style="margin-right:12px;width:130px"
|
|
|
+ clearable
|
|
|
+ @change="loadActivities"
|
|
|
+ >
|
|
|
+ <el-option label="全部" value="" />
|
|
|
+ <el-option label="草稿" value="draft" />
|
|
|
+ <el-option label="已发布" value="published" />
|
|
|
+ <el-option label="已结束" value="ended" />
|
|
|
+ </el-select>
|
|
|
<el-button type="primary" size="mini" @click="$router.push('/activity-edit')">创建活动</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -36,51 +46,31 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="状态" width="120">
|
|
|
+ <el-table-column label="状态" width="100">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <el-tag :type="statusType(row.status)" size="mini" :title="row.status === 'rejected' ? (row.auditReason || '已驳回') : ''">
|
|
|
+ <el-tag :type="statusType(row.status)" size="mini">
|
|
|
{{ statusLabel(row.status) }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="startTime" label="开始时间" width="170" />
|
|
|
<el-table-column prop="endTime" label="结束时间" width="170" />
|
|
|
- <el-table-column label="操作" width="320">
|
|
|
+ <el-table-column label="操作" width="280">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <!-- 草稿箱 -->
|
|
|
- <template v-if="row.status === 'draft' && !row.auditStatus">
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id)">编辑</el-button>
|
|
|
- <el-button size="mini" type="success" @click="handleSubmitReview(row)">提交审核</el-button>
|
|
|
- <el-button size="mini" type="danger" plain @click="handlePublishDirect(row)">直接发布</el-button>
|
|
|
- </template>
|
|
|
- <!-- 待审核 -->
|
|
|
- <template v-else-if="row.status === 'pending'">
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')">查看</el-button>
|
|
|
- <el-button size="mini" type="success" @click="handleAuditApprove(row)">通过</el-button>
|
|
|
- <el-button size="mini" type="danger" @click="showAuditRejectDialog(row)">驳回</el-button>
|
|
|
- </template>
|
|
|
- <!-- 已驳回 -->
|
|
|
- <template v-else-if="row.status === 'rejected'">
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')">查看</el-button>
|
|
|
- <el-button size="mini" type="primary" @click="handleReDraft(row)">重新编辑</el-button>
|
|
|
- </template>
|
|
|
- <!-- 发布中 -->
|
|
|
- <template v-else-if="row.status === 'published'">
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')">查看</el-button>
|
|
|
- <el-button size="mini" type="warning" @click="handleWithdraw(row)">撤回</el-button>
|
|
|
- </template>
|
|
|
- <!-- 已撤回 -->
|
|
|
- <template v-else-if="row.status === 'withdrawn'">
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')">查看</el-button>
|
|
|
- <el-button size="mini" type="success" @click="handlePublishDirect(row)">重新发布</el-button>
|
|
|
- </template>
|
|
|
- <!-- 其他(兼容旧状态) -->
|
|
|
- <template v-else>
|
|
|
- <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')">查看</el-button>
|
|
|
- <el-button v-if="row.status === 'draft'" size="mini" @click="$router.push('/activity-edit?id=' + row.id)">编辑</el-button>
|
|
|
- <el-button v-if="row.status === 'draft'" size="mini" type="success" @click="handlePublishDirect(row)">发布</el-button>
|
|
|
- <el-button v-if="row.status === 'published'" size="mini" type="warning" @click="handleEnd(row)">结束</el-button>
|
|
|
- </template>
|
|
|
+ <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id + '&readonly=1')" v-if="row.status !== 'draft'">查看</el-button>
|
|
|
+ <el-button size="mini" @click="$router.push('/activity-edit?id=' + row.id)" v-else>编辑</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="success"
|
|
|
+ @click="handlePublish(row)"
|
|
|
+ v-if="row.status === 'draft'"
|
|
|
+ >发布</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="warning"
|
|
|
+ @click="handleEnd(row)"
|
|
|
+ v-if="row.status === 'published'"
|
|
|
+ >结束</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -97,16 +87,7 @@
|
|
|
/>
|
|
|
</el-card>
|
|
|
|
|
|
- <!-- 审核驳回弹窗 -->
|
|
|
- <el-dialog title="驳回原因" :visible.sync="auditRejectDialogVisible" width="400px">
|
|
|
- <el-input type="textarea" :rows="4" v-model="auditRejectReason" placeholder="请输入驳回原因..."></el-input>
|
|
|
- <span slot="footer">
|
|
|
- <el-button @click="auditRejectDialogVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="confirmAuditReject">确认驳回</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <!-- 报名列表对话框 -->
|
|
|
+ <!-- 报名列表对话框(保留) -->
|
|
|
<el-dialog
|
|
|
:title="'报名列表 - ' + (currentActivity ? currentActivity.title : '')"
|
|
|
:visible.sync="regDialogVisible"
|
|
|
@@ -143,14 +124,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getActivityList, publishActivity, endActivity, getRegistrationList, approveRegistration, rejectRegistration, submitActivityReview, auditActivity, withdrawActivity, reDraftActivity } from '@/api/activity'
|
|
|
+import { getActivityList, publishActivity, endActivity, getRegistrationList, approveRegistration, rejectRegistration } from '@/api/activity'
|
|
|
|
|
|
const STATUS_MAP = {
|
|
|
- draft: { label: '草稿箱', type: 'info' },
|
|
|
- pending: { label: '待审核', type: 'warning' },
|
|
|
- rejected: { label: '已驳回', type: 'danger' },
|
|
|
- published: { label: '发布中', type: 'success' },
|
|
|
- withdrawn: { label: '已撤回', type: 'info' }
|
|
|
+ draft: { label: '草稿', type: 'info' },
|
|
|
+ published: { label: '已发布', type: 'success' },
|
|
|
+ ended: { label: '已结束', type: 'danger' }
|
|
|
}
|
|
|
const ACTIVITY_TYPE_MAP = {
|
|
|
offline: '线下活动',
|
|
|
@@ -172,14 +151,6 @@ export default {
|
|
|
loading: false,
|
|
|
activities: [],
|
|
|
total: 0,
|
|
|
- statusTabs: [
|
|
|
- { value: '', label: '全部' },
|
|
|
- { value: 'draft', label: '草稿箱' },
|
|
|
- { value: 'pending', label: '待审核' },
|
|
|
- { value: 'rejected', label: '已驳回' },
|
|
|
- { value: 'published', label: '发布中' },
|
|
|
- { value: 'withdrawn', label: '已撤回' }
|
|
|
- ],
|
|
|
filter: {
|
|
|
status: '',
|
|
|
page: 1,
|
|
|
@@ -189,11 +160,7 @@ export default {
|
|
|
regDialogVisible: false,
|
|
|
regLoading: false,
|
|
|
currentActivity: null,
|
|
|
- registrations: [],
|
|
|
- // 审核驳回
|
|
|
- auditRejectDialogVisible: false,
|
|
|
- auditRejectReason: '',
|
|
|
- currentAuditRow: null
|
|
|
+ registrations: []
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -244,76 +211,11 @@ export default {
|
|
|
try {
|
|
|
await publishActivity(row.id)
|
|
|
this.$message.success('发布成功')
|
|
|
-
|
|
|
this.loadActivities()
|
|
|
} catch (e) {
|
|
|
this.$message.error('发布失败')
|
|
|
}
|
|
|
},
|
|
|
- async handleSubmitReview(row) {
|
|
|
- try {
|
|
|
- await submitActivityReview({ id: row.id })
|
|
|
- this.$message.success('已提交审核')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error(e.message || '提交审核失败')
|
|
|
- }
|
|
|
- },
|
|
|
- async handlePublishDirect(row) {
|
|
|
- try {
|
|
|
- await publishActivity(row.id)
|
|
|
- this.$message.success('发布成功')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error('发布失败')
|
|
|
- }
|
|
|
- },
|
|
|
- async handleAuditApprove(row) {
|
|
|
- try {
|
|
|
- await auditActivity({ id: row.id, action: 'approved' })
|
|
|
- this.$message.success('审核通过')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error(e.message || '审核失败')
|
|
|
- }
|
|
|
- },
|
|
|
- showAuditRejectDialog(row) {
|
|
|
- this.currentAuditRow = row
|
|
|
- this.auditRejectReason = ''
|
|
|
- this.auditRejectDialogVisible = true
|
|
|
- },
|
|
|
- async confirmAuditReject() {
|
|
|
- if (!this.auditRejectReason.trim()) {
|
|
|
- this.$message.warning('请填写驳回原因')
|
|
|
- return
|
|
|
- }
|
|
|
- this.auditRejectDialogVisible = false
|
|
|
- try {
|
|
|
- await auditActivity({ id: this.currentAuditRow.id, action: 'rejected', auditReason: this.auditRejectReason })
|
|
|
- this.$message.success('已驳回')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error(e.message || '驳回失败')
|
|
|
- }
|
|
|
- },
|
|
|
- async handleWithdraw(row) {
|
|
|
- try {
|
|
|
- await withdrawActivity({ id: row.id })
|
|
|
- this.$message.success('已撤回')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error(e.message || '撤回失败')
|
|
|
- }
|
|
|
- },
|
|
|
- async handleReDraft(row) {
|
|
|
- try {
|
|
|
- await reDraftActivity({ id: row.id })
|
|
|
- this.$message.success('已保存到草稿箱')
|
|
|
- this.loadActivities()
|
|
|
- } catch (e) {
|
|
|
- this.$message.error(e.message || '操作失败')
|
|
|
- }
|
|
|
- },
|
|
|
async handleEnd(row) {
|
|
|
try {
|
|
|
await endActivity(row.id)
|
|
|
@@ -378,4 +280,4 @@ export default {
|
|
|
|
|
|
<style scoped>
|
|
|
.activities { padding: 20px; }
|
|
|
-</style>
|
|
|
+</style>
|