|
|
@@ -676,6 +676,13 @@
|
|
|
:disabled="checkerIsLoginUser"
|
|
|
size="small"
|
|
|
>{{ selectedItem.reportType === PressureReportType['SUGGUESTION'] ? '编制意见书' : '填写记录' }}</el-button>
|
|
|
+ <!-- 撤销流程:报告审核或审批阶段,有OA流程ID且当前用户是发起人时显示 -->
|
|
|
+ <el-button
|
|
|
+ v-if="isCanCancelFlow"
|
|
|
+ type="warning"
|
|
|
+ @click="handleCancelFlow"
|
|
|
+ size="small"
|
|
|
+ >撤销流程</el-button>
|
|
|
<!-- <el-button v-if="isCanSyncReportData" type="primary" @click="handleSyncReportData" :disabled="checkerIsLoginUser" size="small"-->
|
|
|
<!-- >同步报表</el-button>-->
|
|
|
</template>
|
|
|
@@ -1212,7 +1219,43 @@ const isCanEditReport = computed(
|
|
|
props.selectedItem.taskStatus === PressureCheckerMyTaskStatus['REPORT_INPUT']
|
|
|
)
|
|
|
|
|
|
-// 判断“填写结果”按钮是否显示
|
|
|
+// 判断"撤销流程"按钮是否显示:报告审核或审批阶段,且有OA流程ID,且当前用户是发起人
|
|
|
+const isCanCancelFlow = computed(() => {
|
|
|
+ if (!props.selectedItem) return false
|
|
|
+ const isAuditOrApprove = [
|
|
|
+ PressureCheckerMyTaskStatus['REPORT_AUDIT'],
|
|
|
+ PressureCheckerMyTaskStatus['REPORT_APPROVE']
|
|
|
+ ].includes(props.selectedItem.taskStatus)
|
|
|
+ if (!isAuditOrApprove) return false
|
|
|
+ if (!props.selectedItem.summaryId) return false
|
|
|
+ return !checkerIsLoginUser.value
|
|
|
+})
|
|
|
+
|
|
|
+// 撤销流程
|
|
|
+const handleCancelFlow = async () => {
|
|
|
+ if (!props.selectedItem?.summaryId) {
|
|
|
+ ElMessage.warning('未找到OA流程ID,无法撤销')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm('确定要撤销该流程吗?撤销后报告将回到报告编制阶段,您可以重新发起。', '撤销流程', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ try {
|
|
|
+ const result = await PipeTaskOrderApi.cancelOAFlow(props.selectedItem.summaryId)
|
|
|
+ if (result) {
|
|
|
+ ElMessage.success('流程已撤销')
|
|
|
+ handleRefresh()
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('撤销流程失败:', error)
|
|
|
+ ElMessage.error('撤销流程失败,请稍后重试')
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+}
|
|
|
+
|
|
|
+// 判断"填写结果"按钮是否显示
|
|
|
const isCanEditRecordResult = computed(() => {
|
|
|
// 非我的任务详情页面,不显示
|
|
|
if ('PipeCheckerTaskDetail' !== routeName.value) return false
|