baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.18k stars 2.49k forks source link

通过按钮修改isQuickEdit变量,来控制crud的列能否开启快速编辑模式,但是crud不会随数据的变化而发生渲染 #9924

Open 1776313143 opened 6 months ago

1776313143 commented 6 months ago

描述问题:

通过按钮修改isQuickEdit变量,来控制crud的列能否开启快速编辑模式,但是crud不会随数据的变化而发生渲染

截图或视频:

image image

如何复现(请务必完整填写下面内容):

{ "type": "page", "body": [ { "type": "service", "id": "u:fdbdffd6880a", "body": [ { "type": "flex", "items": [ { "type": "container", "body": [ { "type": "alert", "body": [ { "type": "tpl", "tpl": "展示API平台接口清单,支持条件查询、接口新增、接口修改、接口复制等各类操作<a href=\"www.baidu.com\"> 查看详情", "wrapperComponent": "", "inline": false, "id": "u:bafd0a345e4b", "maxLine": 3, "editorSetting": { "mock": {} }, "onEvent": { "click": { "weight": 0, "actions": [] } } } ], "level": "info", "id": "u:6f987d14f48c", "showCloseButton": true, "showIcon": true } ], "size": "xs", "style": { "position": "static", "display": "block", "flex": "0 0 auto" }, "wrapperBody": false, "isFixedHeight": false, "isFixedWidth": false, "id": "u:b0916ada259a", "themeCss": { "baseControlClassName": {} } }, { "type": "container", "body": [ { "type": "crud", "id": "u:bdc1086fde05", "className": "m-b-none", "syncLocation": false, "autoGenerateFilter": true, "filter": { "body": [ { "type": "input-text", "name": "apiId", "placeholder": "请求编号", "id": "u:9e95b018f262", "label": "", "clearable": true, "showCounter": false, "size": "sm" }, { "type": "select", "label": "", "name": "apiStatus", "options": [ { "label": "启用", "value": "启用" }, { "label": "停用", "value": "停用" } ], "id": "u:f58bc53cf3b9", "multiple": false, "value": "", "placeholder": "是否启用", "size": "sm", "clearable": true }, { "type": "select", "placeholder": "请求方式", "id": "u:f58bc53cf3b9", "name": "apiMethod", "label": "", "options": [ { "label": "GET", "value": "GET" }, { "label": "POST", "value": "POST" } ], "multiple": false, "value": "", "mode": "inline", "size": "sm", "clearable": true }, { "type": "input-text", "name": "plaform", "label": "", "id": "u:a2f0edad819e", "placeholder": "是否启用", "text": "这只是个示例, 目前搜索对查询结果无效.", "size": "full", "mode": "inline" }, { "label": "", "type": "input-date-range", "id": "u:7cb23eb6567d", "name": "select" }, { "label": "重置", "type": "button", "actionType": "reset", "id": "u:416148fab1ce", "level": "default" }, { "label": "查询", "type": "button", "actionType": "submit", "id": "u:416148fab1ce", "level": "primary" } ], "title": "", "submitText": "", "id": "u:05acd5cf200e", "wrapWithPanel": false, "feat": "Insert", "mode": "inline", "columnCount": 0, "debug": false }, "defaultParams": { "perPage": "10", "orderBy": "apiId", "orderDir": "asc" }, "perPageAvailable": [ 10, 20, 50, 100, 500, 10000 ], "checkOnItemClick": true, "headerToolbar": [ { "type": "button", "tpl": "内容", "wrapperComponent": "", "id": "u:8a3acfb56950", "align": "left", "label": "+创建记录", "level": "link" }, { "type": "bulk-actions", "tpl": "内容", "wrapperComponent": "", "id": "u:d792bef55cd7", "align": "left" }, { "type": "columns-toggler", "align": "right", "draggable": true, "icon": "fas fa-cog", "overlay": true, "footerBtnSize": "sm" }, { "type": "switch", "id": "u:65c799ca384b", "align": "left", "onEvent": { "change": { "weight": 0, "actions": [ { "actionType": "setValue", "componentId": "u:f6f7088cdea7", "ignoreError": false, "args": { "value": { "isQuickEdit": "${IF(isQuickEdit,false,true)}" } } }, { "actionType": "reload", "componentId": "u:f6f7088cdea7", "groupType": "component" }, { "componentId": "u:fdbdffd6880a", "groupType": "component", "actionType": "reload" }, { "componentId": "u:bdc1086fde05", "groupType": "component", "actionType": "reload" }, { "ignoreError": false, "actionType": "custom", "script": "debugger;"//event.context.scoped.component.handleSelect([],[]) } ] } }, "name": "switch", "onText": [ { "type": "icon", "icon": "fa fa-pencil-square", "vendor": "", "className": "mr-1" }, { "type": "tpl", "tpl": "快速编辑" } ], "offText": [ { "type": "icon", "icon": "fa fa-pencil-square", "vendor": "", "className": "mr-1", "id": "u:0937a8befe77" }, { "type": "tpl", "tpl": "快速编辑", "id": "u:cf789b4db5f5" } ], "value": false }, { "type": "button", "align": "right", "label": "操作2", "tpl": "内容", "wrapperComponent": "", "id": "u:5609d98ed404", "level": "danger", "size": "sm" } ], "bulkActions": [ { "label": "批量操作1", "type": "button", "id": "u:080c5dcc2fd1" }, { "label": "批量操作2", "type": "button", "id": "u:e3ae8d0a0ceb" } ], "footerToolbar": [ "switch-per-page", { "type": "tpl", "tpl": "共${total}条", "id": "u:e7f2230c2055" }, "pagination" ], "columns": [ { "name": "apiId", "label": "apiId", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "quickEdit": true, "quickEditEnabledOn": "${isQuickEdit}", "id": "u:95d4ee2240b6" }, { "name": "apiPath", "label": "apiPath", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:fb77f2d6ab78" }, { "name": "apiStatus", "label": "apiStatus", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:15fcf968666c" }, { "name": "apiMethod", "label": "apiMethod", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:15c99f57487f" }, { "name": "requestParameters", "label": "requestParameters", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:ea5f0fb6db94" }, { "name": "responseParameters", "label": "responseParameters", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:cc2991ad776c" }, { "name": "glueType", "label": "glueType", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:fc4f345bdbb5" }, { "name": "glueSource", "label": "glueSource", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:aee831412567" }, { "name": "glueSourceUpdataTime", "label": "glueSourceUpdataTime", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:6716a47595db" }, { "name": "createDateTime", "label": "createDateTime", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:f99f1d6cb000" }, { "name": "creator", "label": "creator", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:c45252cd9174" }, { "name": "lastModifiedDateTime", "label": "lastModifiedDateTime", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:e7060358d4aa" }, { "name": "mender", "label": "mender", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:d46870cb14f0" }, { "name": "remark", "label": "remark", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:cef1ff992c55" }, { "name": "menderIP", "label": "menderIP", "width": 150, "align": "center", "sortable": true, "copyable": false, "fixed": "", "id": "u:3c34f9ee0f2b" }, { "type": "operation", "label": "操作", "width": 100, "fixed": "right", "buttons": [ { "label": "修改", "type": "button", "level": "info", "actionType": "dialog", "dialog": { "title": "数据修改", "resizable": true, "actions": [ { "type": "button", "actionType": "cancel", "level": "light", "label": "关闭" }, { "type": "button", "actionType": "prev", "visibleOn": "data.hasPrev", "label": "上一条" }, { "type": "button", "actionType": "next", "visibleOn": "data.hasNext", "label": "下一条" }, { "type": "submit", "actionType": "next", "visibleOn": "data.hasNext", "label": "保存并下一条", "level": "primary" }, { "type": "submit", "label": "保存", "level": "primary" } ], "size": "xl", "body": { "type": "form", "columnCount": 0, "id": "edit_form", "api": { "method": "post", "url": "/imc/update", "dataType": "json", "data": { "req": "m572Req", "data": "{\"apiId\": \"${apiId}\", \"apiPath\": \"${apiPath}\", \"apiStatus\": \"${apiStatus}\", \"apiMethod\": \"${apiMethod}\", \"requestParameters\": \"${requestParameters}\", \"responseParameters\": \"${responseParameters}\", \"glueType\": \"${glueType}\", \"glueSource\": \"${glueSource}\", \"glueSourceUpdataTime\": \"${glueSourceUpdataTime}\", \"createDateTime\": \"${createDateTime}\", \"creator\": \"${creator}\", \"lastModifiedDateTime\": \"${lastModifiedDateTime}\", \"mender\": \"${mender}\", \"remark\": \"${remark}\", \"menderIP\": \"${menderIP}\", \"ID\": \"${ID}\"}" } }, "body": [ { "name": "apiId", "label": "apiId", "type": "input-text" }, { "name": "apiPath", "label": "apiPath", "type": "input-text" }, { "name": "apiStatus", "label": "apiStatus", "type": "input-text" }, { "name": "apiMethod", "label": "apiMethod", "type": "input-text" }, { "name": "requestParameters", "label": "requestParameters", "type": "input-text" }, { "name": "responseParameters", "label": "responseParameters", "type": "input-text" }, { "name": "glueType", "label": "glueType", "type": "input-text" }, { "name": "glueSource", "label": "glueSource", "type": "input-text" }, { "name": "glueSourceUpdataTime", "label": "glueSourceUpdataTime", "type": "input-date", "format": "YYYY-MM-DD HH:mm:ss", "shortcuts": [ "yesterday", "today", "tomorrow" ] }, { "name": "createDateTime", "label": "createDateTime", "type": "input-date", "format": "YYYY-MM-DD HH:mm:ss", "shortcuts": [ "yesterday", "today", "tomorrow" ] }, { "name": "creator", "label": "creator", "type": "input-text" }, { "name": "lastModifiedDateTime", "label": "lastModifiedDateTime", "type": "input-date", "format": "YYYY-MM-DD HH:mm:ss", "shortcuts": [ "yesterday", "today", "tomorrow" ] }, { "name": "mender", "label": "mender", "type": "input-text" }, { "name": "remark", "label": "remark", "type": "input-text" }, { "name": "menderIP", "label": "menderIP", "type": "input-text" } ] } }, "id": "u:5ac05e126445" } ], "id": "u:d5171551e104" } ], "api": { "method": "post", "url": "/imc/queryData", "dataType": "form", "data": { "req": "m572Req", "page": "${page}", "rows": "${perPage}", "sort": "${orderBy}", "order": "${orderDir}", "pid": "", "filterRules": "[]" } }, "messages": {}, "onEvent": { "fetchInited": { "weight": 0, "actions": [ { "ignoreError": false, "actionType": "custom", "script": "/ 自定义JS使用说明:\n 1.动作执行函数doAction,可以执行所有类型的动作\n 2.通过上下文对象context可以获取当前组件实例,例如context.props可以获取该组件相关属性\n 3.事件对象event,在doAction之后执行event.stopPropagation();可以阻止后续动作执行\n*/\ndebugger\n" } ] } } } ], "size": "xs", "style": { "position": "static", "display": "block", "flex": "1 1 auto", "flexGrow": 1 }, "wrapperBody": false, "isFixedHeight": false, "isFixedWidth": false, "id": "u:f1a5a540d65b", "data": [ { "keywords": "1", "plaform": "pc" } ] } ], "style": { "position": "relative", "inset": "auto", "flexWrap": "nowrap", "flexDirection": "column" }, "id": "u:8492214fd2bb", "isFixedHeight": false, "isFixedWidth": false, "className": "p-1" } ], "dsType": "api", "data": {} } ], "id": "u:f6f7088cdea7", "title": "Hello world", "asideResizor": false, "pullRefresh": { "disabled": true }, "regions": [ "body" ], "toolbar": [], "data": { "isQuickEdit": false } }

github-actions[bot] commented 6 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

1776313143 commented 6 months ago

通过JSSDK方式引入,版本 6.2.2