|
|
@@ -20,9 +20,10 @@
|
|
|
</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">
|
|
|
+ <el-table-column label="操作" width="470">
|
|
|
<template #default="scope">
|
|
|
<template v-if="isGenerated(scope.row)">
|
|
|
+ <el-button v-if="canEditEvaluation(scope.row)" link type="text" size="mini" @click="openEvaluation(scope.row)">评估修改</el-button>
|
|
|
<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>
|
|
|
@@ -34,12 +35,26 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <el-dialog title="修改评估内容" :visible.sync="evaluationVisible" width="620px" @close="closeEvaluation">
|
|
|
+ <el-form label-position="top">
|
|
|
+ <el-form-item label="总体评估结果">
|
|
|
+ <el-input v-model="evaluationForm.overallAssessment" type="textarea" :rows="7" maxlength="20000" show-word-limit placeholder="请输入总体评估结果" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="团队发展建议">
|
|
|
+ <el-input v-model="evaluationForm.developmentAdvice" type="textarea" :rows="7" maxlength="20000" show-word-limit placeholder="请输入团队发展建议" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="closeEvaluation">取消</el-button>
|
|
|
+ <el-button type="primary" :loading="evaluationSubmitting" @click="submitEvaluation">保存提交</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="QuestionnaireReports">
|
|
|
import { ref, getCurrentInstance, onMounted } from 'vue'
|
|
|
- import { getQuestionnaireReportList } from '@/api/agent/index.js'
|
|
|
+ import { getQuestionnaireReportList, getReportEvaluation, updateReportEvaluation } from '@/api/agent/index.js'
|
|
|
import { reportArtifactUrl } from '@/utils/reportArtifactLinks.js'
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
@@ -50,8 +65,16 @@
|
|
|
const loading = ref(false)
|
|
|
const reportTypeDict = { 1: '团队报告', 2: '个人报告' }
|
|
|
const stateDict = { '-1': '生成失败', 0: '生成中', 1: '未发送', 2: '已发送' }
|
|
|
+ const evaluationVisible = ref(false)
|
|
|
+ const evaluationSubmitting = ref(false)
|
|
|
+ const evaluationReportId = ref(null)
|
|
|
+ const evaluationForm = ref({ overallAssessment: '', developmentAdvice: '' })
|
|
|
+ const evaluationProcessingMessage = '评估分析正在进行中,你需要等待1小时左右,我们会在报告生成完成后提示你,你可以去“我的PERILL报告”查阅报告结果。'
|
|
|
|
|
|
const isGenerated = row => [1, 2].includes(Number(row.state))
|
|
|
+ const canEditEvaluation = row => String(row.reportType) === '1'
|
|
|
+ && isGenerated(row)
|
|
|
+ && !['RUNNING', 'PENDING'].includes(String(row.status || ''))
|
|
|
const handleReview = (row, kind) => {
|
|
|
const url = reportArtifactUrl(row, kind)
|
|
|
if (!url) return proxy.$message.error('该报告尚未生成,请生成后再查看!')
|
|
|
@@ -61,6 +84,51 @@
|
|
|
if (!row.fileUrl) return proxy.$message.error('该报告尚未生成,请生成后再下载!')
|
|
|
window.open(row.fileUrl, '_blank', 'noopener,noreferrer')
|
|
|
}
|
|
|
+ const openEvaluation = async row => {
|
|
|
+ if (!canEditEvaluation(row)) return
|
|
|
+ evaluationReportId.value = row.reportId
|
|
|
+ evaluationForm.value = { overallAssessment: '', developmentAdvice: '' }
|
|
|
+ evaluationVisible.value = true
|
|
|
+ const res = await getReportEvaluation(row.reportId)
|
|
|
+ if (res.code !== 0) {
|
|
|
+ closeEvaluation()
|
|
|
+ return proxy.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ if (res.data && res.data.processing) {
|
|
|
+ closeEvaluation()
|
|
|
+ return proxy.$message.warning('评估分析正在重新生成中,请稍候')
|
|
|
+ }
|
|
|
+ evaluationForm.value = {
|
|
|
+ overallAssessment: res.data?.overallAssessment || '',
|
|
|
+ developmentAdvice: res.data?.developmentAdvice || ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const closeEvaluation = () => {
|
|
|
+ if (evaluationSubmitting.value) return
|
|
|
+ evaluationVisible.value = false
|
|
|
+ evaluationReportId.value = null
|
|
|
+ }
|
|
|
+ const submitEvaluation = async () => {
|
|
|
+ if (evaluationSubmitting.value) return
|
|
|
+ const form = evaluationForm.value
|
|
|
+ if (!form.overallAssessment.trim()) return proxy.$message.warning('请输入总体评估结果')
|
|
|
+ if (!form.developmentAdvice.trim()) return proxy.$message.warning('请输入团队发展建议')
|
|
|
+ evaluationSubmitting.value = true
|
|
|
+ try {
|
|
|
+ const res = await updateReportEvaluation(evaluationReportId.value, {
|
|
|
+ overallAssessment: form.overallAssessment.trim(),
|
|
|
+ developmentAdvice: form.developmentAdvice.trim()
|
|
|
+ })
|
|
|
+ if (res.code !== 0) return proxy.$message.error(res.msg)
|
|
|
+ evaluationVisible.value = false
|
|
|
+ evaluationReportId.value = null
|
|
|
+ await getList()
|
|
|
+ proxy.$message.success('评估意见已保存,报告正在重新生成')
|
|
|
+ proxy.$alert(evaluationProcessingMessage, '温馨提示', { confirmButtonText: '确定' })
|
|
|
+ } finally {
|
|
|
+ evaluationSubmitting.value = false
|
|
|
+ }
|
|
|
+ }
|
|
|
const getList = async () => {
|
|
|
if (!id) return
|
|
|
loading.value = true
|