From aa013c2f4e69e2ba4eb72081dc004d8334d59257 Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期一, 28 十月 2024 23:15:27 +0800 Subject: [PATCH] 1028 --- internal_system_v1/converinfo2.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 95 insertions(+), 4 deletions(-) diff --git a/internal_system_v1/converinfo2.cpp b/internal_system_v1/converinfo2.cpp index 7e3f124..466e8b9 100644 --- a/internal_system_v1/converinfo2.cpp +++ b/internal_system_v1/converinfo2.cpp @@ -15,8 +15,9 @@ ui->setupUi(this); m_menu = nullptr; //initUi(); - readInfo(); // 鍔犺浇琛ㄦ牸 + //readInfo(); // 鍔犺浇琛ㄦ牸 addMenu(); // 澧炲姞鑿滃崟 + disableWheelEvent(); // 绂佺敤涓嬫媺妗嗙殑婊氳疆浜嬩欢 // 鑷�傚簲澶勭悊 ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); @@ -49,7 +50,7 @@ it4->setCheckState(0,Qt::Checked); // 澶嶉�夋鐘舵�佸鐞� - connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ + connect(ui->treeWidget,QOverload<QTreeWidgetItem*,int>::of(&QTreeWidget::itemClicked),this,[=](QTreeWidgetItem* it,int index){ qDebug()<<it<<index; if(it == top1){ qDebug()<<"鐐瑰嚮浜嗙爜铓侀泦鍥�"; @@ -90,25 +91,64 @@ { if(m_curItem==nullptr)return; qDebug()<<"娣诲姞鍏徃淇℃伅,鍦ㄨ妭鐐癸細"<<m_curItem->text(0); + on_pushButton_laodFile_clicked(); } void ConverInfo2::deleteInfo() { if(m_curItem==nullptr)return; qDebug()<<"鍒犻櫎鍏徃淇℃伅,鑺傜偣锛�"<<m_curItem->text(0); + auto resList = m_curItem->takeChildren(); + + qDebug()<<"鍒犻櫎鏁伴噺:"<<resList.size(); } void ConverInfo2::on_treeWidget_doubleClicked(const QModelIndex &index) { QString name = index.model()->data(index).toString(); qDebug()<<"鍙屽嚮"<<index<<name; + ComInfo curCominfo = m_nameAndComInfos[name]; if(name.contains("(鏈骇)")){ QStringList sps = name.split("(鏈骇)"); name = sps.at(0); + curCominfo = m_nameAndComInfos[name]; }else if(name.contains("(姹囨��)")){ name = name.split("(姹囨��)").at(0); + qDebug()<<"姹囨�诲鐞�:"; + // 鍋氫竴涓眹鎬荤殑澶勭悊锛屾妸鎵�鏈変笅绾х殑閮界疮鍔犺捣鏉� + ComInfo allCominfo = m_nameAndComInfos[name]; + for(QString cur:m_treeNodes[name]){ + if(name != cur){ + ComInfo &tmp = m_nameAndComInfos[cur]; + allCominfo.organazationNum += tmp.organazationNum; + allCominfo.realNum += tmp.realNum; + allCominfo.professionalNum += tmp.professionalNum; + allCominfo.CIANum += tmp.CIANum; + allCominfo.masterNum += tmp.masterNum; + allCominfo.undergraduatesNum += tmp.undergraduatesNum; + allCominfo.juniorNum += tmp.juniorNum; + allCominfo.seniorNum += tmp.seniorNum; + allCominfo.intermediateNum += tmp.intermediateNum; + allCominfo.primaryNum += tmp.primaryNum; + allCominfo.noTitleNum += tmp.noTitleNum; + allCominfo.upFiftyOldNum += tmp.upFiftyOldNum; + allCominfo.upThirtyOldNum += tmp.upThirtyOldNum; + allCominfo.downThirtyOldNum += tmp.downThirtyOldNum; + allCominfo.auditNum += tmp.auditNum; + allCominfo.accountingNum += tmp.accountingNum; + allCominfo.economyNum += tmp.economyNum; + allCominfo.lawNum += tmp.lawNum; + allCominfo.managerNum += tmp.managerNum; + allCominfo.itNum += tmp.itNum; + allCominfo.engineeringNum += tmp.engineeringNum; + allCominfo.otherNum += tmp.otherNum; + } + + } + curCominfo = allCominfo; + } - ComInfo curCominfo = m_nameAndComInfos[name]; + //ComInfo curCominfo = m_nameAndComInfos[name]; // 涓�銆佸崟浣嶅熀鏈儏鍐� ui->lineEdit_creditCode->setText(curCominfo.creditCode); ui->lineEdit_name->setText(QString::fromLocal8Bit( curCominfo.name)); @@ -209,11 +249,15 @@ it.next(); list.append(it.fileInfo().absoluteFilePath()); } + int allSize = list.size(); + float cntIdx=1.0; foreach(QString str, list) { qDebug() << str; int index = str.indexOf("鍐呭缁�01琛�"); qDebug()<<"index:"<<index; + + if(index > 0){ QAxObject excel("ket.Application"); if(!excel.setControl("ket" @@ -713,10 +757,16 @@ qDebug()<<"鍗曚綅淇℃伅鏁伴噺锛�"<<m_nameAndComInfos.size(); } + + // 鎺у埗鏄剧ず杩涘害鐩稿叧 + emit loadProgress((cntIdx/allSize)*100); + cntIdx++; } createTreeNode(); // 鏋勫缓鏍戝舰鑺傜偣 + // 鍙戝皠 鍔犺浇瀹屾垚鐨勪俊鍙� + emit loadFinished(); // QAxObject excel("./debug/Data/闄勪欢2_鍐呭缁�01琛╛鍗曚綅鍙婂唴閮ㄥ璁℃満鏋勫熀鏈儏鍐佃〃-1.301鐗�(1).xls"); // excel.setProperty("Visible",true); @@ -1542,6 +1592,38 @@ } } } + +void ConverInfo2::disableWheelEvent() +{ + ui->comboBox_ChiefDesignerLevel->installEventFilter(this); + ui->comboBox_comType->installEventFilter(this); + ui->comboBox_employmentMode->installEventFilter(this); + ui->comboBox_hasChiefDesigner->installEventFilter(this); + ui->comboBox_hasSetIntervalAudit->installEventFilter(this); + ui->comboBox_hasSetSeparateIA->installEventFilter(this); + ui->comboBox_hasUpLegal->installEventFilter(this); + ui->comboBox_intavalAuditLeval->installEventFilter(this); + ui->comboBox_leadingOrganization->installEventFilter(this); + ui->comboBox_scale->installEventFilter(this); + ui->comboBox_standardType->installEventFilter(this); +} + +bool ConverInfo2::eventFilter(QObject *watched, QEvent *event) +{ + QString cls = watched->metaObject()->className(); + if(cls == "QComboBox"){ + //qDebug()<<"鍙戠幇涓嬫媺妗�"; + if(event->type() == QEvent::Wheel){ + //qDebug()<<"浣跨敤浜嗘粴杞�"; + return true; // 杩斿洖鐪熻〃绀虹鐢紝杩斿洖鍋囧垯鑳界敤 + } + }else{ + qDebug()<<"鍏朵粬绫诲瀷:"<<cls; + } + + return QMainWindow::eventFilter(watched,event); + +} void ConverInfo2::addTreeWidgetNode(QVariant upName,QVariant name){ // 娣诲姞宸﹁竟鏍戝舰鍥剧浉鍏� // 鑿滃崟鐩稿叧 褰撲笂绾у叕鍙镐负绌轰笂绾ф椂锛岃嚜宸卞綋鑷繁鐨勪笂绾э紝骞朵笖缃楀垪杩涘幓褰� 鏈骇 @@ -1553,7 +1635,8 @@ for(int k=0;k<ui->treeWidget->topLevelItemCount();++k){ QTreeWidgetItem *tmp = ui->treeWidget->topLevelItem(k); qDebug()<<k<<tmp->text(0)<<upName.toString(); - if(upName.toString()+"(姹囨��)" == tmp->text(0)){ + int pos = tmp->text(0).indexOf(upName.toString()+"(姹囨��)"); + if(upName.toString()+"(姹囨��)" == tmp->text(0) || pos != -1){ top = tmp; break; } @@ -1562,11 +1645,13 @@ if(top){ // 瀛樺湪锛屽垯娣诲姞鍒板瀛愬垪琛ㄤ腑 QTreeWidgetItem *top1 = new QTreeWidgetItem(top); top1->setText(0,name.toString()); + top->setText(0,upName.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top->childCount()-1)); }else{ // 涓嶅瓨鍦紝鍒欐柊寤轰竴涓垪琛� QTreeWidgetItem *top1 = new QTreeWidgetItem(ui->treeWidget); top1->setText(0,name.toString()+"(姹囨��)"); QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); top2->setText(0,name.toString()+"(鏈骇)"); + top1->setText(0,name.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top1->childCount()-1)); } } @@ -1578,6 +1663,7 @@ top1->setText(0,name.toString()+"(姹囨��)"); QTreeWidgetItem *top2 = new QTreeWidgetItem(top1); top2->setText(0,name.toString()+"(鏈骇)"); + top1->setText(0,name.toString()+"(姹囨��)涓嬬骇鏁�:"+QString::number(top1->childCount()-1)); } } @@ -1590,3 +1676,8 @@ readExcelFromPath(path); } } + +void ConverInfo2::showExcelSlot() +{ + readInfo(); // 鍔犺浇琛ㄦ牸 +} -- Gitblit v1.8.0