| | |
| | | // m_coverInfo->setParent(ui->tab); |
| | | |
| | | // éèææä¸ªé项 |
| | | // æç´¢å¼æ¥ï¼ä»å¤§å°å° |
| | | ui->tabWidget->removeTab(3); // OK |
| | | ui->tabWidget->removeTab(1); // OK èä¸å¡æ
åµè¡¨ |
| | | ui->tabWidget->removeTab(0); // OK èå°é¢ |
| | | |
| | | |
| | | |
| | | // é®é¢æ´æ¹å°è´¦ |
| | | m_proRecStandingBook = new ProblemRectStandingBook(this); |
| | |
| | | |
| | | // æ°çæ¬ |
| | | m_conInfo2 = new ConverInfo2(this); |
| | | ui->tabWidget->addTab(m_conInfo2,"åºæ¬ä¿¡æ¯"); |
| | | //ui->tabWidget->addTab(m_conInfo2,"åºæ¬ä¿¡æ¯"); |
| | | ui->tabWidget->insertTab(0,m_conInfo2,"å°é¢ä¿¡æ¯"); |
| | | |
| | | m_problemList = new ProblemList(this); |
| | | ui->tabWidget->addTab(m_problemList,"é®é¢æ¸
å"); |
| | | |
| | | m_problemRectifResult = new ProblemRectificationResult(this); |
| | | ui->tabWidget->addTab(m_problemRectifResult,"æ´æ¹ææ"); |
| | | |
| | | |
| | | } |
| | |
| | | qDebug()<<__FUNCTION__<<row<<column; |
| | | calc(); |
| | | } |
| | | |
| | | void ClientMainWindow::on_pushButton_save_clicked() |
| | | { |
| | | // ä¿åæ°æ®ï¼ç»ææ¯è¾ç¹æ®ï¼éè¦å¤è¡å¤ååæ¶åå
¥ |
| | | // å¾èèåæ®µå表å¤çæ¹å¯ |
| | | // è·ååå°æä»¶éé¢ï¼æ¯ä¸ªåä½ä¸ä¸ªæä»¶ |
| | | } |
| | |
| | | #include "converinfo2.h" |
| | | |
| | | #include "xlsxdocument.h" |
| | | #include "problemlist.h" |
| | | #include "problemrectificationresult.h" |
| | | |
| | | namespace Ui { |
| | | class ClientMainWindow; |
| | |
| | | |
| | | void on_tableWidget_cellClicked(int row, int column); |
| | | |
| | | void on_pushButton_save_clicked(); |
| | | |
| | | signals: |
| | | void sendDataToAuditProject(QVariantList); |
| | | void sendDataToAuditWorkLoad(QVariantList); |
| | |
| | | |
| | | // æ°çæ¬ |
| | | ConverInfo2* m_conInfo2; |
| | | ProblemList *m_problemList; |
| | | ProblemRectificationResult *m_problemRectifResult; |
| | | |
| | | }; |
| | | |
| | |
| | | </rect> |
| | | </property> |
| | | <property name="windowTitle"> |
| | | <string>IS v1.1</string> |
| | | <string>IS v2.0</string> |
| | | </property> |
| | | <widget class="QWidget" name="centralWidget"> |
| | | <layout class="QGridLayout" name="gridLayout"> |
| | | <layout class="QGridLayout" name="gridLayout_3"> |
| | | <item row="0" column="0"> |
| | | <widget class="QTabWidget" name="tabWidget"> |
| | | <property name="currentIndex"> |
| | |
| | | </widget> |
| | | <widget class="QWidget" name="tab_4"> |
| | | <attribute name="title"> |
| | | <string>ç»è®¡ç»¼å表</string> |
| | | <string>综åå½å
¥</string> |
| | | </attribute> |
| | | <layout class="QGridLayout" name="gridLayout_3"> |
| | | <layout class="QGridLayout" name="gridLayout"> |
| | | <item row="0" column="0"> |
| | | <widget class="QComboBox" name="comboBox_company"> |
| | | <property name="editable"> |
| | | <bool>true</bool> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item row="1" column="0"> |
| | | <widget class="QTableWidget" name="tableWidget"> |
| | | <attribute name="verticalHeaderVisible"> |
| | |
| | | </item> |
| | | </widget> |
| | | </item> |
| | | <item row="0" column="0"> |
| | | <widget class="QComboBox" name="comboBox_company"/> |
| | | <item row="2" column="0"> |
| | | <layout class="QHBoxLayout" name="horizontalLayout_2"> |
| | | <item> |
| | | <spacer name="horizontalSpacer"> |
| | | <property name="orientation"> |
| | | <enum>Qt::Horizontal</enum> |
| | | </property> |
| | | <property name="sizeHint" stdset="0"> |
| | | <size> |
| | | <width>40</width> |
| | | <height>20</height> |
| | | </size> |
| | | </property> |
| | | </spacer> |
| | | </item> |
| | | <item> |
| | | <widget class="QLabel" name="label_2"> |
| | | <property name="text"> |
| | | <string>æ±æ»ä¿®æ¹å®æç¹å»æé®--></string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item> |
| | | <widget class="QPushButton" name="pushButton_save"> |
| | | <property name="text"> |
| | | <string>æ±æ»å½å
¥</string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | </layout> |
| | | </item> |
| | | </layout> |
| | | </widget> |
| | |
| | | QVariant val = usedRange->dynamicCall("Value"); // æ¿å°äºç»´è¡¨æ ¼ |
| | | QVariantList valRows = val.toList(); |
| | | // é忝ä¸é¡¹ |
| | | for(int i=0;i<rows;++i){ |
| | | QVariantList valrow = valRows[i].toList(); |
| | | for(int j=0;j<columns;++j){ |
| | | QVariant valData = valrow[j]; |
| | | if(valData.isValid()){ |
| | | qDebug()<<"val:"<< i<< j << valData; |
| | | } |
| | | // for(int i=0;i<rows;++i){ |
| | | // QVariantList valrow = valRows[i].toList(); |
| | | // for(int j=0;j<columns;++j){ |
| | | // QVariant valData = valrow[j]; |
| | | // if(valData.isValid()){ |
| | | // qDebug()<<"val:"<< i<< j << valData; |
| | | // } |
| | | |
| | | } |
| | | } |
| | | // } |
| | | // } |
| | | |
| | | // å®ä¾åç»æä½ï¼ç¶åæ¨ä¸ªèµå¼ |
| | | ComInfo curComInfo; |
| | |
| | | <widget class="QWidget" name="scrollAreaWidgetContents"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>0</x> |
| | | <y>-1097</y> |
| | | <width>1000</width> |
| | | <height>3000</height> |
| | | <x>-115</x> |
| | | <y>-637</y> |
| | | <width>1100</width> |
| | | <height>1600</height> |
| | | </rect> |
| | | </property> |
| | | <widget class="QLabel" name="label_webSite"> |
| | |
| | | <set>Qt::AlignCenter</set> |
| | | </property> |
| | | </widget> |
| | | <widget class="QPushButton" name="pushButton_importExcel"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>660</x> |
| | | <y>90</y> |
| | | <width>291</width> |
| | | <height>28</height> |
| | | </rect> |
| | | </property> |
| | | <property name="styleSheet"> |
| | | <string notr="true">background-color: rgb(0, 170, 255);</string> |
| | | </property> |
| | | <property name="text"> |
| | | <string>æå¨å¯¼å
¥</string> |
| | | </property> |
| | | </widget> |
| | | <widget class="QLabel" name="label_22"> |
| | | <property name="geometry"> |
| | | <rect> |
| | |
| | | <property name="alignment"> |
| | | <set>Qt::AlignCenter</set> |
| | | </property> |
| | | </widget> |
| | | <widget class="QComboBox" name="comboBox"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>660</x> |
| | | <y>60</y> |
| | | <width>291</width> |
| | | <height>22</height> |
| | | </rect> |
| | | </property> |
| | | <item> |
| | | <property name="text"> |
| | | <string>å
¬å¸åç§°</string> |
| | | </property> |
| | | </item> |
| | | </widget> |
| | | <widget class="QLabel" name="label_3"> |
| | | <property name="geometry"> |
| | |
| | | <rect> |
| | | <x>250</x> |
| | | <y>50</y> |
| | | <width>391</width> |
| | | <width>581</width> |
| | | <height>41</height> |
| | | </rect> |
| | | </property> |
| | |
| | | <rect> |
| | | <x>250</x> |
| | | <y>90</y> |
| | | <width>391</width> |
| | | <width>581</width> |
| | | <height>41</height> |
| | | </rect> |
| | | </property> |
| | |
| | | <zorder>label_31</zorder> |
| | | <zorder>label</zorder> |
| | | <zorder>label_people</zorder> |
| | | <zorder>pushButton_importExcel</zorder> |
| | | <zorder>label_22</zorder> |
| | | <zorder>label_name</zorder> |
| | | <zorder>label_29</zorder> |
| | | <zorder>label_creditCode</zorder> |
| | | <zorder>label_18</zorder> |
| | | <zorder>label_25</zorder> |
| | | <zorder>comboBox</zorder> |
| | | <zorder>label_3</zorder> |
| | | <zorder>label_15</zorder> |
| | | <zorder>label_8</zorder> |
| | |
| | | ui->setupUi(this); |
| | | CoInitializeEx(NULL, COINIT_MULTITHREADED); // å
å°COMåºåå§å |
| | | |
| | | readInfo(); |
| | | readDataFromSQL(); // 仿°æ®åºè¯»åæ°æ® |
| | | //readInfo(); |
| | | //readDataFromSQL(); // 仿°æ®åºè¯»åæ°æ® |
| | | |
| | | } |
| | | |
| | |
| | | coverinfo.cpp \ |
| | | searchinfo.cpp \ |
| | | problemrectstandingbook.cpp \ |
| | | converinfo2.cpp |
| | | converinfo2.cpp \ |
| | | problemlist.cpp \ |
| | | problemrectificationresult.cpp \ |
| | | tableitemdelegate.cpp |
| | | |
| | | HEADERS += \ |
| | | clientmainwindow.h \ |
| | |
| | | searchinfo.h \ |
| | | problemrectstandingbook.h \ |
| | | converinfo2.h \ |
| | | struct_data.h |
| | | struct_data.h \ |
| | | problemlist.h \ |
| | | problemrectificationresult.h \ |
| | | tableitemdelegate.h |
| | | |
| | | FORMS += \ |
| | | clientmainwindow.ui \ |
| | |
| | | coverinfo.ui \ |
| | | searchinfo.ui \ |
| | | problemrectstandingbook.ui \ |
| | | converinfo2.ui |
| | | converinfo2.ui \ |
| | | problemlist.ui \ |
| | | problemrectificationresult.ui |
| | | |
| | | include(QXlsx/QXlsx.pri) |
| | | |
New file |
| | |
| | | #include "problemlist.h" |
| | | #include "ui_problemlist.h" |
| | | #include <QDebug> |
| | | #include <QSqlQuery> |
| | | #include <QSqlError> |
| | | #include <QMessageBox> |
| | | |
| | | ProblemList::ProblemList(QWidget *parent) : |
| | | QMainWindow(parent), |
| | | ui(new Ui::ProblemList) |
| | | { |
| | | ui->setupUi(this); |
| | | initUi(); |
| | | } |
| | | |
| | | ProblemList::~ProblemList() |
| | | { |
| | | delete ui; |
| | | } |
| | | |
| | | void ProblemList::initUi() |
| | | { |
| | | ui->tableWidget->setItem(0,0,new QTableWidgetItem("é®é¢æ¸
å")); |
| | | ui->tableWidget->setSpan(0,0,3,2); |
| | | ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(0,2,new QTableWidgetItem("æ´æ¹æ£æ¥ç»æå对账éå·æ¸
å")); |
| | | ui->tableWidget->setSpan(0,2,1,12); |
| | | ui->tableWidget->item(0,2)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(1,2,new QTableWidgetItem("æ´æ¹æ£æ¥ç»æ")); |
| | | ui->tableWidget->setSpan(1,2,2,2); |
| | | ui->tableWidget->item(1,2)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(1,4,new QTableWidgetItem("æ´æ¹ç±»å")); |
| | | ui->tableWidget->setSpan(1,4,1,8); |
| | | ui->tableWidget->item(1,4)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(2,4,new QTableWidgetItem("å·²æ´æ¹")); |
| | | ui->tableWidget->setSpan(2,4,1,3); |
| | | ui->tableWidget->item(2,4)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(2,7,new QTableWidgetItem("æ£å¨æ´æ¹")); |
| | | ui->tableWidget->setSpan(2,7,1,2); |
| | | ui->tableWidget->item(2,7)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(2,9,new QTableWidgetItem("å°æªæ´æ¹")); |
| | | ui->tableWidget->setSpan(2,9,1,3); |
| | | ui->tableWidget->item(2,9)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(1,12,new QTableWidgetItem("æ¯å¦éå·")); |
| | | ui->tableWidget->setSpan(1,12,3,1); |
| | | ui->tableWidget->item(1,12)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setItem(1,13,new QTableWidgetItem("éå·æ¶é´")); |
| | | ui->tableWidget->setSpan(1,13,3,1); |
| | | ui->tableWidget->item(1,13)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | |
| | | // ä¸çº§åæ é¢ 12个 |
| | | ui->tableWidget->setItem(3,0,new QTableWidgetItem("åºå·")); |
| | | ui->tableWidget->setItem(3,1,new QTableWidgetItem("æè¦")); |
| | | ui->tableWidget->setItem(3,2,new QTableWidgetItem("æ£æ¥æ¶é´")); |
| | | ui->tableWidget->setItem(3,3,new QTableWidgetItem("æ£æ¥æ¹å¼")); |
| | | ui->tableWidget->setItem(3,4,new QTableWidgetItem("çº æ£é®é¢")); |
| | | ui->tableWidget->setItem(3,5,new QTableWidgetItem("å®åå¶åº¦")); |
| | | ui->tableWidget->setItem(3,6,new QTableWidgetItem("宿æ¶é´")); |
| | | ui->tableWidget->setItem(3,7,new QTableWidgetItem("主è¦åå ")); |
| | | ui->tableWidget->setItem(3,8,new QTableWidgetItem("宿æ¶é")); |
| | | ui->tableWidget->setItem(3,9,new QTableWidgetItem("主è¦åå ")); |
| | | ui->tableWidget->setItem(3,10,new QTableWidgetItem("责任é¨é¨æè´£ä»»äºº")); |
| | | ui->tableWidget->setItem(3,11,new QTableWidgetItem("宿æ¶é")); |
| | | |
| | | // ç¦æ¢ç¼è¾ |
| | | for(int i=0;i<4;++i){ |
| | | ui->tableWidget->setItemDelegateForRow(i,new TableItemDelegate()); |
| | | } |
| | | |
| | | |
| | | // å³é®èå |
| | | m_menu = new QMenu(this); |
| | | m_menu->addAction("å é¤å½åè¡"); |
| | | ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->tableWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenuSlot(QPoint))); |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteAction())); |
| | | |
| | | |
| | | // å è½½å
¬å¸å |
| | | readCompanyFromSQL(); |
| | | } |
| | | |
| | | void ProblemList::readCompanyFromSQL() |
| | | { |
| | | ui->comboBox_company->clear(); |
| | | |
| | | QString sql = "select DISTINCT name from all_company_info"; |
| | | QSqlQuery query; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<QString("select DISTINCT all_company_info ok"); |
| | | |
| | | while(query.next()){ // æ·»å å
¬å¸å |
| | | QString name = query.value(0).toString(); |
| | | ui->comboBox_company->addItem(name); |
| | | } |
| | | |
| | | }else{ |
| | | qDebug()<<QString("select all_company_info fail...")<<query.lastError().text(); |
| | | |
| | | } |
| | | } |
| | | |
| | | void ProblemList::showMenuSlot(QPoint){ |
| | | m_menu->exec(QCursor::pos()); |
| | | } |
| | | |
| | | void ProblemList::deleteAction(){ |
| | | |
| | | int row = ui->tableWidget->currentRow(); |
| | | if(row>=4){ |
| | | qDebug()<<"ok"; |
| | | ui->tableWidget->removeRow(row); |
| | | }else{ |
| | | qDebug()<<"fail"; |
| | | } |
| | | } |
| | | void ProblemList::on_pushButton_addRow_clicked() |
| | | { |
| | | ui->tableWidget->insertRow(ui->tableWidget->rowCount()); |
| | | } |
| | | |
| | | void ProblemList::on_pushButton_save_clicked() |
| | | { |
| | | QString sql = QString("insert into problem_list_info (name,åºå·,æè¦,æ£æ¥æ¶é´,æ£æ¥æ¹å¼,çº æ£é®é¢,å®åå¶åº¦\ |
| | | ,宿æ¶é´,主è¦åå ,宿æ¶é,主è¦åå 1,责任é¨é¨æè´£ä»»äºº,宿æ¶é1,æ¯å¦éå·,éå·æ¶é´) values "); |
| | | QString name = ui->comboBox_company->currentText(); |
| | | |
| | | for(int i=4;i<ui->tableWidget->rowCount();++i){ |
| | | QStringList labels; |
| | | |
| | | for(int j=0;j<ui->tableWidget->columnCount();++j){ |
| | | QTableWidgetItem *item = ui->tableWidget->item(i,j);; |
| | | qDebug() <<i<<j <<item; |
| | | if(item){ |
| | | qDebug()<<"OK"; |
| | | labels<<item->data(Qt::EditRole).toString(); |
| | | }else{ |
| | | labels<<" "; |
| | | } |
| | | } |
| | | qDebug()<<labels; |
| | | if(labels.at(0)==" ")continue; |
| | | if(name.size()==0){ |
| | | QMessageBox::information(this,"åä½ä¿¡æ¯ä¸ºç©º ","请è¾å
¥åä½åç§°"); |
| | | continue; |
| | | } |
| | | sql += QString("('%1',").arg(name); |
| | | for(int k=0;k<labels.size()-1;++k){ |
| | | sql += QString("'%1',").arg(labels[k]); |
| | | } |
| | | sql += QString("'%1')").arg(labels.back()); |
| | | } |
| | | |
| | | qDebug()<<"sql="<<sql; |
| | | QSqlQuery query; |
| | | if(query.exec(sql)) |
| | | { |
| | | qDebug()<<QString("insert problem_list_info ok..."); |
| | | QMessageBox::information(this,"OK","æ·»å æå"); |
| | | }else{ |
| | | qDebug()<<QString("insert problem_list_info fail...")<<query.lastError().text(); |
| | | QMessageBox::information(this,"æ·»å 失败","å¯è½æ·»å çæ°æ®ä¸å
¨å¯¼è´çï¼å¾ç¡®è®¤æ¯è¡çé¦é¡¹ææ°æ®"); |
| | | } |
| | | } |
| | | |
| | | void ProblemList::on_comboBox_company_currentIndexChanged(const QString &arg1) |
| | | { |
| | | // è¦æ¸
é¤ä¸ä¸å®¶å
¬å¸çæ°æ® |
| | | ui->tableWidget->setRowCount(4); |
| | | ui->tableWidget->setRowCount(7); |
| | | // å è½½è¡¨æ ¼ä¿¡æ¯ |
| | | qDebug()<<"current :"<<arg1; |
| | | |
| | | QString sql = QString("select * from problem_list_info where name='%1'").arg(arg1); |
| | | QSqlQuery query; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<QString("select problem_list_info ok"); |
| | | int row=0; |
| | | while(query.next()){ // æ·»å è¡æ°æ® |
| | | for(int i=0;i<14;++i){ |
| | | ui->tableWidget->setItem(row+4,i,new QTableWidgetItem(query.value(2+i).toString())); |
| | | } |
| | | row++; |
| | | ui->tableWidget->setRowCount(ui->tableWidget->rowCount()+1); // å¢å ä¸ä¸ªæ°çè¡ |
| | | } |
| | | qDebug()<<"row:"<<row; |
| | | |
| | | }else{ |
| | | qDebug()<<QString("select problem_list_info fail...")<<query.lastError().text(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | #ifndef PROBLEMLIST_H |
| | | #define PROBLEMLIST_H |
| | | |
| | | #include <QMainWindow> |
| | | #include "tableitemdelegate.h" |
| | | #include <QMenu> |
| | | #include <QAction> |
| | | |
| | | namespace Ui { |
| | | class ProblemList; |
| | | } |
| | | |
| | | class ProblemList : public QMainWindow |
| | | { |
| | | Q_OBJECT |
| | | |
| | | public: |
| | | explicit ProblemList(QWidget *parent = 0); |
| | | ~ProblemList(); |
| | | void initUi(); |
| | | |
| | | void readCompanyFromSQL(); |
| | | |
| | | private slots: |
| | | void on_pushButton_addRow_clicked(); |
| | | |
| | | void on_pushButton_save_clicked(); |
| | | |
| | | void showMenuSlot(QPoint); |
| | | void deleteAction(); |
| | | void on_comboBox_company_currentIndexChanged(const QString &arg1); |
| | | |
| | | private: |
| | | Ui::ProblemList *ui; |
| | | QMenu *m_menu; |
| | | }; |
| | | |
| | | #endif // PROBLEMLIST_H |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ui version="4.0"> |
| | | <class>ProblemList</class> |
| | | <widget class="QMainWindow" name="ProblemList"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>0</x> |
| | | <y>0</y> |
| | | <width>1031</width> |
| | | <height>609</height> |
| | | </rect> |
| | | </property> |
| | | <property name="windowTitle"> |
| | | <string>MainWindow</string> |
| | | </property> |
| | | <widget class="QWidget" name="centralwidget"> |
| | | <layout class="QGridLayout" name="gridLayout"> |
| | | <item row="0" column="0"> |
| | | <widget class="QComboBox" name="comboBox_company"> |
| | | <property name="editable"> |
| | | <bool>true</bool> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item row="1" column="0"> |
| | | <widget class="QTableWidget" name="tableWidget"> |
| | | <attribute name="horizontalHeaderVisible"> |
| | | <bool>false</bool> |
| | | </attribute> |
| | | <attribute name="verticalHeaderVisible"> |
| | | <bool>false</bool> |
| | | </attribute> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | </widget> |
| | | </item> |
| | | <item row="2" column="0"> |
| | | <layout class="QHBoxLayout" name="horizontalLayout"> |
| | | <item> |
| | | <widget class="QPushButton" name="pushButton_addRow"> |
| | | <property name="text"> |
| | | <string>å¢å ä¸è¡</string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item> |
| | | <spacer name="horizontalSpacer"> |
| | | <property name="orientation"> |
| | | <enum>Qt::Horizontal</enum> |
| | | </property> |
| | | <property name="sizeHint" stdset="0"> |
| | | <size> |
| | | <width>40</width> |
| | | <height>20</height> |
| | | </size> |
| | | </property> |
| | | </spacer> |
| | | </item> |
| | | <item> |
| | | <widget class="QPushButton" name="pushButton_save"> |
| | | <property name="text"> |
| | | <string>ä¿å</string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | </layout> |
| | | </item> |
| | | </layout> |
| | | </widget> |
| | | <widget class="QMenuBar" name="menubar"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>0</x> |
| | | <y>0</y> |
| | | <width>1031</width> |
| | | <height>26</height> |
| | | </rect> |
| | | </property> |
| | | </widget> |
| | | <widget class="QStatusBar" name="statusbar"/> |
| | | </widget> |
| | | <resources/> |
| | | <connections/> |
| | | </ui> |
New file |
| | |
| | | #include "problemrectificationresult.h" |
| | | #include "ui_problemrectificationresult.h" |
| | | #include <QMessageBox> |
| | | #include <QSqlQuery> |
| | | #include <QSqlError> |
| | | #include <QDebug> |
| | | |
| | | ProblemRectificationResult::ProblemRectificationResult(QWidget *parent) : |
| | | QMainWindow(parent), |
| | | ui(new Ui::ProblemRectificationResult) |
| | | { |
| | | ui->setupUi(this); |
| | | initUi(); |
| | | } |
| | | |
| | | ProblemRectificationResult::~ProblemRectificationResult() |
| | | { |
| | | delete ui; |
| | | } |
| | | |
| | | void ProblemRectificationResult::initUi() |
| | | { |
| | | ui->tableWidget->setSpan(0,0,1,5); |
| | | ui->tableWidget->setItem(0,0,new QTableWidgetItem("æ´æ¹ææ")); |
| | | ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignCenter); |
| | | |
| | | ui->tableWidget->setSpan(1,0,1,2); |
| | | ui->tableWidget->setItem(1,0,new QTableWidgetItem("å¶åº¦å»ºè®¾")); |
| | | ui->tableWidget->item(1,0)->setTextAlignment(Qt::AlignCenter); |
| | | ui->tableWidget->setSpan(1,2,1,3); |
| | | ui->tableWidget->setItem(1,2,new QTableWidgetItem("èµéæ¶å")); |
| | | ui->tableWidget->item(1,2)->setTextAlignment(Qt::AlignCenter); |
| | | ui->tableWidget->setSpan(0,5,3,1); |
| | | ui->tableWidget->setItem(0,5,new QTableWidgetItem("å¤ç人")); |
| | | ui->tableWidget->setSpan(0,6,3,1); |
| | | ui->tableWidget->setItem(0,6,new QTableWidgetItem("宣贯å¹è®")); |
| | | ui->tableWidget->setSpan(0,7,3,1); |
| | | ui->tableWidget->setItem(0,7,new QTableWidgetItem("å
¶ä»")); |
| | | ui->tableWidget->setSpan(0,8,3,1); |
| | | ui->tableWidget->setItem(0,8,new QTableWidgetItem("å®¡æ ¸ç»æ")); |
| | | ui->tableWidget->setSpan(0,9,3,1); |
| | | ui->tableWidget->setItem(0,9,new QTableWidgetItem("注é")); |
| | | |
| | | // ä¸çº§æ é¢ |
| | | ui->tableWidget->setItem(2,0,new QTableWidgetItem("修订å¶åº¦")); |
| | | ui->tableWidget->setItem(2,1,new QTableWidgetItem("æ°å¢å¶åº¦")); |
| | | ui->tableWidget->setItem(2,2,new QTableWidgetItem("æ½åæå¤±")); |
| | | ui->tableWidget->setItem(2,3,new QTableWidgetItem("åé¤")); |
| | | ui->tableWidget->setItem(2,4,new QTableWidgetItem("审å")); |
| | | |
| | | // ç¦æ¢ç¼è¾ |
| | | for(int i=0;i<3;++i){ |
| | | ui->tableWidget->setItemDelegateForRow(i,new TableItemDelegate()); |
| | | } |
| | | |
| | | // å³é®èå |
| | | m_menu = new QMenu(this); |
| | | m_menu->addAction("å é¤å½åè¡"); |
| | | ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); |
| | | connect(ui->tableWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showMenuSlot(QPoint))); |
| | | connect(m_menu->actions().at(0),SIGNAL(triggered(bool)),this,SLOT(deleteAction())); |
| | | |
| | | // å è½½ä¸ææ¡çå
¬å¸å |
| | | readCompanyFromSQL(); |
| | | |
| | | } |
| | | |
| | | void ProblemRectificationResult::readCompanyFromSQL() |
| | | { |
| | | ui->comboBox_company->clear(); |
| | | |
| | | QString sql = "select DISTINCT name from all_company_info"; |
| | | QSqlQuery query; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<QString("select DISTINCT all_company_info ok"); |
| | | |
| | | while(query.next()){ // æ·»å å
¬å¸å |
| | | QString name = query.value(0).toString(); |
| | | ui->comboBox_company->addItem(name); |
| | | } |
| | | |
| | | }else{ |
| | | qDebug()<<QString("select all_company_info fail...")<<query.lastError().text(); |
| | | |
| | | } |
| | | } |
| | | |
| | | void ProblemRectificationResult::showMenuSlot(QPoint){ |
| | | m_menu->exec(QCursor::pos()); |
| | | } |
| | | |
| | | void ProblemRectificationResult::deleteAction(){ |
| | | |
| | | int row = ui->tableWidget->currentRow(); |
| | | if(row>=3){ |
| | | qDebug()<<"ok"; |
| | | ui->tableWidget->removeRow(row); |
| | | }else{ |
| | | qDebug()<<"fail"; |
| | | } |
| | | } |
| | | |
| | | void ProblemRectificationResult::on_pushButton_addRow_clicked() |
| | | { |
| | | ui->tableWidget->insertRow(ui->tableWidget->rowCount()); |
| | | } |
| | | |
| | | void ProblemRectificationResult::on_pushButton_save_clicked() |
| | | { |
| | | QString sql = QString("insert into rectify_result_info (name,修订å¶åº¦,æ°å¢å¶åº¦,æ½åæå¤±,åé¤,审å,å¤ç人,宣贯å¹è®,å
¶ä»,å®¡æ ¸ç»æ,注é) values "); |
| | | QString name = ui->comboBox_company->currentText(); |
| | | |
| | | for(int i=3;i<ui->tableWidget->rowCount();++i){ |
| | | QStringList labels; |
| | | |
| | | for(int j=0;j<ui->tableWidget->columnCount();++j){ |
| | | QTableWidgetItem *item = ui->tableWidget->item(i,j);; |
| | | qDebug() <<i<<j <<item; |
| | | if(item){ |
| | | qDebug()<<"OK"; |
| | | labels<<item->data(Qt::EditRole).toString(); |
| | | }else{ |
| | | labels<<" "; |
| | | } |
| | | } |
| | | qDebug()<<labels; |
| | | if(labels.at(0)==" ")continue; |
| | | if(name.size()==0){ |
| | | QMessageBox::information(this,"åä½ä¿¡æ¯ä¸ºç©º ","请è¾å
¥åä½åç§°"); |
| | | continue; |
| | | } |
| | | sql += QString("('%1',").arg(name); |
| | | for(int k=0;k<labels.size()-1;++k){ |
| | | sql += QString("'%1',").arg(labels[k]); |
| | | } |
| | | sql += QString("'%1')").arg(labels.back()); |
| | | } |
| | | |
| | | qDebug()<<"sql="<<sql; |
| | | QSqlQuery query; |
| | | if(query.exec(sql)) |
| | | { |
| | | qDebug()<<QString("insert rectify_result_info ok..."); |
| | | QMessageBox::information(this,"OK","æ·»å æå"); |
| | | }else{ |
| | | qDebug()<<QString("insert rectify_result_info fail...")<<query.lastError().text(); |
| | | QMessageBox::information(this,"æ·»å 失败","å¯è½æ·»å çæ°æ®ä¸å
¨å¯¼è´çï¼å¾ç¡®è®¤æ¯è¡çé¦é¡¹ææ°æ®"); |
| | | } |
| | | } |
| | | |
| | | void ProblemRectificationResult::on_comboBox_company_currentIndexChanged(const QString &arg1) |
| | | { |
| | | // è¦æ¸
é¤ä¸ä¸å®¶å
¬å¸çæ°æ® |
| | | ui->tableWidget->setRowCount(3); |
| | | ui->tableWidget->setRowCount(6); |
| | | // å è½½è¡¨æ ¼ä¿¡æ¯ |
| | | qDebug()<<"current :"<<arg1; |
| | | |
| | | QString sql = QString("select * from rectify_result_info where name='%1'").arg(arg1); |
| | | QSqlQuery query; |
| | | if(query.exec(sql)){ |
| | | qDebug()<<QString("select rectify_result_info ok"); |
| | | int row=0; |
| | | while(query.next()){ // æ·»å è¡æ°æ® |
| | | for(int i=0;i<10;++i){ |
| | | ui->tableWidget->setItem(row+3,i,new QTableWidgetItem(query.value(2+i).toString())); |
| | | } |
| | | row++; |
| | | ui->tableWidget->setRowCount(ui->tableWidget->rowCount()+1); // å¢å ä¸ä¸ªæ°çè¡ |
| | | } |
| | | qDebug()<<"row:"<<row; |
| | | |
| | | }else{ |
| | | qDebug()<<QString("select rectify_result_info fail...")<<query.lastError().text(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | #ifndef PROBLEMRECTIFICATIONRESULT_H |
| | | #define PROBLEMRECTIFICATIONRESULT_H |
| | | |
| | | #include <QMainWindow> |
| | | #include "tableitemdelegate.h" |
| | | #include <QMenu> |
| | | #include <QAction> |
| | | |
| | | namespace Ui { |
| | | class ProblemRectificationResult; |
| | | } |
| | | |
| | | class ProblemRectificationResult : public QMainWindow |
| | | { |
| | | Q_OBJECT |
| | | |
| | | public: |
| | | explicit ProblemRectificationResult(QWidget *parent = 0); |
| | | ~ProblemRectificationResult(); |
| | | |
| | | void initUi(); |
| | | void readCompanyFromSQL(); |
| | | |
| | | private slots: |
| | | void on_pushButton_addRow_clicked(); |
| | | |
| | | void on_pushButton_save_clicked(); |
| | | |
| | | void showMenuSlot(QPoint); |
| | | void deleteAction(); |
| | | void on_comboBox_company_currentIndexChanged(const QString &arg1); |
| | | |
| | | private: |
| | | Ui::ProblemRectificationResult *ui; |
| | | QMenu *m_menu; |
| | | }; |
| | | |
| | | #endif // PROBLEMRECTIFICATIONRESULT_H |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ui version="4.0"> |
| | | <class>ProblemRectificationResult</class> |
| | | <widget class="QMainWindow" name="ProblemRectificationResult"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>0</x> |
| | | <y>0</y> |
| | | <width>1076</width> |
| | | <height>639</height> |
| | | </rect> |
| | | </property> |
| | | <property name="windowTitle"> |
| | | <string>MainWindow</string> |
| | | </property> |
| | | <widget class="QWidget" name="centralwidget"> |
| | | <layout class="QGridLayout" name="gridLayout"> |
| | | <item row="0" column="0"> |
| | | <widget class="QComboBox" name="comboBox_company"> |
| | | <property name="editable"> |
| | | <bool>true</bool> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item row="1" column="0"> |
| | | <widget class="QTableWidget" name="tableWidget"> |
| | | <attribute name="horizontalHeaderVisible"> |
| | | <bool>false</bool> |
| | | </attribute> |
| | | <attribute name="verticalHeaderVisible"> |
| | | <bool>false</bool> |
| | | </attribute> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <row> |
| | | <property name="text"> |
| | | <string>æ°å»ºè¡</string> |
| | | </property> |
| | | </row> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | <column> |
| | | <property name="text"> |
| | | <string>æ°å»ºå</string> |
| | | </property> |
| | | </column> |
| | | </widget> |
| | | </item> |
| | | <item row="2" column="0"> |
| | | <layout class="QHBoxLayout" name="horizontalLayout"> |
| | | <item> |
| | | <widget class="QPushButton" name="pushButton_addRow"> |
| | | <property name="text"> |
| | | <string>å¢å ä¸è¡</string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item> |
| | | <spacer name="horizontalSpacer"> |
| | | <property name="orientation"> |
| | | <enum>Qt::Horizontal</enum> |
| | | </property> |
| | | <property name="sizeHint" stdset="0"> |
| | | <size> |
| | | <width>40</width> |
| | | <height>20</height> |
| | | </size> |
| | | </property> |
| | | </spacer> |
| | | </item> |
| | | <item> |
| | | <widget class="QPushButton" name="pushButton_save"> |
| | | <property name="text"> |
| | | <string>ä¿å</string> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | </layout> |
| | | </item> |
| | | </layout> |
| | | </widget> |
| | | <widget class="QMenuBar" name="menubar"> |
| | | <property name="geometry"> |
| | | <rect> |
| | | <x>0</x> |
| | | <y>0</y> |
| | | <width>1076</width> |
| | | <height>26</height> |
| | | </rect> |
| | | </property> |
| | | </widget> |
| | | <widget class="QStatusBar" name="statusbar"/> |
| | | </widget> |
| | | <resources/> |
| | | <connections/> |
| | | </ui> |
| | |
| | | <widget class="QWidget" name="centralwidget"> |
| | | <layout class="QGridLayout" name="gridLayout"> |
| | | <item row="0" column="0" colspan="2"> |
| | | <widget class="QComboBox" name="comboBox_company"/> |
| | | <widget class="QComboBox" name="comboBox_company"> |
| | | <property name="editable"> |
| | | <bool>true</bool> |
| | | </property> |
| | | </widget> |
| | | </item> |
| | | <item row="1" column="0"> |
| | | <widget class="QTextEdit" name="textEdit"> |
| | |
| | | // åä½çææä¿¡æ¯è¡¨ å建 |
| | | createTableAllComInfo("all_company_info"); |
| | | |
| | | // æ´æ¹ç»æä¿¡æ¯è¡¨ å建 |
| | | createTableRectifyResultInfo("rectify_result_info"); |
| | | |
| | | // é®é¢æ¸
åä¿¡æ¯è¡¨ å建 |
| | | createTableProblemListInfo("problem_list_info"); |
| | | |
| | | } |
| | | |
| | | // æ´æ¹ç»æä¿¡æ¯è¡¨ |
| | | void SearchInfo::createTableRectifyResultInfo(QString tableName){ |
| | | QString sql = QString("CREATE TABLE %1 (\ |
| | | id INTEGER PRIMARY KEY AUTOINCREMENT,\ |
| | | name VARCHAR (30),\ |
| | | 修订å¶åº¦ TEXT,\ |
| | | æ°å¢å¶åº¦ TEXT,\ |
| | | æ½åæå¤± TEXT,\ |
| | | åé¤ TEXT,\ |
| | | 审å TEXT,\ |
| | | å¤ç人 TEXT,\ |
| | | 宣贯å¹è® TEXT,\ |
| | | å
¶ä» TEXT,\ |
| | | å®¡æ ¸ç»æ TEXT,\ |
| | | 注é TEXT)").arg(tableName); |
| | | QSqlQuery query; |
| | | if(query.exec(sql)) |
| | | { |
| | | qDebug()<<QString("create %1 ok...").arg(tableName); |
| | | }else{ |
| | | qDebug()<<QString("create %1 fail...").arg(tableName)<<query.lastError().text(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // é®é¢æ¸
åä¿¡æ¯è¡¨ |
| | | void SearchInfo::createTableProblemListInfo(QString tableName){ |
| | | QString sql = QString("CREATE TABLE %1 (\ |
| | | id INTEGER PRIMARY KEY AUTOINCREMENT,\ |
| | | name VARCHAR (30),\ |
| | | åºå· TEXT,\ |
| | | æè¦ TEXT,\ |
| | | æ£æ¥æ¶é´ TEXT,\ |
| | | æ£æ¥æ¹å¼ TEXT,\ |
| | | çº æ£é®é¢ TEXT,\ |
| | | å®åå¶åº¦ TEXT,\ |
| | | 宿æ¶é´ TEXT,\ |
| | | 主è¦åå TEXT,\ |
| | | 宿æ¶é TEXT,\ |
| | | 主è¦åå 1 TEXT,\ |
| | | 责任é¨é¨æè´£ä»»äºº TEXT,\ |
| | | 宿æ¶é1 TEXT,\ |
| | | æ¯å¦éå· TEXT,\ |
| | | éå·æ¶é´ TEXT)").arg(tableName); |
| | | QSqlQuery query; |
| | | if(query.exec(sql)) |
| | | { |
| | | qDebug()<<QString("create %1 ok...").arg(tableName); |
| | | }else{ |
| | | qDebug()<<QString("create %1 fail...").arg(tableName)<<query.lastError().text(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | QVector<QVector<QString>> getResult(QString &sql,int colCnt); |
| | | void setLabels(); |
| | | |
| | | void createTableAllComInfo(QString tableName); |
| | | void createTableAllComInfo(QString tableName); // åä½ä¿¡æ¯è¡¨å
¨ |
| | | void createTableRectifyResultInfo(QString tableName); // æ´æ¹ç»æä¿¡æ¯è¡¨ |
| | | void createTableProblemListInfo(QString tableName); // é®é¢æ¸
åå表信æ¯è¡¨ |
| | | private slots: |
| | | void on_pushButton_search_clicked(); |
| | | |
New file |
| | |
| | | #include "tableitemdelegate.h" |
| | | |
| | | TableItemDelegate::TableItemDelegate() |
| | | { |
| | | |
| | | } |
| | | |
| | | QWidget *TableItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| | | { |
| | | return nullptr; |
| | | } |
New file |
| | |
| | | #ifndef TABLEITEMDELEGATE_H |
| | | #define TABLEITEMDELEGATE_H |
| | | |
| | | #include <QStyledItemDelegate> |
| | | |
| | | |
| | | |
| | | class TableItemDelegate : public QStyledItemDelegate |
| | | { |
| | | public: |
| | | TableItemDelegate(); |
| | | QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
| | | }; |
| | | |
| | | #endif // TABLEITEMDELEGATE_H |