Hand-Aurora-screen页面常见设计

调用带有输入输出参数的执行存储过程

可以执行的存储过程,一般通过request请求进行调用,通过对回调函数的解析,进而获取相应的返回值

请求的写法

Aurora.request({
  url: $('check_travel_positon_link').getUrl(),
  para: {exp_report_header_id:exp_report_header_id},
  success: function(res) {
    成功的回调函数
  },
  error: function() {
    失败的回调函数
  },
  failure: function() {
    没有调用的回调函数
  },
  sync: true,
  scope: this
});

BM文件中的调用写法
其中对输出参数进行特别声明,告知其为输出参数.

<bm:operations>
  <bm:operation name="execute">
    <bm:update-sql><![CDATA[
             begin
               cs_csh_payment_apply_pkg.check_travel_positon(p_exp_report_header_id => ${@exp_report_header_id},
                                                             p_status_code => ${@status_code},
                                                             p_message => ${@message} );
             end;
    ]]></bm:update-sql>
    <bm:parameters>
      <bm:parameter name="status_code" dataType="java.lang.String" input="false" output="true" outputPath="@status_code"/>
      <bm:parameter name="message" dataType="java.lang.String" input="false" output="true" outputPath="@message"/>
    </bm:parameters>
  </bm:operation>
</bm:operations>

批量调用BM

编写方法,为 screen的请求方法,携带请求参数数组,访问BM

function acr517_invoice_confirm_receive(){
    var ds = $('acr517_invoice_result_ds');                        //获得数据集
    var records = ds.getSelected();                                      //获得多行
    var datas = [];                                                             //数据数组容器,注意位置
    if (records.length == 0) {                                           //非空校验
        return;
    }
    for (var i = 0;i < records.length;i++) {                //遍历每行数据
            var obj = {};                                                //参数对象,注意位置
             obj['invoice_hd_id']=records[i].get('invoice_hd_id');
             obj['type']='RECEIVED';                                     //参数对象赋值构建
             obj['_status']='update';                            //必填,指明调用的BM或者SVC方法
             datas[i]=obj;
    }
                                                                                      //提示,并发送请求
    Aurora.showConfirm('${l:HLS.PROMPT}', '是否确认接收?',function()
       {      
           Aurora.request({                                                      //发送请求
            url: $('acr517_invoice_confirm_received_bm').getUrl(), //调用BM
            para: datas,                                                 //必填,参数数组
            success: function(res) {                               //成功回调
                acr517_invoice_result_ds_submitsuccess();
            },
            failure: function() {                                  //失败回调
            },
            error: function() {                                          //错误回调
            },
            scope: this
        });
       },function (){                                                                  //请求结束方法
       });
}

在Link中,指明调用的方法为 batch_update

<a:link id="acr517_invoice_confirm_received_bm"  model="acr.ACR517.acr_invoice_update_query" modelaction="batch_update"/>

批量调用SVC

编写方法,为 screen的请求方法,携带请求参数数组,访问BM

function createScreen_save(){
    var win = $('acp_invoice_create_invoice');              
    f_hls.winMask(win);                                                         //锁屏
    var ds=$('headDs');                                                         //数据集对象
    if(!ds.validate(true)){                                                     //数据验证
        f_hls.winNoMask(win);
        return;
    }
    var datas = ds.getJsonData();                                  //获得JSON数组
    for (var j = 0;j < datas.length;j++) {
        var item = datas[j];
        item._status = 'insert';                                   //每个JSON对象状态为insert
    }
    Aurora.request({                                                            //发送请求
        url: $('svcLink_create_invoice').getUrl(),          //批量调用SCV
        para: datas,                                                            //数据对象
        success: function(res){                                          //成功回调
            f_hls.winNoMask(win);
            //Aurora.Masker.unmask(Ext.getBody());
            Aurora.SideBar.show({
                msg: '保存成功',
                duartion: 2000
              });
              $('selectedDs').query();                             //重新查询
        },
        failure: function(){                                             //失败回调
            //Aurora.Masker.unmask(Ext.getBody());
        },
        error: function() {                                                     //错误回调
            //Aurora.Masker.unmask(Ext.getBody());
        },
        scope: this
    });
}

在Link中,指明调用的SVC

<a:link id="svcLink_create_invoice"  url="${/request/@context_path}/modules/acp/ACP510/acp_invoice_create.svc"/>

编写svc,在一个svc中可以有多个调用bm

<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.aurora-framework.org/application"  xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <a:batch-apply sourcepath="/parameter">                                       //从parameter获取当前调用状态,进而做判断
            <p:switch test="@current_parameter/@_status">                //从@current_parameter获得当前参数的状态
                <p:case value="insert">                                               //insert事件,执行
                    //批量更新方法,获得当前对象中的line_info对象信息
                    <a:model-batch-update model="acp.ACP510.acp_invoice_create"  sourcepath="/@current_parameter/line_info"/>   
                    //插入方法
                    <a:model-insert  model="acp.ACP510.acp_invoice_selected_cashflow"/>
                    //执行方法
                    <a:model-execute model="acp.ACP510.acp_invoice_create"/>
                </p:case>
                <p:case value="update">                                               //update事件,执行
                    <a:model-update model="acp.ACP512.acp_invoice_hd_v"/>
                    <a:model-batch-update model="acp.ACP510.acp_invoice_create"  sourcepath="/@current_parameter/line_info"/>
                    <a:model-batch-update model="acp.ACP510.acp_invoice_ln"  sourcepath="/@current_parameter/line_info"/>
                </p:case>
            </p:switch>
        </a:batch-apply>
    </a:init-procedure>
    <a:service-output output="/parameter"/>
</a:service>

参数层级不一致时,修改
修改参数

头行表级联保存

创建具有级联关系的页面

父数据集

这里,数据集采用 autoCreate 自动创建的形式,同时开启 autoQuery 自动查询.
为了便于查询,数据集词用自定义查询 queryUrl="${/request/@context_path}/autocrud/csh.CSH720.csh_payment_apply/query?apply_id=${/parameter/@apply_id}" URL为相同的BM查询
数据集以父数据集形式提交,因此重写提交 submitUrl="${/request/@context_path}/modules/csh/CSH720/csh_payment_apply_batch_update.svc" URL, 指向为新建的SVC
字段默认值,可以通过 defaultValue="${/model/default_data/record/@company_n}" 方式从值栈中获取

<a:dataSet id="payment_apply_ds" autoCreate="true" autoQuery="true"
    model="csh.CSH720.csh_payment_apply"
     queryUrl="${/request/@context_path}/autocrud/csh.CSH720.csh_payment_apply/query?apply_id=${/parameter/@apply_id}"
     submitUrl="${/request/@context_path}/modules/csh/CSH720/csh_payment_apply_batch_update.svc">
    <a:fields>
        <a:field name="currency_name" defaultValue="人民币"  displayField="currency_name" options="currency_ds" required="true"  returnField="currency_code" valueField="currency_code"/>
        <a:field name="currency_code" defaultValue="CNY"/>
        <a:field name="payer_unit"  defaultValue="${/model/default_data/record/@company_n}" required="true"/>
        <a:field name="contract_number" lovGridHeight="350" lovHeight="500"  lovService="csh.CSH720.csh_payment_con_other_contract_query" lovWidth="500"  prompt="其他合同" required="false">
            <a:mapping>
                <a:map from="contract_number" to="contract_number"/>
                <a:map from="contract_id" to="contract_id"/>
            </a:mapping>
        </a:field>
        <a:field name="payment_account_id"  defaultValue="${/model/default_data/record/@bank_account_id}"/>
        <a:field name="bank_full_name"/>
        <a:field name="bank_account" required="true"/>
        <a:field name="use_purpose" required="true"/>
        <a:field name="payment_date" required="true"/>
        <a:field name="total_amount" readOnly="true" required="false"/>
        <a:field name="apply_number" readOnly="true"/>
        <a:field name="apply_type_desc"  defaultValue="${/parameter/@apply_type_desc}" displayField="code_value_name"  options="payment_apply_type_ds" readOnly="true" returnField="apply_type"  valueField="code_value"/>
        <a:field name="apply_type" defaultValue="${/parameter/@apply_type}"/>
        <a:field name="apply_date"  defaultValue="${/model/default_data/record/@default_date}" required="true"/>
        <a:field name="unit_id"  defaultValue="${/model/default_data/record/@unit_id}"/>
        <a:field name="apply_unit"  defaultValue="${/model/default_data/record/@apply_unit_name}"  lovGridHeight="350" lovHeight="500"  lovService="csh.CSH720.csh_payment_apply_unit_lov" lovWidth="500" prompt="使用部门" required="true">
            <a:mapping>
                <a:map from="unit_id" to="operator_unit_id"/>
                <a:map from="unit_name" to="apply_unit"/>
                <a:map from="bank_account_id" to="bank_account_id"/>
                <a:map from="bank_account_name" to="bank_account_name"/>
            </a:mapping>
        </a:field>
    </a:fields>
</a:dataSet>

子数据集创建

子数据集需要 bindTarget="payment_apply_ds" 设置父页面的数据集,并设置 bindName="ln_detail" 作为父数据集的具体某个字段名
同时,为了查询方便,需要重写查询语句 queryUrl="${/request/@context_path}/autocrud/csh.CSH720.csh_payment_apply_ln/query?apply_id=${/parameter/@apply_id}", 传入查询的头表ID

<a:dataSet id="apply_ln_result_ds" autoQuery="true" bindName="ln_detail"  bindTarget="payment_apply_ds" fetchAll="true"  model="csh.CSH720.csh_payment_apply_ln"  queryUrl="${/request/@context_path}/autocrud/csh.CSH720.csh_payment_apply_ln/query?apply_id=${/parameter/@apply_id}" selectable="true">
    <a:fields>
        <a:field name="report_amount" required="true"/>
        <a:field name="unit_name_ln" lovGridHeight="350" lovHeight="500"  lovService="csh.CSH720.csh_payment_apply_unit_lov" lovWidth="500" prompt="部门"  required="true">
            <a:mapping>
                <a:map from="unit_id" to="unit_id"/>
                <a:map from="unit_name" to="unit_name_ln"/>
            </a:mapping>
        </a:field>
        <a:field name="expense_type_desc" displayField="value_name"  options="expense_type_ds" required="true" returnField="expense_type_id"  valueField="value_code"/>
        <a:field name="expense_type_code"/>
        <a:field name="ishave_vat"/>
        <a:field name="ishave_vat_desc" displayField="code_value_name"  options="csh720_yesno_ds" returnField="ishave_vat" valueField="code_value"/>
        <a:field name="is_special_fund"/>
        <a:field name="is_special_fund_desc" displayField="code_value_name"  options="csh720_is_special_fund_ds" required="true"  returnField="is_special_fund" valueField="code_value"/>
        <a:field name="fund_id"/>
    </a:fields>
</a:dataSet>

设定SVC

设定请求的SVC,这里根据传入的 @current_parameter/@_status 参数,调用头表的创建或者修改方法,对于行表,采用重写保存方法, sourcePath="@current_parameter/ln_detail" 指向传入参数的名称, ln_detail 为在子数据集中配置的 bindName 属性,完成保存
如果有输出参数,则输出参数在 <a:service-output output="/parameter"/> 下保存

<a:service xmlns:a="http://www.aurora-framework.org/application"  xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <a:batch-apply sourcepath="/parameter">
            <p:switch test="@current_parameter/@_status">
                <p:case value="insert">
                    <a:model-insert model="csh.CSH720.csh_payment_apply"/>
                    <a:model-batch-update  model="csh.CSH720.csh_payment_apply_ln"  sourcePath="@current_parameter/ln_detail"/>
                </p:case>
                <p:case value="update">
                    <a:model-update model="csh.CSH720.csh_payment_apply"/>
                    <a:model-batch-update  model="csh.CSH720.csh_payment_apply_ln"  sourcePath="@current_parameter/ln_detail"/>
                </p:case>
            </p:switch>
        </a:batch-apply>
        <p:echo/>
    </a:init-procedure>
    <a:service-output output="/parameter"/>
</a:service>

头表的BM保存修改

插入操作,调用过程,主表ID为输出参数,设置 outputPath 放入 parameter
这里主键为 `out`` 输出参数.

<bm:operation name="insert">
    <bm:parameters>
        <bm:parameter name="apply_id" dataType="java.lang.Long" input="false"  output="true" outputPath="@apply_id"/>
    </bm:parameters>
    <bm:update-sql><![CDATA[
        BEGIN
            cs_csh_payment_apply_pkg.insert_csh_payment_apply(p_user_id         =>${/session/@user_id},
                                                            p_company_id        =>${/session/@company_id},
                                                            p_employee_id       =>${@employee_id},
                                                            p_unit_id          =>${@unit_id},
                                                            p_apply_type       =>${@apply_type},
                                                            p_apply_id         =>${@apply_id},                                                                               
                                                            p_apply_date       =>to_date(${@apply_date},'YYYY-MM-DD'),
                                                            p_description      =>${@description},
                                                            p_reception_unit   =>${@reception_unit}
                                                          );
        END;
    ]]></bm:update-sql>
</bm:operation>

更新操作,传入主键的更新操作

<bm:operation name="update">
    <bm:update-sql><![CDATA[
        BEGIN
           cs_csh_payment_apply_pkg.update_csh_payment_apply (p_user_id  =>${/session/@user_id},
                                                              p_apply_id =>${@apply_id},                                                                                
                                                              p_apply_date => to_date(${@apply_date},'YYYY-MM-DD'),
                                                              p_description =>${@description},
                                                              p_reception_unit  =>${@reception_unit},
                                                              p_reception_room   =>${@reception_room},
                                                              p_accompany_number =>${@accompany_number},
                                                              p_operator         =>${@operator}
                                                             );
             end;
    ]]></bm:update-sql>
</bm:operation>

行表的BM保存修改

行表的方式与头表一致,通过重写 insertupdate 方法分别调用,具体的调用,交由 model-batch-update 判断.
注意行表中, insert 方法中,主表主键通过 ../../@主键 方式获得

<bm:operation name="insert">
    <bm:parameters>
        <bm:parameter name="apply_line_id" dataType="java.lang.Long"  input="false" output="true" outputPath="@apply_line_id"/>
    </bm:parameters>
    <bm:update-sql><![CDATA[
        BEGIN
           cs_csh_payment_apply_pkg.insert_csh_payment_apply_ln(p_user_id              =>${/session/@user_id},
                                                                                                        p_company_id          =>${/session/@company_id},
                                                                                                        p_apply_id            =>${../../@apply_id},
                                                                                                        p_apply_line_id       =>${@apply_line_id},
                                                                                                        p_employee_id         =>${@employee_id},
                                                                                                        p_unit_id             =>${@unit_id},   
                                                                                                        p_description         =>${@description},   
                                                                                                        p_remarks             =>${@remarks},
                                                                                                        p_currency_code       =>${@currency_code},   
                                                                                                        p_attachment_num      =>${@attachment_num},
                                                                                                        p_expense_item_id     =>${@expense_item_id},
                                                                                                          p_expense_type_id     =>${@expense_type_id},   
                                                                                                        p_price               =>${@price} ,           
                                                                                                        p_primary_quantity    =>${@primary_quantity}   ,
                                                                                                        p_report_amount       =>${@report_amount} ,  
                                                                                                        p_report_functional_amount   =>${@report_functional_amount},
                                                                                                        p_ishave_vat  =>${@ishave_vat},
                                                                                                         p_item_tax  =>${@item_tax2}
                                                                                   );
        END;
    ]]></bm:update-sql>
</bm:operation>

系统默认时间,Session信息

在页面开始放入以下查询

<a:init-procedure>
  <a:model-query autocount="true" fetchall="true"  model="basic.hls_sys_time_default_value" rootpath="defaultDate"/>  
  <a:model-query model="basic.sys_session_info"  rootPath="aut101_session_info"/>
</a:init-procedure>

直接引用字段方式,仅限于直接创建方式

<a:dataSet id="sys_notice_msg_user_save_ds" autoCreate="true">
  <a:fields>
   	<a:field name="start_date"  defaultValue="${/model/sys_date_rp/record/@now_time}" required="true"/>  
    <a:field name="end_date"  defaultValue="${/model/sys_date_rp/record/@now_time}" required="true"/>  
  <a:dataSet>
</a:dataSet>

引用数据集方式
defaultDate 查询为系统时间,对应的SQL为

SELECT
      sysdate now_time,
      to_date('3000-01-01','yyyy-mm-dd') never_date,
      to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') sys_c,
      gld_common_pkg.get_gld_period_name(1,sysdate) now_period_name,
      gld_common_pkg.get_gld_internal_period_num(1,gld_common_pkg.get_gld_period_name(1,sysdate)) now_internal_period_num
 FROM
      dual

查询的为系统中 session 存放的信息,对应BM为 basic.sys_session_info

LOV多选,返回多选值

创建LOV的链接
Lov引入
编写页面,在编写的页面里书写提交事件,将提交记录的数据进行更换

<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.aurora-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <script><![CDATA[
            function lovcancle() {
                $('${/parameter/@lovid}').win.close();
            }

            function griddbclick(grid, record, row, name) {
                $('${/parameter/@lovid}').commit(record);

            }

            function querygrid() {
                $('grid_result_ds').query();
            }

            function submitClick(){
                var records = $('grid_result_ds').getSelected();
                var draftinfo_id_s = '';
                var deposit_num_s = '';
                for (var i = 0;i < records.length;i++) {
                    var record = records[i];
                    var draftinfo_id = record.get('draftinfo_id');
                    var deposit_num = record.get('deposit_num');
                    draftinfo_id_s = draftinfo_id_s + draftinfo_id + ',';
                    deposit_num_s = deposit_num_s + deposit_num + ',';
                }
                draftinfo_id_s = draftinfo_id_s.substring(0,draftinfo_id_s.length-1);
                deposit_num_s = deposit_num_s.substring(0,deposit_num_s.length-1);

                debugger;

                    var record = $('grid_result_ds').getAt(0);
                    record.set('draftinfo_id',draftinfo_id_s);
                    record.set('deposit_num',deposit_num_s);
                $('${/parameter/@lovid}').commit(record);
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="draft_code" prompt="承兑汇票编码"/>
                    <a:field name="draft_amount" prompt="票据金额"/>
                    <a:field name="bill_bank_account_num" prompt="银行账号"/>
                    <a:field name="bank_account_num" prompt="账户名称"/>
                    <a:field name="pay_account_code" prompt="出票银行"/>
                    <a:field name="draft_issue_date" prompt="出票日期"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="grid_result_ds" autoQuery="true" model="csh.CSH502.csh_payment_acceptance_bill_number_lov" queryDataSet="query_ds" queryUrl="${/request/@context_path}/autocrud/csh.CSH502.csh_payment_acceptance_bill_number_lov/query?pay_account_code=${/parameter/@pay_account_code}&amp;rev_unit=${/parameter/@rev_unit}" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:form bindTarget="query_ds" column="2" labelWidth="120" title="查询条件" width="650">
                <a:textField name="draft_code" bindTarget="query_ds" prompt="承兑汇票编码" width="200"/>
                <a:textField name="draft_amount" bindTarget="query_ds" prompt="票据金额" width="200"/>
                <a:textField name="bill_bank_account_num" bindTarget="query_ds" prompt="银行账号" width="200"/>
                <a:textField name="bank_account_num" bindTarget="query_ds" prompt="账户名称" width="200"/>
                <a:textField name="pay_account_code" bindTarget="query_ds" prompt="出票银行" width="200"/>
                <a:datePicker name="draft_issue_date" bindTarget="query_ds" prompt="出票日期" width="200"/>
            </a:form>
            <a:hBox>
                <a:button click="querygrid" text="查询"/>
                <a:button click="submitClick" text="确定"/>
                <a:button click="lovcancle" text="取消"/>
            </a:hBox>
            <a:grid bindTarget="grid_result_ds" height="320" navBar="true" width="650">
                <a:columns>
                    <a:column name="draft_code" prompt="承兑汇票编码" width="100"/>
                    <a:column name="draft_amount" prompt="票据金额" renderer="Aurora.formatMoney" width="100"/>
                    <a:column name="bank_account_code" prompt="账户代码" width="100"/>
                    <a:column name="bank_account_name" prompt="银行账号" width="100"/>
                    <a:column name="bank_account_num" prompt="账户名称" width="100"/>
                    <a:column name="pay_account_code" prompt="出票银行" width="100"/>
                    <a:column name="draft_issue_date" prompt="出票日期" renderer="Aurora.formatDate" width="100"/>
                    <a:column name="deposit_num" prompt="保证金编号" width="100"/>
                </a:columns>
                <a:events>
                    <a:event name="dblclick" handler="griddbclick"/>
                </a:events>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>

传入数组,保存中间表,后台返回多条记录

跳转到中转svc,作为视图控制
SVC数据
中转的,表示必须执行bm中的acp.ACP512.acp_invoice_export_temp_execute文件中的delete方法.
batch-apply:表示抓取数据的路径
随后执行insert方法,传入数据
SVC处理
执行的insert方法,@invoice_hd_id为前一个svc中,解析的对象属性
数据处理

数据绑定

使用BM文件

BM文件

使用查询服务

使用查询服务

绑定数据源

绑定数据源

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值