Sfoglia il codice sorgente

fix(audit): abnormal status

daigang 2 anni fa
parent
commit
bf72b4b22b

+ 5 - 3
src/constant.js

@@ -70,9 +70,9 @@ export const WorkflowStateInfo = {
   [State.SECOND_LEVEL_DOING]: '二审',
   [State.SECOND_LEVEL]: '二审通过',
   [State.SECOND_LEVEL_REJECTED]: '二审驳回',
-  [State.FINAL_LEVEL_DOING]: '审',
-  [State.RESOLVED]: '审通过',
-  [State.REJECTED]: '审驳回',
+  [State.FINAL_LEVEL_DOING]: '审',
+  [State.RESOLVED]: '审通过',
+  [State.REJECTED]: '审驳回',
   [State.WORKFLOW_DONE]: '流程结束'
 }
 
@@ -214,6 +214,8 @@ export const RoleAccess = {
     Access.MANAGE_TENANT,
     Access.MANAGE_GROUP,
     Access.MANAGE_CALENDAR,
+    Access.REVIEW_RELEASE_FIRST,
+    Access.REVIEW_RELEASE_SECOND,
     Access.REVIEW_RELEASE_FINAL
   ],
   [Role.ADMIN]: [

+ 2 - 2
src/views/device/detail/components/DeviceExternal/external/Gateway/index.vue

@@ -39,7 +39,7 @@
               @click="getPLCs"
             />
             <div
-              v-if="!plcOptions.loading && plcOptions.list.length === 0"
+              v-else-if="!plcOptions.loading && plcOptions.list.length === 0"
               class="c-sibling-item--v u-font-size--sm u-color--info"
             >
               暂未绑定
@@ -75,7 +75,7 @@
               @click="getSensors"
             />
             <div
-              v-if="!sensorOptions.loading && sensorOptions.list.length === 0"
+              v-else-if="!sensorOptions.loading && sensorOptions.list.length === 0"
               class="c-sibling-item--v u-font-size--sm u-color--info"
             >
               暂未绑定

+ 1 - 1
src/views/external/mesh/index.vue

@@ -446,7 +446,7 @@ export default {
             ]
           }
         default:
-          return {}
+          return { cols: [] }
       }
     }
   },

+ 2 - 2
src/views/platform/tenant/device/settings/components/external/Gateway/index.vue

@@ -48,7 +48,7 @@
               @click="getPLCs"
             />
             <div
-              v-if="!plcOptions.loading && plcOptions.list.length === 0"
+              v-else-if="!plcOptions.loading && plcOptions.list.length === 0"
               class="c-sibling-item--v u-font-size--sm u-color--info"
             >
               暂未绑定
@@ -84,7 +84,7 @@
               @click="getSensors"
             />
             <div
-              v-if="!sensorOptions.loading && sensorOptions.list.length === 0"
+              v-else-if="!sensorOptions.loading && sensorOptions.list.length === 0"
               class="c-sibling-item--v u-font-size--sm u-color--info"
             >
               暂未绑定

+ 37 - 14
src/views/screen/review/workflow/audit/components/ReviewPublish.vue

@@ -7,7 +7,7 @@
     />
     <div class="l-flex__fill c-sibling-item--v u-overflow-y--auto">
       <div class="c-sibling-item--v u-font-size--sm u-color--black u-bold">目标设备</div>
-      <div class="c-sibling-item--v near c-devices u-color--info u-line-height">
+      <div class="c-sibling-item--v near c-devices u-color--info">
         <div
           v-for="device in devices"
           :key="device.deviceId"
@@ -76,7 +76,9 @@ import {
   EventTarget,
   AssetTagInfo,
   AssetTypeInfo,
-  Access
+  Access,
+  State,
+  JUMP_REVIEW
 } from '@/constant'
 import {
   parseByte,
@@ -173,19 +175,40 @@ export default {
     devices () {
       return this.list?.[0].devices
     },
+    status () {
+      return this.workflow.status
+    },
+    isSecondLevel () {
+      return this.status === State.FIRST_LEVEL
+    },
+    isFinalLevel () {
+      return this.status === State.SECOND_LEVEL
+    },
     resolveInvoke () {
-      return this.access.has(Access.REVIEW_RELEASE_FINAL)
-        ? resolveFinal
-        : this.access.has(Access.REVIEW_RELEASE_SECOND)
-          ? resolveSecondLevel
-          : resolveFirstLevel
+      if (JUMP_REVIEW && this.access.has(Access.REVIEW_RELEASE_FINAL)) {
+        return resolveFinal
+      }
+      switch (this.workflow.status) {
+        case State.SUBMITTED:
+          return resolveFirstLevel
+        case State.FIRST_LEVEL:
+          return resolveSecondLevel
+        default:
+          return resolveFinal
+      }
     },
     rejectInvoke () {
-      return this.access.has(Access.REVIEW_RELEASE_FINAL)
-        ? rejectFinal
-        : this.access.has(Access.REVIEW_RELEASE_SECOND)
-          ? rejectSecondLevel
-          : rejectFirstLevel
+      if (JUMP_REVIEW && this.access.has(Access.REVIEW_RELEASE_FINAL)) {
+        return rejectFinal
+      }
+      switch (this.workflow.status) {
+        case State.SUBMITTED:
+          return rejectFirstLevel
+        case State.FIRST_LEVEL:
+          return rejectSecondLevel
+        default:
+          return rejectFinal
+      }
     },
     publishTarget () {
       return this.list?.[0].target
@@ -285,7 +308,7 @@ export default {
     },
     onResolve () {
       this.$confirm(
-        this.access.has(Access.REVIEW_RELEASE_FINAL) ? '立即发布?' : '审核通过?',
+        '审核通过?',
         '操作确认',
         { type: 'warning' }
       ).then(() => {
@@ -327,6 +350,6 @@ export default {
 .c-devices {
   display: flex;
   flex-wrap: wrap;
-  gap: $spacing--sm;
+  gap: $spacing--xs;
 }
 </style>

+ 30 - 13
src/views/screen/review/workflow/audit/index.vue

@@ -128,11 +128,20 @@ export default {
       return this.$route.params.id
     },
     title () {
-      return this.access.has(Access.REVIEW_RELEASE_FINAL)
-        ? '终审'
-        : this.access.has(Access.REVIEW_RELEASE_SECOND)
-          ? '二审'
-          : '一审'
+      if (JUMP_REVIEW && this.access.has(Access.REVIEW_RELEASE_FINAL)) {
+        return '三审'
+      }
+      if (this.workflow) {
+        switch (this.workflow.status) {
+          case State.SUBMITTED:
+            return '一审'
+          case State.FIRST_LEVEL:
+            return '二审'
+          default:
+            return '三审'
+        }
+      }
+      return ''
     },
     createBy () {
       if (this.workflow) {
@@ -184,13 +193,21 @@ export default {
       return this.process[this.active]
     },
     status () {
-      return this.access.has(Access.REVIEW_RELEASE_FINAL)
-        ? JUMP_REVIEW
-          ? [State.SUBMITTED, State.SECOND_LEVEL, State.FINAL_LEVEL]
-          : [State.FINAL_LEVEL]
-        : this.access.has(Access.REVIEW_RELEASE_SECOND)
-          ? [State.SECOND_LEVEL]
-          : [State.SUBMITTED]
+      const isFinal = this.access.has(Access.REVIEW_RELEASE_FINAL)
+      if (isFinal && JUMP_REVIEW) {
+        return [State.SUBMITTED, State.FIRST_LEVEL, State.SECOND_LEVEL]
+      }
+      const arr = []
+      if (isFinal) {
+        arr.push(State.SECOND_LEVEL)
+      }
+      if (this.access.has(Access.REVIEW_RELEASE_SECOND)) {
+        arr.push(State.FIRST_LEVEL)
+      }
+      if (this.access.has(Access.REVIEW_RELEASE_FIRST)) {
+        arr.push(State.SUBMITTED)
+      }
+      return arr
     }
   },
   created () {
@@ -202,7 +219,7 @@ export default {
       this.error = false
       getWorkflow(this.id).then(
         ({ data }) => {
-          if (this.status.includes(data.calendarReleaseScheduling.status)) {
+          if (!data.status || this.status.includes(data.status)) {
             this.workflow = data
             this.loading = false
           } else {

+ 15 - 7
src/views/screen/review/workflow/index.vue

@@ -52,13 +52,21 @@ export default {
   computed: {
     ...mapGetters(['access']),
     status () {
-      return this.access.has(Access.REVIEW_RELEASE_FINAL)
-        ? JUMP_REVIEW
-          ? [State.SUBMITTED, State.FIRST_LEVEL, State.SECOND_LEVEL]
-          : [State.SECOND_LEVEL]
-        : this.access.has(Access.REVIEW_RELEASE_SECOND)
-          ? [State.FIRST_LEVEL]
-          : [State.SUBMITTED]
+      const isFinal = this.access.has(Access.REVIEW_RELEASE_FINAL)
+      if (isFinal && JUMP_REVIEW) {
+        return [State.SUBMITTED, State.FIRST_LEVEL, State.SECOND_LEVEL]
+      }
+      const arr = []
+      if (isFinal) {
+        arr.push(State.SECOND_LEVEL)
+      }
+      if (this.access.has(Access.REVIEW_RELEASE_SECOND)) {
+        arr.push(State.FIRST_LEVEL)
+      }
+      if (this.access.has(Access.REVIEW_RELEASE_FIRST)) {
+        arr.push(State.SUBMITTED)
+      }
+      return arr
     }
   },
   activated () {