|
|
@@ -10,11 +10,25 @@
|
|
|
<el-table-column label="问卷类型" prop="">
|
|
|
<template #default="scope">{{ typeCfg[scope.row.type]||'' }}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="团队名称" prop="teamName"></el-table-column>
|
|
|
+ <el-table-column label="团队名称" prop="teamName"></el-table-column>
|
|
|
+ <el-table-column label="开始时间" prop="startTime"></el-table-column>
|
|
|
+ <el-table-column label="截止时间" prop="endTime"></el-table-column>
|
|
|
+ <el-table-column label="作答进度" prop="">
|
|
|
+ <template #default="scope">{{ scope.row.finishNum || 0 }}/{{ scope.row.userNum || 0 }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="问卷状态" prop="">
|
|
|
<template #default="scope">{{ statusCfg[scope.row.status]||'' }}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="创建时间" prop="createDate"></el-table-column>
|
|
|
+ <el-table-column label="创建时间" prop="createDate"></el-table-column>
|
|
|
+ <el-table-column label="操作" width="120">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button v-if="Number(scope.row.type) === 0" link type="text" size="mini"
|
|
|
+ :loading="reportLoadingId === scope.row.teamQuestionnaireId"
|
|
|
+ @click="handleReport(scope.row)">
|
|
|
+ {{ scope.row.reportCount > 0 ? '重新生成' : '生成报告' }}
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<el-row style="display: flex;justify-content: center;">
|
|
|
<el-pagination
|
|
|
@@ -42,7 +56,9 @@
|
|
|
import { ref, getCurrentInstance, onMounted } from 'vue'
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
import {
|
|
|
- getQuestionniareManagerList
|
|
|
+ getQuestionniareManagerList,
|
|
|
+ checkQuestionnaireReport,
|
|
|
+ generateQuestionnaireReport
|
|
|
} from '@/api/agent/indexTwo.js'
|
|
|
|
|
|
const queryParams = ref({
|
|
|
@@ -61,7 +77,8 @@
|
|
|
})
|
|
|
const dataList = ref([])
|
|
|
const total = ref(0)
|
|
|
- const loading = ref(false)
|
|
|
+ const loading = ref(false)
|
|
|
+ const reportLoadingId = ref(null)
|
|
|
|
|
|
const handleSizeChange = (val) => {
|
|
|
queryParams.value.limit = val;
|
|
|
@@ -81,7 +98,36 @@
|
|
|
loading.value = false;
|
|
|
}
|
|
|
|
|
|
- onMounted(() => {
|
|
|
+ const handleReport = async (row) => {
|
|
|
+ if (Number(row.status) !== 1) {
|
|
|
+ proxy.$message.warning('问卷尚未完成,暂不能生成报告')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reportLoadingId.value = row.teamQuestionnaireId
|
|
|
+ try {
|
|
|
+ const check = await checkQuestionnaireReport(row.teamQuestionnaireId)
|
|
|
+ if (check.code !== 0) return proxy.$message.error(check.msg)
|
|
|
+ if (check.data > 0) {
|
|
|
+ await proxy.$confirm(`该问卷已生成${check.data}份报告,是否再次生成新报告?`, '生成报告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const result = await generateQuestionnaireReport(row.teamQuestionnaireId)
|
|
|
+ if (result.code !== 0) return proxy.$message.error(result.msg)
|
|
|
+ proxy.$message.success(check.data > 0 ? '重新生成已提交' : '报告生成已提交')
|
|
|
+ await getList()
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel' && error !== 'close') {
|
|
|
+ proxy.$message.error(error?.message || '报告生成失败')
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ reportLoadingId.value = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
queryParams.value.userId = props.userId;
|
|
|
getList();
|
|
|
})
|
|
|
@@ -89,4 +135,4 @@
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
-</style>
|
|
|
+</style>
|