mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
Merge remote-tracking branch 'baidu/master'
Change-Id: If2b82f7a56418d82fc4d62ee4ded3fc8cf32ac7d
This commit is contained in:
commit
532f2808b6
@ -132,7 +132,9 @@ order: 34
|
||||
|
||||
## 配置图表点击行为
|
||||
|
||||
可以通过配置`"clickAction": {}`,来指定图表节点的点击行为,支持 amis 的[行为](./action)。
|
||||
可以通过配置`"clickAction": {}`,来指定图表节点的点击行为,支持 amis 的 [行为](./action)。
|
||||
|
||||
然后在配置的行为中可以通过 [数据链](../concepts/datascope-and-datachain) 获取到 [echarts 鼠标事件](https://echarts.apache.org/zh/api.html#events.%E9%BC%A0%E6%A0%87%E4%BA%8B%E4%BB%B6.click) 的值,例如下面例子中可以通过`${value|json}`获取到点击节点的`传入的数据值`
|
||||
|
||||
> 点击下面坐标中的节点查看效果!
|
||||
|
||||
|
@ -1317,6 +1317,80 @@ crud 组件支持通过配置`headerToolbar`和`footerToolbar`属性,实现在
|
||||
}
|
||||
```
|
||||
|
||||
## 弹框与数据链
|
||||
|
||||
一般 CRUD 中会有弹框,然后进行数据展示或进行二次编辑的需求,通过在列中配置按钮,然后配置弹框,弹框内配置相应的组件即可。
|
||||
|
||||
现在问题是,如何获取到当前操作行的数据呢?
|
||||
|
||||
实际上,你操作当前行数据,会成为弹框这层节点的父级节点,因此你可以通过 [数据链](../concepts/datascope-and-datachain),获取到上层,也就是点击的行的数据,具体获取方法和普通组件获取数据域中数据的方法相同,
|
||||
|
||||
```schema:height="600" scope="body"
|
||||
{
|
||||
"type": "crud",
|
||||
"api": "https://houtai.baidu.com/api/sample",
|
||||
"draggable": true,
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "engine",
|
||||
"label": "Rendering engine"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "platform",
|
||||
"label": "Platform(s)"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "Engine version"
|
||||
},
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"label": "一个弹框",
|
||||
"actionType": "dialog",
|
||||
"dialog": {
|
||||
"title": "一个弹框",
|
||||
"body": [
|
||||
{
|
||||
"type": "tpl",
|
||||
"tpl": "行数据中 Browser 值为:${browser}"
|
||||
},
|
||||
{
|
||||
"type": "divider"
|
||||
},
|
||||
{
|
||||
"type": "form",
|
||||
"api": "/api/sample/$id",
|
||||
"controls": [
|
||||
{
|
||||
"type": "text",
|
||||
"name": "engine",
|
||||
"label": "Engine"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
例如上例中 Tpl 用 `${browser}` 获取 `browser` 变量,Form 中配置`"name": "engine"` 映射 `engine` 变量。
|
||||
|
||||
> 遇到数据字段冲突时,可以在 [弹框上通过配置数据映射](./dialog#%E5%BC%B9%E6%A1%86%E4%B8%8E%E6%95%B0%E6%8D%AE%E6%98%A0%E5%B0%84) 解决。
|
||||
|
||||
## 拖拽排序
|
||||
|
||||
通过配置`"draggable": true`和保存排序接口`saveOrderApi`,可以实现拖拽排序功能,
|
||||
|
@ -83,6 +83,127 @@ Dialog 弹框 主要由 [Action](./action) 触发,主要展示一个对话框
|
||||
}
|
||||
```
|
||||
|
||||
## 弹框与数据映射
|
||||
|
||||
默认弹框内由于数据链的存在,会自动映射父级同名变量,例如下例:
|
||||
|
||||
```schema:height="600" scope="body"
|
||||
{
|
||||
"type": "crud",
|
||||
"api": "https://houtai.baidu.com/api/sample",
|
||||
"draggable": true,
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "engine",
|
||||
"label": "Rendering engine"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "platform",
|
||||
"label": "Platform(s)"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "Engine version"
|
||||
},
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"label": "一个弹框",
|
||||
"actionType": "dialog",
|
||||
"dialog": {
|
||||
"title": "一个弹框",
|
||||
"body": [
|
||||
{
|
||||
"type": "form",
|
||||
"api": "/api/sample/$id",
|
||||
"controls": [
|
||||
{
|
||||
"type": "text",
|
||||
"name": "engine",
|
||||
"label": "Engine"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
上例弹框中的表单项 `Engine` 会自动映射到父级数据中的 `engine` 变量,如果想调整当前特性,如你想调整父级映射变量的字段,可以利用[数据映射](../concepts/data-mapping),例如:
|
||||
|
||||
```schema:height="600" scope="body"
|
||||
{
|
||||
"type": "crud",
|
||||
"api": "https://houtai.baidu.com/api/sample",
|
||||
"draggable": true,
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "engine",
|
||||
"label": "Rendering engine"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "platform",
|
||||
"label": "Platform(s)"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "Engine version"
|
||||
},
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"label": "一个弹框",
|
||||
"actionType": "dialog",
|
||||
"dialog": {
|
||||
"data": {
|
||||
"engine2": "${engine}"
|
||||
},
|
||||
"title": "一个弹框",
|
||||
"body": [
|
||||
{
|
||||
"type": "form",
|
||||
"api": "/api/sample/$id",
|
||||
"controls": [
|
||||
{
|
||||
"type": "text",
|
||||
"name": "engine2",
|
||||
"label": "Engine"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
上例给 `dialog` 中配置 `data` 属性,可以将上层的 `engine` 变量映射为 `engine2`
|
||||
|
||||
## 多级弹框
|
||||
|
||||
```schema:height="100" scope="body"
|
||||
|
@ -88,6 +88,28 @@ order: 58
|
||||
|
||||
调整时间,观察数据域中表单项值的变化
|
||||
|
||||
## 显示秒
|
||||
|
||||
默认显示的是时和分,要显示秒请参考以下配置
|
||||
|
||||
```schema:height="400" scope="body"
|
||||
{
|
||||
"type": "form",
|
||||
"debug": true,
|
||||
"api": "https://houtai.baidu.com/api/mock2/form/saveForm",
|
||||
"controls": [
|
||||
{
|
||||
"type": "time",
|
||||
"name": "time",
|
||||
"label": "时间",
|
||||
"format": "HH:mm:ss",
|
||||
"timeFormat": "HH:mm:ss",
|
||||
"inputFormat": "HH:mm:ss"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 默认值
|
||||
|
||||
可以设置`value`属性,设置日期选择器的默认值
|
||||
@ -148,6 +170,7 @@ order: 58
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| --------------- | --------- | -------------- | ----------------------------------------------------------------------------------- |
|
||||
| value | `string` | | [默认值](./date#%E9%BB%98%E8%AE%A4%E5%80%BC) |
|
||||
| timeFormat | `string` | `HH:mm` | 时间选择器值格式,更多格式类型请参考 [moment](http://momentjs.com/) |
|
||||
| format | `string` | `X` | 时间选择器值格式,更多格式类型请参考 [moment](http://momentjs.com/) |
|
||||
| inputFormat | `string` | `HH:mm` | 时间选择器显示格式,即时间戳格式,更多格式类型请参考 [moment](http://momentjs.com/) |
|
||||
| placeholder | `string` | `"请选择时间"` | 占位文本 |
|
||||
|
@ -162,6 +162,8 @@ let amisScoped = amis.embed(
|
||||
|
||||
可以通过 `amisScoped.getComponentByName('page1.form1').getValues()` 来获取到所有表单的值,需要注意 page 和 form 都需要有 name 属性。
|
||||
|
||||
还可以通过 `amisScoped.getComponentByName('page1.form1').setValues({'name1': 'othername'})` 来修改表单中的值。
|
||||
|
||||
## npm
|
||||
|
||||
### 安装
|
||||
|
@ -77,18 +77,21 @@ API 类型用于配置请求接口的格式,涉及请求方式、请求地址
|
||||
}
|
||||
```
|
||||
|
||||
### 不推荐的格式
|
||||
### 兼容格式
|
||||
|
||||
部分组件为了可以兼容,支持下面这种直接返回数组的用法,但并不推荐这种方式。
|
||||
> 1.0.19 及以上版本。
|
||||
|
||||
为了支持多种后端,amis 支持直接返回数据的方式,无需返回 status 和将数据放在 data 字段中,比如下面的例子:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"msg": "",
|
||||
"data": ["a", "b"] // 不推荐,使用 key 包装
|
||||
"username": "amis",
|
||||
"email": "amis@amis.com"
|
||||
}
|
||||
```
|
||||
|
||||
但这种方式无法显示错误信息,只能通过返回 http 状态码来标识错误。
|
||||
|
||||
## 复杂配置
|
||||
|
||||
API 还支持配置对象类型
|
||||
|
340
mock/test.json
340
mock/test.json
@ -1,340 +0,0 @@
|
||||
{
|
||||
"status": 0,
|
||||
"result": null,
|
||||
"msg": null,
|
||||
"data": {
|
||||
"count": 5,
|
||||
"pageNo": 1,
|
||||
"pageSize": 10,
|
||||
"orderBy": null,
|
||||
"order": null,
|
||||
"rows": [
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201543308,
|
||||
"creativeId": 187,
|
||||
"ideaId": 0,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "b4299ee3ed76b2f439d7e29dfc5cf6ab",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:39:19"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201543308,
|
||||
"creativeId": 187,
|
||||
"ideaId": 54009256299,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com1297102669",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "801bb193d8ed2d44aa8d672d30d0b2a1",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:42:22"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 187,
|
||||
"ideaId": 0,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "b4299ee3ed76b2f439d7e29dfc5cf6ab",
|
||||
"auditResult": "0",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:39:19"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 187,
|
||||
"ideaId": 54009256074,
|
||||
"title": "橱窗样式",
|
||||
"brand": "橱窗品牌",
|
||||
"url": "http://www.ronhe.comww",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/e1228057dc685dcd90d2be52e7160e11.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "5803a7eba7cbe6ba111e310549f0204d",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 19:53:11"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 171,
|
||||
"ideaId": 54009255238,
|
||||
"title": "闪投创意_测试aa",
|
||||
"brand": "闪投测试ff",
|
||||
"url": "http://www.baidu.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/e2a076e03f1624997b27eb5f0f8d69ff.jpgdd",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "10a208706d1c1bf4716d85e4e1ae5447",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 19:55:45"
|
||||
}
|
||||
]
|
||||
},
|
||||
"warning": null,
|
||||
"debug": {
|
||||
"request": {
|
||||
"url": "http://prim2.jpaas-off00.baidu.com/audit/feed/idealist",
|
||||
"params": {
|
||||
"_url": "http://prim2.jpaas-off00.baidu.com/audit/feed/idealist"
|
||||
},
|
||||
"data": {
|
||||
"userId": "630152",
|
||||
"pageSize": "10",
|
||||
"pageNo": "1",
|
||||
"page": 1,
|
||||
"perPage": 10
|
||||
},
|
||||
"headers": {
|
||||
"AMIS_GROUP_KEY": "prim",
|
||||
"AMIS_ROLES": "",
|
||||
"AMIS_PERMS": "__is_uuap_user",
|
||||
"AMIS_USER_IP": "10.91.140.154",
|
||||
"AMIS_USER_TYPE": 0,
|
||||
"AMIS_USER": "liaoxuezhi",
|
||||
"AMIS_IS_OWNER": "true",
|
||||
"Cookie": "BIDUPSID=6010BA9C9E557FE4093A55F26B853D8A; PSTM=1519639480; MCITY=-131%3A; BDSFRCVID=cJFsJeC624fG1XrAc_DStBWfyWJwDL5TH6aoiDZK23UeK7yc6biqEG0PDM8g0KubLgH7ogKK0mOTHvbP; H_BDCLCKID_SF=JbujoI_MtKv2jJjvq4bMK4FQqxby26nHKHReaJ5nJDoSSR6jDM6N0RtRQGJNbP6yJJn3XRT_QpP-HJ7R-qbsjh_vXU-tJ6jLQ6rUKl0MLpbtbb0xyn_VynF10MnMBMPeteOnaILaLIFbMD-Gj50WenIJqxQ0btjXKto2WbCQWIJrqpcNLTDKefIFWqQ23ljeyI0fbtJ8abCh8MoJ5lO1j4_eXJKtK-vX3Tr-WMJkb4QUoh5jDh3M25ksD-Rte4kqaa5y0hvctKocShPCjq00DjO3ea-JtTFs-DTbB4oHK--_qnTz-4L_5-_e-xQyetJyaR3T_lRbWJ5TMCoGQR6ZMTKF0lbvhjbN-IoyWlvlbxDbShPC-tnhKn0jyP59L6ch2eTiWfO73l02VhcIe-t2ynQDQlovW4RMW20eoq7mWILhVKFRjTA2DjJBepJf-K6QbDjKWRD8Kb7Vbn5lLnbkbfJBDxr7aM6DWe6NQKJDJMo2DR7J-jraXPD7yajK2-7WHCuHaq58MCbfhxcOKMrpQT8rKqAOK5Oib4jZo-5hab3vOI84XpO1j6LreGtttTLJtn-sXJP8KRTKHRrPq4bohjPjXpoeBtQmJJu8aqjw-RONV48R36JCK-CehHorQfJqQg-q3R7zLD5JjbreK4oo0MC054Ov0x-jLTnOVn0MW-KVjKQvWtnJyUnyD4nnBTKtLnLDVCDaJD0-MDvGh4rohCuShMr2aK6B5Po2WbCQWDOMqpcNLTDKjl_HLPPf3RItBNOJ5f3DMCoBOUbk5lO1j4_eybngXPQ7-DjLbbuh2nnIhp5jDh3tXjksD-Rt5tQD0Cjy0hvctn6cShnC-l00D6j-jaKDtjKsb5vfsJQ-24OoHRjP2DTjhPrM-P6lbMT-0bFH_nQTtxnKEJO3QhbMLl-E2JJZ-M3rJGn7_JjO2lbAOI_R3tovjnFSjx50bxQxtNRR2CnjtpvhHlRTy5JobUPUDMc9LUvqKH4E3-oJqCKBbKt93f; BAIDUID=5B2BBA9D53B86EE8ECE6F4A51151026A:FG=1; Hm_lvt_1f80f2c9dbe21dc3af239cf9eee90f1f=1525227445; Hm_lvt_0b20b782e46454330553f136ffb8c303=1525658669; Hm_lpvt_0b20b782e46454330553f136ffb8c303=1525661732; BDUSS=FnZHhkam9mcW15c2NPNEhxRWlzNEQ0cWRXS1ByZEd5NzlWdmx0ZTFiV2d-aUZiQUFBQUFBJCQAAAAAAAAAAAEAAAAQl~oAbGlhb3h1ZXpoaQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKBx-lqgcfpaV1; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; SIGNIN_UC=70a2711cf1d3d9b1a82d2f87d633bd8a02764772933; H_PS_PSSID=1420_26458_21118_18559_22159; BAIDU_WISE_UID=wapp_1526524424557_688; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; PSINO=2; amisid=s%3Am2bXcd_ZZ0HGuOlFzFQIO-7MXYpTyplI.rnSQoUh4LG0n22lZWJM0dEdfFi1AOCly8JeLn4gPaW0; amis_env=2; Hm_lpvt_1f80f2c9dbe21dc3af239cf9eee90f1f=1526544494",
|
||||
"Content-Type": "application/json",
|
||||
"Content-Length": 70
|
||||
},
|
||||
"method": "post"
|
||||
},
|
||||
"response": {
|
||||
"status": 0,
|
||||
"result": null,
|
||||
"msg": null,
|
||||
"data": {
|
||||
"count": 5,
|
||||
"pageNo": 1,
|
||||
"pageSize": 10,
|
||||
"orderBy": null,
|
||||
"order": null,
|
||||
"rows": [
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201543308,
|
||||
"creativeId": 187,
|
||||
"ideaId": 0,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "b4299ee3ed76b2f439d7e29dfc5cf6ab",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:39:19"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201543308,
|
||||
"creativeId": 187,
|
||||
"ideaId": 54009256299,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com1297102669",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "801bb193d8ed2d44aa8d672d30d0b2a1",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:42:22"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 187,
|
||||
"ideaId": 0,
|
||||
"title": "闪投创意_橱窗测试",
|
||||
"brand": "橱窗样式品牌",
|
||||
"url": "http://www.tuiguang.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/65e55b02f73ea07b4079e247a2ffd05b.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "b4299ee3ed76b2f439d7e29dfc5cf6ab",
|
||||
"auditResult": "0",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 20:39:19"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 187,
|
||||
"ideaId": 54009256074,
|
||||
"title": "橱窗样式",
|
||||
"brand": "橱窗品牌",
|
||||
"url": "http://www.ronhe.comww",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/e1228057dc685dcd90d2be52e7160e11.jpg",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/d6362946b69a71340595e56d8527a31a.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/164c83612b9837f9f565cd80a0d6245e.jpg"
|
||||
},
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/4258ea37ba97236ff661be0a09ceea02.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "5803a7eba7cbe6ba111e310549f0204d",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 19:53:11"
|
||||
},
|
||||
{
|
||||
"userId": 630152,
|
||||
"planId": 0,
|
||||
"unitId": 2201545776,
|
||||
"creativeId": 171,
|
||||
"ideaId": 54009255238,
|
||||
"title": "闪投创意_测试aa",
|
||||
"brand": "闪投测试ff",
|
||||
"url": "http://www.baidu.com",
|
||||
"userPortrait": "http://fc-feed.cdn.bcebos.com/0/pic/e2a076e03f1624997b27eb5f0f8d69ff.jpgdd",
|
||||
"pictures": [
|
||||
{
|
||||
"pic": "http://bj.bcebos.com/fc-feed/0/pic/62c40ba3e297ea57c5b80f41e958b4f2.jpg"
|
||||
}
|
||||
],
|
||||
"signature": "10a208706d1c1bf4716d85e4e1ae5447",
|
||||
"auditResult": "",
|
||||
"status": 1,
|
||||
"type": "DPA",
|
||||
"lastModifiedTime": "2018-05-16 19:55:45"
|
||||
}
|
||||
]
|
||||
},
|
||||
"warning": null
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import {Renderer} from '../../factory';
|
||||
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
||||
import {filter} from '../../utils/tpl';
|
||||
import cx from 'classnames';
|
||||
import LazyComponent from '../../components/LazyComponent';
|
||||
import debouce from 'lodash/debounce';
|
||||
import {isPureVariable} from '../../utils/tpl-builtin';
|
||||
import {
|
||||
isPureVariable,
|
||||
resolveVariableAndFilter
|
||||
} from '../../utils/tpl-builtin';
|
||||
import {SchemaTokenizeableString} from '../../Schema';
|
||||
import {autobind} from '../../utils/helper';
|
||||
|
||||
@ -132,7 +132,10 @@ export class DiffEditor extends React.Component<DiffEditorProps, any> {
|
||||
.getModel()
|
||||
.setValue(
|
||||
isPureVariable(diffValue as string)
|
||||
? normalizeValue(filter(diffValue || '', data, '| raw'), language)
|
||||
? normalizeValue(
|
||||
resolveVariableAndFilter(diffValue || '', data, '| raw'),
|
||||
language
|
||||
)
|
||||
: normalizeValue(diffValue, language)
|
||||
);
|
||||
}
|
||||
@ -183,7 +186,10 @@ export class DiffEditor extends React.Component<DiffEditorProps, any> {
|
||||
this.editor.setModel({
|
||||
original: this.monaco.editor.createModel(
|
||||
isPureVariable(diffValue as string)
|
||||
? normalizeValue(filter(diffValue || '', data, '| raw'), language)
|
||||
? normalizeValue(
|
||||
resolveVariableAndFilter(diffValue || '', data, '| raw'),
|
||||
language
|
||||
)
|
||||
: normalizeValue(diffValue, language),
|
||||
language
|
||||
),
|
||||
|
@ -92,7 +92,8 @@ export default class PickerControl extends React.PureComponent<
|
||||
'multiple',
|
||||
'embed',
|
||||
'resetValue',
|
||||
'placeholder'
|
||||
'placeholder',
|
||||
'onQuery' // 防止 Form 的 onQuery 事件透传下去,不然会导致 table 先后触发 Form 和 Crud 的 onQuery
|
||||
];
|
||||
static defaultProps: Partial<PickerProps> = {
|
||||
modalMode: 'dialog',
|
||||
|
@ -6,6 +6,7 @@ import Overlay from '../../components/Overlay';
|
||||
import {findDOMNode} from 'react-dom';
|
||||
import PopOver from '../../components/PopOver';
|
||||
import {ITableStore} from '../../store/table';
|
||||
import {setVariable} from '../../utils/helper';
|
||||
|
||||
export interface QuickSearchConfig {
|
||||
type?: string;
|
||||
@ -180,7 +181,7 @@ export class HeadCellSearchDropDown extends React.Component<
|
||||
handleReset() {
|
||||
const {onQuery, data, name} = this.props;
|
||||
const values = {...data};
|
||||
this.formItems.forEach(key => (values[key] = undefined));
|
||||
this.formItems.forEach(key => setVariable(values, key, undefined));
|
||||
|
||||
if (values.orderBy === name) {
|
||||
values.orderBy = '';
|
||||
|
@ -1648,8 +1648,8 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
classnames: cx,
|
||||
...rest
|
||||
} = this.props;
|
||||
const __ = rest.translate
|
||||
const env = rest.env
|
||||
const __ = rest.translate;
|
||||
const env = rest.env;
|
||||
|
||||
const render = this.props.render;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import {isEffectiveApi, isApiOutdated} from '../utils/api';
|
||||
import {ScopedContext, IScopedContext} from '../Scoped';
|
||||
import Spinner from '../components/Spinner';
|
||||
import {BaseSchema, SchemaApi, SchemaClassName, SchemaName} from '../Schema';
|
||||
import {createObject} from '../utils/helper';
|
||||
|
||||
/**
|
||||
* Tasks 渲染器,格式说明
|
||||
@ -305,10 +306,7 @@ export default class Task extends React.Component<TaskProps, TaskState> {
|
||||
isEffectiveApi(api, data) &&
|
||||
env &&
|
||||
env
|
||||
.fetcher(api, {
|
||||
...data,
|
||||
...item
|
||||
})
|
||||
.fetcher(api, createObject(data, item))
|
||||
.then((ret: Payload) => {
|
||||
if (ret && ret.data) {
|
||||
if (Array.isArray(ret.data)) {
|
||||
|
@ -89,7 +89,6 @@ export interface Action extends Button {
|
||||
| 'delete'
|
||||
| 'edit'
|
||||
| 'cancel'
|
||||
| 'close'
|
||||
| 'next'
|
||||
| 'prev'
|
||||
| 'reset';
|
||||
|
@ -168,9 +168,8 @@ function responseAdaptor(ret: fetcherResult) {
|
||||
if (!data) {
|
||||
throw new Error('Response is empty!');
|
||||
} else if (!data.hasOwnProperty('status')) {
|
||||
throw new Error(
|
||||
'接口返回格式不符合,请参考 http://amis.baidu.com/v2/docs/api'
|
||||
);
|
||||
// 兼容不返回 status 字段的情况
|
||||
data.status = 0;
|
||||
}
|
||||
|
||||
const payload: Payload = {
|
||||
@ -178,7 +177,7 @@ function responseAdaptor(ret: fetcherResult) {
|
||||
status: data.status,
|
||||
msg: data.msg,
|
||||
msgTimeout: data.msgTimeout,
|
||||
data: data.data
|
||||
data: data.data ? data.data : data // 兼容直接返回数据的情况
|
||||
};
|
||||
|
||||
if (payload.status == 422) {
|
||||
|
Loading…
Reference in New Issue
Block a user