baidu/amis

导出的时候可以有loading吗

Opened this issue · 0 comments

实现场景:

导出时间较长,需要添加一个loading效果

存在的问题:

api里添加silent:false不生效,没有loading效果,messages也不生效

当前方案:

请粘贴你当前方案的完整 amis schema 代码...

{
          "type": "export-csv",
          "label": "导出 CSV",
          "api": {
            "url": "http:127.0.0.1:3004/getList",
            "method": "post",
            "requestAdaptor": "const like = ['new_query'']\nconst querys = {\n    request_time: context.request_time,\n    requestTimeOrder: context.orderDir?.toUpperCase() || 'DESC',\n    time_range: context.time_range,\n    tableName: context.tableName,\n            limit: 50,\n                offset: 1\n}\nconst body = []\nObject.keys(context).forEach((key) => {\n    if (context[key] !== undefined && ['tableName','request_time', 'time_range', 'page', 'perPage', 'orderBy', 'orderDir'].indexOf(key) === -1) {\n        const param = { key, value: context[key] }\n        if (like.indexOf(key) > -1) param.operator = 'like'\n        body.push(param)\n     }\n})\napi.data = body\napi.url = api.url + '?' +\n    (Object.keys(querys)\n    .map((k) => `${k}=${querys[k]}`)\n    .join('&'))\n\nreturn api",
            "adaptor": "",
            "messages": {
              "fetchSuccess": "失败了呢",
              "success": "导出成功"
            },
            "loadingConfig": {
              "show": true,
              "message": "查询中,请稍后...."
            },
            "data": {},
            "headers": {
              "X-Api-Switch": "node"
            },
            "silent": false
          }
        },