68 lines
2.5 KiB
C++
68 lines
2.5 KiB
C++
#pragma once
|
||
#include <QPointer>
|
||
#include <QString>
|
||
#include <QWidget>
|
||
|
||
namespace geopro::data {
|
||
class IAsyncProjectRepository;
|
||
class NavRequest;
|
||
} // namespace geopro::data
|
||
|
||
class QLabel;
|
||
class QLineEdit;
|
||
class QPushButton;
|
||
class QFormLayout;
|
||
class QScrollArea;
|
||
|
||
namespace geopro::app {
|
||
|
||
class DynamicFormEditor;
|
||
|
||
// 对象属性面板(右上 Tab「对象属性」):可编辑动态表单 + 保存。
|
||
// 顶层固定字段与 ObjectFormDialog 编辑态一致:name(可改) / 类型只读 / GS 负责人。
|
||
// 动态字段来自 project/getDynamicForm(DynamicFormEditor 渲染)。
|
||
// 仅编辑既有对象(无新建/类型下拉);提交体口径与 ObjectFormDialog::buildBody 编辑态相同:
|
||
// PUT gsObject {gsTypeId,id,projectId,name,responsiblePersonName,properties}(无 parentId)
|
||
// PUT tmObject {tmTypeId,id,name,properties,projectId,parentId,parentType:"1"}
|
||
// 注:TM 编辑须带真实 parentId(该 TM 的父 GS/项目根 id,由调用方经
|
||
// ObjectTreePanel::parentObjectId 解析后传入);GS 编辑不带 parentId。
|
||
class ObjectAttrPanel : public QWidget {
|
||
Q_OBJECT
|
||
public:
|
||
explicit ObjectAttrPanel(geopro::data::IAsyncProjectRepository& repo, QWidget* parent = nullptr);
|
||
|
||
// 单击对象 → 渲染可编辑表单。isRoot=项目根(只读占位,不可编辑)。
|
||
// projectId 随当前项目动态传入(面板长生命周期,不在构造期固化)。
|
||
// parentId=该对象父 GS/项目根 id(TM 编辑 PUT 用;GS 编辑忽略)。
|
||
void loadObject(const QString& projectId, const QString& typeId, const QString& objectId,
|
||
int confType, const QString& displayName, bool isRoot,
|
||
const QString& parentId);
|
||
void showMessage(const QString& message); // 空/占位
|
||
|
||
signals:
|
||
void saved(); // 保存成功(调用方据此 toast/刷新)
|
||
|
||
private:
|
||
void rebuildTopFields();
|
||
void onSave();
|
||
|
||
geopro::data::IAsyncProjectRepository& repo_;
|
||
QString projectId_;
|
||
QString objectId_;
|
||
QString typeId_;
|
||
QString parentId_; // TM 编辑 PUT 的父 GS/根 id(GS 编辑不用)
|
||
int confType_ = 0;
|
||
|
||
QLabel* status_ = nullptr;
|
||
QScrollArea* scroll_ = nullptr;
|
||
QWidget* topBox_ = nullptr;
|
||
QLineEdit* nameEdit_ = nullptr;
|
||
QLineEdit* responsibleEdit_ = nullptr;
|
||
DynamicFormEditor* editor_ = nullptr;
|
||
QPushButton* saveBtn_ = nullptr;
|
||
QPointer<geopro::data::NavRequest> formReq_;
|
||
QPointer<geopro::data::NavRequest> saveReq_;
|
||
};
|
||
|
||
} // namespace geopro::app
|