/**
 * 执行 {{pascalCase logicNode.name}} 节点
 *
 * @protected
 * @memberof {{pascalCase uiLogic.codeName}}UILogicBase
 */
protected async execute_{{logicNode.codeName}}_node() {
{{#if logicNode.psDEUILogicNodeParams}}
  try {
  {{#each logicNode.psDEUILogicNodeParams as | nodeParam |}}
    {{#if (eq nodeParam.paramAction 'SETPARAMVALUE')}}
      {{#if (or nodeParam.dstPSDEUILogicParam nodeParam.srcValueType)}}
    //  目标数据
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
        {{#if (eq nodeParam.srcValueType 'NONEVALUE')}}
          {{#if nodeParam.dstFieldName}}
    dstParam_{{@index}}.reset("{{nodeParam.dstFieldName}}");
          {{else}}
    dstParam_{{@index}}.bind(undefined);
          {{/if}}
        {{else}}
    let result_{{@index}}: any = null;
            {{#if (or (or (eq nodeParam.srcValueType 'SRCDLPARAM') (eq nodeParam.srcValueType 'WEBCONTEXT')) (eq nodeParam.srcValueType 'VIEWPARAM'))}}
    const srcParam_{{@index}} = this.getParam('{{nodeParam.srcPSDEUILogicParam.codeName}}');
    result_{{@index}} = srcParam_{{@index}}.get('{{nodeParam.srcFieldName}}') || null;
            {{else if (or (or (eq nodeParam.srcValueType 'APPLICATION') (eq nodeParam.srcValueType 'SESSION')) (or (eq nodeParam.srcValueType 'APPDATA') (eq nodeParam.srcValueType 'DATACONTEXT')))}}
    result_{{@index}} = this.context["{{nodeParam.srcFieldName}}"];
            {{else if (eq nodeParam.srcValueType 'ENVPARAM')}}
    result_{{@index}} = App.getProjectSetting()["{{nodeParam.srcFieldName}}"];
            {{else if (eq nodeParam.srcValueType 'EXPRESSION')}}
    try {
      let data = this.defaultParam.getReal() || {};
      let context = this.context;
      let viewParams = this.viewParams;
      const translateExpression = (expression: any): string => {
          if ((expression.indexOf('${') != -1) && (expression.indexOf('}') != -1)) {
              const start: number = expression.indexOf('${');
              const end: number = expression.indexOf('}');
              const contentStr: string = expression.slice(start + 2, end);
              expression = expression.replace(expression.slice(start, end + 1), `data.${contentStr}`);
              return translateExpression(expression);
          }
          return expression;
      }
      let expression = "{{nodeParam.expression}}";
      if (!expression) {
          throw new Error(`表达式不能为空`);
      }
      expression = translateExpression(expression);
      result_{{@index}} = eval(expression);
    } catch (error: any) {
      throw new Error(`表达式计算异常: ${error}`);
    }
            {{else if (eq nodeParam.srcValueType 'SRCVALUE')}}
    result_{{@index}} = '{{nodeParam.srcValue}}';
            {{else if (eq nodeParam.srcValueType 'NULLVALUE')}}
    result_{{@index}} = null;
            {{else}}
    result_{{@index}} = undefined;
            {{/if}}
            {{#if nodeParam.dstFieldName}}
    dstParam_{{@index}}.set("{{nodeParam.dstFieldName}}", result_{{@index}});
            {{else}}
    dstParam_{{@index}}.bind(result_{{@index}});
            {{/if}}
        {{/if}}
    {{else}}
    throw new Error(`逻辑参数{{param.name}}源类型参数或者目标逻辑参数缺失`);
    {{/if}}
{{else if (or (eq nodeParam.paramAction 'RESETPARAM') (eq nodeParam.paramAction 'RENEWPARAM'))}}
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
    dstParam_{{@index}}.resetAll();
{{else if (eq nodeParam.paramAction 'COPYPARAM')}}
    //  源数据
    const srcParam_{{@index}}: any = this.getParam('{{nodeParam.srcPSDEUILogicParam.codeName}}');
    //  目标数据
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
    srcParam_{{@index}}.copyTo(dstParam_{{@index}});
{{else if (eq nodeParam.paramAction 'BINDPARAM')}}
    //  源数据
    const srcParam_{{@index}}: any = this.getParam('{{nodeParam.srcPSDEUILogicParam.codeName}}');
    //  目标数据
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
    {{#if nodeParam.srcFieldName}}
    dstParam_{{@index}}.bind(srcParam_{{@index}}.get('{{nodeParam.srcFieldName}}'));
    {{else}}
    dstParam_{{@index}}.bind(srcParam_{{@index}}.getReal());
    {{/if}}
{{else if (eq nodeParam.paramAction 'APPENDPARAM')}}
    //  源数据
    const srcParam_{{@index}}: any = this.getParam('{{nodeParam.srcPSDEUILogicParam.codeName}}');
    //  目标数据
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
    {{#if nodeParam.srcFieldName}}
    const objParam_{{@index}} = srcParam_{{@index}}.get('{{nodeParam.srcFieldName}}');
    {{else}}
    const objParam_{{@index}} = srcParam_{{@index}}.getReal();
    {{/if}}
    dstParam_{{@index}}.append({{nodeParam.dstIndex}}, objParam_{{@index}}, {{nodeParam.srcIndex}}, {{nodeParam.srcSize}});
{{else if (eq nodeParam.paramAction 'SORTPARAM')}}
    //  目标数据
    const dstParam_{{@index}}: any = this.getParam('{{nodeParam.dstPSDEUILogicParam.codeName}}');
    {{#if nodeParam.dstFieldName}}
    dstParam_{{@index}}.sort('{{ nodeParam.dstFieldName}}', '{{nodeParam.dstSortDir}}');
    {{else}}
    throw new Error(`逻辑参数${param.name}未指定设置排序属性`);
    {{/if}}
{{/if}}
{{/each}}
    {{> @macro/logic-node/next-node.hbs}}
    } catch (error: any) {
        throw new Error(`执行 {{logicNode.name}} 节点 ${error && error.message ? error.message : '发生未知错误!'}`);
    }
{{else}}
    throw new Error('无界面逻辑节点参数');
{{/if}}
}
