首页 / 浏览问题 / 三维GIS / 问题详情
featureService.editFeatures为什么没有执行
10EXP 2020年04月30日
featureService.editFeatures(addFeatureParams, function (serviceResult) {

方法没有执行,也没有弹出对话框

    function add() {
                //实例化地物编辑服务
              //  var url="https://iserver.supermap.io/iserver/services/data-world/rest/data";
                var url = 'http://localhost:8090/iserver/services/data-sql_search/rest/data';

                
                var featureService = L.supermap.featureService(url);
                                alert("featureService:"+featureService);

                //设置地物编辑字段参数
                var addFeatureParams = new SuperMap.EditFeaturesParameters({
                    dataSourceName: "sqlsource",
                    dataSetName: "LDG_PT",
                    features: marker,
                    editType: "add",
                    returnContent: true
                });
                
                alert("addFeatureParams:"+addFeatureParams);

                //使用地物编辑服务向服务端发送请求并获取数据
                featureService.editFeatures(addFeatureParams, function (serviceResult) {
                     // 获取返回数据
                  if (serviceResult.result.succeed) {
                      alert("111");

                      var result = serviceResult.result;
                      alert("serviceResult:"+serviceResult);
                  }else{
                      alert("222");
                  }                    

                });                
    }

1个回答

您好,您可以查看netwrok里面的报错信息,然后贴图,您直接复制代码没法排错
3,357EXP 2020年04月30日
iclient-leaflet-es6.min.js:164 POST http://localhost:8090/iserver/services/data-sql_search/rest/data/datasources/sqlsource/datasets/LDG_PT/features.json?returnContent=true 405

 var url = 'http://localhost:8090/iserver/services/data-sql_search/rest/data';

发布的数据服务有问题吗,可以sql查询
您能发下network的header和请求体里面的内容吗?然后发下perview
  1. perview: {succeed: false, error: {code: 405, errorMsg: "当前数据服务不可编辑"}}
    1. error: {code: 405, errorMsg: "当前数据服务不可编辑"}
    2. succeed: false
这已经说的很清楚了,当前服务不可编辑,您那边发数据服务的时候,勾选可编辑了吗???

还是不执行报这个

  1. {succeed: false, error: {code: 400, errorMsg: "the features is empty addFeatures method"}}
    1. error: {code: 400, errorMsg: "the features is empty addFeatures method"}
    2. succeed: false
...