wumu
2024-10-28 aa013c2f4e69e2ba4eb72081dc004d8334d59257
internal_system_v1/converinfo2.cpp
@@ -17,6 +17,7 @@
    //initUi();
    //readInfo(); // 加载表格
    addMenu(); // 增加菜单
    disableWheelEvent(); // 禁用下拉框的滚轮事件
    // 自适应处理
    ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
@@ -106,13 +107,48 @@
{
    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));
@@ -1556,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){
    // 添加左边树形图相关
    // 菜单相关  当上级公司为空上级时,自己当自己的上级,并且罗列进去当 本级