-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaschredialog.cpp
94 lines (82 loc) · 2.84 KB
/
aschredialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "aschredialog.h"
#include "ui_aschredialog.h"
#include "repairscheduledialog.h"
#include <QtSql>
#include <QString>
#include <QPainter>
#include <QMessageBox>
#include <QTranslator>
extern bool language_en;
extern QString changeReId;
extern int power;
extern QString uid;
ASChReDialog::ASChReDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ASChReDialog)
{
ui->setupUi(this);
this->setFixedSize(this->width(), this->height());
showL();
if(language_en){
QTranslator translator;
translator.load(":language/qzher_en.qm");
qApp->installTranslator(&translator);
ui->retranslateUi(this);
}
}
ASChReDialog::~ASChReDialog()
{
delete ui;
}
void ASChReDialog::paintEvent(QPaintEvent*){
QPainter painter(this);
QPixmap pix;
pix.load(":/IconPic/pic/backimage.jpg");//图片的位置
painter.drawPixmap(0,0,this->width(),this->height(),pix);//根据窗口的宽高来将图片画在窗口上
}
void ASChReDialog::showL(){
QSqlQuery query;
query.exec(QString("SELECT * FROM repair WHERE id = %1").arg(changeReId));
query.next();
ui->edtOwnerUid->setText(query.value("ownerUid").toString().trimmed());
ui->edtName->setText(query.value("owner").toString().trimmed());
ui->edtHouseId->setText(query.value("houseId").toString().trimmed());
ui->edtKind->setText(query.value("kind").toString().trimmed());
ui->edtProblem->setText(query.value("problem").toString().trimmed());
ui->edtStaff->setText(query.value("solveStaff").toString().trimmed());
ui->edtTele->setText(query.value("teleNum").toString().trimmed());
ui->edtState->setText(query.value("state").toString().trimmed());
if(query.value("evaluate").toBool()){
QString star;
ui->edtEvaluate->setText(query.value("thank").toString().trimmed());
for(int i = 0; i < query.value("star").toInt(); i++){
star += "★";
}
ui->txtStar->setText(star);
}else{
ui->edtEvaluate->setText(QObject::tr("尚未评价"));
ui->txtStar->setText(QObject::tr("尚未评价"));
}
if(query.value("state").toString().trimmed() == "已解决"){
ui->btnSubmit->setEnabled(false);
}
}
void ASChReDialog::submit(){
QSqlQuery query;
query.prepare("UPDATE repair SET solveStaff = ?, teleNum = ?, state = ? "
"WHERE id = ?");
query.addBindValue(ui->edtStaff->text().trimmed());
query.addBindValue(ui->edtTele->text().trimmed());
query.addBindValue(ui->boxState->currentText());
query.addBindValue(changeReId);
query.exec();
QMessageBox::information(this, QObject::tr("成功"), QObject::tr("修改成功!"));
RepairScheduleDialog rsDlg;
this->accept();
rsDlg.exec();
}
void ASChReDialog::closeEvent(QCloseEvent * event){
RepairScheduleDialog rsDlg;
this->accept();
rsDlg.exec();
}