#ifndef SAFETYINSPECT_H #define SAFETYINSPECT_H #include #include #include #include #include #include #include #include #include #include #include #include /** * SafetyInspect Dialog Component * * Usage example: * * // Method 1: Set data manually * SafetyInspect *dialog = new SafetyInspect(this); * dialog->setDate("2025-07-30"); * * QList records; * SafetyInspect::InspectionRecord record1; * record1.name = "张三"; * record1.phone = "13800138000"; * record1.checkStatus = "检查通过"; * records.append(record1); * * dialog->setInspectionRecords(records); * dialog->exec(); * * // Method 2: Fetch data from HTTP * SafetyInspect *dialog = new SafetyInspect(this); * dialog->fetchDataFromHttp("https://api.example.com/safety-inspection"); * dialog->exec(); */ class SafetyInspectDialog : public QDialog { Q_OBJECT public: struct InspectionRecord { QString name; QString phone; QString confirmTime; }; explicit SafetyInspectDialog(QWidget *parent = nullptr, const QMap &userNameById = QMap(), const QString &dateStr = QString()); ~SafetyInspectDialog(); // Set the date to display in header void setDate(const QString &date); // Set the inspection records to display in table void setInspectionRecords(const QList &records); void onCloseButtonClicked(); private: void setupUI(); void setupTable(); void populateTable(); QLabel *m_dateLabel; QTableWidget *m_tableWidget; QPushButton *m_closeButton; QString m_currentDate; QMap m_userNameById; QList m_inspectionRecords; }; #endif // SAFETYINSPECT_H