htc пре 3 дана
родитељ
комит
9ec9f53fea
1 измењених фајлова са 16 додато и 1 уклоњено
  1. 16 1
      src/views/modules/activity/list.vue

+ 16 - 1
src/views/modules/activity/list.vue

@@ -70,6 +70,7 @@
                       <!-- <el-button link type="text" @click="handleUpDown(scope.row,0)" v-if="scope.row.state==1&&(scope.row.activeState==0||scope.row.activeState==3)&&$hasPermission('core:activity:updown')">下架</el-button> -->
                       <el-button link type="text" @click="handleUpDown(scope.row,0)" v-if="scope.row.state==1&&$hasPermission('core:activity:updown')">下架</el-button>
                       <el-button link type="text" @click="handleUpDown(scope.row,1)" v-if="scope.row.state==0&&$hasPermission('core:activity:updown')">上架</el-button>
+                      <el-button link type="text" @click="handleCancel(scope.row)" v-if="$hasPermission('core:activity:cancel')&&scope.row.activeState!=-1&&(Date.parse(new Date())>Date.parse(scope.row.signupEndTime)&&Date.parse(new Date())<Date.parse(scope.row.activityStartTime))">取消</el-button>
                       <el-button link type="text" @click="handleDelete(scope.row)" v-if="$hasPermission('core:activity:delete')&&scope.row.state==0&&scope.row.activeState==0">删除</el-button>
                   </template>
               </el-table-column>
@@ -102,6 +103,7 @@ export default {
   data () {
     return {
       activeStateCfg: {
+        '-1': '已取消',
         0: '未开始',
         1: '报名中',
         2: '进行中',
@@ -213,7 +215,7 @@ export default {
       this.show = false
     },
     handleUpDown (row, state) {
-      if (row.recruitmentNow > 0) return this.$message.error('当前活动已存在报名人数,无法下架')
+      if ([1, 2].includes(row.activeState) && row.recruitmentNow > 0) return this.$message.error('当前活动已存在报名人数,无法下架')
       this.$confirm(`是否确认${state ? '上架' : '下架'}活动【${row.activityName}】?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -226,6 +228,19 @@ export default {
         })
       })
     },
+    handleCancel (row) {
+      this.$confirm(`是否确认取消活动【${row.activityName}】?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http.get(`core/activity/cancelEvent/${row.id}`).then(res => {
+          if (res.data.code !== 0) return this.$message.error(res.data.msg)
+          this.$message.success('取消成功')
+          this.getList()
+        })
+      }).catch(() => {})
+    },
     handleDelete (row) {
       this.$confirm(`是否确认删除活动【${row.activityName}】?`, '提示', {
         confirmButtonText: '确定',