Forráskód Böngészése

feat: workflow use constant

fenghao 3 éve
szülő
commit
e729585de7

+ 24 - 6
src/views/review/components/MyWorkflow.vue

@@ -5,7 +5,6 @@
       class="c-tabs has-bottom-padding"
       @tab-click="onTabClick"
     >
-
       <el-tab-pane
         label="待审核"
         name="1"
@@ -26,7 +25,6 @@
     />
     <schedule-dialog ref="scheduleDialog" />
   </div>
-
 </template>
 
 <script>
@@ -34,7 +32,7 @@ import {
   getPublishWorkflows, calendarPublishRestart
 } from '@/api/workflow'
 import {
-  PublishType, EventPriority
+  PublishType, EventPriority, State
 } from '@/constant'
 import { getEventDescription } from '@/utils/event'
 export default {
@@ -86,9 +84,13 @@ export default {
             width: 160,
             render: [
               { label: '查看', on: this.onView },
-              { label: '提交', render ({ status }) {
-                return status === 3
-              }, on: this.restart }
+              {
+                label: '提交',
+                render ({ status }) {
+                  return status === State.REJECTED
+                },
+                on: this.restart
+              }
             ]
           }
         ]
@@ -174,6 +176,22 @@ export default {
           break
       }
     },
+    onEdit ({ target: { type, detail } }) {
+      switch (type) {
+        case PublishType.CALENDAR:
+          this.viewSchedule(detail)
+          break
+        case PublishType.EVENT:
+          if (detail.target.type === EventTarget.RECUR) {
+            this.viewSchedule(detail.target.id)
+          } else {
+            this.viewProgram(detail.target.id)
+          }
+          break
+        default:
+          break
+      }
+    },
     viewSchedule (id) {
       this.$refs.scheduleDialog.show(id)
     },

+ 8 - 8
src/views/review/detail/index.vue

@@ -173,7 +173,7 @@ const data2label = {
   calendarReleaseScheduling: '发布'
 }
 function showOpt (status) {
-  return ![2, 3].includes(status)
+  return ![State.RESOLVED, State.REJECTED].includes(status)
 }
 const allDataMap = [
   'minios',
@@ -426,7 +426,7 @@ export default {
           text: `${data2label[item]}驳回`,
           show:
             !this.tempRejectMap.length
-            && this.sourceMap[item].filter(i => ![2, 3].includes(i.status))
+            && this.sourceMap[item].filter(i => ![State.RESOLVED, State.REJECTED].includes(i.status))
               .length
         }
       }
@@ -463,7 +463,7 @@ export default {
             this.tempRejectMap[item] = {
               text: `${data2label[item]}驳回`,
               length: this.sourceMap[item].filter(
-                i => ![2, 3].includes(i.status)
+                i => ![State.RESOLVED, State.REJECTED].includes(i.status)
               ).length
             }
           }
@@ -473,7 +473,7 @@ export default {
       // 确定节点
       let active = 0
       for (const item of this.dataMap) {
-        if (this.sourceMap[item].every(i => i.status === 2)) {
+        if (this.sourceMap[item].every(i => i.status === State.RESOLVED)) {
           active++
           continue
         }
@@ -493,11 +493,11 @@ export default {
       const index = list.findIndex(i => i.id === item.id)
       list[index].status = status
       this.$refs.table.onPagination()
-      if (status === 2 && this.tableData.every(i => i.status === 2)) {
+      if (status === State.RESOLVED && this.tableData.every(i => i.status === State.RESOLVED)) {
         this.closePreviewDialog()
         this.nextStep()
       }
-      if (status === 3) {
+      if (status === State.REJECTED) {
         list[index].review = review
       }
     },
@@ -678,7 +678,7 @@ export default {
     // 通过
     onResolve (item) {
       this.resolve(item).then(() => {
-        this.refreshStatus(item, 2)
+        this.refreshStatus(item, State.RESOLVED)
       })
     },
     resolve (item) {
@@ -734,7 +734,7 @@ export default {
           // 缓存驳回数据
           done()
           this.tempRejectInfo.push(rejectInfo)
-          this.refreshStatus(this.$item, 3, {
+          this.refreshStatus(this.$item, State.REJECTED, {
             type: this.review.type,
             reason: this.review.reason
           })