Lxw100514 发表于 2023-3-21 11:55:37

json request err

管理员您好,我使用updateWithJob修改数据时提示 json request err是修改数据中有数字和日期字段就不行如果都是字符串就可以,这怎么办?

var items= this.data;
var action= this.Actions.load("x_processplatform_assemble_surface");

var workid =items.gongzid;
var data;
action.DataAction.getWithJob( //平台封装好的方法
   workid, //uri的参数
   function( json ){ //服务调用成功的回调函数, json为服务传回的数据
         data = json.data; //为变量data赋值
         console.log('修改前数据'+data.xqrs1);

   }.bind(this),
   function( json ){ //服务调用失败的回调函数, json为服务传回的数据
      data = json.data; //为变量data赋值
   }.bind(this),
   false   
)




data.xqrs1 =(items.xqrs1);// 数字字段
data.qwdg1 =items.qwdg1.toString();//日期字段

console.log('修改后数据'+data.xqrs1);
//JSON.stringify(data);

action.DataAction.updateWithJob(
   workid, //uri的参数
   data, //保存的数据
   function(){ //服务调用成功的回调函数
         o2.xDesktop.notice("success", {"y":"top", "x": "right"}, "保存成功");//提示,{"y":"top", "x": "right"}指提示框在顶部右边
   }.bind(this),
   function( json ){ //服务调用失败的回调函数, json为服务传回的数据
      data = json.data; //为变量data赋值
   }.bind(this)
);



论坛管理员 发表于 2023-3-21 16:42:08

您把详细错误信息,前后端的都截图出来看一下,data修改后的数据也贴出来一下

Lxw100514 发表于 2023-3-22 10:54:08

我把tostring() 都去掉了,可以正常使用了,奇怪,最开始我没加这些转换的也报json request err,莫名其妙的好了

论坛管理员 发表于 2023-3-22 16:07:20

可能还是哪里有点不对吧,这个得具体测试检查,管理员单看这些脚本,没有发现什么问题:(
页: [1]
查看完整版本: json request err