1. /* 根据fid删除 */
    2. function DelFeature({
    3. fid,
    4. service,
    5. layer
    6. }) {
    7. /* service必须是对象 name,layerId */
    8. checkService(service, () => {
    9. var deleteService = new Zondy.Service.EditDocFeature(service.name, service.layerId, {
    10. ip: "localhost",
    11. port: "6163" //访问IGServer的端口号,.net版为6163,Java版为8089
    12. });
    13. deleteService.deletes(fid, onSuccess(layer));
    14. });
    15. }
    16. function onSuccess(layer) {
    17. return function (result) {
    18. if (result) {
    19. alert("删除要素成功!");
    20. layer.refresh();
    21. } else {
    22. alert("删除要素失败!");
    23. }
    24. }
    25. }
    26. function checkService(service, callback) {
    27. if (service instanceof Object) {
    28. var keys = Object.keys(service);
    29. if (keys.includes("name") && keys.includes("layerId")) {
    30. callback();
    31. } else {
    32. console.log("参数不合法")
    33. }
    34. } else {
    35. console.log("输入的参数不合法")
    36. }
    37. }
    38. /*