diff --git a/src/data/api/ApiProjectRepository.cpp b/src/data/api/ApiProjectRepository.cpp index ab7cb43..1bd7b14 100644 --- a/src/data/api/ApiProjectRepository.cpp +++ b/src/data/api/ApiProjectRepository.cpp @@ -74,21 +74,49 @@ RepoResult> ApiProjectRepository::loadStructure(const st return {true, dto::parseStructNodes(r.data.value(QStringLiteral("value")).toArray()), {}}; } -RepoResult ApiProjectRepository::loadTmRows(const std::string& projectId, - const std::string& tmObjectId, int classifyType, - int pageNo) { +RepoResult ApiProjectRepository::loadRows(const std::string& projectId, + const std::string& parentId, int parentConfType, + int classifyType, int pageNo) { const QString path = (classifyType == 1) ? QStringLiteral("/business/dsObject/file/page") : QStringLiteral("/business/dsObject/data/page"); const QJsonObject body{ {QStringLiteral("projectId"), QString::fromStdString(projectId)}, - {QStringLiteral("structParentId"), QString::fromStdString(tmObjectId)}, - {QStringLiteral("structParentConfType"), 2}, + {QStringLiteral("structParentId"), QString::fromStdString(parentId)}, + {QStringLiteral("structParentConfType"), parentConfType}, {QStringLiteral("classifyTypeList"), QJsonArray{classifyType}}, {QStringLiteral("pageNo"), pageNo}, - {QStringLiteral("pageSize"), 5}}; // 数据/文件页签每页 5;不足 total 时"加载更多"追加 + {QStringLiteral("pageSize"), 5}}; 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), {}}; } +RepoResult 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 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> 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 diff --git a/src/data/api/ApiProjectRepository.hpp b/src/data/api/ApiProjectRepository.hpp index 9423897..dd27b4b 100644 --- a/src/data/api/ApiProjectRepository.hpp +++ b/src/data/api/ApiProjectRepository.hpp @@ -16,8 +16,11 @@ public: int pageNo, int pageSize) override; RepoResult> listProjectTypes() override; RepoResult> loadStructure(const std::string& projectId) override; - RepoResult loadTmRows(const std::string& projectId, const std::string& tmObjectId, - int classifyType, int pageNo) override; + RepoResult loadRows(const std::string& projectId, const std::string& parentId, + int parentConfType, int classifyType, int pageNo) override; + RepoResult loadObjectDetail(const std::string& objectId, int confType) override; + RepoResult loadDatasetForm(const std::string& dsObjectId) override; + RepoResult> loadExceptionsByTm(const std::string& tmObjectId) override; private: net::ApiClient& api_; diff --git a/src/data/repo/IProjectRepository.hpp b/src/data/repo/IProjectRepository.hpp index 37bd82c..0c7c0af 100644 --- a/src/data/repo/IProjectRepository.hpp +++ b/src/data/repo/IProjectRepository.hpp @@ -26,10 +26,16 @@ public: // 项目类型列表(弹窗类型过滤下拉)。 virtual RepoResult> listProjectTypes() = 0; virtual RepoResult> loadStructure(const std::string& projectId) = 0; - // 按 TM 分页拉数据/文件行:classifyType 3=数据 1=文件;pageNo 从 1 起,pageSize 固定 5。 - virtual RepoResult loadTmRows(const std::string& projectId, - const std::string& tmObjectId, int classifyType, - int pageNo) = 0; + // 按结构父节点分页拉数据/文件行:parentConfType 1=GS 2=TM;classifyType 3=数据 1=文件; + // pageNo 从 1 起,pageSize 固定 5。 + virtual RepoResult loadRows(const std::string& projectId, const std::string& parentId, + int parentConfType, int classifyType, int pageNo) = 0; + // 对象详情:confType 1=GS(getGsObjectDetail) 2=TM(tmObject/getDetail) → 动态表单。 + virtual RepoResult loadObjectDetail(const std::string& objectId, int confType) = 0; + // 数据集详情:dsObject/dynamicForm/{dsObjectId} → 动态表单。 + virtual RepoResult loadDatasetForm(const std::string& dsObjectId) = 0; + // 单 TM 异常列表(含异常体归属字段)。 + virtual RepoResult> loadExceptionsByTm(const std::string& tmObjectId) = 0; }; } // namespace geopro::data