李维 发表于 2025-6-25 21:21:18

明细表栏位增加自定义校验,异步发起ESP请求出现异常

环境:华为云测试区
租户:icd
用户名:liwei1
问题描述:
过滤类型栏位新增了自定义校验,运行出现异常: P.ATDM.500.0000: 调用https://atdm-test.apps.digiwincl ... ata/query/by/action异常,dataSourceDTO
设计态脚本如下所示:
{
"application": "spa-icd",
"remark": null,
"objectId": "685bbf9f5bef621ef12a686f",
"taskCode": "DE_342fe4821000150e",
"key": "DE_342fe4821000150e_1750843295865",
"name": "过滤类型:必须保持一致",
"domain": "DataEntry",
"domainId": "DE_342fe4821000150e",
"content": {
    "path": "data_filter_rule_detail.data_filter_rule_d",
    "schema": "filter_type",
    "targetSchema": null,
    "key": "custom",
    "condition": null,
    "errorMessage": "过滤类型必须统一,请检查!",
    "scope": "EDIT",
    "validatorType": "error",
    "asyncCacheScope": null,
    "lang": {
      "errorMessage": {
      "zh_CN": "过滤类型必须统一,请检查!",
      "zh_TW": "過濾類型必須統一,請檢查!",
      "en_US": "过滤类型必须统一,请检查!"
      },
      "name": {
      "zh_CN": "过滤类型:必须保持一致",
      "zh_TW": "過濾類型:必須保持一致",
      "en_US": "过滤类型:必须保持一致"
      }
    },
    "linkageSchemas": [],
    "crossFieldOrNot": false,
    "trigger": {
      "type": "async",
      "point": "default",
      "condition": "(() => { const uuid = currentControl.parent.get('uuid').value; const filterType = currentControl.value; const rowValue = currentControl.parent.parent.value;const result = rowValue.some(item => item.uuid !== uuid && item.filter_type !== '' && item.filter_type !== filterType); return currentControl.value !== '' && result})();",
      "parameterScript": "const entity=currentControl.parent.parent.parent.value;\r\nconsole.log(entity); \r\nconst params = {\r\n    canRequest: true,\r\n    // tmAction: {\r\n    //   \"sequence\": 0,\r\n    //   \"type\": \"ESP\",\r\n    //   \"actionId\": \"esp_spa.icd.data.filter.rule.detail.get\"\r\n    // },\r\n    data_filter_rule: {\r\n      rule_type: entity.rule_type,\r\n      filter_category: entity.filter_category,\r\n      supplier_no: entity.supplier_no,\r\n      template_type: entity.template_type,\r\n      template_no: entity.template_no,\r\n      s_date: entity.s_date\r\n    }\r\n};\r\nconsole.log(params); \r\nreturn params;",
      "apiUrl": "/api/atdm/v1/data/query/by/action",
      "apiPrefixType": "atdmUrl",
      "apiMethodType": "post",
      "needValidateParameter": true,
      "needCustomEvaluation": false
    }
}
}
重现步骤:
登陆Athena,进入“业务数据录入”,进入“维护数据过滤规则”浏览界面,选择第一笔数据“维护”。

进入编辑界面,点击“编辑”按钮。明细表表头点击“新增换行”。即可重现问题。



翁俊 发表于 2025-6-26 11:58:41

看你的规则中的脚本里面,具体调用接口的代码被注释了,而且传参的格式也不正确



异步请求接口时,脚本中具体配置参考下列代码:

let canRequest = false;
if (rowData.owner_emp_no) {
    canRequest = true
}
const params = {
    canRequest: canRequest,
    businessUnit: businessUnit,
    tmAction: {
      sequence: 0,
      type: 'ESP',
      actionId: 'esp_dtdapp.outsourced.employees.basic.data.detail.get' //这里写入你需要调用的接口名称
    },
    paras: {
      outsourced_employees_basic_data: {
            owner_emp_no: rowData.owner_emp_no
      }   //这里接入你接口的入参key和value值
    }
};
return params;

页: [1]
查看完整版本: 明细表栏位增加自定义校验,异步发起ESP请求出现异常