Quellcode durchsuchen

feat: publish cancel

Casper Dai vor 3 Jahren
Ursprung
Commit
008e3415a7
3 geänderte Dateien mit 34 neuen und 4 gelöschten Zeilen
  1. 7 0
      src/api/platform.js
  2. 1 0
      src/constant.js
  3. 26 4
      src/views/schedule/history/index.vue

+ 7 - 0
src/api/platform.js

@@ -63,6 +63,13 @@ export function getPublishHistory (query) {
   })
 }
 
+export function cancelPublish (calendarReleaseHisId, name) {
+  return confirmAndSend('下架', name, {
+    url: `/orchestration/calendarReleaseSchedu/${calendarReleaseHisId}/off`,
+    method: 'POST'
+  })
+}
+
 // 日志
 export function getLogs (query) {
   const { pageNum: pageIndex, pageSize, ...params } = query

+ 1 - 0
src/constant.js

@@ -27,6 +27,7 @@ export const State = {
   SUBMITTED: 1,
   RESOLVED: 2,
   REJECTED: 3,
+  CANCEL: 7,
   // 占位值
   REVIEW: 99,
   AVAILABLE: 100,

+ 26 - 4
src/views/schedule/history/index.vue

@@ -16,7 +16,10 @@
 </template>
 
 <script>
-import { getPublishHistory } from '@/api/platform'
+import {
+  getPublishHistory,
+  cancelPublish
+} from '@/api/platform'
 import {
   State,
   EventPriority,
@@ -30,7 +33,6 @@ export default {
   data () {
     return {
       schema: {
-        condition: { status: State.RESOLVED },
         list: getPublishHistory,
         transform: this.transform,
         cols: [
@@ -44,9 +46,22 @@ export default {
           } },
           { prop: 'type', label: '类型', width: 100 },
           { prop: 'name', label: '名称', 'min-width': 100 },
-          { prop: 'createBy', label: '申请人' },
+          { prop: 'createBy', label: '发布人' },
           { prop: 'createTime', label: '发布时间' },
+          { label: '状态', type: 'tag', render ({ status }) {
+            if (status === State.CANCEL) {
+              return {
+                type: 'danger',
+                label: '已下架'
+              }
+            }
+            return {
+              type: 'success',
+              label: '正常'
+            }
+          } },
           { type: 'invoke', render: [
+            { label: '下架', render: ({ status }) => status === State.RESOLVED, on: this.onCancel },
             { label: '查看', on: this.onView }
           ] }
         ]
@@ -59,8 +74,10 @@ export default {
       const diff = this.getDiff(item)
       return { ...same, ...diff }
     },
-    getSame ({ programCalendarName, resolutionRatio, createBy, createByUsername, createTime, calendarReleaseDeviceList }) {
+    getSame ({ id, status, programCalendarName, resolutionRatio, createBy, createByUsername, createTime, calendarReleaseDeviceList }) {
       return {
+        id,
+        status,
         name: programCalendarName,
         resolutionRatio,
         createBy: createByUsername || createBy,
@@ -114,6 +131,11 @@ export default {
     },
     viewSchedule (id) {
       this.$refs.scheduleDialog.show(id)
+    },
+    onCancel (publishItem) {
+      cancelPublish(publishItem.id, publishItem.name).then(() => {
+        publishItem.status = State.CANCEL
+      })
     }
   }
 }