Comments (3)
👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.
Please review the labels and make any necessary changes.
from amis.
要实现这个有以下几个要点:
1.先说说你的使用误区,为了避免死循环,组件不能对自己执行动作,所以在add事件中执行不会生效
2. 所以如果要生效,需要去掉combo原来的新增按钮,设置 addable 为 false
3. 在下面新增一个模拟按钮新增按钮,然后这个按钮点击的时候,对combo执行新增动作addItem
4. 设置新增的值,需要用到很多表达式(具体可以查看文档)以此来计算新的值
5. 另外,这种计算值比较复杂的操作用自定义动作写js获取比较方便,可以尝试一下
完整的schema如下,应该是你要的效果:
{
"type": "form",
"id": "u:1bd293cd8bba",
"title": "表单",
"debug": true,
"body": [
{
"type": "combo",
"id": "u:6668b5cd6246",
"name": "combo11",
"label": "组合多条多行内联",
"multiple": true,
"multiLine": false,
"inline": true,
"value": [
{
"start": "00:00",
"end": "01:00",
"price_category": 0
}
],
"addable": false,
"items": [
{
"type": "input-time-range",
"label": "时间范围",
"name": "start",
"id": "u:5c130c3d188f",
"displayFormat": "HH:mm",
"placeholder": "请选择时间范围",
"valueFormat": "HH:mm",
"minDate": "",
"shortcuts": [],
"extraName": "end",
"endPlaceholder": "结束时间",
"autoFill": {},
"required": true,
"embed": false,
"unique": true,
"value": "",
"maxDate": ""
},
{
"type": "select",
"label": "价格类别",
"name": "price_category",
"options": [
{
"label": "尖费率",
"value": 0
},
{
"label": "峰费率",
"value": 1
},
{
"label": "平费率",
"value": 2
},
{
"label": "谷费率",
"value": 3
}
],
"id": "u:c800ea06ec55",
"multiple": false,
"required": true,
"value": ""
}
],
"strictMode": true,
"maxLength": 24,
"minLength": 1,
"removableMode": "button",
"removable": true,
"canAccessSuperData": false,
"draggable": false,
"tabsMode": false,
"size": "full",
"syncFields": [],
"lazyLoad": false,
"className": "mb-1"
},
{
"type": "button-toolbar",
"label": "",
"buttons": [
{
"type": "button",
"label": "新增",
"icon": "fa fa-plus",
"level": "primary",
"size": "sm",
"onEvent": {
"click": {
"weight": 0,
"actions": [
{
"componentId": "u:6668b5cd6246",
"ignoreError": false,
"actionType": "addItem",
"args": {
"item": {
"start": "${combo11[COUNT(combo11)-1].end}",
"end": "${DATETOSTR(DATEMODIFY(STRTODATE('2000/01/01 '+combo11[COUNT(combo11)-1].end+ ':00'), 1, 'hours'), 'HH:mm')}",
"price_category": "${HOUR(STRTODATE('2000/01/01 '+combo11[COUNT(combo11)-1].end+ ':00')) % 2}"
}
}
}
]
}
}
}
]
}
]
}
from amis.
另外,我看你另一个issue #9415 也是为了解决一样的问题吧
from amis.
Related Issues (20)
- input-time类型控件值来自字段value而不是上层作用域data中字段值时,会差8小时
- input-datetime类型控件编辑时,如果连续点选某个日期或某个小时分两次值会跳8小时
- 无法打印表格 HOT 1
- JSSDK乱码
- 表单数据缓存
- input-table配置合并单元格后,表格错行 HOT 1
- picker组件 开启标签收纳,已选隐藏项样式有问题
- 如何禁止提交initApi获取表单的数据,只提交当前表单填写的数据 HOT 3
- aside中badge 动态设置数据
- inputTable组件在行内编辑时存在延迟更新数据域的问题
- amis-editor,编辑器初始化改变schema,导致功能无法使用
- tpl js模版引擎会自动转义
- #10134 table2刷新页面改成crud2下发存在bug HOT 1
- amis-editor-demo本地安装运行错误
- 移动端nav组件样式问题
- select控件搜索功能,输入搜索条件后,如果搜索结果没有包含当前控件本身已选中值项的话,已选中项会显示为选项value,应该显示为选项label
- dynamic input-range
- image配置enlargeTitle、enlargeCaption文字超过一行时展示有问题
- 爱速搭模组件模版功能有开源计划吗?
- 弹出窗口中下拉框联动CRUD表格内容不刷新数据 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amis.