|
|
@@ -0,0 +1,86 @@
|
|
|
+<template>
|
|
|
+ <div class="page">
|
|
|
+ <div class="top adfacjb">
|
|
|
+ <div>
|
|
|
+ <p>问卷报告</p>
|
|
|
+ <p class="tip">{{ title }}<span v-if="teamName"> · {{ teamName }}</span></p>
|
|
|
+ </div>
|
|
|
+ <el-button @click="$router.back()">返回问卷</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="dataList" border v-loading="loading" empty-text="暂无报告" style="margin-top: 18px;">
|
|
|
+ <el-table-column label="序号" width="60">
|
|
|
+ <template #default="scope">{{ scope.$index + 1 }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="报告名称" prop="reportName" min-width="220" />
|
|
|
+ <el-table-column label="报告类型" width="130">
|
|
|
+ <template #default="scope">{{ reportTypeDict[scope.row.reportType] || '报告' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="报告状态" width="110">
|
|
|
+ <template #default="scope">{{ stateDict[scope.row.state] || '未知' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="团队名称" prop="teamName" min-width="150" />
|
|
|
+ <el-table-column label="创建时间" prop="createDate" min-width="160" />
|
|
|
+ <el-table-column label="操作" width="390">
|
|
|
+ <template #default="scope">
|
|
|
+ <template v-if="isGenerated(scope.row)">
|
|
|
+ <el-button link type="text" size="mini" @click="handleReview(scope.row, 'personal')">个人报告</el-button>
|
|
|
+ <el-button link type="text" size="mini" @click="handleReview(scope.row, 'background')">背景报告</el-button>
|
|
|
+ <el-button link type="text" size="mini" @click="handleReview(scope.row, 'professional')">教练报告</el-button>
|
|
|
+ <el-button link type="text" size="mini" @click="handleReview(scope.row, 'public')">团队报告</el-button>
|
|
|
+ <el-button link type="text" size="mini" @click="handleDownload(scope.row)">下载报告</el-button>
|
|
|
+ </template>
|
|
|
+ <span v-else-if="scope.row.state === -1" class="failed">生成失败</span>
|
|
|
+ <span v-else class="pending">生成中</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="QuestionnaireReports">
|
|
|
+ import { ref, getCurrentInstance, onMounted } from 'vue'
|
|
|
+ import { getQuestionnaireReportList } from '@/api/agent/index.js'
|
|
|
+ import { reportArtifactUrl } from '@/utils/reportArtifactLinks.js'
|
|
|
+
|
|
|
+ const { proxy } = getCurrentInstance()
|
|
|
+ const id = proxy.$route.query.id
|
|
|
+ const title = proxy.$route.query.title || '问卷报告'
|
|
|
+ const teamName = proxy.$route.query.teamName || ''
|
|
|
+ const dataList = ref([])
|
|
|
+ const loading = ref(false)
|
|
|
+ const reportTypeDict = { 1: '团队报告', 2: '个人报告' }
|
|
|
+ const stateDict = { '-1': '生成失败', 0: '生成中', 1: '未发送', 2: '已发送' }
|
|
|
+
|
|
|
+ const isGenerated = row => [1, 2].includes(Number(row.state))
|
|
|
+ const handleReview = (row, kind) => {
|
|
|
+ const url = reportArtifactUrl(row, kind)
|
|
|
+ if (!url) return proxy.$message.error('该报告尚未生成,请生成后再查看!')
|
|
|
+ window.open(url, '_blank', 'noopener,noreferrer')
|
|
|
+ }
|
|
|
+ const handleDownload = row => {
|
|
|
+ if (!row.fileUrl) return proxy.$message.error('该报告尚未生成,请生成后再下载!')
|
|
|
+ window.open(row.fileUrl, '_blank', 'noopener,noreferrer')
|
|
|
+ }
|
|
|
+ const getList = async () => {
|
|
|
+ if (!id) return
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const res = await getQuestionnaireReportList(id)
|
|
|
+ if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
+ dataList.value = res.data || []
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(getList)
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.page { padding: 28px 20px; background: #FAFAFA; }
|
|
|
+.top { padding: 16px 20px; background: #FFF; border-radius: 6px; }
|
|
|
+.top p { margin: 0; font-weight: bold; }
|
|
|
+.top .tip { margin-top: 10px; color: #6B7280; font-size: 14px; font-weight: normal; }
|
|
|
+.failed { color: #F31616; }
|
|
|
+.pending { color: #FEA400; }
|
|
|
+</style>
|