| | |
| | | } |
| | | } |
| | | |
| | | QVector<QVector<QString>> SearchInfo::getResult(QString &sql,int colCnt) |
| | | { |
| | | QVector<QVector<QString>> resultSet; |
| | | QSqlQuery query; |
| | | qDebug()<<sql; |
| | | if(query.exec(sql)){ |
| | | while (query.next()) { |
| | | QVector<QString> tmp; |
| | | for(int i=0;i<colCnt;++i){ |
| | | tmp.push_back(query.value(i).toString()); |
| | | } |
| | | resultSet.append(tmp); |
| | | } |
| | | } |
| | | return resultSet; |
| | | } |
| | | |
| | | void SearchInfo::on_pushButton_search_clicked() |
| | | { |
| | | // 获取信息,然后查询 |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | void SearchInfo::on_pushButton_export_clicked() |
| | | { |
| | | // 每一张表拿最新的那一批数据即可,然后保存到电子表格中 |
| | | int comId = m_comInfo[ui->comboBox_company->currentText()]; |
| | | QString audit_project = QString("select kpi_name,code,num from %2 where com_id=%1 limit 10").arg(comId).arg("audit_project"); |
| | | QString audit_workload = QString("select kpi_name,code,num from %2 where com_id=%1 limit 1").arg(comId).arg("audit_workload"); |
| | | QString case_clue = QString("select kpi_name,code,unit,num from %2 where com_id=%1 limit 2").arg(comId).arg("case_clue"); |
| | | QString problem_count = QString("select kpi_name,code,num,evidences from %2 where com_id=%1 limit 7").arg(comId).arg("problem_count"); |
| | | QString problem_money = QString("select kpi_name,code,num,evidences from %2 where com_id=%1 limit 11").arg(comId).arg("problem_money"); |
| | | QString problem_no_money = QString("select kpi_name,code,num,evidences from %2 where com_id=%1 limit 5").arg(comId).arg("problem_no_money"); |
| | | QString problem_rectification = QString("select kpi_name,code,num,evidences from %2 where com_id=%1 limit 7").arg(comId).arg("problem_rectification"); |
| | | QString punish = QString("select kpi_name,code,num from %2 where com_id=%1 limit 4").arg(comId).arg("punish"); |
| | | |
| | | QVector<QVector<QString>> audit_project_res = getResult(audit_project,3); |
| | | QVector<QVector<QString>> audit_workload_res = getResult(audit_workload,3); |
| | | QVector<QVector<QString>> case_clue_res = getResult(case_clue,4); |
| | | QVector<QVector<QString>> problem_count_res = getResult(problem_count,4); |
| | | QVector<QVector<QString>> problem_money_res = getResult(problem_money,4); |
| | | QVector<QVector<QString>> problem_no_money_res = getResult(problem_no_money,4); |
| | | QVector<QVector<QString>> problem_rectification_res = getResult(problem_rectification,4); |
| | | QVector<QVector<QString>> punish_res = getResult(punish,3); |
| | | qDebug()<<audit_project_res.size()<<punish_res.size(); |
| | | |
| | | } |