feat(data): 仓储泛化 loadRows + 对象/数据集详情 + 按TM异常 接口实现
This commit is contained in:
parent
a21d392816
commit
4621e11c73
|
|
@ -74,21 +74,49 @@ RepoResult<std::vector<StructNode>> ApiProjectRepository::loadStructure(const st
|
||||||
return {true, dto::parseStructNodes(r.data.value(QStringLiteral("value")).toArray()), {}};
|
return {true, dto::parseStructNodes(r.data.value(QStringLiteral("value")).toArray()), {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
RepoResult<DsPage> ApiProjectRepository::loadTmRows(const std::string& projectId,
|
RepoResult<DsPage> ApiProjectRepository::loadRows(const std::string& projectId,
|
||||||
const std::string& tmObjectId, int classifyType,
|
const std::string& parentId, int parentConfType,
|
||||||
int pageNo) {
|
int classifyType, int pageNo) {
|
||||||
const QString path = (classifyType == 1) ? QStringLiteral("/business/dsObject/file/page")
|
const QString path = (classifyType == 1) ? QStringLiteral("/business/dsObject/file/page")
|
||||||
: QStringLiteral("/business/dsObject/data/page");
|
: QStringLiteral("/business/dsObject/data/page");
|
||||||
const QJsonObject body{
|
const QJsonObject body{
|
||||||
{QStringLiteral("projectId"), QString::fromStdString(projectId)},
|
{QStringLiteral("projectId"), QString::fromStdString(projectId)},
|
||||||
{QStringLiteral("structParentId"), QString::fromStdString(tmObjectId)},
|
{QStringLiteral("structParentId"), QString::fromStdString(parentId)},
|
||||||
{QStringLiteral("structParentConfType"), 2},
|
{QStringLiteral("structParentConfType"), parentConfType},
|
||||||
{QStringLiteral("classifyTypeList"), QJsonArray{classifyType}},
|
{QStringLiteral("classifyTypeList"), QJsonArray{classifyType}},
|
||||||
{QStringLiteral("pageNo"), pageNo},
|
{QStringLiteral("pageNo"), pageNo},
|
||||||
{QStringLiteral("pageSize"), 5}}; // 数据/文件页签每页 5;不足 total 时"加载更多"追加
|
{QStringLiteral("pageSize"), 5}};
|
||||||
const net::ApiResponse r = api_.postJson(path, body);
|
const net::ApiResponse r = api_.postJson(path, body);
|
||||||
if (!ok(r)) return {false, {}, errorOf(r, "loadTmRows failed")};
|
if (!ok(r)) return {false, {}, errorOf(r, "loadRows failed")};
|
||||||
return {true, dto::parseDsPage(r.data), {}};
|
return {true, dto::parseDsPage(r.data), {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RepoResult<DynamicForm> ApiProjectRepository::loadObjectDetail(const std::string& objectId,
|
||||||
|
int confType) {
|
||||||
|
const QString path =
|
||||||
|
(confType == 1)
|
||||||
|
? QStringLiteral("/business/gsObject/getGsObjectDetail/%1").arg(enc(objectId))
|
||||||
|
: QStringLiteral("/business/tmObject/getDetail/%1").arg(enc(objectId));
|
||||||
|
const net::ApiResponse r = api_.get(path);
|
||||||
|
if (!ok(r)) return {false, {}, errorOf(r, "loadObjectDetail failed")};
|
||||||
|
return {true, dto::parseDynamicForm(r.data), {}};
|
||||||
|
}
|
||||||
|
|
||||||
|
RepoResult<DynamicForm> ApiProjectRepository::loadDatasetForm(const std::string& dsObjectId) {
|
||||||
|
const QString path =
|
||||||
|
QStringLiteral("/business/dsObject/dynamicForm/%1").arg(enc(dsObjectId));
|
||||||
|
const net::ApiResponse r = api_.get(path);
|
||||||
|
if (!ok(r)) return {false, {}, errorOf(r, "loadDatasetForm failed")};
|
||||||
|
return {true, dto::parseDynamicForm(r.data), {}};
|
||||||
|
}
|
||||||
|
|
||||||
|
RepoResult<std::vector<ExceptionRow>> ApiProjectRepository::loadExceptionsByTm(
|
||||||
|
const std::string& tmObjectId) {
|
||||||
|
const QString path =
|
||||||
|
QStringLiteral("/business/exception/queryExceptionByTmObjectId/%1").arg(enc(tmObjectId));
|
||||||
|
const net::ApiResponse r = api_.get(path);
|
||||||
|
if (!ok(r)) return {false, {}, errorOf(r, "loadExceptionsByTm failed")};
|
||||||
|
return {true, dto::parseExceptions(r.data.value(QStringLiteral("value")).toArray()), {}};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace geopro::data
|
} // namespace geopro::data
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ public:
|
||||||
int pageNo, int pageSize) override;
|
int pageNo, int pageSize) override;
|
||||||
RepoResult<std::vector<ProjectType>> listProjectTypes() override;
|
RepoResult<std::vector<ProjectType>> listProjectTypes() override;
|
||||||
RepoResult<std::vector<StructNode>> loadStructure(const std::string& projectId) override;
|
RepoResult<std::vector<StructNode>> loadStructure(const std::string& projectId) override;
|
||||||
RepoResult<DsPage> loadTmRows(const std::string& projectId, const std::string& tmObjectId,
|
RepoResult<DsPage> loadRows(const std::string& projectId, const std::string& parentId,
|
||||||
int classifyType, int pageNo) override;
|
int parentConfType, int classifyType, int pageNo) override;
|
||||||
|
RepoResult<DynamicForm> loadObjectDetail(const std::string& objectId, int confType) override;
|
||||||
|
RepoResult<DynamicForm> loadDatasetForm(const std::string& dsObjectId) override;
|
||||||
|
RepoResult<std::vector<ExceptionRow>> loadExceptionsByTm(const std::string& tmObjectId) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
net::ApiClient& api_;
|
net::ApiClient& api_;
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,16 @@ public:
|
||||||
// 项目类型列表(弹窗类型过滤下拉)。
|
// 项目类型列表(弹窗类型过滤下拉)。
|
||||||
virtual RepoResult<std::vector<ProjectType>> listProjectTypes() = 0;
|
virtual RepoResult<std::vector<ProjectType>> listProjectTypes() = 0;
|
||||||
virtual RepoResult<std::vector<StructNode>> loadStructure(const std::string& projectId) = 0;
|
virtual RepoResult<std::vector<StructNode>> loadStructure(const std::string& projectId) = 0;
|
||||||
// 按 TM 分页拉数据/文件行:classifyType 3=数据 1=文件;pageNo 从 1 起,pageSize 固定 5。
|
// 按结构父节点分页拉数据/文件行:parentConfType 1=GS 2=TM;classifyType 3=数据 1=文件;
|
||||||
virtual RepoResult<DsPage> loadTmRows(const std::string& projectId,
|
// pageNo 从 1 起,pageSize 固定 5。
|
||||||
const std::string& tmObjectId, int classifyType,
|
virtual RepoResult<DsPage> loadRows(const std::string& projectId, const std::string& parentId,
|
||||||
int pageNo) = 0;
|
int parentConfType, int classifyType, int pageNo) = 0;
|
||||||
|
// 对象详情:confType 1=GS(getGsObjectDetail) 2=TM(tmObject/getDetail) → 动态表单。
|
||||||
|
virtual RepoResult<DynamicForm> loadObjectDetail(const std::string& objectId, int confType) = 0;
|
||||||
|
// 数据集详情:dsObject/dynamicForm/{dsObjectId} → 动态表单。
|
||||||
|
virtual RepoResult<DynamicForm> loadDatasetForm(const std::string& dsObjectId) = 0;
|
||||||
|
// 单 TM 异常列表(含异常体归属字段)。
|
||||||
|
virtual RepoResult<std::vector<ExceptionRow>> loadExceptionsByTm(const std::string& tmObjectId) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace geopro::data
|
} // namespace geopro::data
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue