diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 91b23e2..9706dfe 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -332,4 +332,31 @@ for(const itemCategory& item : catList){ ui->comboBoxCategory->addItem(item.category_name); } + setMethodName(); +} + +void NewCheckMethod::on_comboBoxCategory_currentIndexChanged(int index) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_2_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_3_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::setMethodName(){ + QString sName = ui->comboBoxEquipment->currentText()+"-"+ui->comboBoxCategory->currentText(); + if(ui->lineEdit_2->text()!=""){ + sName+="-"+ui->lineEdit_2->text(); + } + if(ui->lineEdit_3->text()!=""){ + sName+="-"+ui->lineEdit_3->text(); + } + ui->lineEditName->setText(sName); } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 91b23e2..9706dfe 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -332,4 +332,31 @@ for(const itemCategory& item : catList){ ui->comboBoxCategory->addItem(item.category_name); } + setMethodName(); +} + +void NewCheckMethod::on_comboBoxCategory_currentIndexChanged(int index) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_2_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_3_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::setMethodName(){ + QString sName = ui->comboBoxEquipment->currentText()+"-"+ui->comboBoxCategory->currentText(); + if(ui->lineEdit_2->text()!=""){ + sName+="-"+ui->lineEdit_2->text(); + } + if(ui->lineEdit_3->text()!=""){ + sName+="-"+ui->lineEdit_3->text(); + } + ui->lineEditName->setText(sName); } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index c6e8210..5a8f5ea 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -18,6 +18,7 @@ ~NewCheckMethod(); void getMethodInfo(); void chooseDevices(QString checkIds,QString bizIds); + void setMethodName(); private slots: void showCheckDevice(); void choosePicture(); @@ -31,6 +32,12 @@ void on_commButton_clicked(int type,QString id); void on_comboBoxEquipment_currentIndexChanged(int index); + void on_comboBoxCategory_currentIndexChanged(int index); + + void on_lineEdit_2_textChanged(const QString &arg1); + + void on_lineEdit_3_textChanged(const QString &arg1); + protected: void showEvent(QShowEvent *event); public: diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 91b23e2..9706dfe 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -332,4 +332,31 @@ for(const itemCategory& item : catList){ ui->comboBoxCategory->addItem(item.category_name); } + setMethodName(); +} + +void NewCheckMethod::on_comboBoxCategory_currentIndexChanged(int index) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_2_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_3_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::setMethodName(){ + QString sName = ui->comboBoxEquipment->currentText()+"-"+ui->comboBoxCategory->currentText(); + if(ui->lineEdit_2->text()!=""){ + sName+="-"+ui->lineEdit_2->text(); + } + if(ui->lineEdit_3->text()!=""){ + sName+="-"+ui->lineEdit_3->text(); + } + ui->lineEditName->setText(sName); } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index c6e8210..5a8f5ea 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -18,6 +18,7 @@ ~NewCheckMethod(); void getMethodInfo(); void chooseDevices(QString checkIds,QString bizIds); + void setMethodName(); private slots: void showCheckDevice(); void choosePicture(); @@ -31,6 +32,12 @@ void on_commButton_clicked(int type,QString id); void on_comboBoxEquipment_currentIndexChanged(int index); + void on_comboBoxCategory_currentIndexChanged(int index); + + void on_lineEdit_2_textChanged(const QString &arg1); + + void on_lineEdit_3_textChanged(const QString &arg1); + protected: void showEvent(QShowEvent *event); public: diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp index fb1e50d..67b2efb 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_verifymethodmanage.h" #include "newverifymethod.h" #include +#include "PageControl.h" VerifyMethodManage::VerifyMethodManage(QWidget *parent) : QWidget(parent), @@ -35,10 +36,6 @@ { programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); for(int i=programList.length()-1;i>=0;i--){ @@ -53,28 +50,50 @@ programList.removeAt(i); } } - for (const CheckProgramManage& program : programList) { - rowCount = ui->tableWidget_2->rowCount(); + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; +void VerifyMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; } } void VerifyMethodManage::updateTable(bool insert,CheckProgramManage program) { if(insert){ - int rowCount = ui->tableWidget_2->rowCount(); - ui->tableWidget_2->insertRow(rowCount); + //int rowCount = ui->tableWidget_2->rowCount(); + //ui->tableWidget_2->insertRow(rowCount); /*VerificationProgramInfo info; info.id = program.id; info.program_name = program.program_name; info.create_name = program.create_name; info.create_time = program.create_time; info.remark = program.remark;*/ - updateRow(rowCount,program); - programList.append(program); + //updateRow(rowCount,program); + //programList.append(program); + //pagedTable->setData(programList.count(), page); + getVerifyMethod(); }else{ programList[editIdx] =program; updateRow(editIdx,program); @@ -164,8 +183,9 @@ { if(BaseCommonApi::DeleteCheckProgramManage(programList[row].id)) { - programList.removeAt(row); - ui->tableWidget_2->removeRow(row); + //programList.removeAt(row); + //ui->tableWidget_2->removeRow(row); + getVerifyMethod(); } } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 91b23e2..9706dfe 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -332,4 +332,31 @@ for(const itemCategory& item : catList){ ui->comboBoxCategory->addItem(item.category_name); } + setMethodName(); +} + +void NewCheckMethod::on_comboBoxCategory_currentIndexChanged(int index) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_2_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_3_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::setMethodName(){ + QString sName = ui->comboBoxEquipment->currentText()+"-"+ui->comboBoxCategory->currentText(); + if(ui->lineEdit_2->text()!=""){ + sName+="-"+ui->lineEdit_2->text(); + } + if(ui->lineEdit_3->text()!=""){ + sName+="-"+ui->lineEdit_3->text(); + } + ui->lineEditName->setText(sName); } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index c6e8210..5a8f5ea 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -18,6 +18,7 @@ ~NewCheckMethod(); void getMethodInfo(); void chooseDevices(QString checkIds,QString bizIds); + void setMethodName(); private slots: void showCheckDevice(); void choosePicture(); @@ -31,6 +32,12 @@ void on_commButton_clicked(int type,QString id); void on_comboBoxEquipment_currentIndexChanged(int index); + void on_comboBoxCategory_currentIndexChanged(int index); + + void on_lineEdit_2_textChanged(const QString &arg1); + + void on_lineEdit_3_textChanged(const QString &arg1); + protected: void showEvent(QShowEvent *event); public: diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp index fb1e50d..67b2efb 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_verifymethodmanage.h" #include "newverifymethod.h" #include +#include "PageControl.h" VerifyMethodManage::VerifyMethodManage(QWidget *parent) : QWidget(parent), @@ -35,10 +36,6 @@ { programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); for(int i=programList.length()-1;i>=0;i--){ @@ -53,28 +50,50 @@ programList.removeAt(i); } } - for (const CheckProgramManage& program : programList) { - rowCount = ui->tableWidget_2->rowCount(); + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; +void VerifyMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; } } void VerifyMethodManage::updateTable(bool insert,CheckProgramManage program) { if(insert){ - int rowCount = ui->tableWidget_2->rowCount(); - ui->tableWidget_2->insertRow(rowCount); + //int rowCount = ui->tableWidget_2->rowCount(); + //ui->tableWidget_2->insertRow(rowCount); /*VerificationProgramInfo info; info.id = program.id; info.program_name = program.program_name; info.create_name = program.create_name; info.create_time = program.create_time; info.remark = program.remark;*/ - updateRow(rowCount,program); - programList.append(program); + //updateRow(rowCount,program); + //programList.append(program); + //pagedTable->setData(programList.count(), page); + getVerifyMethod(); }else{ programList[editIdx] =program; updateRow(editIdx,program); @@ -164,8 +183,9 @@ { if(BaseCommonApi::DeleteCheckProgramManage(programList[row].id)) { - programList.removeAt(row); - ui->tableWidget_2->removeRow(row); + //programList.removeAt(row); + //ui->tableWidget_2->removeRow(row); + getVerifyMethod(); } } } diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.h b/softwareDirectory/AutoVerScheme/verifymethodmanage.h index 2a46fe4..272e98f 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.h +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.h @@ -27,11 +27,15 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::VerifyMethodManage *ui; QList programList; int editIdx=-1; + int page; + int totalcount; + int pageIndex; }; #endif // VERIFYMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index a696bb5..4f762a7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -87,13 +87,10 @@ { programList.clear(); programList = BaseCommonApi::getVerificationProgramInfoMain(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); - for (const VerificationProgramInfo& program : programList) { + for (int i=programList.count()-1;i>=0;i--) { + VerificationProgramInfo program =programList[i]; bool bAdd=true; if(sFilterName!=""&&!program.program_name.contains(sFilterName)){ bAdd=false; @@ -101,17 +98,37 @@ if(sFilterUser!=""&&!program.create_name.contains(sFilterUser)){ bAdd=false; } - if(bAdd){ - rowCount = ui->tableWidget_2->rowCount(); - - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; + if(!bAdd){ + programList.removeAt(i); } } - //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); - //data转换位QList> - //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} + +void CheckMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; + } } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index 3dec22e..0f6143e 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -27,6 +27,7 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::CheckMethodManage *ui; @@ -35,6 +36,9 @@ QStringList equipList={"多功能校准源标准装置","直流稳压电源检定装置","多功能电气安全标准器标准装置","0.02级活塞式压力计标准装置","二等铂电阻温度计标准装置","安全阀校验装置", "精密露点仪标准装置","E2等级砝码标准装置","频谱分析仪标准装置","信号发生器标准装置","微波衰减标准装置","频率短期稳定度标准装置","示波器标准装置","铯原子频率标准装置","小功率标准装置"}; QList catList; + int page; + int totalcount; + int pageIndex; }; #endif // CHECKMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 91b23e2..9706dfe 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -332,4 +332,31 @@ for(const itemCategory& item : catList){ ui->comboBoxCategory->addItem(item.category_name); } + setMethodName(); +} + +void NewCheckMethod::on_comboBoxCategory_currentIndexChanged(int index) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_2_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::on_lineEdit_3_textChanged(const QString &arg1) +{ + setMethodName(); +} + +void NewCheckMethod::setMethodName(){ + QString sName = ui->comboBoxEquipment->currentText()+"-"+ui->comboBoxCategory->currentText(); + if(ui->lineEdit_2->text()!=""){ + sName+="-"+ui->lineEdit_2->text(); + } + if(ui->lineEdit_3->text()!=""){ + sName+="-"+ui->lineEdit_3->text(); + } + ui->lineEditName->setText(sName); } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index c6e8210..5a8f5ea 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -18,6 +18,7 @@ ~NewCheckMethod(); void getMethodInfo(); void chooseDevices(QString checkIds,QString bizIds); + void setMethodName(); private slots: void showCheckDevice(); void choosePicture(); @@ -31,6 +32,12 @@ void on_commButton_clicked(int type,QString id); void on_comboBoxEquipment_currentIndexChanged(int index); + void on_comboBoxCategory_currentIndexChanged(int index); + + void on_lineEdit_2_textChanged(const QString &arg1); + + void on_lineEdit_3_textChanged(const QString &arg1); + protected: void showEvent(QShowEvent *event); public: diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp index fb1e50d..67b2efb 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_verifymethodmanage.h" #include "newverifymethod.h" #include +#include "PageControl.h" VerifyMethodManage::VerifyMethodManage(QWidget *parent) : QWidget(parent), @@ -35,10 +36,6 @@ { programList.clear(); programList = BaseCommonApi::getCheckProgramManage(); - ui->tableWidget_2->clearContents(); - ui->tableWidget_2->setRowCount(0); - int rowCount = 0; - int row=0; QString sFilterName = ui->lineEdit_9->text(); QString sFilterUser = ui->lineEdit_10->text(); for(int i=programList.length()-1;i>=0;i--){ @@ -53,28 +50,50 @@ programList.removeAt(i); } } - for (const CheckProgramManage& program : programList) { - rowCount = ui->tableWidget_2->rowCount(); + page=20; + pageIndex=-1; + PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + pagedTable->setData(programList.count(), page); // 每页10行 + connect(pagedTable, SIGNAL(pageChanged(int)), this,SLOT(onpageChanged(int))); + this->onpageChanged(0); +} - ui->tableWidget_2->insertRow(rowCount); - updateRow(row,program); - row++; +void VerifyMethodManage::onpageChanged(int currPage){ + if(pageIndex==currPage) + return; + qDebug() << currPage; + pageIndex =currPage; + // 计算当前页的开始和结束索引 + int start = pageIndex * page; + int end = std::min(start + page, programList.size()); + ui->tableWidget_2->clearContents(); + ui->tableWidget_2->setRowCount(0); + int rowCount = 0; + int row=0; + for (int i=start;itableWidget_2->rowCount(); + ui->tableWidget_2->insertRow(rowCount); + updateRow(row,program); + row++; } } void VerifyMethodManage::updateTable(bool insert,CheckProgramManage program) { if(insert){ - int rowCount = ui->tableWidget_2->rowCount(); - ui->tableWidget_2->insertRow(rowCount); + //int rowCount = ui->tableWidget_2->rowCount(); + //ui->tableWidget_2->insertRow(rowCount); /*VerificationProgramInfo info; info.id = program.id; info.program_name = program.program_name; info.create_name = program.create_name; info.create_time = program.create_time; info.remark = program.remark;*/ - updateRow(rowCount,program); - programList.append(program); + //updateRow(rowCount,program); + //programList.append(program); + //pagedTable->setData(programList.count(), page); + getVerifyMethod(); }else{ programList[editIdx] =program; updateRow(editIdx,program); @@ -164,8 +183,9 @@ { if(BaseCommonApi::DeleteCheckProgramManage(programList[row].id)) { - programList.removeAt(row); - ui->tableWidget_2->removeRow(row); + //programList.removeAt(row); + //ui->tableWidget_2->removeRow(row); + getVerifyMethod(); } } } diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.h b/softwareDirectory/AutoVerScheme/verifymethodmanage.h index 2a46fe4..272e98f 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.h +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.h @@ -27,11 +27,15 @@ void on_pushButton_10_clicked(); void on_pushButton_11_clicked(); + void onpageChanged(int currPage); private: Ui::VerifyMethodManage *ui; QList programList; int editIdx=-1; + int page; + int totalcount; + int pageIndex; }; #endif // VERIFYMETHODMANAGE_H diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.ui b/softwareDirectory/AutoVerScheme/verifymethodmanage.ui index 5762850..80b7cd2 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.ui @@ -289,6 +289,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 1295 + 20 + + + + + + +