From 781f2864a66bea976c2b701a5e0803d11f2c5edf Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 31 Mar 2023 18:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E8=8B=A5=E5=B9=B2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96=E8=8B=A5=E5=B9=B2=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MagicLightAssistant.vcxproj.filters | 6 +- MagicLightAssistant.vcxproj.user | 4 +- activitymanagework.cpp | 7 +- approvalwork.cpp | 17 +- approvalwork.h | 6 +- attendmanagework.cpp | 40 ++++- attendmanagework.h | 7 +- attendwork.cpp | 78 +++++--- attendwork.h | 6 +- checkupdate.cpp | 4 +- eCharts/echarts_workTime.html | 4 +- excelexport.cpp | 99 +++-------- excelexport.h | 24 ++- formLogin.ui | 60 ++++--- formlogin.cpp | 4 +- friendinfowidget.cpp | 2 +- img/nt-logo.png | Bin 0 -> 17215 bytes mainwindow.cpp | 267 ++++++++++++++++------------ mainwindow.h | 10 +- mainwindow.ui | 19 +- msgservice.cpp | 16 +- posterwork.cpp | 6 +- resource.qrc | 1 + usermanagework.cpp | 26 ++- usermanagework.h | 4 +- 25 files changed, 399 insertions(+), 318 deletions(-) create mode 100644 img/nt-logo.png diff --git a/MagicLightAssistant.vcxproj.filters b/MagicLightAssistant.vcxproj.filters index a72f223..76d381e 100644 --- a/MagicLightAssistant.vcxproj.filters +++ b/MagicLightAssistant.vcxproj.filters @@ -133,9 +133,6 @@ Header Files - - Header Files - Header Files @@ -456,6 +453,9 @@ Generated Files + + Header Files + diff --git a/MagicLightAssistant.vcxproj.user b/MagicLightAssistant.vcxproj.user index b3a60d5..d2465dd 100644 --- a/MagicLightAssistant.vcxproj.user +++ b/MagicLightAssistant.vcxproj.user @@ -2,9 +2,9 @@ - 2023-03-14T12:37:28.3943389Z + 2023-03-31T07:04:21.6303138Z - 2023-03-14T12:37:28.4952107Z + 2023-03-31T07:04:21.8030684Z \ No newline at end of file diff --git a/activitymanagework.cpp b/activitymanagework.cpp index c50b569..6ed427a 100644 --- a/activitymanagework.cpp +++ b/activitymanagework.cpp @@ -45,6 +45,8 @@ void ActivityManageWork::working() tabModel->setHeaderData(tabModel->fieldIndex("editUid"), Qt::Horizontal, "发布者UID"); tabModel->setHeaderData(tabModel->fieldIndex("act_score"), Qt::Horizontal, "活动学时"); tabModel->select(); + while(tabModel->canFetchMore()) + tabModel->fetchMore(); //加载超过256的其余数据 memberTabModel->setTable("magic_activityMembers"); memberTabModel->setSort(memberTabModel->fieldIndex("actm_joinDate"), Qt::DescendingOrder); @@ -54,6 +56,9 @@ void ActivityManageWork::working() memberTabModel->setHeaderData(memberTabModel->fieldIndex("actm_joinDate"), Qt::Horizontal, "报名时间"); memberTabModel->setHeaderData(memberTabModel->fieldIndex("status"), Qt::Horizontal, "活动状态"); memberTabModel->select(); + while (memberTabModel->canFetchMore()) + memberTabModel->fetchMore(); //加载超过256的其余数据 + if (type == 1) updateActStatus(); //更新已报名活动状态并统计学时 emit activityManageWorkFinished(type); @@ -86,7 +91,7 @@ void ActivityManageWork::updateActStatus() } memberTabModel->setFilter("actm_uid=" + uid); - qDebug() << "当前待新增的总学时:" + QString::number(curScore); + qDebug() << "当前待新增总学时:" + QString::number(curScore); } void ActivityManageWork::homeWorking()//已废弃 diff --git a/approvalwork.cpp b/approvalwork.cpp index 3b6c5ea..d4a8d45 100644 --- a/approvalwork.cpp +++ b/approvalwork.cpp @@ -121,6 +121,7 @@ void ApprovalWork::getUserPageApplyItems(const QString& uid) { DB.open(); QSqlQuery query(DB); + //ȡĿ query.exec(QString("SELECT * FROM magic_applyItems WHERE isHide=0")); applyItems.clear(); while (query.next()) { @@ -143,9 +144,11 @@ void ApprovalWork::getUserPageApplyItems(const QString& uid) } } query.clear(); + //ȡûύ applyForms.clear(); query.exec(QString("SELECT * FROM magic_apply WHERE uid=%1 ORDER BY apply_id DESC").arg(uid)); //id + DB_SECOND.open(); //getApplyProcess()ǰ򿪸ݿ while(query.next()) { QByteArray array; @@ -166,8 +169,8 @@ void ApprovalWork::getUserPageApplyItems(const QString& uid) } } query.clear(); - DB.close(); - + DB_SECOND.close(); //رյgetApplyProcess()ݿ + DB.close(); emit getUserPageApplyItemsFinished(); } @@ -227,7 +230,7 @@ void ApprovalWork::autoExecuteSystemApplyItems() DB_SECOND.close(); finishedNum++; if(!mail.isEmpty()) - service::sendMail(smtp_config, mail, "WePlanet ȸ", QString("û%1\nġϢ춯롿ˣϢѸ¡\n\nע춯ϢϵԱ").arg(record.value("uid").toString())); + service::sendMail(smtp_config, mail, "WePlanet ȸ", QString("û%1\nġϢ춯롿ˣϢѸ¡\n\nע춯ϢϵԱ").arg(record.value("uid").toString())); } } } @@ -279,7 +282,7 @@ void ApprovalWork::autoExecuteSystemApplyItems() DB_SECOND.close(); finishedNum++; if (!mail.isEmpty()) - service::sendMail(smtp_config, mail, "WePlanet ȸ", QString("û%1\nġ˺֤롿ˣ˺֤ϢѸ¡\n\nע֤ϢϵԱ").arg(record.value("uid").toString())); + service::sendMail(smtp_config, mail, "WePlanet ȸ", QString("û%1\nġ˺֤롿ˣ˺֤ϢѸ¡\n\nע֤ϢϵԱ").arg(record.value("uid").toString())); } } } @@ -291,9 +294,9 @@ void ApprovalWork::autoExecuteSystemApplyItems() emit autoExecuteSystemApplyItemsFinished(finishedNum); } -int ApprovalWork::getApplyProcess(const QString& apply_id, const QString& item_id) +int ApprovalWork::getApplyProcess(const QString& apply_id, const QString& item_id) //ô˺ǰݿDB_SECOND { - DB_SECOND.open(); + //DB_SECOND.open(); QSqlQuery query(DB_SECOND); currentProcess.clear(); int step = 0, apply_status = 0; //ѳɹ̣ͨ״̬ @@ -329,7 +332,7 @@ int ApprovalWork::getApplyProcess(const QString& apply_id, const QString& item_i applyFormsProcess.insert(apply_id, currentProcess); //˵IJӦidֵ query.clear(); - DB_SECOND.close(); + //DB_SECOND.close(); return apply_status; } diff --git a/approvalwork.h b/approvalwork.h index b3293b2..0806984 100644 --- a/approvalwork.h +++ b/approvalwork.h @@ -25,11 +25,11 @@ class ApprovalWork : public QObject QList smtp_config; public: - void getManagePageApplyItems(const QString& uid); - void getUserPageApplyItems(const QString& uid); + void getManagePageApplyItems(const QString& uid); //ҳ + void getUserPageApplyItems(const QString& uid); //ûҳ void getManagePageAuditorList(); //ȡȨ޵Աб void getAllApplyFormList(const QString& uid); //ȡйԱ - int getApplyProcess(const QString& apply_id, const QString& item_id); //״̬ + int getApplyProcess(const QString& apply_id, const QString& item_id); //ȡ̣״̬ô˺ǰݿDB_SECONDӣ void addOrModifyApplyItem(int type, QByteArray array); //01޸ ByteArray ->ѡ->->->isHide QByteArray getSimpleApplyItems(const QString& item_id); QList getApplyFormList(); diff --git a/attendmanagework.cpp b/attendmanagework.cpp index 6b47263..048c6a0 100644 --- a/attendmanagework.cpp +++ b/attendmanagework.cpp @@ -8,7 +8,7 @@ AttendManageWork::AttendManageWork(QObject *parent) : QObject(parent) //DB.setConnectOptions("MYSQL_OPT_RECONNECT=1"); //超时重连 heartBeat = new QTimer(this); connect(heartBeat, &QTimer::timeout, this, [=]() { - if (isDisplay) + if (isDisplay && userModel != nullptr && attendModel != nullptr) { userModel->select(); attendModel->select(); @@ -31,8 +31,13 @@ void AttendManageWork::working() { if (!DB.isOpen()) DB.open(); + + //使用relationalModel时,这数据库不能关闭,否则外键的映射就没办法操作了...早知道不用relationalModel了,数据库连接很难管理... + if(userModelQueue.count() >= 2) + delete userModelQueue.dequeue(); //仅保留前一个model + userModel = new QSqlRelationalTableModel(this, DB); + userModelQueue.enqueue(userModel); isDisplay = true; - //使用relationalModel时,这数据库不能关闭,否则外键的映射就没办法操作了...早知道不用relationalModel了,数据库连接很难管理... userModel->setTable("magic_users"); userModel->setSort(userModel->fieldIndex("uid"), Qt::AscendingOrder); //升序排列 userModel->setEditStrategy(QSqlTableModel::OnManualSubmit); //手动提交 @@ -51,6 +56,13 @@ void AttendManageWork::working() userModel->setRelation(userModel->fieldIndex("user_group"), QSqlRelation("magic_group", "group_id", "group_name")); userModel->setRelation(userModel->fieldIndex("user_dpt"), QSqlRelation("magic_department", "dpt_id", "dpt_name")); userModel->select(); + while (userModel->canFetchMore()) + userModel->fetchMore(); //加载超过256的其余数据 + + if(attendModelQueue.count() >= 2) + delete attendModelQueue.dequeue(); + attendModel = new QSqlRelationalTableModel(this, DB); + attendModelQueue.enqueue(attendModel); attendModel->setTable("magic_attendance"); attendModel->setSort(attendModel->fieldIndex("today"), Qt::DescendingOrder); //时间降序排列 @@ -66,6 +78,8 @@ void AttendManageWork::working() //建立外键关联 attendModel->setRelation(attendModel->fieldIndex("operator"), QSqlRelation("magic_users", "uid", "name")); attendModel->select(); + while (attendModel->canFetchMore()) + attendModel->fetchMore(); //加载超过256的其余数据 //将未签退的考勤项签退,签退时间23:59:59 DB_SECOND.open(); @@ -154,19 +168,29 @@ void AttendManageWork::setCurAvatarUrl(const QString url) avatarUrl = url; } -void AttendManageWork::setUserModel(QSqlRelationalTableModel *relTableModel) +//void AttendManageWork::setUserModel(QSqlRelationalTableModel *relTableModel) +//{ +// userModel = relTableModel; +//} +// +//void AttendManageWork::setAttendModel(QSqlRelationalTableModel *relTableModel) +//{ +// attendModel = relTableModel; +//} + +QSqlDatabase AttendManageWork::getDB() { - userModel = relTableModel; + return DB; } -void AttendManageWork::setAttendModel(QSqlRelationalTableModel *relTableModel) +QSqlRelationalTableModel* AttendManageWork::getUserModel() { - attendModel = relTableModel; + return userModel; } -QSqlDatabase AttendManageWork::getDB() +QSqlRelationalTableModel* AttendManageWork::getAttendModel() { - return DB; + return attendModel; } void AttendManageWork::getComboxItems(QStringList& comboxItems_group, QStringList& comboxItems_department) diff --git a/attendmanagework.h b/attendmanagework.h index 81894d1..a4b2726 100644 --- a/attendmanagework.h +++ b/attendmanagework.h @@ -17,8 +17,8 @@ class AttendManageWork : public QObject bool isFirst = true; //是否为首次加载model void working(); void setCurAvatarUrl(const QString url); - void setUserModel(QSqlRelationalTableModel *relTableModel); - void setAttendModel(QSqlRelationalTableModel *relTableModel); + //void setUserModel(QSqlRelationalTableModel *relTableModel); + //void setAttendModel(QSqlRelationalTableModel *relTableModel); void getComboxItems(QStringList& comboxItems_group, QStringList& comboxItems_department); //已弃用 void submitAll(int type); //1补签 0退签 void loadAvatar(); @@ -27,6 +27,8 @@ class AttendManageWork : public QObject void setFilter(int type, const QString& filter); bool isDisplay = false; QSqlDatabase getDB(); + QSqlRelationalTableModel* getUserModel(); + QSqlRelationalTableModel* getAttendModel(); private: service db_service; QComboBox *m_group, *m_department; @@ -36,6 +38,7 @@ class AttendManageWork : public QObject QStringList comboxItems_group, comboxItems_department; QSqlRelationalTableModel *userModel, *attendModel; QTimer* heartBeat; + QQueue userModelQueue, attendModelQueue; void getComboxItems(); signals: void attendManageWorkFinished(); diff --git a/attendwork.cpp b/attendwork.cpp index bc48d0a..c50e779 100644 --- a/attendwork.cpp +++ b/attendwork.cpp @@ -8,7 +8,7 @@ AttendWork::AttendWork(QObject *parent) : QObject(parent) //DB.setConnectOptions("MYSQL_OPT_RECONNECT=1"); //超时重连 heartBeat = new QTimer(this); connect(heartBeat, &QTimer::timeout, this, [=]() { - if (isDisplay) + if (isDisplay && relTableModel != nullptr) relTableModel->select(); else if (DB.isOpen()) @@ -28,6 +28,11 @@ void AttendWork::working() { if (!DB.isOpen()) DB.open(); + + if (modelQueue.count() >= 2) + delete modelQueue.dequeue(); + relTableModel = new QSqlRelationalTableModel(this, DB); + modelQueue.enqueue(relTableModel); isDisplay = true; relTableModel->setTable("magic_attendance"); relTableModel->setSort(relTableModel->fieldIndex("today"), Qt::DescendingOrder); //时间降序排列 @@ -44,6 +49,8 @@ void AttendWork::working() relTableModel->setRelation(relTableModel->fieldIndex("operator"), QSqlRelation("magic_users", "uid", "name")); relTableModel->select(); relTableModel->setFilter("a_uid='" + uid +"'"); + while (relTableModel->canFetchMore()) + relTableModel->fetchMore(); //加载超过256的其余数据 //将未签退的考勤项签退,签退时间23:59:59 DB_SECOND.open(); @@ -61,22 +68,17 @@ void AttendWork::working() void AttendWork::homeChartWorking() { - if (!DB.isOpen()) - DB.open(); - isDisplay = true; - relTableModel->setTable("magic_attendance"); - relTableModel->setSort(relTableModel->fieldIndex("today"), Qt::DescendingOrder); //时间降序排列 - relTableModel->setEditStrategy(QSqlTableModel::OnManualSubmit); //手动提交 - relTableModel->select(); - relTableModel->setFilter("a_uid='" + uid + "'"); - analyseWorkTime(); + DB_SECOND.open(); + + QSqlQuery query(DB_SECOND); + query.exec(QString("SELECT * FROM magic_attendance WHERE a_uid='%1' ORDER BY today DESC").arg(uid)); + analyseWorkTime(&query); QJsonObject seriesObj; QJsonArray dateArray; seriesObj.insert("data_yStatus", weekAllWorkStatus); seriesObj.insert("data_yTime", weekMyWorkTime); - seriesObj.insert("data_yMem", weekWorkMem); QString date; QDateTime curDateTime = QDateTime::fromSecsSinceEpoch(service::getWebTime()); @@ -90,11 +92,14 @@ void AttendWork::homeChartWorking() seriesObj.insert("data_x", dateArray); QString jsCode = QString("init(%1, 1)").arg(QString(QJsonDocument(seriesObj).toJson())); - isDisplay = false; //首页仅需要展示图表,并不需要model一直活动 + isDisplay = false; //首页仅需要展示图表,并不需要model活动 + + query.clear(); + DB_SECOND.close(); emit homeChartDone(jsCode); } -void AttendWork::analyseWorkTime() +void AttendWork::analyseWorkTime(QSqlQuery* query) { int cnt = 0; QTime workTime(0, 0, 0, 0), beginTime, endTime; @@ -105,7 +110,12 @@ void AttendWork::analyseWorkTime() for(int i = 0; i < 4; i++) workTimeData[i] = 0; do{ - curRecord = relTableModel->record(cnt); + if (query != nullptr && query->seek(cnt)) + curRecord = query->record(); + else if (query == nullptr) + curRecord = relTableModel->record(cnt); + else + break; if(!curRecord.value("begin_date").isNull() && !curRecord.value("end_date").isNull()) { beginTime = QTime::fromString(curRecord.value("begin_date").toString(), "hh:mm:ss"); @@ -123,6 +133,7 @@ void AttendWork::analyseWorkTime() } cnt ++; }while(!curRecord.value("begin_date").isNull()); + today = today.addDays(-7); for (int i = 0; i < 7; i++) { @@ -130,7 +141,12 @@ void AttendWork::analyseWorkTime() today = today.addDays(1); workTime.setHMS(0, 0, 0); do{ - curRecord = relTableModel->record(cnt); + if (query != nullptr && query->seek(cnt)) + curRecord = query->record(); + else if (query == nullptr) + curRecord = relTableModel->record(cnt); + else + break; if (today.date().toString("yyyy-MM-dd") == curRecord.value("today").toDateTime().date().toString("yyyy-MM-dd")) { beginTime = QTime::fromString(curRecord.value("begin_date").toString(), "hh:mm:ss"); @@ -147,16 +163,19 @@ void AttendWork::analyseWorkTime() } this->weekMyWorkTime = weekMyWorkTime; this->weekAllWorkStatus = weekAllWorkStatus; - QString preFilter = relTableModel->filter(); - today = today.addDays(-7); - for (int i = 0; i < 7; i++) + if (query == nullptr) { - today = today.addDays(1); - relTableModel->setFilter("today='" + today.date().toString("yyyy-MM-dd") + "'"); - weekWorkMem[i] = relTableModel->rowCount(); + QString preFilter = relTableModel->filter(); + today = today.addDays(-7); + for (int i = 0; i < 7; i++) + { + today = today.addDays(1); + relTableModel->setFilter("today='" + today.date().toString("yyyy-MM-dd") + "'"); + weekWorkMem[i] = relTableModel->rowCount(); + } + relTableModel->setFilter(preFilter); + this->weekWorkMem = weekWorkMem; } - relTableModel->setFilter(preFilter); - this->weekWorkMem = weekWorkMem; } void AttendWork::analyseWorkStatus() @@ -175,10 +194,10 @@ void AttendWork::setUid(const QString &uid) this->uid = uid; } -void AttendWork::setModel(QSqlRelationalTableModel *relTableModel) -{ - this->relTableModel = relTableModel; -} +//void AttendWork::setModel(QSqlRelationalTableModel *relTableModel) +//{ +// this->relTableModel = relTableModel; +//} int AttendWork::fieldIndex(const QString &field) { @@ -205,6 +224,11 @@ QJsonArray AttendWork::getWeekWorkMem() return weekWorkMem; } +QSqlRelationalTableModel* AttendWork::getModel() +{ + return relTableModel; +} + QSqlDatabase AttendWork::getDB() { return DB; diff --git a/attendwork.h b/attendwork.h index deae423..85038c2 100644 --- a/attendwork.h +++ b/attendwork.h @@ -21,17 +21,18 @@ class AttendWork : public QObject ~AttendWork(); void working(); void homeChartWorking(); - void analyseWorkTime(); + void analyseWorkTime(QSqlQuery* query = nullptr); void analyseWorkStatus(); QSqlRecord getRecord(const int index); QSqlDatabase getDB(); void setUid(const QString& uid); - void setModel(QSqlRelationalTableModel *relTableModel); + //void setModel(QSqlRelationalTableModel *relTableModel); int fieldIndex(const QString &field); int* getWorkTime(); QJsonArray getWeekMyWorkTime(); QJsonArray getWeekAllWorkStatus(); QJsonArray getWeekWorkMem(); + QSqlRelationalTableModel* getModel(); bool isDisplay = false; private slots: void submitAll(int type); //1代表签到,0代表签退 @@ -43,6 +44,7 @@ private slots: QSqlRelationalTableModel *relTableModel; QJsonArray weekMyWorkTime, weekAllWorkStatus, weekWorkMem; QTimer* heartBeat; + QQueue modelQueue; signals: void attendWorkFinished(); void attendDone(bool); diff --git a/checkupdate.cpp b/checkupdate.cpp index 8c841bb..3bad2ea 100644 --- a/checkupdate.cpp +++ b/checkupdate.cpp @@ -3,8 +3,8 @@ checkUpdate::checkUpdate() { - CurVersion = "1.2.8.9"; //在此处定义软件当前版本 - AutoUpdateToolVersion = 11289; //自动更新工具识别版本 + CurVersion = "1.2.9.0"; //在此处定义软件当前版本 + AutoUpdateToolVersion = 11290; //自动更新工具识别版本 writeVersion(); } checkUpdate::~checkUpdate() diff --git a/eCharts/echarts_workTime.html b/eCharts/echarts_workTime.html index 0859dff..7e14d6f 100644 --- a/eCharts/echarts_workTime.html +++ b/eCharts/echarts_workTime.html @@ -22,7 +22,7 @@ myChart.clear(); option = { title: { - text: '工时总体数据分析', + text: '我的工作时长数据统计', subtext: args['type'], left: 'center' }, @@ -36,7 +36,7 @@ }, series: [ { - name: '工时数据统计', + name: '该区间工作时长数量', type: 'pie', radius: '50%', data: args['data'], diff --git a/excelexport.cpp b/excelexport.cpp index 13d7950..7b71eb4 100644 --- a/excelexport.cpp +++ b/excelexport.cpp @@ -8,105 +8,56 @@ #include "excelexport.h" -ExcelExport::ExcelExport(QObject *parent) +ExcelExport::ExcelExport() { - this->parent = parent; } ExcelExport::~ExcelExport() { } -// type 1 - 导出所有记录,type 2 - 导出当天所有记录,type 3 - 导出当前用户所有记录 -bool ExcelExport::WriteExcel(const QString &filePath, QSqlTableModel *tableModel, const QString &uid, int type) +bool ExcelExport::WriteExcel(const QString &filepath, QStack& dataStack) { - if (filePath.isEmpty()) + if (filepath.isEmpty()) return false; - excel = new QAxObject(parent); - excel->setControl("Excel.Application"); - excel->dynamicCall("SetVisible(bool Visible)", false); - excel->setProperty("DisplayAlerts", false); - - QAxObject *workbooks = excel->querySubObject("WorkBooks"); - workbooks->dynamicCall("Add"); - QAxObject *workbook = excel->querySubObject("ActiveWorkBook"); - QAxObject *worksheets = workbook->querySubObject("Sheets"); - QAxObject *worksheet = worksheets->querySubObject("Item(int)", 1); + QFile csvfile(filepath); + csvfile.open(QIODevice::WriteOnly | QIODevice::Text); + QTextStream out(&csvfile); QStringList headData; - headData << "账号(UID)" + headData << "考勤编号" + << "用户账号" << "签到时间" << "签退时间" << "考勤日期" << "是否补签" << "签到来源"; - QSqlRecord curRecord = tableModel->record(0); //获取记录 curDateTime = QDateTime::currentDateTime(); //写入表头 - int column = 1; - foreach (auto cur, headData) + int headcnt = 0; + foreach(auto headTitle, headData) { - QAxObject *Range = worksheet->querySubObject("Cells(int, int)", 1, column++); - Range->dynamicCall("SetValue(const QString &)", cur); + if (++headcnt < headData.count()) + out << headTitle << ","; + else + out << headTitle << "\n"; } //写入考勤数据 - switch (type) + while(!dataStack.isEmpty()) { - case 1: - tableModel->setFilter(""); - for (int i = 1; curRecord.value("num").isValid(); i++) - { - curRecord = tableModel->record(i - 1); - for (int j = 1; curRecord.value(j).isValid(); j++) - { - QAxObject *Range = worksheet->querySubObject("Cells(int, int)", i + 1, j); //从第二行开始 - Range->dynamicCall("SetValue(const QString &)", curRecord.value(j).toString()); - } - } - tableModel->setFilter("a_uid='" + uid +"'"); - break; - case 2: - tableModel->setFilter(""); - for (int i = 1; curRecord.value("num").isValid(); i++) - { - curRecord = tableModel->record(i - 1); - if (curRecord.value("today") != curDateTime.date().toString("yyyy-MM-dd")) - continue; - for (int j = 1; curRecord.value(j).isValid(); j++) - { - QAxObject *Range = worksheet->querySubObject("Cells(int, int)", i + 1, j); //从第二行开始 - Range->dynamicCall("SetValue(const QString &)", curRecord.value(j).toString()); - } - } - tableModel->setFilter("a_uid='" + uid +"'"); - break; - case 3: - tableModel->setSort(tableModel->fieldIndex("a_uid"), Qt::DescendingOrder); //暂时按UID排列,避免出现空行 - for (int i = 1; curRecord.value("num").isValid(); i++) + QSqlRecord lineData = dataStack.pop(); + for(int cnt = 0; cnt < lineData.count(); cnt++) { - curRecord = tableModel->record(i - 1); - if (curRecord.value("a_uid") != uid) - continue; - for (int j = 1; curRecord.value(j).isValid(); j++) - { - QAxObject *Range = worksheet->querySubObject("Cells(int, int)", i + 1, j); //从第二行开始 - Range->dynamicCall("SetValue(const QString &)", curRecord.value(j).toString()); - } + QString data = lineData.value(cnt).toString(); + if (cnt + 1 < lineData.count()) + out << data << ","; + else + out << data << "\n"; } - tableModel->setSort(tableModel->fieldIndex("today"), Qt::DescendingOrder); //恢复时间降序排列 - break; - default: - return false; - } - workbook->dynamicCall("SaveAs(const QString &)", QDir::toNativeSeparators(filePath)); - if (excel != NULL) - { - excel->dynamicCall("Quit()"); - delete excel; - return true; } - else - return false; + csvfile.flush(); + csvfile.close(); + return true; } diff --git a/excelexport.h b/excelexport.h index 2f5f40f..6e9c4a4 100644 --- a/excelexport.h +++ b/excelexport.h @@ -1,9 +1,6 @@ /***************************************************/ -/* Magic Light Assistant */ -/* Copyright (c) 2017-2021 by bytecho.net */ +/* Copyright (c) 2017-2023 bytecho.net */ /* Written by Henry */ -/* Function: */ -/* Communication, activity, management and approval*/ /***************************************************/ #pragma once #pragma execution_character_set("utf-8") @@ -11,27 +8,26 @@ #ifndef EXCELEXPORT_H #define EXCELEXPORT_H -#include -#include -#include #include -#include +#include #include +#include +#include +#include #include -#include - class ExcelExport { public: - ExcelExport(QObject* parent); + ExcelExport(); ~ExcelExport(); - bool WriteExcel(const QString& filePath, QSqlTableModel* tableModel, const QString& uid, int type); + bool WriteExcel(const QString& filepath, QStack& dataStack); private: - QObject *parent; - QAxObject *excel; QDateTime curDateTime; + +signals: + void exportExcelFinished(bool res); }; #endif diff --git a/formLogin.ui b/formLogin.ui index 0865fb4..c0e1789 100644 --- a/formLogin.ui +++ b/formLogin.ui @@ -44,24 +44,6 @@ - - - - - 微软雅黑 - 9 - 75 - true - - - - -- - - - true - - - @@ -79,14 +61,42 @@ - - :/images/color_icon/color-tips.svg - true + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 微软雅黑 + 9 + 75 + true + + + + -- + + + true + + + @@ -159,13 +169,13 @@ - 95 + 63 38 - 95 + 63 38 @@ -173,7 +183,7 @@ - :/images/img/qq-nt-logo.png + :/images/img/nt-logo.png true @@ -912,7 +922,7 @@ padding: 0px 5px; 32767 - 请输入找回账号绑定的邮箱... + 请输入待找回账号所绑定的邮箱... diff --git a/formlogin.cpp b/formlogin.cpp index 05d6155..4bfae83 100644 --- a/formlogin.cpp +++ b/formlogin.cpp @@ -191,7 +191,7 @@ formLogin::formLogin(QDialog *parent) : ui->label_announcement->adjustSize(); //自动调整大小 this->adjustSize(); if (loginWork->getAnnouncementTag() == 1) - ui->label_announcementIcon->setPixmap(QPixmap(":/images/color_icon/color-tips.svg")); + ui->label_announcementIcon->setPixmap(QPixmap(":/images/color_icon/color-info.svg")); else ui->label_announcementIcon->setPixmap(QPixmap(":/images/color_icon/color-warning_2.svg")); } @@ -200,7 +200,7 @@ formLogin::formLogin(QDialog *parent) : if (loginWork->getIsDebug()) { ui->tabWidget->setEnabled(false); - ui->btn_Login->setText("【系统维护中,预计恢复时间详见公告】"); + ui->btn_Login->setText("系统维护中,预计恢复时间详见公告"); ui->btn_Login->setIcon(QIcon(":/images/color_icon/color-warning_2.svg")); } }); diff --git a/friendinfowidget.cpp b/friendinfowidget.cpp index 78f30f6..9704eb7 100644 --- a/friendinfowidget.cpp +++ b/friendinfowidget.cpp @@ -181,7 +181,7 @@ void FriendInfoWidget::on_btn_sendMsg_clicked() return; } Mailsending = true; - int smtp_rescode = service::sendMail(smtp_config, m_mail, QString("WePlanet Ϣ"), QString("ĺ %1 ͨ WePlanet 㷢Ϣ뾡ǰWePlanet ġ鿴/ظϢ").arg(fromUserInfo)); + int smtp_rescode = service::sendMail(smtp_config, m_mail, QString("WePlanet Ϣ"), QString("ĺ %1 ͨ [WePlanet ] 㷢Ϣ뾡ǰ [WePlanet ] 鿴/ظϢ").arg(fromUserInfo)); if (smtp_rescode != 1) QMessageBox::warning(this, "", "ʼʧܣǷȷϵԱSMTPá", QMessageBox::Ok); diff --git a/img/nt-logo.png b/img/nt-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..7a1ab72fbcc6ab2b8897b4724e7b79fbea624aaf GIT binary patch literal 17215 zcmb4qV|!&y*X@p-j-8He+qUhbW7{@%(m}_zjUBUNr<2^VZ96%6-hXgDRMn?-)ta^H z8f(ls$B0%|ltO~Xg9iWrNHWsms^9D7_xKG9{XPE})=K_f;GCp&Tmb-jx&IBY5`okT z06_FcMqEVQEBnI0Gh2PJ`zy!wvU_1-+Roh9D8>y_1trcDDWpTXWkgn`ki}bttw+40 z90!5cI2O-q3Hu>qD5-po8d^j+CW_v?V&XBU{VCUVlc;TSQq?0ZXT|*>;01BPvBP4EzgRlkSV{-?v;eez6%H%OvXrCw25?`t` zYYI0QlEahn32|+LdD*~<%Fv!}+LP7J0bds`NqVsTv+Dz&ais6l)=yp98yk%}+}Qu6UA^TT-6n=vX9KQihaK`z34Ope z!EB>9It-dYWkD1nlCi3xX)s@d@lfw!e z0u?6xE_h!P0;K^mfxv3#P?~1?9tN`{rAfkUvy?XypucU4gI3RjeTjAW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I_DT~PfZHDXTKA%$jmiOz) z-@7)u6}`ugR{t>PpULh(5Kk=6D*sK570UfjwM`Xr1Lhl#yc)1zM<@n6m z*52^)mvp%`gHCk$Kj0O+Cd$z3)U~}{8E)!S@ASeiY%C70C8k%0g|?GOPo=IN6` zDaZsF^9_82)u6(z&Aq$s@n1Jwu!{;6s|{yQz8;s(Z9nzCg|frfYWd~dj=MkjGKI|Y z1)Z+@`f0WtH{i3`!tOE9=9zGYrEzDeG%zp^<|pd7pXz7MUW)X1*xTr&CbXZe^U3tj zS%x^Sr<2nRX(mp|Y(MYBoVGrBH~uA1Ingr@@YjKa$BzGW;|9O)#9wGEU##d{EM=?N z(?>c(PU8f?7n}d$*X^!*xi#SPD88(zO)d2BPH8?IFog{kW=0gUt#{e| zb5r^~u>xM7Wzew!+c{Lj$c2bMw;n%w`t@4XxM5%+Lv2K?N!FTNEsK4g z3=>|U#XmMk${x+6-6S|`*Nh#lZDLfmhrumW>|;^DWzb$yXwu3l%wN8CvkjBy-{Ogq z+PAO*R-ebdcQHPgm(7c%`Ej*nbsp|)J_xJ0vGkLFGmDN`N`>mYgQX9V=5xvsO z%PnPA7V;k1aQ$`Z$B)zJUk{0z^_}z3rL&E8m&;YE)P-Re#+NhXF3H&yEH{XG2hgE4!pli_~b zr6td1y_`ov;1_@K_~Ye*EM^y4>q;FbL`JI+K})th0@a?AO}cv{AYiV+UzN! TAMhJ^A_jw}tDnm{r-UW|YNT-i literal 0 HcmV?d00001 diff --git a/mainwindow.cpp b/mainwindow.cpp index 569d121..65ac31e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -191,8 +191,8 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) setBaseInfoWork->moveToThread(sqlThread); attendWork->moveToThread(sqlThread); userManageWork->moveToThread(sqlThread_SECOND); - attendManageWork->moveToThread(sqlThread); - groupManageWork->moveToThread(sqlThread); + attendManageWork->moveToThread(sqlThread_SECOND); + groupManageWork->moveToThread(sqlThread_SECOND); activityManageWork->moveToThread(sqlThread_SECOND); posterWork->moveToThread(sqlThread); msgService->moveToThread(sqlThread_MSG); @@ -203,9 +203,10 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) updateSoftWare.moveToThread(sqlThread_SECOND); //校验、更新本地时间,本对象中curDateTime即为10分钟更新一次的网络时间 - if (!checkLocalTime()) + bool checkLocalTimeRes = checkLocalTime(); + if (!checkLocalTimeRes) { - disableDynamicItems(); + disableDynamicItems(true); curDateTime = QDateTime::currentDateTime(); } currentTimeUpdate = new QTimer(this); @@ -216,8 +217,8 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) timeLabel->setText("程序时间:" + curDateTime.toString("yyyy年MM月dd日 hh:mm:ss")); if (cnt > 10 * 60) //校验一次网络时间 { - checkLocalTime(); - cnt = 0; + if(checkLocalTime()) + cnt = 0; } }); currentTimeUpdate->start(1000); @@ -257,10 +258,10 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) sqlWork->stopThread(); //构造model - attendPageModel = new QSqlRelationalTableModel(this, attendWork->getDB()); - userManageModel = new QSqlRelationalTableModel(this, userManageWork->getDB()); - attendUserModel = new QSqlRelationalTableModel(this, attendManageWork->getDB()); - attendManageModel = new QSqlRelationalTableModel(this, attendManageWork->getDB()); + //attendPageModel = new QSqlRelationalTableModel(this, attendWork->getDB()); + //userManageModel = new QSqlRelationalTableModel(this, userManageWork->getDB()); + //attendUserModel = new QSqlRelationalTableModel(this, attendManageWork->getDB()); + //attendManageModel = new QSqlRelationalTableModel(this, attendManageWork->getDB()); groupModel = new QSqlTableModel(this, groupManageWork->getDB()); departmentModel = new QSqlTableModel(this, groupManageWork->getDB()); activityModel = new QSqlTableModel(this, activityManageWork->getDB()); @@ -268,8 +269,8 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) noticeModel = new QSqlTableModel(this, posterWork->getDB()); noticeManageModel = new QSqlTableModel(this, posterWork->getDB()); - userManagePageSelection = new QItemSelectionModel(userManageModel); - attendUserSelection = new QItemSelectionModel(attendUserModel); + userManagePageSelection = new QItemSelectionModel(); //model在子线程 + attendUserSelection = new QItemSelectionModel(); //model在子线程 groupPageSelection_group = new QItemSelectionModel(groupModel); groupPageSelection_department = new QItemSelectionModel(departmentModel); activitySelection = new QItemSelectionModel(activityModel); @@ -285,16 +286,16 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) //初始化work setBaseInfoWork->setUid(uid); - attendWork->setModel(attendPageModel); + //attendWork->setModel(attendPageModel); attendWork->setUid(uid); friendsWidget->setUid(uid); activityManageWork->setUid(uid); - userManageWork->setModel(userManageModel); + //userManageWork->setModel(userManageModel); userManageWork->setCombox(ui->comboBox_group, ui->comboBox_department); - attendManageWork->setUserModel(attendUserModel); - attendManageWork->setAttendModel(attendManageModel); + //attendManageWork->setUserModel(attendUserModel); + //attendManageWork->setAttendModel(attendManageModel); attendManageWork->setCombox(ui->comboBox_group_2, ui->comboBox_department_2); groupManageWork->setGroupModel(groupModel); @@ -433,7 +434,7 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) on_actAttend_triggered(); //刷新信息 } else - QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendPageModel->lastError().text(), QMessageBox::Ok); + QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendWork->getModel()->lastError().text(), QMessageBox::Ok); }, Qt::UniqueConnection); connect(attendWork, &AttendWork::attendOutDone, this, [=](bool res){ if(res) @@ -444,7 +445,7 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) on_actAttend_triggered(); //刷新信息 } else - QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendPageModel->lastError().text(), QMessageBox::Ok); + QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendWork->getModel()->lastError().text(), QMessageBox::Ok); }, Qt::UniqueConnection); //用户管理信号槽 @@ -530,7 +531,7 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) }, Qt::UniqueConnection); connect(userManageWork, &UserManageWork::submitAllFinished, this, [=](bool res){ if(!res) - QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + userManageModel->lastError().text(), + QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + userManageWork->getModel()->lastError().text(), QMessageBox::Ok); else{ ui->btn_editUser_check->setEnabled(false); @@ -579,7 +580,7 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) ui->label_attendManagePage_status->setText("已签到"); } else - QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendManageModel->lastError().text(), + QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendManageWork->getAttendModel()->lastError().text(), QMessageBox::Ok); }); connect(attendManageWork, &AttendManageWork::submitDelFinished, this, [=](bool res){ @@ -589,7 +590,7 @@ MainWindow::MainWindow(QWidget *parent, QDialog *formLoginWindow) ui->label_attendManagePage_status->setText("未签到"); } else - QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendManageModel->lastError().text(), + QMessageBox::warning(this, "消息", "保存数据失败,错误信息:\n" + attendManageWork->getAttendModel()->lastError().text(), QMessageBox::Ok); }); //活动管理信号槽 @@ -1169,7 +1170,9 @@ void MainWindow::setHomePageBaseInfo() ui->label_homeStatus->setPixmap(QPixmap(":/images/color_icon/approve_3.svg")); else ui->label_homeStatus->setPixmap(QPixmap(":/images/color_icon/approve_2.svg")); - + + trayIcon->setToolTip(QString("WePlanet - 运行中\n账号:%1\n姓名:%2\n邮箱:%3\n\n当天考勤:%4\n签到时间:%5\n签退时间:%6").arg(ui->label_home_uid->text(), ui->label_home_name->text(), ui->label_home_mail->text(), ui->label_homePage_attendStatus->text(), ui->label_homePage_beginTime->text(), ui->label_homePage_endTime->text())); + sqlWork->beginThread(); } @@ -1264,7 +1267,7 @@ void MainWindow::on_actExit_triggered() void MainWindow::on_actHome_triggered() { - if (homeLoading) + if (homeLoading || ui->stackedWidget->currentIndex() == 13) return; initModelViewIsDisplay(); ui->stackedWidget->setCurrentIndex(0); @@ -1281,6 +1284,8 @@ void MainWindow::on_actHome_triggered() void MainWindow::on_actMyInfo_triggered() { + if (ui->stackedWidget->currentIndex() == 13 || homeLoading) + return; initModelViewIsDisplay(); ui->stackedWidget->setCurrentIndex(1); QRegExp regx_pwd("[0-9A-Za-z!@#$%^&*.?]{1,16}$"), regx_num("[0-9]{1,11}$"); @@ -1292,9 +1297,14 @@ void MainWindow::on_actMyInfo_triggered() void MainWindow::on_actAttend_triggered() { - if (ui->stackedWidget->currentIndex() == 13) + if (ui->stackedWidget->currentIndex() == 13 || homeLoading) return; initModelViewIsDisplay(); + if (isDisabledDynamicItems) + { + ui->stackedWidget->setCurrentIndex(18); + return; + } ui->stackedWidget->setCurrentIndex(13); ui->tableView_attendPage->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -1306,7 +1316,7 @@ void MainWindow::setAttendPage() ui->stackedWidget->setCurrentIndex(4); //curDateTime = QDateTime::fromSecsSinceEpoch(service::getWebTime()); - ui->tableView_attendPage->setModel(attendPageModel); + ui->tableView_attendPage->setModel(attendWork->getModel()); ui->tableView_attendPage->hideColumn(0); //隐藏考勤数据编号 ui->tableView_attendPage->setEditTriggers(QAbstractItemView::NoEditTriggers); //不可编辑 QSqlRecord curRec = attendWork->getRecord(0); //取最新的一条记录 @@ -2094,7 +2104,7 @@ void MainWindow::updateApplyItemProcess(int type, QString apply_id, QListgroupBox_22->setTitle("当前项目审批流程"); else - ui->groupBox_22->setTitle("当前申请审批进度(点击具体流程可查看审核意见)"); + ui->groupBox_22->setTitle("当前申请审批进度(点击流程步骤可查看审核意见)"); //清除所有widget while (ui->ApplyProcess_Layout->count()) ui->ApplyProcess_Layout->removeItem(ui->ApplyProcess_Layout->itemAt(0)); @@ -2171,7 +2181,13 @@ void MainWindow::updateApplyItemProcess(int type, QString apply_id, QListshowMinimized(); infoWidget->showNormal(); }); - } + } + else if(type == 1) + { + connect(process, &QToolButton::clicked, this, [=]() { + QMessageBox::information(this, "审核意见", "等待审核中,暂无审核意见。"); + }); + } ui->ApplyProcess_Layout->addWidget(process); QLabel* arrow = new QLabel(); @@ -2309,8 +2325,8 @@ bool MainWindow::checkLocalTime() if (webTimeSinceEpoch == -1) { - QMessageBox::warning(this, "时间误差警告", "获取服务器时间失败,请检查网络连接。\n考勤、活动、畅聊等已被禁用,请前往【设置】页面重新验证时间以启动部分项。"); - disableDynamicItems(); + trayIcon->showMessage("时间校验失败", QString("获取服务器时间失败,请检查网络连接。考勤、活动、畅聊等已被禁用,请前往[设置]验证时间以重新启用。")); + disableDynamicItems(true); return false; } curDateTime = QDateTime::fromSecsSinceEpoch(webTimeSinceEpoch); //更新网络时间 @@ -2321,20 +2337,21 @@ bool MainWindow::checkLocalTime() if (marginMinutes > 3 || marginMinutes < -3) { - QMessageBox::warning(this, "时间误差警告", "本地时间与Windows服务器时间的误差超出范围。\n考勤、活动、畅聊等已被禁用,请检查本地时间后前往【设置】页面重新验证时间以启动部分项。"); - disableDynamicItems(); + trayIcon->showMessage("时间校验失败", QString("本地时间与Windows服务器时间的不匹配。考勤、活动、畅聊等已被禁用,请检查本地时间后前往[设置]验证时间以重新启用。")); + disableDynamicItems(false); return false; } return true; } -void MainWindow::disableDynamicItems() +void MainWindow::disableDynamicItems(bool isDisabled) { - ui->btn_actJoin->setEnabled(false); - ui->btn_actCancel->setEnabled(false); - ui->btn_beginAttend->setEnabled(false); - ui->btn_endAttend->setEnabled(false); - ui->btn_sendMsg->setEnabled(false); + isDisabledDynamicItems = isDisabled; + ui->btn_actJoin->setEnabled(!isDisabled); + ui->btn_actCancel->setEnabled(!isDisabled); + ui->btn_beginAttend->setEnabled(!isDisabled); + ui->btn_endAttend->setEnabled(!isDisabled); + ui->btn_sendMsg->setEnabled(!isDisabled); } void MainWindow::on_actApply_triggered() @@ -2361,10 +2378,11 @@ void MainWindow::on_actUserManager_triggered() void MainWindow::setUserManagePage() { - ui->tableView_userManage->setModel(userManageModel); + ui->tableView_userManage->setModel(userManageWork->getModel()); //userManageModel ui->tableView_userManage->hideColumn(1); //隐藏密码列 ui->tableView_userManage->hideColumn(10); //隐藏用户状态 + userManagePageSelection->setModel(userManageWork->getModel()); //userManageModel ui->tableView_userManage->setSelectionModel(userManagePageSelection); /* //当前项变化时触发currentChanged信号 @@ -2376,7 +2394,7 @@ void MainWindow::setUserManagePage() this, SLOT(on_userManagePagecurrentRowChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection); //移动到下一行(第0行为系统账号) - QModelIndex next_index = userManageModel->index(1, 1); + QModelIndex next_index = userManageWork->getModel()->index(1, 1); userManagePageSelection->setCurrentIndex(next_index, QItemSelectionModel::Select); ui->stackedWidget->setCurrentIndex(6); @@ -2403,12 +2421,13 @@ void MainWindow::on_actAttendManager_triggered() void MainWindow::setAttendManagePage() { //用户列表 - ui->tableView_attendUsers->setModel(attendUserModel); + ui->tableView_attendUsers->setModel(attendManageWork->getUserModel()); ui->tableView_attendUsers->hideColumn(1); //隐藏密码 ui->tableView_attendUsers->hideColumn(8); //头像地址 ui->tableView_attendUsers->hideColumn(9); //学时 ui->tableView_attendUsers->hideColumn(10); //用户状态 + attendUserSelection->setModel(attendManageWork->getUserModel()); ui->tableView_attendUsers->setSelectionModel(attendUserSelection); //当前行变化时触发currentRowChanged信号 @@ -2416,7 +2435,7 @@ void MainWindow::setAttendManagePage() this, SLOT(on_attendManagePageUserscurrentRowChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection); //签到列表 - ui->tableView_attendInfo->setModel(attendManageModel); + ui->tableView_attendInfo->setModel(attendManageWork->getAttendModel()); ui->tableView_attendInfo->hideColumn(0); //隐藏不需要的签到编号 ui->stackedWidget->setCurrentIndex(7); @@ -2687,6 +2706,11 @@ void MainWindow::on_action_triggered() if (ui->stackedWidget->currentIndex() == 13) return; initModelViewIsDisplay(); + if (isDisabledDynamicItems) + { + ui->stackedWidget->setCurrentIndex(18); + return; + } ui->stackedWidget->setCurrentIndex(13); ui->lineEdit_actSearch->clear(); if(ui->comboBox_activity->currentIndex() != 0) @@ -2762,6 +2786,11 @@ void MainWindow::on_actMessage_triggered() if (ui->stackedWidget->currentIndex() == 13) return; initModelViewIsDisplay(); + if (isDisabledDynamicItems) + { + ui->stackedWidget->setCurrentIndex(18); + return; + } ui->stackedWidget->setCurrentIndex(13); emit loadMsgMemList(uid); } @@ -2909,7 +2938,7 @@ void MainWindow::on_actPanel_triggered() void MainWindow::on_actRefresh_triggered() { emit get_statistics(); //统计心跳请求量 - trayIcon->setToolTip("WePlanet - 运行中(上次刷新" + QDateTime::currentDateTime().time().toString("hh:mm") + ")"); + //trayIcon->setToolTip("WePlanet - 运行中(上次刷新" + QDateTime::currentDateTime().time().toString("hh:mm") + ")"); int index = ui->stackedWidget->currentIndex(); switch (index) { @@ -2985,10 +3014,10 @@ void MainWindow::on_userManagePagecurrentChanged(const QModelIndex ¤t, con void MainWindow::on_userManagePagecurrentRowChanged(const QModelIndex ¤t, const QModelIndex &previous) { - QSqlRecord curRecord = userManageModel->record(current.row()), preRecord = userManageModel->record(previous.row()); + QSqlRecord curRecord = userManageWork->getModel()->record(current.row()), preRecord = userManageWork->getModel()->record(previous.row()); - ui->btn_editUser_check->setEnabled(userManageModel->isDirty()); - ui->btn_editUser_cancel->setEnabled(userManageModel->isDirty()); + ui->btn_editUser_check->setEnabled(userManageWork->getModel()->isDirty()); + ui->btn_editUser_cancel->setEnabled(userManageWork->getModel()->isDirty()); //ui->tableView_userManage->setItemDelegateForRow(current.row(), readOnlyDelegate); //禁止编辑系统账号 ui->tableView_userManage->setRowHidden(current.row(), curRecord.value("uid") == "1"); @@ -3044,10 +3073,10 @@ void MainWindow::on_userManagePagecurrentRowChanged(const QModelIndex ¤t, { if(ui->lineEdit_editPwd->text() == ui->lineEdit_editPwdCheck->text()) { - userManageModel->setData(userManageModel->index(previous.row(), userManageModel->fieldIndex("password")), service::pwdEncrypt(ui->lineEdit_editPwd->text()), Qt::EditRole); + userManageWork->getModel()->setData(userManageWork->getModel()->index(previous.row(), userManageWork->getModel()->fieldIndex("password")), service::pwdEncrypt(ui->lineEdit_editPwd->text()), Qt::EditRole); QMessageBox::information(this, "提示", "当前用户(UID:" + preRecord.value("uid").toString()+ ")密码已成功缓存。\n点击确认修改即可生效(请确认UID是否正确*)。\n新密码为:" + ui->lineEdit_editPwd->text(), QMessageBox::Ok); - ui->btn_editUser_check->setEnabled(userManageModel->isDirty()); - ui->btn_editUser_cancel->setEnabled(userManageModel->isDirty()); + ui->btn_editUser_check->setEnabled(userManageWork->getModel()->isDirty()); + ui->btn_editUser_cancel->setEnabled(userManageWork->getModel()->isDirty()); ui->lineEdit_editPwd->clear(); ui->lineEdit_editPwdCheck->clear(); } @@ -3062,7 +3091,7 @@ void MainWindow::on_userManagePagecurrentRowChanged(const QModelIndex ¤t, void MainWindow::on_attendManagePageUserscurrentRowChanged(const QModelIndex ¤t, const QModelIndex &previous) { Q_UNUSED(previous); - QSqlRecord curRecord = attendUserModel->record(current.row()); + QSqlRecord curRecord = attendManageWork->getUserModel()->record(current.row()); QSqlRecord curAttendRecord; //curDateTime = QDateTime::currentDateTime(); @@ -3072,12 +3101,12 @@ void MainWindow::on_attendManagePageUserscurrentRowChanged(const QModelIndex &cu ui->label_attendManagePage_uid->setText(uid); - for (int i = 0; i < attendManageModel->rowCount(); i++) + for (int i = 0; i < attendManageWork->getAttendModel()->rowCount(); i++) { - if (attendManageModel->record(i).value("a_uid").toString() == uid) + if (attendManageWork->getAttendModel()->record(i).value("a_uid").toString() == uid) { - if (attendManageModel->record(i).value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) - curAttendRecord = attendManageModel->record(i); //取最新考勤记录 + if (attendManageWork->getAttendModel()->record(i).value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) + curAttendRecord = attendManageWork->getAttendModel()->record(i); //取最新考勤记录 ui->tableView_attendInfo->showRow(i); } else @@ -3090,7 +3119,7 @@ void MainWindow::on_attendManagePageUserscurrentRowChanged(const QModelIndex &cu attendManageWork->setCurAvatarUrl(curRecord.value("user_avatar").toString()); emit attendManageGetAvatar(); } - getAvatarQueue.enqueue(curRecord.value("user_avatar").toString()); //加载项入栈 + getAvatarQueue.enqueue(curRecord.value("user_avatar").toString()); //加载项入队列 if(curAttendRecord.value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) { @@ -3196,9 +3225,8 @@ void MainWindow::on_myActivityPagecurrentRowChanged(const QModelIndex& current, ui->textBrowser_activityDsc->setText(curActRec.value("act_des").toString()); ui->label_actScore_2->setText(curActRec.value("act_score").toString()); if (curRecord.value("status").toString() == "未录取") - { ui->label_curActStatus->setText("" + curRecord.value("status").toString() + ""); - }else + else ui->label_curActStatus->setText(curRecord.value("status").toString()); } @@ -3483,26 +3511,26 @@ void MainWindow::on_btn_editDpt_cancel_clicked() void MainWindow::on_btn_addUser_clicked() { QMessageBox::information(this, "消息", "新增用户请勿填写UID,程序将自动生成。\n初始密码:123456\n", QMessageBox::Ok); - userManageModel->insertRow(userManageModel->rowCount(), QModelIndex()); //在末尾添加一个记录 - QModelIndex curIndex = userManageModel->index(userManageModel->rowCount() - 1, 1);//创建最后一行的ModelIndex + userManageWork->getModel()->insertRow(userManageWork->getModel()->rowCount(), QModelIndex()); //在末尾添加一个记录 + QModelIndex curIndex = userManageWork->getModel()->index(userManageWork->getModel()->rowCount() - 1, 1);//创建最后一行的ModelIndex userManagePageSelection->clearSelection();//清空选择项 userManagePageSelection->setCurrentIndex(curIndex, QItemSelectionModel::Select);//设置刚插入的行为当前选择行 int currow = curIndex.row(); //获得当前行 - userManageModel->setData(userManageModel->index(currow, userManageModel->fieldIndex("password")), service::pwdEncrypt("123456")); //自动生成密码 - userManageModel->setData(userManageModel->index(currow, userManageModel->fieldIndex("group_name")), 2); - userManageModel->setData(userManageModel->index(currow, userManageModel->fieldIndex("dpt_name")), 1); - userManageModel->setData(userManageModel->index(currow, userManageModel->fieldIndex("score")), 0); - userManageModel->setData(userManageModel->index(currow, userManageModel->fieldIndex("user_status")), 1); + userManageWork->getModel()->setData(userManageWork->getModel()->index(currow, userManageWork->getModel()->fieldIndex("password")), service::pwdEncrypt("123456")); //自动生成密码 + userManageWork->getModel()->setData(userManageWork->getModel()->index(currow, userManageWork->getModel()->fieldIndex("group_name")), 2); + userManageWork->getModel()->setData(userManageWork->getModel()->index(currow, userManageWork->getModel()->fieldIndex("dpt_name")), 1); + userManageWork->getModel()->setData(userManageWork->getModel()->index(currow, userManageWork->getModel()->fieldIndex("score")), 0); + userManageWork->getModel()->setData(userManageWork->getModel()->index(currow, userManageWork->getModel()->fieldIndex("user_status")), 1); } void MainWindow::on_btn_delUser_clicked() { QModelIndex curIndex = userManagePageSelection->currentIndex();//获取当前选择单元格的模型索引 - QString uid = userManageModel->record(curIndex.row()).value("uid").toString(); - QString name = userManageModel->record(curIndex.row()).value("name").toString(); + QString uid = userManageWork->getModel()->record(curIndex.row()).value("uid").toString(); + QString name = userManageWork->getModel()->record(curIndex.row()).value("name").toString(); - userManageModel->removeRow(curIndex.row()); //删除 + userManageWork->getModel()->removeRow(curIndex.row()); //删除 QMessageBox::information(this, "消息", "用户 [" + uid + " " + name + "] 待注销,点击[确认修改]以确认操作。\n注意:该操作会将该用户数据删除,请谨慎操作,如误操作,请点击[取消操作]以撤销。", QMessageBox::Ok); ui->btn_editUser_check->setEnabled(true); @@ -3512,17 +3540,17 @@ void MainWindow::on_btn_delUser_clicked() void MainWindow::on_btn_banUser_clicked() { QModelIndex curIndex = userManagePageSelection->currentIndex();//获取当前选择单元格的模型索引 - QString uid = userManageModel->record(curIndex.row()).value("uid").toString(); - QString name = userManageModel->record(curIndex.row()).value("name").toString(); + QString uid = userManageWork->getModel()->record(curIndex.row()).value("uid").toString(); + QString name = userManageWork->getModel()->record(curIndex.row()).value("name").toString(); - if (userManageModel->record(curIndex.row()).value("user_status").toInt() == 1) + if (userManageWork->getModel()->record(curIndex.row()).value("user_status").toInt() == 1) { - userManageModel->setData(userManageModel->index(curIndex.row(), 10), 0, Qt::EditRole); + userManageWork->getModel()->setData(userManageWork->getModel()->index(curIndex.row(), 10), 0, Qt::EditRole); QMessageBox::information(this, "消息", "用户 [" + uid + " " + name + "] 待封禁,点击[确认修改]以确认操作。", QMessageBox::Ok); } else { - userManageModel->setData(userManageModel->index(curIndex.row(), 10), 1, Qt::EditRole); + userManageWork->getModel()->setData(userManageWork->getModel()->index(curIndex.row(), 10), 1, Qt::EditRole); QMessageBox::information(this, "消息", "用户 [" + uid + " " + name + "] 待解封,点击[确认修改]以确认操作。", QMessageBox::Ok); } ui->btn_editUser_check->setEnabled(true); @@ -3536,7 +3564,7 @@ void MainWindow::on_btn_editUser_check_clicked() void MainWindow::on_btn_editUser_cancel_clicked() { - userManageModel->revertAll(); + userManageWork->getModel()->revertAll(); ui->btn_editUser_check->setEnabled(false); ui->btn_editUser_cancel->setEnabled(false); } @@ -3870,15 +3898,15 @@ void MainWindow::on_btn_attendManage_reAttend_clicked() return; } //curDateTime = QDateTime::currentDateTime(); - attendManageModel->insertRow(attendManageModel->rowCount(), QModelIndex()); //在末尾添加一个记录 - QModelIndex curIndex = attendManageModel->index(attendManageModel->rowCount() - 1, 1);//创建最后一行的ModelIndex + attendManageWork->getAttendModel()->insertRow(attendManageWork->getAttendModel()->rowCount(), QModelIndex()); //在末尾添加一个记录 + QModelIndex curIndex = attendManageWork->getAttendModel()->index(attendManageWork->getAttendModel()->rowCount() - 1, 1);//创建最后一行的ModelIndex int currow = curIndex.row(); //获得当前行 - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("a_uid")), ui->label_attendManagePage_uid->text()); - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("today")), curDateTime.date().toString("yyyy-MM-dd")); - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("begin_date")), curDateTime.time().toString("HH:mm:ss")); - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("end_date")), curDateTime.time().toString("HH:mm:ss")); - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("isSupply")), "是"); - attendManageModel->setData(attendManageModel->index(currow, attendManageModel->fieldIndex("name")), uid); //这里要填外键关联的字段! + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("a_uid")), ui->label_attendManagePage_uid->text()); + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("today")), curDateTime.date().toString("yyyy-MM-dd")); + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("begin_date")), curDateTime.time().toString("HH:mm:ss")); + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("end_date")), curDateTime.time().toString("HH:mm:ss")); + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("isSupply")), "是"); + attendManageWork->getAttendModel()->setData(attendManageWork->getAttendModel()->index(currow, attendManageWork->getAttendModel()->fieldIndex("name")), uid); //这里要填外键关联的字段! emit attendManageModelSubmitAll(1); } @@ -3887,11 +3915,11 @@ void MainWindow::on_btn_attendManage_cancelAttend_clicked() //curDateTime = QDateTime::currentDateTime(); QSqlRecord curRecord; int delete_row; - for (delete_row = 0; delete_row < attendManageModel->rowCount(); delete_row++) + for (delete_row = 0; delete_row < attendManageWork->getAttendModel()->rowCount(); delete_row++) { - if (!ui->tableView_attendInfo->isRowHidden(delete_row) && attendManageModel->record(delete_row).value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) + if (!ui->tableView_attendInfo->isRowHidden(delete_row) && attendManageWork->getAttendModel()->record(delete_row).value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) { - curRecord = attendManageModel->record(delete_row); + curRecord = attendManageWork->getAttendModel()->record(delete_row); break; } } @@ -3903,7 +3931,7 @@ void MainWindow::on_btn_attendManage_cancelAttend_clicked() //检测即将删除的数据是否与当前用户对应 if(curRecord.value("a_uid").toString() == ui->label_attendManagePage_uid->text() && curRecord.value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) { - attendManageModel->removeRow(delete_row); //删除顶部的数据 + attendManageWork->getAttendModel()->removeRow(delete_row); //删除顶部的数据 emit attendManageModelSubmitAll(0); } else @@ -3913,8 +3941,7 @@ void MainWindow::on_btn_attendManage_cancelAttend_clicked() void MainWindow::on_btn_attendManagePage_exp_clicked() { - ExcelExport expExcel(this); - QSqlRecord re = attendManageModel->record(); + ExcelExport expExcel; //导出方式 int type = -1; if(ui->rBtn_attendManagePage_all->isChecked()) @@ -3923,9 +3950,22 @@ void MainWindow::on_btn_attendManagePage_exp_clicked() type = 2; if(ui->rBtn__attendManagePage_curAll->isChecked()) type = 3; - //curDateTime = QDateTime::currentDateTime(); - QString filePath = QFileDialog::getSaveFileName(this, "导出数据", "考勤数据_" + curDateTime.toString("yyyy-MM-dd_hh-mm-ss"), "Microsoft Excel(*.xlsx)"); - if(expExcel.WriteExcel(filePath, attendManageModel, ui->label_attendManagePage_uid->text(), type)) + + //获取所有考勤记录 + QStack dataStack; + for (int i = 0; i < attendManageWork->getAttendModel()->rowCount(); i++) + { + if (type == 3 && ui->label_attendManagePage_uid->text() == attendManageWork->getAttendModel()->record(i).value("a_uid").toString()) + dataStack.push(attendManageWork->getAttendModel()->record(i)); + else if (type == 2 && attendManageWork->getAttendModel()->record(i).value("today").toString() == curDateTime.date().toString("yyyy-MM-dd")) + dataStack.push(attendManageWork->getAttendModel()->record(i)); + else if (type == 1) + dataStack.push(attendManageWork->getAttendModel()->record(i)); + else continue; + } + + QString filePath = QFileDialog::getSaveFileName(this, "导出数据", "考勤数据_" + curDateTime.toString("yyyy-MM-dd_hh-mm-ss"), "Microsoft Excel(*.csv)"); + if(expExcel.WriteExcel(filePath, dataStack)) QMessageBox::information(this, "消息", "考勤数据已成功导出到:" + filePath, QMessageBox::Ok); else QMessageBox::warning(this, "消息", "考勤数据导出失败,请检查文件路径。", QMessageBox::Ok); @@ -3933,11 +3973,18 @@ void MainWindow::on_btn_attendManagePage_exp_clicked() void MainWindow::on_btn_expAttend_clicked() { - ExcelExport expExcel(this); - QSqlRecord re = attendPageModel->record(); - //curDateTime = QDateTime::currentDateTime(); - QString filePath = QFileDialog::getSaveFileName(this, "导出数据", "考勤数据_" + curDateTime.toString("yyyy-MM-dd_hh-mm-ss"), "Microsoft Excel(*.xlsx)"); - if(expExcel.WriteExcel(filePath, attendPageModel, ui->label_attendPage_uid->text(), 3)) + ExcelExport expExcel; + QString filePath = QFileDialog::getSaveFileName(this, "导出数据", "考勤数据_" + curDateTime.toString("yyyy-MM-dd_hh-mm-ss"), "Microsoft Excel(*.csv)"); + + //获取所有考勤记录 + QStack dataStack; + for (int i = 0; i < attendWork->getModel()->rowCount(); i++) + { + if (uid == attendWork->getModel()->record(i).value("a_uid").toString()) + dataStack.push(attendWork->getModel()->record(i)); + } + + if(expExcel.WriteExcel(filePath, dataStack)) QMessageBox::information(this, "消息", "考勤数据已成功导出到:" + filePath, QMessageBox::Ok); else QMessageBox::warning(this, "消息", "考勤数据导出失败,请检查文件路径。", QMessageBox::Ok); @@ -3951,14 +3998,14 @@ void MainWindow::on_btn_beginAttend_clicked() return; } //curDateTime = QDateTime::fromSecsSinceEpoch(service::getWebTime()); //获取网络时间 - attendPageModel->insertRow(attendPageModel->rowCount(), QModelIndex()); //在末尾添加一个记录 - QModelIndex curIndex = attendPageModel->index(attendPageModel->rowCount() - 1, 1);//创建最后一行的ModelIndex + attendWork->getModel()->insertRow(attendWork->getModel()->rowCount(), QModelIndex()); //在末尾添加一个记录 + QModelIndex curIndex = attendWork->getModel()->index(attendWork->getModel()->rowCount() - 1, 1);//创建最后一行的ModelIndex int currow = curIndex.row(); //获得当前行 - attendPageModel->setData(attendPageModel->index(currow, attendPageModel->fieldIndex("a_uid")), uid); - attendPageModel->setData(attendPageModel->index(currow, attendPageModel->fieldIndex("today")), curDateTime.date().toString("yyyy-MM-dd")); - attendPageModel->setData(attendPageModel->index(currow, attendPageModel->fieldIndex("begin_date")), curDateTime.time().toString("HH:mm:ss")); - attendPageModel->setData(attendPageModel->index(currow, attendPageModel->fieldIndex("isSupply")), "否"); - attendPageModel->setData(attendPageModel->index(currow, attendPageModel->fieldIndex("name")), 1); //这里要填外键关联的字段! + attendWork->getModel()->setData(attendWork->getModel()->index(currow, attendWork->getModel()->fieldIndex("a_uid")), uid); + attendWork->getModel()->setData(attendWork->getModel()->index(currow, attendWork->getModel()->fieldIndex("today")), curDateTime.date().toString("yyyy-MM-dd")); + attendWork->getModel()->setData(attendWork->getModel()->index(currow, attendWork->getModel()->fieldIndex("begin_date")), curDateTime.time().toString("HH:mm:ss")); + attendWork->getModel()->setData(attendWork->getModel()->index(currow, attendWork->getModel()->fieldIndex("isSupply")), "否"); + attendWork->getModel()->setData(attendWork->getModel()->index(currow, attendWork->getModel()->fieldIndex("name")), 1); //这里要填外键关联的字段! beginAttendLoading = true; emit attendPageModelSubmitAll(1); @@ -4023,8 +4070,8 @@ void MainWindow::on_btn_personalSubmit_clicked() } if(!ui->lineEdit_personalPwd->text().isEmpty()) newPwd = ui->lineEdit_personalPwd->text(); - if(!ui->lineEdit_personalTel->text().isEmpty()) - newTel = ui->lineEdit_personalTel->text(); + //if(!ui->lineEdit_personalTel->text().isEmpty()) 暂不支持个人修改手机号 + // newTel = ui->lineEdit_personalTel->text(); if(!ui->lineEdit_personalMail->text().isEmpty()) newMail = ui->lineEdit_personalMail->text(); if (!ui->lineEdit_personalAvatar->text().isEmpty()) @@ -4251,20 +4298,12 @@ void MainWindow::on_btn_checkTime_clicked() if (marginMinutes > 3 || marginMinutes < -3) { res = QString("校验完成,当前时间误差为:%1 分钟,不满足误差要求(3 min),考勤、活动等已禁用。").arg(marginMinutes); - ui->btn_actJoin->setEnabled(false); - ui->btn_actCancel->setEnabled(false); - ui->btn_beginAttend->setEnabled(false); - ui->btn_endAttend->setEnabled(false); - ui->btn_sendMsg->setEnabled(false); + disableDynamicItems(true); } else { res = QString("校验完成,当前时间误差为:%1 分钟,满足误差要求(3 min),考勤、活动等已启用。").arg(marginMinutes); - ui->btn_actJoin->setEnabled(true); - ui->btn_actCancel->setEnabled(true); - ui->btn_beginAttend->setEnabled(true); - ui->btn_endAttend->setEnabled(true); - ui->btn_sendMsg->setEnabled(true); + disableDynamicItems(false); } QMessageBox::information(this, "时间校验", res); @@ -4323,7 +4362,7 @@ void MainWindow::on_btn_manageApplyModify_clicked() void MainWindow::on_lineEdit_msgPushTime_textChanged(const QString& arg) { - if (arg.toInt() > 0 && arg.toInt() <= 300) + if (arg.toInt() >= 3 && arg.toInt() <= 300) { msgPushTime = arg.toInt(); config_ini->setValue("/System/MsgPushTime", msgPushTime); diff --git a/mainwindow.h b/mainwindow.h index 0996e07..dc670e4 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -79,6 +79,8 @@ class MainWindow : public QMainWindow bool dbStatus = true; + bool isDisabledDynamicItems = false; + bool openChat = false; //是否开启聊天 bool isSending = false; //消息发送中 @@ -117,7 +119,7 @@ class MainWindow : public QMainWindow QSqlTableModel *groupModel, *departmentModel, *activityModel, *activityMemModel, *noticeModel, *noticeManageModel; //数据模型 - QSqlRelationalTableModel *userManageModel, *attendUserModel, *attendManageModel, *attendPageModel; + //QSqlRelationalTableModel *userManageModel, *attendUserModel, *attendManageModel, *attendPageModel; QDataWidgetMapper* actEditMapper, *noticeEditMapper; @@ -177,9 +179,7 @@ class MainWindow : public QMainWindow void updateManageApplyItemProcess(QList list); - void updateApplyItemProcess(int type, QString apply_id, QList list); //0审批流程 1审批进度 - - void updateApplyItemProcess(QList list); + void updateApplyItemProcess(int type, QString apply_id, QList list); //0加载审批流程 1加载审批流程和审批进度 void updateApplyItemOptions(int type, QList list);//0用户页面,1审核页面 @@ -237,7 +237,7 @@ class MainWindow : public QMainWindow bool checkLocalTime(); - void disableDynamicItems(); //本地时间误差过大,禁用需要准确时间的项目 + void disableDynamicItems(bool isDisabled); //本地时间误差过大,禁用需要准确时间的项目 void initModelViewIsDisplay(); //重置各work的状态 diff --git a/mainwindow.ui b/mainwindow.ui index 91827a2..1b645ce 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1046,13 +1046,13 @@ - 95 + 63 38 - 95 + 63 38 @@ -1060,7 +1060,7 @@ - :/images/img/qq-nt-logo.png + :/images/img/nt-logo.png true @@ -1849,6 +1849,9 @@ padding: 0px 5px; + + false + 0 @@ -1898,7 +1901,7 @@ padding: 0px 5px; true - 功能升级中,暂不可用... + 请使用[申请]->[个人信息异动申请]修改手机号 @@ -7995,7 +7998,7 @@ padding: 0px 5px; 系统将自动处理【个人信息异动】【账号认证】申请通过后的数据变动。 - 自动化处理 + 自动化处理数据变动 @@ -10260,7 +10263,7 @@ padding: 0px 5px; 0 0 - 421 + 439 291 @@ -10622,7 +10625,7 @@ padding: 0px 5px; - <html><head/><body><p align="center"><span style=" font-size:22pt; font-weight:600;">畅聊系统已被系统管理员暂停使用</span></p><p align="center"><span style=" font-size:10pt; font-weight:600; color:#7a7a7a;">WePlanet权限系统</span></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:22pt; font-weight:600;">当前板块已被系统管理员暂停使用</span></p><p align="center"><span style=" font-size:10pt; font-weight:600; color:#7a7a7a;">WePlanet权限系统</span></p></body></html> Qt::AlignCenter @@ -10823,7 +10826,7 @@ background-color: transparent; :/images/color_icon/color-idcard.svg:/images/color_icon/color-idcard.svg - 我的 + 资料 我的资料 diff --git a/msgservice.cpp b/msgservice.cpp index d520715..2039ded 100644 --- a/msgservice.cpp +++ b/msgservice.cpp @@ -7,6 +7,10 @@ MsgService::MsgService(QObject *parent, int path) db_service.addDatabase(DB_PUSHER, "MsgService_DB_PUSHER_" + QString::number(path)); } +MsgService::~MsgService() +{ +} + void MsgService::loadMsgMemList(QString uid) { DB.open(); @@ -52,8 +56,10 @@ void MsgService::pushMessage(QString me, QString member, int limit) QString from_uid, from_name, to_uid, to_name, msgText, send_time; msgStack.clear(); - query.exec(QString("SELECT * FROM magic_message WHERE from_uid='%1' AND to_uid='%2' UNION ALL SELECT * FROM magic_message WHERE from_uid='%2' AND to_uid='%1' ORDER BY id DESC").arg(me, member)); // LIMIT 0,30 - msgStackCnt[member] = query.size(); //Ϣջ + query.exec(QString("SELECT COUNT(id) FROM magic_message WHERE (from_uid='%1' AND to_uid='%2') OR (from_uid='%2' AND to_uid='%1');").arg(me, member)); + query.next(); + msgStackCnt[member] = query.value("COUNT(id)").toInt(); //Ϣջ + query.exec(QString("SELECT * FROM magic_message WHERE from_uid='%1' AND to_uid='%2' UNION ALL SELECT * FROM magic_message WHERE from_uid='%2' AND to_uid='%1' ORDER BY id DESC LIMIT %3;").arg(me, member, QString::number(limit))); // LIMIT 0,30 while (query.next() && cnt <= limit) { QByteArray array; QDataStream stream(&array, QIODevice::WriteOnly); @@ -84,7 +90,7 @@ void MsgService::pushMessage(QString me, QString member, int limit) } else isOnline.insert(member, false); - query.exec(); + query.clear(); DB_PUSHER.close(); previousPushUid = member; @@ -321,7 +327,3 @@ QString MsgService::getPreviousPushUid() { return previousPushUid; } - -MsgService::~MsgService() -{ -} diff --git a/posterwork.cpp b/posterwork.cpp index 0eef92b..d184789 100644 --- a/posterwork.cpp +++ b/posterwork.cpp @@ -46,7 +46,8 @@ void PosterWork::working() tabModel->setHeaderData(tabModel->fieldIndex("author_id"), Qt::Horizontal, ""); tabModel->setFilter("isHide = 0"); //ʾδ tabModel->select(); - + while (tabModel->canFetchMore()) + tabModel->fetchMore(); //س256 emit contentsWorkFinished(); } else @@ -60,7 +61,8 @@ void PosterWork::working() manageModel->setHeaderData(manageModel->fieldIndex("c_id"), Qt::Horizontal, ""); manageModel->setHeaderData(manageModel->fieldIndex("title"), Qt::Horizontal, ""); manageModel->select(); - + while (manageModel->canFetchMore()) + manageModel->fetchMore(); //س256 emit contentsManageWorkFinished(); } } diff --git a/resource.qrc b/resource.qrc index 50503d7..9d2b771 100644 --- a/resource.qrc +++ b/resource.qrc @@ -111,6 +111,7 @@ color_icon/arrow_up_2.svg img/stable.png img/ae_loading.gif + img/nt-logo.png eCharts/echarts.html diff --git a/usermanagework.cpp b/usermanagework.cpp index 46b1604..ab8d62e 100644 --- a/usermanagework.cpp +++ b/usermanagework.cpp @@ -8,7 +8,7 @@ UserManageWork::UserManageWork(QObject *parent) : QObject(parent) //DB.setConnectOptions("MYSQL_OPT_RECONNECT=1"); //超时重连 heartBeat = new QTimer(this); connect(heartBeat, &QTimer::timeout, this, [=]() { - if (isDisplay) + if (isDisplay && relTableModel != nullptr) relTableModel->select(); else if (DB.isOpen()) @@ -29,7 +29,13 @@ void UserManageWork::working() if (!DB.isOpen()) DB.open(); isDisplay = true; - //使用relationalModel时,这数据库不能关闭,否则外键的映射就没办法操作了...早知道不用relationalModel了,数据库连接很难管理... + //使用relationalModel时,这数据库不能关闭,否则外键的映射就没办法操作了...早知道不用relationalModel了,数据库连接很难管理... + + if(modelQueue.count() >= 2) + delete modelQueue.dequeue(); + relTableModel = new QSqlRelationalTableModel(this, DB); + modelQueue.enqueue(relTableModel); + relTableModel->setTable("magic_users"); relTableModel->setSort(relTableModel->fieldIndex("uid"), Qt::AscendingOrder); //升序排列 relTableModel->setEditStrategy(QSqlTableModel::OnManualSubmit); //手动提交 @@ -48,9 +54,12 @@ void UserManageWork::working() relTableModel->setRelation(relTableModel->fieldIndex("user_group"), QSqlRelation("magic_group", "group_id", "group_name")); relTableModel->setRelation(relTableModel->fieldIndex("user_dpt"), QSqlRelation("magic_department", "dpt_id", "dpt_name")); relTableModel->select(); + while (relTableModel->canFetchMore()) + relTableModel->fetchMore(); //加载超过256的其余数据 //获取用户组和部门 getComboxItems(); + emit userManageWorkFinished(); } @@ -83,10 +92,10 @@ void UserManageWork::getComboxItems() m_department->addItems(comboxItems_department); } -void UserManageWork::setModel(QSqlRelationalTableModel *model) -{ - relTableModel = model; -} +//void UserManageWork::setModel(QSqlRelationalTableModel *model) +//{ +// relTableModel = model; +//} void UserManageWork::submitAll() { @@ -213,3 +222,8 @@ QString UserManageWork::getUid() { return uid; } + +QSqlRelationalTableModel* UserManageWork::getModel() +{ + return relTableModel; +} diff --git a/usermanagework.h b/usermanagework.h index e433756..c45be38 100644 --- a/usermanagework.h +++ b/usermanagework.h @@ -15,7 +15,7 @@ class UserManageWork : public QObject explicit UserManageWork(QObject *parent = nullptr); ~UserManageWork(); void working(); - void setModel(QSqlRelationalTableModel* model); + //void setModel(QSqlRelationalTableModel* model); QSqlDatabase getDB(); void submitAll(); void setFilter(const QString& filter); @@ -31,6 +31,7 @@ class UserManageWork : public QObject int getVerifyTag(); QString getUid(); bool isDisplay = false; + QSqlRelationalTableModel* getModel(); private slots: @@ -46,6 +47,7 @@ private slots: QTimer *heartBeat; int verifyTag; void getComboxItems(); + QQueue modelQueue; signals: void userManageWorkFinished(); void queryAccountFinished(QSqlRecord);