From 4621e11c7365a8a93e84a8b13ed6ab41ad3736f7 Mon Sep 17 00:00:00 2001 From: gaozheng Date: Wed, 10 Jun 2026 20:15:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(data):=20=E4=BB=93=E5=82=A8=E6=B3=9B?= =?UTF-8?q?=E5=8C=96=20loadRows=20+=20=E5=AF=B9=E8=B1=A1/=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E8=AF=A6=E6=83=85=20+=20=E6=8C=89TM=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=20=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/api/ApiProjectRepository.cpp | 42 ++++++++++++++++++++++----- src/data/api/ApiProjectRepository.hpp | 7 +++-- src/data/repo/IProjectRepository.hpp | 14 ++++++--- 3 files changed, 50 insertions(+), 13 deletions(-) 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