#include "clopPaperReport.h" #include "ui_clopPaperReport.h" #include "CAppInfo.h" #include #include "awMsgBox.h" clopPaperReport::clopPaperReport(__int64 nExamRecordDataId, bool bFromCache, QWidget *parent) : QWidget(parent), ui(new Ui::clopPaperReport) { ui->setupUi(this); setStyleSheet(g_appInfoPtr->m_sQssStr); qRegisterMetaType("CGetPracticeDetailInfo"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetPracticeDetailInfo, this, &clopPaperReport::onGetPracticeDetailInfo); CHttpRequestPackage hrp; hrp.sUri = QString("/api/ecs_oe_admin/client/exam/process/getPracticeDetailInfo"); hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(nExamRecordDataId)); if(bFromCache) { hrp.sParamList.push_back(QString("fromCache,%1").arg(true)); } hrp.nRequestType = RequestType::rtGetPracticeDetailInfo; hrp.eParamType = HttpParamType::hptUrl; g_httpBllPtr->post(hrp); } clopPaperReport::~clopPaperReport() { delete ui; } int clopPaperReport::setUI(const int nWidth) { ui->label_clop_tips_title->adjustSize(); ui->label_clop_tips_title->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*20, ui->label_clop_tips_title->width(), ui->label_clop_tips_title->height()); ui->label_clop_tips->setFixedWidth(nWidth - g_appInfoPtr->m_fRate*30*2); ui->label_clop_tips->adjustSize(); ui->label_clop_tips->setGeometry(ui->label_clop_tips_title->x(), ui->label_clop_tips_title->y() + ui->label_clop_tips_title->height() + g_appInfoPtr->m_fRate*5, ui->label_clop_tips->width(), ui->label_clop_tips->height()); ui->tablewt_examList->setGeometry(g_appInfoPtr->m_fRate*30, ui->label_clop_tips->y() + ui->label_clop_tips->height() + g_appInfoPtr->m_fRate*20, nWidth - g_appInfoPtr->m_fRate*30*2, (ui->tablewt_examList->rowCount() + 1)*g_appInfoPtr->m_fRate * 48); ui->tablewt_examList->setEditTriggers(QAbstractItemView::NoEditTriggers); //整行选中的方式 ui->tablewt_examList->setSelectionBehavior(QAbstractItemView::SelectRows); //设置为只能选中一行 ui->tablewt_examList->setSelectionMode(QAbstractItemView::SingleSelection); //隐藏列表头 ui->tablewt_examList->verticalHeader()->setVisible(false); //隐藏边框 ui->tablewt_examList->setShowGrid(false); //表头不高亮显示 ui->tablewt_examList->horizontalHeader()->setHighlightSections(false); //设置行数 ui->tablewt_examList->setRowCount(10); //设置列数 ui->tablewt_examList->setColumnCount(5); ui->tablewt_examList->setHorizontalScrollMode(QTableWidget::ScrollPerPixel); ui->tablewt_examList->horizontalScrollBar()->setSingleStep(g_appInfoPtr->m_fRate*5); QStringList sHeadStr; sHeadStr << QString::fromLocal8Bit("题型") << QString::fromLocal8Bit("题量") << QString::fromLocal8Bit("正确") << QString::fromLocal8Bit("错误") << QString::fromLocal8Bit("未答"); ui->tablewt_examList->setHorizontalHeaderLabels(sHeadStr); ui->tablewt_examList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->tablewt_examList->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); ui->tablewt_examList->verticalHeader()->setDefaultSectionSize(g_appInfoPtr->m_fRate*48); int nColWidth = ui->tablewt_examList->width()/5; ui->tablewt_examList->setColumnWidth(0, nColWidth); ui->tablewt_examList->setColumnWidth(1, nColWidth); ui->tablewt_examList->setColumnWidth(2, nColWidth); ui->tablewt_examList->setColumnWidth(3, nColWidth); ui->tablewt_examList->setColumnWidth(4, nColWidth); ui->tablewt_examList->horizontalHeader()->setStretchLastSection(true); return ui->tablewt_examList->y() + ui->tablewt_examList->height() + g_appInfoPtr->m_fRate*20; } QString clopPaperReport::getQuestionName(QString questionType) { if(questionType == QUESTION_TYPE::SingleChoice) { return QString::fromLocal8Bit("单选题"); } else if(questionType == QUESTION_TYPE::MultipleChoice) { return QString::fromLocal8Bit("多选题"); } else if(questionType == QUESTION_TYPE::TrueOrFalse) { return QString::fromLocal8Bit("判断题"); } else if(questionType == QUESTION_TYPE::FillUp) { return QString::fromLocal8Bit("填空题"); } else if(questionType == QUESTION_TYPE::Essay) { return QString::fromLocal8Bit("问答题"); } } void clopPaperReport::onGetPracticeDetailInfo(CGetPracticeDetailInfo getPracticeDetailInfo) { if(getPracticeDetailInfo.nCode == 200) { int nSize = getPracticeDetailInfo.vPracticePaperStructList.size(); emit objectiveAccuracy(getPracticeDetailInfo.fObjectiveAccuracy); ui->tablewt_examList->setRowCount(nSize); for(int i = 0; i < nSize; i++) { CPracticePaperStructInfo pps = getPracticeDetailInfo.vPracticePaperStructList[i]; ui->tablewt_examList->setItem(i, 0, new QTableWidgetItem(pps.sTitle)); ui->tablewt_examList->setItem(i, 1, new QTableWidgetItem(QString::number(pps.nQuestionCount))); ui->tablewt_examList->setItem(i, 2, new QTableWidgetItem(QString::number(pps.nSuccQuestionNum))); ui->tablewt_examList->setItem(i, 3, new QTableWidgetItem(QString::number(pps.nFailQuestionNum))); ui->tablewt_examList->setItem(i, 4, new QTableWidgetItem(QString::number(pps.nNotAnsweredCount))); } int nHeight = ui->tablewt_examList->y() + (nSize+1)*g_appInfoPtr->m_fRate*48 + g_appInfoPtr->m_fRate*20; ui->tablewt_examList->setGeometry(g_appInfoPtr->m_fRate * 30, ui->label_clop_tips->y() + ui->label_clop_tips->height() + g_appInfoPtr->m_fRate * 20, width() - g_appInfoPtr->m_fRate * 30 * 2, (ui->tablewt_examList->rowCount()+1)*g_appInfoPtr->m_fRate * 48) ; emit heightChange(nHeight); } else { if(getPracticeDetailInfo.sMessage.isEmpty()) { ShowMsg(QString::fromLocal8Bit("获取练习信息失败"), (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error); } else { ShowMsg(getPracticeDetailInfo.sMessage, (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error); } } }