Преглед на файлове

fix(workflow): reject jump

fenghao преди 3 години
родител
ревизия
def12ca6dc
променени са 2 файла, в които са добавени 33 реда и са изтрити 26 реда
  1. 19 3
      src/views/review/workflow/detail/components/ReviewDialog.vue
  2. 14 23
      src/views/review/workflow/detail/index.vue

+ 19 - 3
src/views/review/workflow/detail/components/ReviewDialog.vue

@@ -108,7 +108,9 @@
 
 <script>
 import { getAssetUrl } from '@/api/asset'
-import { AssetType } from '@/constant'
+import {
+  AssetType, State
+} from '@/constant'
 export default {
   name: 'ReviewDialog',
   props: {
@@ -150,7 +152,7 @@ export default {
   },
   computed: {
     showOpt () {
-      return ![2, 3].includes(this.form.status)
+      return ![State.RESOLVED, State.REJECTED].includes(this.form.status)
     },
     form () {
       return this.list[this.index] || {}
@@ -187,17 +189,31 @@ export default {
       this.$refs.previewDialog.show(this.source)
     },
     resolve () {
-      this.$emit('resolve', this.form)
+      this.$emit('resolve', this.form, () => this.nextWaiting())
     },
     reject () {
       this.$emit(
         'reject',
         () => {
           this.$message.success('驳回成功!')
+          this.nextWaiting()
         },
         { item: this.form, review: this.review }
       )
     },
+    nextWaiting () {
+      const list = this.list.map((i, index) => { return { ...i, index } }).filter(i => ![State.REJECTEDt, State.RESOLVED].includes(i.status))
+      if (!list.length) {
+        this.isReviewing = false
+      }
+      for (const item of list) {
+        if (this.index < item.index) {
+          this.next(item.index - this.index)
+          return
+        }
+      }
+      this.next(list[0].index + this.list.length - this.index)
+    },
     next (gap) {
       const position = this.index
       let index = (position + gap) % this.list.length

+ 14 - 23
src/views/review/workflow/detail/index.vue

@@ -11,7 +11,7 @@
       :error="error"
       @click="getPublishWorkflowDetail"
     />
-    <div v-if="dataMap.length">
+    <template v-if="dataMap.length">
       <div class="l-flex--row o-title has-bottom-padding u-color--black u-bold">{{ title }} <span class="applicant">{{ createBy?`申请人:${createBy}`:'' }}</span></div>
       <div class="l-flex--row has-padding">
         <el-steps
@@ -114,7 +114,7 @@
           </template>
         </div>
       </confirm-dialog>
-    </div>
+    </template>
   </wrapper>
 </template>
 
@@ -134,7 +134,6 @@ import {
 import mediaMixin from '@/views/platform/media/mixin.js'
 import {
   State,
-  ScheduleType,
   EventPriority,
   EventFreq,
   EventTarget,
@@ -242,10 +241,7 @@ export default {
       switch (this.backDataType) {
         case front2back['assets']:
           return {
-            singlePage: true,
-            condition: { status: State.REVIEW },
             list: this.getList('assets'),
-            // transform: this.transform,
             cols: [
               { prop: 'typeName', label: '类型', align: 'center', width: 80 },
               { prop: 'file', type: 'asset', on: this.onViewAsset },
@@ -267,16 +263,15 @@ export default {
               {
                 type: 'invoke',
                 width: 80,
-                render: [{ label: '审核', on: this.onView }]
+                render: [{ label: '审核', on: this.onView, render ({ status }) {
+                  return showOpt(status)
+                } }]
               }
             ]
           }
         case front2back['program']:
           return {
-            singlePage: true,
-            condition: { status: State.REVIEW },
             list: this.getList('program'),
-            // transform: this.transform,
             cols: [
               { prop: 'name', label: '节目名称', 'min-width': 100 },
               { prop: 'resolutionRatio', label: '分辨率' },
@@ -317,11 +312,6 @@ export default {
         case front2back['programRecur']:
         case front2back['schedule']:
           return {
-            singlePage: true,
-            condition: {
-              type: ScheduleType.COMPLEX,
-              status: State.REVIEW
-            },
             list: this.getList('schedule'),
             cols: [
               { prop: 'name', label: '排期名称', 'min-width': 100 },
@@ -362,10 +352,7 @@ export default {
           }
         case front2back['publish']:
           return {
-            singlePage: true,
-            condition: { status: State.REVIEW },
             list: this.getList('publish'),
-            // transform: this.transform,
             cols: [
               {
                 prop: 'expand',
@@ -488,7 +475,7 @@ export default {
       this.getPublishWorkflowDetail()
     },
     refreshStatus (item, status, review) {
-      const list = this.sourceMap[this.backDataType]
+      const list = this.tableData
       const index = list.findIndex(i => i.id === item.id)
       list[index].status = status
       this.$refs.table.onPagination()
@@ -501,7 +488,7 @@ export default {
       }
     },
     getList () {
-      return () => Promise.resolve({ data: this.tableData })
+      return () => Promise.resolve({ data: this.tableData, totalCount: 1 })
     },
     // 全部审批通过
     nextStep () {
@@ -669,9 +656,10 @@ export default {
       }
     },
     // 通过
-    onResolve (item) {
+    onResolve (item, done) {
       this.resolve(item).then(() => {
         this.refreshStatus(item, State.RESOLVED)
+        done()
       })
     },
     resolve (item) {
@@ -731,10 +719,13 @@ export default {
             type: this.review.type,
             reason: this.review.reason
           })
+          // 自动触发媒资驳回的二次确认弹窗
+          if (!this.tableData.filter(i => ![State.RESOLVED, State.REJECTED].includes(i.status)).length) {
+            this.reject()
+          }
         })
       } else {
-        // 取最新
-        done()
+        // 单数据方取最新 直接驳回接口 单数据方法不回调,确认验证在接口方法
         this.reject([rejectInfo], rejectInfo.name)
       }
     },