wumu
2024-05-09 9ddb25babb774f773b62106fb4d1a9404af71fd9
0509
6个文件已修改
6个文件已添加
467 ■■■■■ 已修改文件
internal_system_v1/comboboxdelegate.cpp 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/comboboxdelegate.h 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/customheaderview.cpp 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/customheaderview.h 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/datedelegate.cpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/datedelegate.h 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/filedialogdelegate.cpp 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/filedialogdelegate.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/internal_system_v1.pro 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.cpp 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.h 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/threemergeproblemlist.ui 217 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
internal_system_v1/comboboxdelegate.cpp
New file
@@ -0,0 +1,23 @@
#include "comboboxdelegate.h"
ComboBoxDelegate::ComboBoxDelegate(QStringList labels,QObject *parent)
    :QItemDelegate(parent),
      m_labels(labels)
{
}
QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QComboBox *cbb = new QComboBox(parent);
    for(int i=0;i<m_labels.size();++i){
        cbb->addItem(m_labels.at(i));
    }
    return cbb;
}
void ComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    QString val = ((QComboBox*)editor)->currentText();
    model->setData(index,val);
}
internal_system_v1/comboboxdelegate.h
New file
@@ -0,0 +1,20 @@
#ifndef COMBOBOXDELEGATE_H
#define COMBOBOXDELEGATE_H
#include <QItemDelegate>
#include <QComboBox>
class ComboBoxDelegate : public QItemDelegate
{
public:
    ComboBoxDelegate(QStringList labels,QObject *parent=0);
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
private:
    QStringList m_labels;
};
#endif // COMBOBOXDELEGATE_H
internal_system_v1/customheaderview.cpp
New file
@@ -0,0 +1,23 @@
#include "customheaderview.h"
CustomHeaderView::CustomHeaderView(Qt::Orientation orientation, QWidget *parent)
    :QHeaderView(orientation,parent)
{
}
void CustomHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
{
    if (logicalIndex == 0) // 指定第一个表头项
    {
       painter->save();
       painter->fillRect(rect, Qt::red); // 设置背景色为红色
       //painter->setBackground(QBrush(Qt::red));
       painter->restore();
    }
    else
    {
       QHeaderView::paintSection(painter, rect, logicalIndex);
    }
}
internal_system_v1/customheaderview.h
New file
@@ -0,0 +1,18 @@
#ifndef CUSTOMHEADERVIEW_H
#define CUSTOMHEADERVIEW_H
#include <QHeaderView>
#include <QPainter>
class CustomHeaderView : public QHeaderView
{
public:
    CustomHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr);
protected:
    void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
};
#endif // CUSTOMHEADERVIEW_H
internal_system_v1/datedelegate.cpp
New file
@@ -0,0 +1,20 @@
#include "datedelegate.h"
DateDelegate::DateDelegate(QObject *parent):QItemDelegate(parent)
{
}
QWidget *DateDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QDateTimeEdit *de = new QDateTimeEdit(parent);
    de->setDate(QDate::currentDate());
    de->setDisplayFormat("yyyy");
    return de;
}
void DateDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
    QString ct = ((QDateTimeEdit*)editor)->text();
    model->setData(index,ct);
}
internal_system_v1/datedelegate.h
New file
@@ -0,0 +1,18 @@
#ifndef DATEDELEGATE_H
#define DATEDELEGATE_H
#include <QItemDelegate>
#include <QDateTimeEdit>
class DateDelegate : public QItemDelegate
{
public:
    DateDelegate(QObject *parent=0);
    QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
};
#endif // DATEDELEGATE_H
internal_system_v1/filedialogdelegate.cpp
@@ -7,11 +7,11 @@
}
QWidget *FileDialogDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QFileDialog *fd = new QFileDialog(parent);
    return fd;
}
//QWidget *FileDialogDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
//{
//    QFileDialog *fd = new QFileDialog(parent);
//    return fd;
//}
void FileDialogDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
@@ -22,7 +22,8 @@
{
    QString fn = ((QFileDialog *)editor)->getOpenFileName();
    qDebug()<<index<<fn;
    index.model()->setData(index,fn);
    //index.model()->setData(index,fn);
    model->setData(index,fn);
}
void FileDialogDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
internal_system_v1/filedialogdelegate.h
@@ -11,7 +11,7 @@
public:
    FileDialogDelegate(QObject *parent=0);
    QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    //QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
internal_system_v1/internal_system_v1.pro
@@ -42,7 +42,10 @@
    problemrectificationresult.cpp \
    tableitemdelegate.cpp \
    threemergeproblemlist.cpp \
    filedialogdelegate.cpp
    filedialogdelegate.cpp \
    customheaderview.cpp \
    comboboxdelegate.cpp \
    datedelegate.cpp
HEADERS += \
        clientmainwindow.h \
@@ -63,7 +66,10 @@
    problemrectificationresult.h \
    tableitemdelegate.h \
    threemergeproblemlist.h \
    filedialogdelegate.h
    filedialogdelegate.h \
    customheaderview.h \
    comboboxdelegate.h \
    datedelegate.h
FORMS += \
        clientmainwindow.ui \
internal_system_v1/threemergeproblemlist.cpp
@@ -17,6 +17,9 @@
    ui->menubar->hide();
    initUi(); // 初始化所有界面
    //ui->tableWidget_2->hide();
    //ui->tableWidget_3->hide();
}
ThreeMergeProblemList::~ThreeMergeProblemList()
@@ -35,6 +38,95 @@
    ui->tableWidget_3->setMinimumHeight(500); // 问题清单
    ui->tableWidget->setItemDelegateForColumn(1,m_fdd);
    // 自适应操作
    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->tableWidget->resizeColumnsToContents();
    ui->tableWidget->resizeRowsToContents();
    // 控制表头颜色
        // 自定义的方式有缺陷是容易让对应项锁死
    //m_custonHV = new CustomHeaderView(Qt::Horizontal,ui->tableWidget);
    //ui->tableWidget->setHorizontalHeader(m_custonHV);
        // 给指定项改背景颜色
    //ui->tableWidget->horizontalHeaderItem(1)->setBackground(QBrush(Qt::red));
    //ui->tableWidget->horizontalHeaderItem(3)->setBackground(QBrush(Qt::blue));
//    QTableWidgetItem *item_1 = new QTableWidgetItem("审计类别");
//    item_1->setForeground(QBrush(QColor("#FF1493")));
//    ui->tableWidget->setHorizontalHeaderItem(1,item_1);
    for(int i=0;i<14;++i){
        QString label = ui->tableWidget->horizontalHeaderItem(i)->text();
        QTableWidgetItem *item_1 = new QTableWidgetItem(label);
        item_1->setForeground(QBrush(QColor("#ff00ff")));
        ui->tableWidget->setHorizontalHeaderItem(i,item_1);
    }
    for(int i=14;i<14+10;++i){
        QString label = ui->tableWidget->horizontalHeaderItem(i)->text();
        QTableWidgetItem *item_1 = new QTableWidgetItem(label);
        item_1->setForeground(QBrush(QColor("#00aaff")));
        ui->tableWidget->setHorizontalHeaderItem(i,item_1);
    }
    for(int i=24;i<24+3;++i){
        QString label = ui->tableWidget->horizontalHeaderItem(i)->text();
        QTableWidgetItem *item_1 = new QTableWidgetItem(label);
        item_1->setForeground(QBrush(QColor("#00aa00")));
        ui->tableWidget->setHorizontalHeaderItem(i,item_1);
    }
    for(int i=27;i<27+8;++i){
        QString label = ui->tableWidget->horizontalHeaderItem(i)->text();
        QTableWidgetItem *item_1 = new QTableWidgetItem(label);
        item_1->setForeground(QBrush(QColor("#007a50")));
        ui->tableWidget->setHorizontalHeaderItem(i,item_1);
    }
    for(int i=35;i<35+5;++i){
        QString label = ui->tableWidget->horizontalHeaderItem(i)->text();
        QTableWidgetItem *item_1 = new QTableWidgetItem(label);
        item_1->setForeground(QBrush(QColor("#500a50")));
        ui->tableWidget->setHorizontalHeaderItem(i,item_1);
    }
    // 处理具体某列的情况
        // 审计类别
    QStringList nwLabels;
    nwLabels << "内审"<<"外审";
    m_cbb_nw = new ComboBoxDelegate(nwLabels,this);
    ui->tableWidget->setItemDelegateForColumn(1,m_cbb_nw);
        // 审计年度
    m_date_year = new DateDelegate(this);
    ui->tableWidget->setItemDelegateForColumn(2,m_date_year);
        // 审计单位
    QStringList comLabels;
    comLabels << "审计局"<<"审计厅"<<"审计署"<<"其他";
    m_cbb_company = new ComboBoxDelegate(comLabels,this);
    ui->tableWidget->setItemDelegateForColumn(3,m_cbb_company);
        // 审计方式
    QStringList wayLabels;
    wayLabels << "就地审计"<<"报送审计";
    m_cbb_way = new ComboBoxDelegate(wayLabels,this);
    ui->tableWidget->setItemDelegateForColumn(4,m_cbb_way);
        // 审计项目
    QStringList proLabels;
    proLabels <<"  "<< "贯彻落实国家重大政策措施审计"<<"财政财务收支审计"<<"固定资产投资审计"<<"内部控制和风险管理审计"
              <<"经济责任审计"<<"信息系统审计"<<"境外审计"<<"其他";
    m_cbb_way = new ComboBoxDelegate(proLabels,this);
    ui->tableWidget->setItemDelegateForColumn(6,m_cbb_way);
        // 问题描述佐证资料(上传取证单) 录入或者上传
    ui->tableWidget->setItemDelegateForColumn(13,m_fdd);
    // 加载公司名
    readCompanyFromSQL();
}
internal_system_v1/threemergeproblemlist.h
@@ -7,6 +7,10 @@
#include <QAction>
#include "filedialogdelegate.h"
#include "customheaderview.h"
#include "comboboxdelegate.h"
#include "datedelegate.h"
namespace Ui {
class ThreeMergeProblemList;
@@ -60,6 +64,13 @@
    QMenu *m_menuRectBook; // 整改台账
    FileDialogDelegate *m_fdd;
    CustomHeaderView *m_custonHV;
    ComboBoxDelegate *m_cbb_nw; // 内审或外审
    DateDelegate *m_date_year; // 审计年度
    ComboBoxDelegate *m_cbb_company; // 审计单位
    ComboBoxDelegate *m_cbb_way; // 审计方式
    ComboBoxDelegate *m_cbb_pro; // 审计项目
};
#endif // THREEMERGEPROBLEMLIST_H
internal_system_v1/threemergeproblemlist.ui
@@ -336,14 +336,7 @@
            </property>
           </widget>
          </item>
          <item row="1" column="2">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string>要删除某一行直接右击删除即可</string>
            </property>
           </widget>
          </item>
          <item row="1" column="3">
          <item row="1" column="7">
           <spacer name="horizontalSpacer_3">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
@@ -356,7 +349,28 @@
            </property>
           </spacer>
          </item>
          <item row="2" column="1" colspan="4">
          <item row="1" column="2">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string>要删除某一行直接右击删除即可</string>
            </property>
           </widget>
          </item>
          <item row="0" column="1">
           <widget class="QLabel" name="label_4">
            <property name="text">
             <string>整改台账</string>
            </property>
           </widget>
          </item>
          <item row="1" column="8">
           <widget class="QPushButton" name="pushButton_save_3">
            <property name="text">
             <string>保存</string>
            </property>
           </widget>
          </item>
          <item row="2" column="1" colspan="8">
           <widget class="QTableWidget" name="tableWidget">
            <attribute name="verticalHeaderVisible">
             <bool>false</bool>
@@ -378,12 +392,57 @@
            </row>
            <column>
             <property name="text">
              <string>问题描述</string>
              <string>序号</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>问题描述佐证资料</string>
              <string>审计类别</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计年度</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计单位</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计方式</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>责任主体名称</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计项目</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计项目名称</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>问题类别</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>问题定性</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>问题描述</string>
             </property>
            </column>
            <column>
@@ -393,7 +452,17 @@
            </column>
            <column>
             <property name="text">
              <string>涉及金额(万元)</string>
              <string>涉及金额</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>问题描述佐证资料</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>审计期间已整改</string>
             </property>
            </column>
            <column>
@@ -408,12 +477,7 @@
            </column>
            <column>
             <property name="text">
              <string>整改佐证资料1</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>整改类型</string>
              <string>整改情况佐证资料1</string>
             </property>
            </column>
            <column>
@@ -423,7 +487,7 @@
            </column>
            <column>
             <property name="text">
              <string>整改时间</string>
              <string>整改完成时间</string>
             </property>
            </column>
            <column>
@@ -433,7 +497,7 @@
            </column>
            <column>
             <property name="text">
              <string>尚未整改到位问题整改期限</string>
              <string>整改预计完成时间</string>
             </property>
            </column>
            <column>
@@ -448,42 +512,133 @@
            </column>
            <column>
             <property name="text">
              <string>整改类型</string>
              <string>整改检查结果:检查时间</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>整改结果</string>
              <string>整改检查结果:检查方式</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>整改时间</string>
              <string>整改检查结果:检查结果</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>尚未整改到位的原因</string>
              <string>已整改:纠正问题</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>尚未整改到位问题整改期限</string>
              <string>已整改:完善制度</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>已整改:完成时间</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>正在整改:主要原因</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>正在整改:完成时限</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>尚未整改:主要原因</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>尚未整改:责任部门或责任人</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>尚未整改:完成时限</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>制度建设:修订制度</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>制度建设:新增制度</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>资金收回:挽回损失</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>资金收回:其他</string>
             </property>
            </column>
            <column>
             <property name="text">
              <string>资金收回:审减</string>
             </property>
            </column>
           </widget>
          </item>
          <item row="1" column="4">
           <widget class="QPushButton" name="pushButton_save_3">
            <property name="text">
             <string>保存</string>
           <widget class="QComboBox" name="comboBox">
            <item>
             <property name="text">
              <string>审计类别</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>审计年度</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>问题类别</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>金额</string>
             </property>
            </item>
            <item>
             <property name="text">
              <string>审计方式</string>
             </property>
            </item>
           </widget>
          </item>
          <item row="1" column="5">
           <widget class="QLineEdit" name="lineEdit">
            <property name="placeholderText">
             <string>请输入左边选项的对应条件</string>
            </property>
           </widget>
          </item>
          <item row="0" column="1">
           <widget class="QLabel" name="label_4">
          <item row="1" column="3">
           <widget class="QLabel" name="label_7">
            <property name="text">
             <string>整改台账</string>
             <string>查询条件</string>
            </property>
           </widget>
          </item>
          <item row="1" column="6">
           <widget class="QPushButton" name="pushButton">
            <property name="text">
             <string>查询已录</string>
            </property>
           </widget>
          </item>