From c74f6a4d857f6e232abf55364ff29a75a07bbd2c Mon Sep 17 00:00:00 2001 From: hsm-lv <80095014+hsm-lv@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:37:02 +0800 Subject: [PATCH] =?UTF-8?q?chore:inputTable=E6=B7=BB=E5=8A=A0=E8=A1=8C?= =?UTF-8?q?=E5=86=85=E8=81=94=E5=8A=A8=E4=BE=8B=E5=AD=90=20(#8858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/crud.md | 32 +++++----- docs/zh-CN/components/form/input-table.md | 72 +++++++++++++++++++++++ 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/docs/zh-CN/components/crud.md b/docs/zh-CN/components/crud.md index 058cb3d8067..33958f4fef7 100755 --- a/docs/zh-CN/components/crud.md +++ b/docs/zh-CN/components/crud.md @@ -1074,7 +1074,7 @@ amis 只负责生成下拉选择器组件,并将搜索参数传递给接口, #### 下拉数据源 -过滤器的数据域支持API接口和上下文数据(`3.6.0`及以上版本) +过滤器的数据域支持 API 接口和上下文数据(`3.6.0`及以上版本) ```schema { @@ -3378,22 +3378,22 @@ itemAction 里的 onClick 还能通过 `data` 参数拿到当前行的数据, 除了 Table 组件默认支持的列配置,CRUD 的列配置还额外支持以下属性: | 属性名 | 类型 | 默认值 | 说明 | 版本 | -| ------------------ | --------------------------------------------------------------- | ------- | --------------------------------------------------------------------------- | --- | +| ------------------ | --------------------------------------------------------------- | ------- | --------------------------------------------------------------------------- | ---- | | sortable | `boolean` | `false` | 是否可排序 | | searchable | `boolean` \| `Schema` | `false` | 是否可快速搜索,开启`autoGenerateFilter`后,`searchable`支持配置`Schema` | | filterable | `boolean` \| [`QuickFilterConfig`](./crud.md#quickfilterconfig) | `false` | 是否可快速搜索,`options`属性为静态选项,支持设置`source`属性从接口获取选项 | | quickEdit | `boolean` \| [`QuickEditConfig`](./crud.md#quickeditconfig) | - | 快速编辑,一般需要配合`quickSaveApi`接口使用 | -| quickEditEnabledOn | `SchemaExpression` | - | 开启快速编辑条件[表达式](../../docs/concepts/expression) | | +| quickEditEnabledOn | `SchemaExpression` | - | 开启快速编辑条件[表达式](../../docs/concepts/expression) | | #### QuickFilterConfig -| 属性名 | 类型 | 默认值 | 说明 | 版本 | -| ------------- | ----------------------------- | ------- | -------------------------------------------------------- | ------- | -| options | `Array` | - | 静态选项 | | -| multiple | `boolean` | `false` | 是否支持多选 | | -| source | [`Api`](../../docs/types/api) \| `string` | - | 选项 API 接口 | `3.6.0`版本后支持上下文变量 | -| refreshOnOpen | `boolean` | `false` | 配置 source 前提下,每次展开筛选浮层是否重新加载选项数据 | `2.9.0` | -| strictMode | `boolean` | `false` | 严格模式,开启严格模式后,会采用 JavaScript 严格相等比较 | `2.3.0` | +| 属性名 | 类型 | 默认值 | 说明 | 版本 | +| ------------- | ----------------------------------------- | ------- | -------------------------------------------------------- | --------------------------- | +| options | `Array` | - | 静态选项 | | +| multiple | `boolean` | `false` | 是否支持多选 | | +| source | [`Api`](../../docs/types/api) \| `string` | - | 选项 API 接口 | `3.6.0`版本后支持上下文变量 | +| refreshOnOpen | `boolean` | `false` | 配置 source 前提下,每次展开筛选浮层是否重新加载选项数据 | `2.9.0` | +| strictMode | `boolean` | `false` | 严格模式,开启严格模式后,会采用 JavaScript 严格相等比较 | `2.3.0` | #### QuickEditConfig @@ -4948,7 +4948,7 @@ value 结构说明: #### 行记录中字段赋值 -需要通过表达式配置动态`name`或`id`和`componentName`或`componentId`。例如修改`engine`选中状态的同时选中`version`,勾选`id`的同时去掉对`engine`的选中。 +需要通过表达式配置动态`id`和`componentId`。例如修改`engine`选中状态的同时选中`version`,勾选`id`的同时去掉对`engine`的选中。 ```schema: scope="body" { @@ -4960,13 +4960,12 @@ value 结构说明: { "name": "id", "label": "ID", - "id": "u:3db3f2b1b99e", "onEvent": { "click": { "actions": [ { "actionType": "setValue", - "componentId": "u:4868d7db0139_${index}", + "componentId": "version_${index}", "args": { "value": false } @@ -4981,13 +4980,12 @@ value 结构说明: "label": "engine", "quickEdit": true, "quickEditEnabledOn": "this.id < 5", - "id": "u:0b9be99f3403", "onEvent": { "change": { "actions": [ { "actionType": "setValue", - "componentName": "version_${index}", + "componentId": "version_${index}", "args": { "value": true } @@ -4997,12 +4995,12 @@ value 结构说明: } }, { - "name": "version_${index}", + "name": "version", "type": "checkbox", "label": "version", "quickEdit": true, "quickEditEnabledOn": "this.id < 5", - "id": "u:4868d7db0139_${index}" + "id": "version_${index}" } ], "id": "u:f5bad706d7c5" diff --git a/docs/zh-CN/components/form/input-table.md b/docs/zh-CN/components/form/input-table.md index 581fd92b807..d7e14e2a05f 100755 --- a/docs/zh-CN/components/form/input-table.md +++ b/docs/zh-CN/components/form/input-table.md @@ -1901,6 +1901,7 @@ order: 54 { "type": "button", "label": "新增一行(未指定添加位置)", + "className": "mr-2", "onEvent": { "click": { "actions": [ @@ -1985,6 +1986,7 @@ order: 54 { "type": "button", "label": "删除行(指定行号)", + "className": "mr-2", "onEvent": { "click": { "actions": [ @@ -2184,6 +2186,7 @@ order: 54 { "type": "button", "label": "更新index为1和3的行记录", + "className": "mr-2", "onEvent": { "click": { "actions": [ @@ -2205,6 +2208,7 @@ order: 54 { "type": "button", "label": "更新a=a3的行记录", + "className": "mr-2", "onEvent": { "click": { "actions": [ @@ -2315,6 +2319,74 @@ order: 54 } ``` +#### 行记录内表单项联动 + +需要通过表达式配置动态 `id` 和 `componentId`。 + +```schema: scope="body" +{ + "type": "form", + "api": "/api/mock2/form/saveForm", + "body": [ + { + "type": "input-table", + "label": "表格表单", + "id": "setValue-input-table", + "name": "table", + "columns": [ + { + "type": "input-number", + "name": "num1", + "label": "数量", + "onEvent": { + "change": { + "actions": [ + { + "actionType": "setValue", + "componentId": "num2_${index}", + "args": { + "value": "${num1 * 10}" + } + } + ] + } + } + }, + { + "name": "num2", + "id": "num2_${index}", + "label": "金额" + } + ], + "addable": true, + "footerAddBtn": { + "label": "新增", + "icon": "fa fa-plus", + "hidden": true + }, + "strictMode": true, + "minLength": 0, + "needConfirm": false, + "showTableAddBtn": false + } + ], + "data": { + "table": [ + { + "id": 1, + "num1": 1, + "num2": "10" + }, + { + "id": 2, + "num1": "2", + "num2": 20 + } + ] + } +} +``` + ### clear ```schema: scope="body"