| | |
| | | ui->setupUi(this); |
| | | m_menu = nullptr; |
| | | //initUi(); |
| | | readInfo(); // 加载表格 |
| | | //readInfo(); // 加载表格 |
| | | addMenu(); // 增加菜单 |
| | | disableWheelEvent(); // 禁用下拉框的滚轮事件 |
| | | |
| | | // 自适应处理 |
| | | ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| | |
| | | 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()<<"点击了码蚁集团"; |
| | |
| | | { |
| | | 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)); |
| | |
| | | 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" |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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){ |
| | | // 添加左边树形图相关 |
| | | // 菜单相关 当上级公司为空上级时,自己当自己的上级,并且罗列进去当 本级 |
| | |
| | | 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; |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | readExcelFromPath(path); |
| | | } |
| | | } |
| | | |
| | | void ConverInfo2::showExcelSlot() |
| | | { |
| | | readInfo(); // 加载表格 |
| | | } |