|
| 1 | +<template> |
| 2 | + <el-drawer |
| 3 | + v-model="visible" |
| 4 | + size="800px" |
| 5 | + :modal="false" |
| 6 | + destroy-on-close |
| 7 | + :before-close="closeHandle" |
| 8 | + :close-on-click-modal="false" |
| 9 | + :close-on-press-escape="false" |
| 10 | + :show-close="false" |
| 11 | + > |
| 12 | + <template #header> |
| 13 | + <div class="flex align-center" style="margin-left: -8px"> |
| 14 | + <el-button class="cursor mr-4" link @click.prevent="visible = false"> |
| 15 | + <el-icon :size="20"> |
| 16 | + <Back /> |
| 17 | + </el-icon> |
| 18 | + </el-button> |
| 19 | + <h4>{{ $t('chat.executionDetails.title') }}</h4> |
| 20 | + </div> |
| 21 | + </template> |
| 22 | + <div> |
| 23 | + <el-scrollbar> |
| 24 | + <h4 class="title-decoration-1 mb-16 mt-4"> |
| 25 | + {{ $t('workflow.ExecutionRecord') }} |
| 26 | + </h4> |
| 27 | + <el-card class="mb-24" shadow="never" style="--el-card-padding: 12px 16px"> |
| 28 | + <el-row :gutter="16" class="lighter"> |
| 29 | + <el-col :span="6"> |
| 30 | + <p class="color-secondary mb-4">{{ $t('views.trigger.triggerTask') }}</p> |
| 31 | + <p class="flex align-center"> |
| 32 | + <el-avatar shape="square" :size="22" style="background: none" class="mr-8"> |
| 33 | + <img |
| 34 | + v-if="props.currentContent?.source_type === 'TOOL'" |
| 35 | + :src="resetUrl(props.currentContent?.source_icon, resetUrl('./favicon.ico'))" |
| 36 | + alt="" |
| 37 | + /> |
| 38 | + <img |
| 39 | + v-if="props.currentContent?.source_type === 'APPLICATION'" |
| 40 | + :src="resetUrl(props.currentContent?.source_icon, resetUrl('./favicon.ico'))" |
| 41 | + alt="" |
| 42 | + /> |
| 43 | + </el-avatar> |
| 44 | + |
| 45 | + <span class="ellipsis-1" :title="props.currentContent?.source_name">{{ |
| 46 | + props.currentContent?.source_name || '-' |
| 47 | + }}</span> |
| 48 | + </p> |
| 49 | + </el-col> |
| 50 | + <el-col :span="6"> |
| 51 | + <p class="color-secondary mb-4">{{ $t('common.status.label') }}</p> |
| 52 | + <p> |
| 53 | + <el-text |
| 54 | + class="color-text-primary" |
| 55 | + v-if="props.currentContent?.state === 'SUCCESS'" |
| 56 | + > |
| 57 | + <el-icon class="color-success"><SuccessFilled /></el-icon> |
| 58 | + {{ $t('common.status.success') }} |
| 59 | + </el-text> |
| 60 | + <el-text |
| 61 | + class="color-text-primary" |
| 62 | + v-else-if="props.currentContent?.state === 'FAILURE'" |
| 63 | + > |
| 64 | + <el-icon class="color-danger"><CircleCloseFilled /></el-icon> |
| 65 | + {{ $t('common.status.fail') }} |
| 66 | + </el-text> |
| 67 | + <el-text |
| 68 | + class="color-text-primary" |
| 69 | + v-else-if="props.currentContent?.state === 'REVOKED'" |
| 70 | + > |
| 71 | + <el-icon class="color-danger"><CircleCloseFilled /></el-icon> |
| 72 | + {{ $t('common.status.REVOKED') }} |
| 73 | + </el-text> |
| 74 | + <el-text |
| 75 | + class="color-text-primary" |
| 76 | + v-else-if="props.currentContent?.state === 'REVOKE'" |
| 77 | + > |
| 78 | + <el-icon class="is-loading color-primary"><Loading /></el-icon> |
| 79 | + {{ $t('common.status.REVOKE') }} |
| 80 | + </el-text> |
| 81 | + <el-text class="color-text-primary" v-else> |
| 82 | + <el-icon class="is-loading color-primary"><Loading /></el-icon> |
| 83 | + {{ $t('common.status.STARTED') }} |
| 84 | + </el-text> |
| 85 | + </p> |
| 86 | + </el-col> |
| 87 | + <el-col :span="6"> |
| 88 | + <p class="color-secondary mb-4">{{ $t('chat.KnowledgeSource.consumeTime') }}</p> |
| 89 | + <p> |
| 90 | + {{ |
| 91 | + props.currentContent?.run_time != undefined |
| 92 | + ? props.currentContent?.run_time?.toFixed(2) + 's' |
| 93 | + : '-' |
| 94 | + }} |
| 95 | + </p> |
| 96 | + </el-col> |
| 97 | + <el-col :span="6"> |
| 98 | + <p class="color-secondary mb-4">{{ $t('chat.executionDetails.createTime') }}</p> |
| 99 | + <p>{{ datetimeFormat(props.currentContent?.create_time) }}</p> |
| 100 | + </el-col> |
| 101 | + </el-row> |
| 102 | + </el-card> |
| 103 | + <h4 class="title-decoration-1 mb-16 mt-4"> |
| 104 | + {{ $t('chat.executionDetails.title') }} |
| 105 | + </h4> |
| 106 | + <template v-for="(item, index) in arraySort(detail ?? [], 'index')" :key="index"> |
| 107 | + <ExecutionDetailCard :data="item"> </ExecutionDetailCard> |
| 108 | + </template> |
| 109 | + </el-scrollbar> |
| 110 | + </div> |
| 111 | + <template #footer> |
| 112 | + <div> |
| 113 | + <el-button @click="pre" :disabled="pre_disable || loading">{{ |
| 114 | + $t('common.pages.prev') |
| 115 | + }}</el-button> |
| 116 | + <el-button @click="next" :disabled="next_disable || loading">{{ |
| 117 | + $t('common.pages.next') |
| 118 | + }}</el-button> |
| 119 | + </div> |
| 120 | + </template> |
| 121 | + </el-drawer> |
| 122 | +</template> |
| 123 | + |
| 124 | +<script setup lang="ts"> |
| 125 | +import { ref, computed, watch } from 'vue' |
| 126 | +import { useRoute } from 'vue-router' |
| 127 | +import { arraySort } from '@/utils/array' |
| 128 | +import { isAppIcon, resetUrl } from '@/utils/common' |
| 129 | +import ExecutionDetailCard from '@/components/execution-detail-card/index.vue' |
| 130 | +import { datetimeFormat } from '@/utils/time' |
| 131 | +import triggerAPI from '@/api/trigger/trigger' |
| 132 | +const props = withDefaults( |
| 133 | + defineProps<{ |
| 134 | + /** |
| 135 | + * 当前的action_id |
| 136 | + */ |
| 137 | + currentId: string |
| 138 | + currentContent: any |
| 139 | + /** |
| 140 | + * 下一条 |
| 141 | + */ |
| 142 | + next: () => void |
| 143 | + /** |
| 144 | + * 上一条 |
| 145 | + */ |
| 146 | + pre: () => void |
| 147 | +
|
| 148 | + pre_disable: boolean |
| 149 | +
|
| 150 | + next_disable: boolean |
| 151 | + }>(), |
| 152 | + {}, |
| 153 | +) |
| 154 | +
|
| 155 | +const emit = defineEmits(['update:currentId', 'update:currentContent']) |
| 156 | +
|
| 157 | +const route = useRoute() |
| 158 | +
|
| 159 | +const apiType = computed(() => { |
| 160 | + if (route.path.includes('shared')) { |
| 161 | + return 'systemShare' |
| 162 | + } else if (route.path.includes('resource-management')) { |
| 163 | + return 'systemManage' |
| 164 | + } else { |
| 165 | + return 'workspace' |
| 166 | + } |
| 167 | +}) |
| 168 | +
|
| 169 | +const detail = ref<any>(null) |
| 170 | +
|
| 171 | +const loading = ref(false) |
| 172 | +const visible = ref(false) |
| 173 | +
|
| 174 | +function closeHandle() {} |
| 175 | +
|
| 176 | +watch( |
| 177 | + () => props.currentId, |
| 178 | + () => { |
| 179 | + getDetail() |
| 180 | + }, |
| 181 | +) |
| 182 | +
|
| 183 | +watch(visible, (bool) => { |
| 184 | + if (!bool) { |
| 185 | + emit('update:currentId', '') |
| 186 | + emit('update:currentContent', null) |
| 187 | + } |
| 188 | +}) |
| 189 | +
|
| 190 | +function getDetail() { |
| 191 | + triggerAPI |
| 192 | + .getTriggerTaskRecordDetails( |
| 193 | + props.currentContent?.trigger_id, |
| 194 | + props.currentContent?.trigger_task_id, |
| 195 | + props.currentContent?.id, |
| 196 | + ) |
| 197 | + .then((ok) => { |
| 198 | + detail.value = Object.values(ok.data.details) |
| 199 | + }) |
| 200 | +} |
| 201 | +
|
| 202 | +const open = (row: any) => { |
| 203 | + visible.value = true |
| 204 | +} |
| 205 | +
|
| 206 | +defineExpose({ |
| 207 | + open, |
| 208 | +}) |
| 209 | +</script> |
| 210 | +<style lang="scss"></style> |
0 commit comments