找回密码
 立即注册

QQ登录

只需一步,快速开始

After80s
金牌服务用户   /  发表于:2021-12-2 14:37  /   查看:2579  /  回复:1
本帖最后由 Crystal.Li 于 2021-12-2 16:34 编辑

调用 DesignerInstance.setDataSourceTemplates 方法时,报表设计器提示:无法打开报表“Report”,因为该报表存在内部错误。

我尝试将以前为null的ConnectString更改为“”后此错误依然存在。

升级前正常

以下是setDataSourceTemplates方法的参数:

[{"id":"HealmrDataSource","title":"休闲乐数据源","canEdit":false,"shouldEdit":false,"template":{"Name":"HealmrDataSource","ConnectionProperties":{"DataProvider":"JSONEMBED","ConnectString":""}},"datasets":[{"id":"User","title":"User","canEdit":false,"shouldEdit":false,"template":{"Name":"User","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.User"},"Fields":[{"Name":"MerchantName","DataField":"MerchantName"},{"Name":"GroupName","DataField":"GroupName"},{"Name":"UserName","DataField":"UserName"},{"Name":"UserCode","DataField":"UserCode"},{"Name":"PhoneNumber","DataField":"PhoneNumber"}]}},{"id":"Houses","title":"Houses","canEdit":false,"shouldEdit":false,"template":{"Name":"Houses","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.Houses"},"Fields":[{"Name":"HouseCode","DataField":"HouseCode"}]}},{"id":"GetDateTime","title":"GetDateTime","canEdit":false,"shouldEdit":false,"template":{"Name":"GetDateTime","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.GetDateTime"},"Fields":[{"Name":"StartDateTime","DataField":"StartDateTime"},{"Name":"EndDateTime","DataField":"EndDateTime"}]}},{"id":"Title","title":"Title","canEdit":false,"shouldEdit":false,"template":{"Name":"Title","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.Title"},"Fields":[{"Name":"S","DataField":"S"}]}},{"id":"UserTitle","title":"UserTitle","canEdit":false,"shouldEdit":false,"template":{"Name":"UserTitle","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.UserTitle"},"Fields":[{"Name":"UserTitle","DataField":"UserTitle"}]}},{"id":"SumOrders","title":"SumOrders","canEdit":false,"shouldEdit":false,"template":{"Name":"SumOrders","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.SumOrders"},"Fields":[]}},{"id":"ArraySelect","title":"ArraySelect","canEdit":false,"shouldEdit":false,"template":{"Name":"ArraySelect","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.ArraySelect"},"Fields":[{"Name":"StartDateTime","DataField":"StartDateTime"},{"Name":"HouseCode","DataField":"HouseCode"},{"Name":"EndDateTime","DataField":"EndDateTime"}]}},{"id":"Visitor","title":"Visitor","canEdit":false,"shouldEdit":false,"template":{"Name":"Visitor","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.Visitor"},"Fields":[]}},{"id":"OrdersOther","title":"OrdersOther","canEdit":false,"shouldEdit":false,"template":{"Name":"OrdersOther","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.OrdersOther"},"Fields":[]}},{"id":"OrdersType","title":"OrdersType","canEdit":false,"shouldEdit":false,"template":{"Name":"OrdersType","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.OrdersType"},"Fields":[]}},{"id":"HouseOrder","title":"HouseOrder","canEdit":false,"shouldEdit":false,"template":{"Name":"HouseOrder","Query":{"DataSourceName":"HealmrDataSource","CommandText":"jpath=$.HouseOrder"},"Fields":[]}}]}]

1 个回复

倒序浏览
Crystal.Li讲师达人认证 悬赏达人认证
论坛元老   /  发表于:2021-12-2 17:46:31
沙发
您好,这个我验证下来在2.2是ok的:



我采用的就是论坛的这个demo,但升级到2.2版本测试了:

[ARJS2.1.0] Vue项目集成demo
https://gcdn.grapecity.com.cn/fo ... 1&fromuid=59070
(出处: 葡萄城产品技术社区)


我的setDataSourceTemplates参数:
  1. designer.setDataSourceTemplates([
  2.                 {
  3.                     id: "dataSource1",
  4.                     title: "dataSource1",
  5.                     template: {"Name":"DataSource","ConnectionProperties":{"DataProvider":"JSONEMBED","ConnectString":"jsondata=[\\n    {\\n      "订单编号": "DD000849",\\n      "订购日期": "2017-10-23",\\n      "类别名称": "生鲜蔬果",\\n      "产品名称": "产品008",\\n      "购买数量": "17",\\n      "产品单价": "92",\\n      "产品成本": "53.36",\\n      "折扣": "0.13",\\n      "订单金额": "1360.68",\\n      "订单利润": "453.56",\\n      "销售大区": "华东",\\n      "销售省份": "浙江省",\\n      "销售城市": "宁波市",\\n      "销售门店": "门店022",\\n      "销售顾问": "员工119",\\n      "支付方式": "其他",\\n      "客户姓名": "司建义",\\n      "客户电话": "131****9019"\\n    },\\n    {\\n      "订单编号": "DD000930",\\n      "订购日期": "2017-08-12",\\n      "类别名称": "饮料烟酒",\\n      "产品名称": "产品010",\\n      "购买数量": "17",\\n      "产品单价": "71",\\n      "产品成本": "22.01",\\n      "折扣": "0.17",\\n      "订单金额": "1001.81",\\n      "订单利润": "627.64",\\n      "销售大区": "华南",\\n      "销售省份": "广东省",\\n      "销售城市": "汕头市",\\n      "销售门店": "门店070",\\n      "销售顾问": "员工200",\\n      "支付方式": "刷卡",\\n      "客户姓名": "沙恒彬",\\n      "客户电话": "134****5199"\\n    },\\n    {\\n      "订单编号": "DD000960",\\n      "订购日期": "2017-01-19",\\n      "类别名称": "生鲜蔬果",\\n      "产品名称": "产品042",\\n      "购买数量": "19",\\n      "产品单价": "95",\\n      "产品成本": "57.95",\\n      "折扣": "0.11",\\n      "订单金额": "1606.45",\\n      "订单利润": "505.4",\\n      "销售大区": "东北",\\n      "销售省份": "辽宁省",\\n      "销售城市": "沈阳市",\\n      "销售门店": "门店071",\\n      "销售顾问": "员工140",\\n      "支付方式": "微信",\\n      "客户姓名": "党珺赫",\\n      "客户电话": "138****1083"\\n    }\\n  ]"}},
  6.                     canEdit: true,
  7.                     datasets: [
  8.                         {
  9.                             id: "dataSet1",
  10.                             title: "dataSet1",
  11.                             template: {"Name":"DataSet","Query":{"DataSourceName":"DataSource","CommandText":"jpath=$.[*]"},"Fields":[{"Name":"订单编号","DataField":"订单编号"},{"Name":"订购日期","DataField":"订购日期"},{"Name":"类别名称","DataField":"类别名称"},{"Name":"产品名称","DataField":"产品名称"},{"Name":"购买数量","DataField":"购买数量"},{"Name":"产品单价","DataField":"产品单价"},{"Name":"产品成本","DataField":"产品成本"},{"Name":"折扣","DataField":"折扣"},{"Name":"订单金额","DataField":"订单金额"},{"Name":"订单利润","DataField":"订单利润"},{"Name":"销售大区","DataField":"销售大区"},{"Name":"销售省份","DataField":"销售省份"},{"Name":"销售城市","DataField":"销售城市"},{"Name":"销售门店","DataField":"销售门店"},{"Name":"销售顾问","DataField":"销售顾问"},{"Name":"支付方式","DataField":"支付方式"},{"Name":"客户姓名","DataField":"客户姓名"},{"Name":"客户电话","DataField":"客户电话"}]},
  12.                             canEdit: true,
  13.                         }
  14.                     ],
  15.                 },
  16.             ]);
复制代码


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部