diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index c09fa85..7bf5adb 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -20,6 +20,8 @@ void getCheckMethod(); private slots: void showNewMethod(); + void on_editButton_clicked(); + void on_deleteButton_clicked(); private: Ui::CheckMethodManage *ui; diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index c09fa85..7bf5adb 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -20,6 +20,8 @@ void getCheckMethod(); private slots: void showNewMethod(); + void on_editButton_clicked(); + void on_deleteButton_clicked(); private: Ui::CheckMethodManage *ui; diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index 08f1a92..648509b 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -225,31 +225,61 @@ 序号 + + + 12 + + 检定程序名称 + + + 12 + + 创建人 + + + 12 + + 创建时间 + + + 12 + + 说明 + + + 12 + + 操作 + + + 12 + + diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index c09fa85..7bf5adb 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -20,6 +20,8 @@ void getCheckMethod(); private slots: void showNewMethod(); + void on_editButton_clicked(); + void on_deleteButton_clicked(); private: Ui::CheckMethodManage *ui; diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index 08f1a92..648509b 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -225,31 +225,61 @@ 序号 + + + 12 + + 检定程序名称 + + + 12 + + 创建人 + + + 12 + + 创建时间 + + + 12 + + 说明 + + + 12 + + 操作 + + + 12 + + diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 90288ab..d9286f1 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -6,18 +6,47 @@ #include #include -NewCheckMethod::NewCheckMethod(QWidget *parent) : +NewCheckMethod::NewCheckMethod(QWidget *parent,QString sId) : QWidget(parent), + methodId(sId), ui(new Ui::NewCheckMethod) { ui->setupUi(this); } + NewCheckMethod::~NewCheckMethod() { delete ui; } +void NewCheckMethod::getMethodInfo() +{ + if(methodId!="") + { + programInfo = BaseCommonApi::getVerificationProgramInfo(methodId); + ui->lineEditName->setText(programInfo.program_name); + ui->lineEditUser->setText(programInfo.create_name); + ui->dateEditTime->setDateTime(programInfo.create_time); + ui->lineEditMark->setText(programInfo.remark); + if(programInfo.img_path!="") + { + //QImage img(programInfo.img_path); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + QString strStyle = "QLabel{" + "image:url("+programInfo.img_path+");" + "}"; + qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); + } + } +} + +void NewCheckMethod::showEvent(QShowEvent *event) +{ +} + void NewCheckMethod::showCheckDevice() { CheckDevice *checkWindow = new CheckDevice; @@ -30,19 +59,24 @@ { QString sName = QFileDialog::getOpenFileName(this,"选择图片","","Image File(*.bmp *.jpg *.jpeg *.png)"); //第一个参数:标准文件对话框的父窗口;第二个参数:标准文件对话框的标题;第三个参数:指定默认的目录;第四个参数:文件过滤器 - QImage img(sName); + //QImage img(sName); //int WindowW = this->width(); //int WindowH = this->height(); //ui->label->setGeometry(0, 0, WindowW, WindowH); - QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); //ui->label_11->setPixmap(QPixmap(sName)); + QString strStyle = "QLabel{" + "image:url("+sName+");" + "}"; + //qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); programInfo.img_path = sName; } void NewCheckMethod::deletePicture() { - ui->label_11->clear(); + ui->label_11->setStyleSheet(""); programInfo.img_path = ""; } @@ -56,21 +90,33 @@ void NewCheckMethod::on_pushButton_3_clicked() { - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - programInfo.id = QString::number(id); - programInfo.program_name = ui->lineEditName->text(); - programInfo.create_name = ui->lineEditUser->text(); - programInfo.create_time = ui->dateEditTime->dateTime(); - programInfo.remark = ui->lineEditMark->text(); - - qDebug() << "programInfo.id" << programInfo.id ; - - if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + if(programInfo.id=="") { - this->close(); + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + programInfo.id = QString::number(id); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + //qDebug() << "programInfo.id" << programInfo.id ; + if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } }else{ - QMessageBox::warning(this, "警告", "保存失败!"); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + if(BaseCommonApi::UpdateVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } } } diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index c09fa85..7bf5adb 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -20,6 +20,8 @@ void getCheckMethod(); private slots: void showNewMethod(); + void on_editButton_clicked(); + void on_deleteButton_clicked(); private: Ui::CheckMethodManage *ui; diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index 08f1a92..648509b 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -225,31 +225,61 @@ 序号 + + + 12 + + 检定程序名称 + + + 12 + + 创建人 + + + 12 + + 创建时间 + + + 12 + + 说明 + + + 12 + + 操作 + + + 12 + + diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 90288ab..d9286f1 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -6,18 +6,47 @@ #include #include -NewCheckMethod::NewCheckMethod(QWidget *parent) : +NewCheckMethod::NewCheckMethod(QWidget *parent,QString sId) : QWidget(parent), + methodId(sId), ui(new Ui::NewCheckMethod) { ui->setupUi(this); } + NewCheckMethod::~NewCheckMethod() { delete ui; } +void NewCheckMethod::getMethodInfo() +{ + if(methodId!="") + { + programInfo = BaseCommonApi::getVerificationProgramInfo(methodId); + ui->lineEditName->setText(programInfo.program_name); + ui->lineEditUser->setText(programInfo.create_name); + ui->dateEditTime->setDateTime(programInfo.create_time); + ui->lineEditMark->setText(programInfo.remark); + if(programInfo.img_path!="") + { + //QImage img(programInfo.img_path); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + QString strStyle = "QLabel{" + "image:url("+programInfo.img_path+");" + "}"; + qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); + } + } +} + +void NewCheckMethod::showEvent(QShowEvent *event) +{ +} + void NewCheckMethod::showCheckDevice() { CheckDevice *checkWindow = new CheckDevice; @@ -30,19 +59,24 @@ { QString sName = QFileDialog::getOpenFileName(this,"选择图片","","Image File(*.bmp *.jpg *.jpeg *.png)"); //第一个参数:标准文件对话框的父窗口;第二个参数:标准文件对话框的标题;第三个参数:指定默认的目录;第四个参数:文件过滤器 - QImage img(sName); + //QImage img(sName); //int WindowW = this->width(); //int WindowH = this->height(); //ui->label->setGeometry(0, 0, WindowW, WindowH); - QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); //ui->label_11->setPixmap(QPixmap(sName)); + QString strStyle = "QLabel{" + "image:url("+sName+");" + "}"; + //qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); programInfo.img_path = sName; } void NewCheckMethod::deletePicture() { - ui->label_11->clear(); + ui->label_11->setStyleSheet(""); programInfo.img_path = ""; } @@ -56,21 +90,33 @@ void NewCheckMethod::on_pushButton_3_clicked() { - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - programInfo.id = QString::number(id); - programInfo.program_name = ui->lineEditName->text(); - programInfo.create_name = ui->lineEditUser->text(); - programInfo.create_time = ui->dateEditTime->dateTime(); - programInfo.remark = ui->lineEditMark->text(); - - qDebug() << "programInfo.id" << programInfo.id ; - - if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + if(programInfo.id=="") { - this->close(); + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + programInfo.id = QString::number(id); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + //qDebug() << "programInfo.id" << programInfo.id ; + if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } }else{ - QMessageBox::warning(this, "警告", "保存失败!"); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + if(BaseCommonApi::UpdateVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } } } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index 048f5e0..dfe4e92 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -13,8 +13,9 @@ Q_OBJECT public: - explicit NewCheckMethod(QWidget *parent = nullptr); + explicit NewCheckMethod(QWidget *parent = nullptr,QString sId=""); ~NewCheckMethod(); + void getMethodInfo(); private slots: void showCheckDevice(); void choosePicture(); @@ -24,8 +25,10 @@ void on_pushButton_3_clicked(); void on_pushButton_4_clicked(); - +protected: + void showEvent(QShowEvent *event); private: + QString methodId=""; Ui::NewCheckMethod *ui; VerificationProgramInfo programInfo; }; diff --git a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user index a1348fb..4d3dc70 100644 --- a/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user +++ b/softwareDirectory/AutoVerScheme/AutoVerScheme.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index f4034e2..300668c 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -1,6 +1,7 @@ #include "checkmethodmanage.h" #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" +#include CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -14,6 +15,7 @@ CheckMethodManage::~CheckMethodManage() { + programList.clear(); delete ui; } @@ -25,6 +27,54 @@ checkWindow->show(); } +void CheckMethodManage::on_editButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + QString sId = programList[row].id; + NewCheckMethod* checkWindow = new NewCheckMethod(nullptr,sId); + checkWindow->setWindowState(Qt::WindowMaximized); + checkWindow->setWindowModality(Qt::ApplicationModal); + checkWindow->show(); + checkWindow->getMethodInfo(); +} + +void CheckMethodManage::on_deleteButton_clicked() +{ + QPushButton *pushButton_ = dynamic_cast(this->sender()); + if(NULL == pushButton_) + { + return; + } + // 获取按钮的x坐标和y坐标 + int x = pushButton_->parentWidget()->frameGeometry().x(); + int y = pushButton_->parentWidget()->frameGeometry().y(); + // 根据按钮的x和y坐标来定位对应的单元格 + QModelIndex index = ui->tableWidget_2->indexAt(QPoint(x, y)); + // 获取该按钮所在表格的行号和列号 + int row = index.row(); + //int column = index.column(); + if(QMessageBox::question(this, "确认", "确认删除吗?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)==QMessageBox::Yes) + { + if(BaseCommonApi::DeleteVerificationProgramInfo(programList[row].id)) + { + programList.removeAt(row); + ui->tableWidget_2->removeRow(row); + } + } +} + void CheckMethodManage::getCheckMethod() { programList = BaseCommonApi::getVerificationProgramInfoMain(); @@ -40,19 +90,37 @@ ui->tableWidget_2->setItem(row, 1, new QTableWidgetItem(program.program_name)); //设置数据 ui->tableWidget_2->setItem(row, 2, new QTableWidgetItem(program.create_name)); //设置数据 ui->tableWidget_2->setItem(row, 3, new QTableWidgetItem(program.create_time.toString())); //设置数据 - ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.help_instruction)); //设置数据 + ui->tableWidget_2->setItem(row, 4, new QTableWidgetItem(program.remark)); //设置数据 QPushButton *btn_1 = new QPushButton(); btn_1->setText(tr("编辑")); + btn_1->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(92,170,54,100);" + "text-decoration:underline;" + "}"); + btn_1->setCursor(Qt::PointingHandCursor); + connect(btn_1,SIGNAL(clicked()),this,SLOT(on_editButton_clicked())); + + //btn_1->setIconSize(QSize(16,16)); + //btn_1->setIcon(QIcon(":/image/Index/u15.png")); QPushButton *btn_2 = new QPushButton(); btn_2->setText(tr("删除")); - + btn_2->setStyleSheet("QPushButton{" + "background-color:rgba(255,255,255,0);" + "color:rgba(170,17,17,100);" + "text-decoration:underline;" + "}"); + btn_2->setCursor(Qt::PointingHandCursor); + connect(btn_2,SIGNAL(clicked()),this,SLOT(on_deleteButton_clicked())); + //btn_2->setIconSize(QSize(16,16)); + //btn_2->setIcon(QIcon(":/image/Index/u102.png")); QWidget *tmp_widget = new QWidget(); QHBoxLayout *tmp_layout = new QHBoxLayout(tmp_widget); tmp_layout->addWidget(btn_1); tmp_layout->addWidget(btn_2); tmp_layout->setMargin(0); - ui->tableWidget_2->setCellWidget(row,6,tmp_widget); + ui->tableWidget_2->setCellWidget(row,5,tmp_widget); row++; } } diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.h b/softwareDirectory/AutoVerScheme/checkmethodmanage.h index c09fa85..7bf5adb 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.h +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.h @@ -20,6 +20,8 @@ void getCheckMethod(); private slots: void showNewMethod(); + void on_editButton_clicked(); + void on_deleteButton_clicked(); private: Ui::CheckMethodManage *ui; diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index 08f1a92..648509b 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -225,31 +225,61 @@ 序号 + + + 12 + + 检定程序名称 + + + 12 + + 创建人 + + + 12 + + 创建时间 + + + 12 + + 说明 + + + 12 + + 操作 + + + 12 + + diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp index 90288ab..d9286f1 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.cpp +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.cpp @@ -6,18 +6,47 @@ #include #include -NewCheckMethod::NewCheckMethod(QWidget *parent) : +NewCheckMethod::NewCheckMethod(QWidget *parent,QString sId) : QWidget(parent), + methodId(sId), ui(new Ui::NewCheckMethod) { ui->setupUi(this); } + NewCheckMethod::~NewCheckMethod() { delete ui; } +void NewCheckMethod::getMethodInfo() +{ + if(methodId!="") + { + programInfo = BaseCommonApi::getVerificationProgramInfo(methodId); + ui->lineEditName->setText(programInfo.program_name); + ui->lineEditUser->setText(programInfo.create_name); + ui->dateEditTime->setDateTime(programInfo.create_time); + ui->lineEditMark->setText(programInfo.remark); + if(programInfo.img_path!="") + { + //QImage img(programInfo.img_path); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + QString strStyle = "QLabel{" + "image:url("+programInfo.img_path+");" + "}"; + qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); + } + } +} + +void NewCheckMethod::showEvent(QShowEvent *event) +{ +} + void NewCheckMethod::showCheckDevice() { CheckDevice *checkWindow = new CheckDevice; @@ -30,19 +59,24 @@ { QString sName = QFileDialog::getOpenFileName(this,"选择图片","","Image File(*.bmp *.jpg *.jpeg *.png)"); //第一个参数:标准文件对话框的父窗口;第二个参数:标准文件对话框的标题;第三个参数:指定默认的目录;第四个参数:文件过滤器 - QImage img(sName); + //QImage img(sName); //int WindowW = this->width(); //int WindowH = this->height(); //ui->label->setGeometry(0, 0, WindowW, WindowH); - QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); - ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); + //QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + //ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); //ui->label_11->setPixmap(QPixmap(sName)); + QString strStyle = "QLabel{" + "image:url("+sName+");" + "}"; + //qDebug() << "strStyle:" << strStyle ; + ui->label_11->setStyleSheet(strStyle); programInfo.img_path = sName; } void NewCheckMethod::deletePicture() { - ui->label_11->clear(); + ui->label_11->setStyleSheet(""); programInfo.img_path = ""; } @@ -56,21 +90,33 @@ void NewCheckMethod::on_pushButton_3_clicked() { - BaseCommonApi baseApi; - qint64 id = baseApi.generateId(); - programInfo.id = QString::number(id); - programInfo.program_name = ui->lineEditName->text(); - programInfo.create_name = ui->lineEditUser->text(); - programInfo.create_time = ui->dateEditTime->dateTime(); - programInfo.remark = ui->lineEditMark->text(); - - qDebug() << "programInfo.id" << programInfo.id ; - - if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + if(programInfo.id=="") { - this->close(); + BaseCommonApi baseApi; + qint64 id = baseApi.generateId(); + programInfo.id = QString::number(id); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + //qDebug() << "programInfo.id" << programInfo.id ; + if(BaseCommonApi::InsertVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } }else{ - QMessageBox::warning(this, "警告", "保存失败!"); + programInfo.program_name = ui->lineEditName->text(); + programInfo.create_name = ui->lineEditUser->text(); + programInfo.create_time = ui->dateEditTime->dateTime(); + programInfo.remark = ui->lineEditMark->text(); + if(BaseCommonApi::UpdateVerificationProgramInfo(programInfo)) + { + this->close(); + }else{ + QMessageBox::warning(this, "警告", "保存失败!"); + } } } diff --git a/softwareDirectory/AutoVerScheme/newcheckmethod.h b/softwareDirectory/AutoVerScheme/newcheckmethod.h index 048f5e0..dfe4e92 100644 --- a/softwareDirectory/AutoVerScheme/newcheckmethod.h +++ b/softwareDirectory/AutoVerScheme/newcheckmethod.h @@ -13,8 +13,9 @@ Q_OBJECT public: - explicit NewCheckMethod(QWidget *parent = nullptr); + explicit NewCheckMethod(QWidget *parent = nullptr,QString sId=""); ~NewCheckMethod(); + void getMethodInfo(); private slots: void showCheckDevice(); void choosePicture(); @@ -24,8 +25,10 @@ void on_pushButton_3_clicked(); void on_pushButton_4_clicked(); - +protected: + void showEvent(QShowEvent *event); private: + QString methodId=""; Ui::NewCheckMethod *ui; VerificationProgramInfo programInfo; }; diff --git a/softwareDirectory/AutoVerScheme/verifymethodmanage.ui b/softwareDirectory/AutoVerScheme/verifymethodmanage.ui index a7ce927..d87b91b 100644 --- a/softwareDirectory/AutoVerScheme/verifymethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/verifymethodmanage.ui @@ -224,36 +224,71 @@ 选择 + + + 12 + + 序号 + + + 12 + + 核查程序名称 + + + 12 + + 创建人 + + + 12 + + 创建时间 + + + 12 + + 说明 + + + 12 + + 操作 + + + 12 + +