Skip to content

fix(model): fix several base model component bugs#1761

Merged
hexqi merged 15 commits intoopentiny:developfrom
betterdancing:fix/model-driven-bugs
Feb 3, 2026
Merged

fix(model): fix several base model component bugs#1761
hexqi merged 15 commits intoopentiny:developfrom
betterdancing:fix/model-driven-bugs

Conversation

@betterdancing
Copy link
Contributor

@betterdancing betterdancing commented Feb 3, 2026

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

页面模板组件在分页和搜索的时候没有传递搜索表单的data内容

Issue Number: N/A

What is the new behavior?

页面模板在分页和搜索的时候使用搜索表单的数据,如果自己调用queryApi也可以传递数据作为参数

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Refactor
    • Streamlined query and pagination parameter handling across components for improved consistency and maintainability.
    • Simplified data flow for query operations by consolidating parameter sources.

@github-actions github-actions bot added the bug Something isn't working label Feb 3, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Walkthrough

This PR refactors the queryApi method signatures across three form and table components to simplify parameter passing. Instead of accepting pagination parameters via function arguments, pagination values are now sourced from a shared pagerState object. Query parameters in BaseForm are sourced from formModel rather than pageModel.

Changes

Cohort / File(s) Summary
Parameter sourcing refactor
packages/builtinComponent/src/components/BaseForm.vue
Query parameters now sourced from formModel.value.parameters instead of pageModel.value.parameters.
Method signature simplification
packages/builtinComponent/src/components/BasePage.vue, packages/builtinComponent/src/components/BaseTable.vue
queryApi signature simplified from destructured parameters ({ currentPage, pageSize, data } = {}) to single parameter (data). Pagination values now derived from pagerState instead of function arguments. BaseTable also renames computed binding from TableModel to tableModel.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through refactored code,
Where pagination takes the simpler road,
From scattered args to pagerState so clean,
The formModel flows where pageModel had been,
Less clutter, more grace—what a tidy scene! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'fix(model): fix several base model component bugs' directly aligns with the PR's main objective to fix base model component bugs related to pagination and search form data handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Failure to add the new IP will result in interrupted reviews.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/builtinComponent/src/components/BaseTable.vue (1)

197-213: ⚠️ Potential issue | 🟠 Major

Guard against queryApi() calls with no data to avoid runtime crash.
data is spread directly; if callers invoke queryApi() without arguments, this throws. Since queryApi is exposed, this is a breaking runtime risk.

✅ Suggested fix
-const queryApi = (data) => {
+const queryApi = (data = {}) => {
   const apiInfo = props.modelApis.find((api) => api.nameEn === 'queryApi')
   if (!apiInfo) {
     return undefined
   }
   // 处理查询参数
   const params = Object.fromEntries(tableModel.value.parameters.map((item) => [item.prop, null]))
   return getMetaApi(META_SERVICE.Http)
     .post(apiInfo.url, {
       currentPage: pagerState.currentPage || 1,
       pageSize: pagerState.pageSize || 10,
       nameEn: tableModel.value.nameEn,
       nameCn: tableModel.value.nameCn,
       params: {
         ...params,
-        ...data
+        ...(data || {})
       }
     })

@hexqi hexqi changed the title Fix/model driven bugs: fix several base model component bugs fix(model): fix several base model component bugs Feb 3, 2026
@hexqi hexqi merged commit e23d199 into opentiny:develop Feb 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants