fnd_request_submit.lview 8.78 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: likun  
    $Date: 2012-7-5 下午4:26:37  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <p:set field="/model/request_object" setToNull="true"/>
        <a:model-query defaultWhereClause="request_info_id=${/parameter/@request_info_id}" model="fnd.FND5030.fnd_request_submit" rootPath="request_object"/>
        <p:loop source="/model/request_object">
            <p:switch test="@edit_type">
                <p:case value="COMBOBOX">
                    <a:model-query model="${@bm}" rootPath="/model/${@parameter_name}_list"/>
                </p:case>
            </p:switch>
        </p:loop>
        <p:echo/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[

            function submitFunction() {
                var request_object_ds = $('fnd_request_object');
                var submit_result_ds = $('fnd_request_submit_result_ds');
                if (request_object_ds.validate()) {
                    Leaf.Masker.mask($('fnd_concurrent_request_submit_window').wrap, '正在提交..');
                    $('submit_btn').disable();
                    var record = request_object_ds.getCurrentRecord();
                    var parameter_records = submit_result_ds.getAll();
                    
                    var data = [];
                    data = {
                        request_info_id: ${/parameter/@request_info_id}
                    };
                    var parameter = [];
                    
                    for (var t = 0;t < parameter_records.length;t++) {
                        var parameter_value = record.get(parameter_records[t].get('parameter_id'));
                        parameter_records[t].set('parameter_value', parameter_value);
                        parameter.push(parameter_records[t].data);
            
                    }
            
                    data['parameter'] = parameter;
                    
                    Leaf.request({
                        url: 'fnd_request_submit_parameter.lsc',
                        para: data,
                        success: parametersubmitSuccess,
                        failure: Leaf.Masker.unmask($('fnd_concurrent_request_submit_window').wrap),
                        scope: this
                    });
                    
                }
            }
            
            
            function parametersubmitSuccess(res) {
                Leaf.Masker.unmask($('fnd_concurrent_request_submit_window').wrap);
                Leaf.showMessage('提示', '请求提交成功!');
                closesubmitWindow();
                closeWindow();
                query();
            }
            
            
            function closesubmitWindow() {
                $('fnd_concurrent_request_submit_window').close();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_request_submit_result_ds">
                <a:datas dataSource="/model/request_object"/>
            </a:dataSet>
            <a:placeHolder id="combox_ds"/>
            <a:dataSet id="fnd_request_object" autoCreate="true">
                <a:fields>
                    <a:placeHolder id="object_ds"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form id="request_obj_ds" title="请求参数" width="580">
                <a:box column="2">
                    <a:placeHolder id="object_cmp"/>
                </a:box>
            </a:form>
            <a:hBox>
                <a:button id="submit_btn" click="submitFunction" text="提交"/>
                <a:button click="closesubmitWindow" text="HAP_CLOSE"/>
            </a:hBox>
        </a:screenBody>
    </a:view>
    <a:view-config>
        <c:create-config targetId="object_cmp">
            <p:loop source="/model/request_object">
                <p:switch test="@edit_type">
                    <p:case value="LOV">
                        <c:process-config>
                            <a:lov name="${@displayfiled_to}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="TEXTFIELD">
                        <c:process-config>
                            <a:textField name="${@parameter_id}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="COMBOBOX">
                        <c:process-config>
                            <a:comboBox name="${@displayfiled_to}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="DATAPICKER">
                        <c:process-config>
                            <a:datePicker name="${@parameter_id}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="CHECKBOX">
                        <c:process-config>
                            <a:checkBox name="${@parameter_id}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="NUMBERFIELD">
                        <c:process-config>
                            <a:numberField name="${@parameter_id}" bindTarget="fnd_request_object" prompt="${@description}"/>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
        <c:create-config targetId="combox_ds">
            <p:loop source="/model/request_object">
                <p:switch test="@edit_type">
                    <p:case value="COMBOBOX">
                        <c:process-config>
                            <a:dataSet id="${@parameter_name}_ds">
                                <a:datas dataSource="/model/${@parameter_name}_list"/>
                            </a:dataSet>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
        <c:create-config targetId="object_ds">
            <a:field name="request_info_id" defaultValue="${/parameter/@request_info_id}"/>
            <p:loop source="/model/request_object">
                <p:switch test="@edit_type">
                    <p:case value="LOV">
                        <c:process-config>
                            <a:field name="${@displayfiled_to}" lovHeight="500" lovService="${@bm}" lovWidth="550" required="${@required_flag}">
                                <a:mapping>
                                    <a:map from="${@valuefiled_from}" to="${@parameter_id}"/>
                                    <a:map from="${@displayfiled_from}" to="${@displayfiled_to}"/>
                                </a:mapping>
                            </a:field>
                        </c:process-config>
                    </p:case>
                    <p:case value="COMBOBOX">
                        <c:process-config>
                            <a:field name="${@displayfiled_to}" displayField="${@displayfiled_from}" options="${@parameter_name}_ds" required="${@required_flag}" returnField="${@parameter_id}" valueField="${@valuefiled_from}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="CHECKBOX">
                        <c:process-config>
                            <a:field name="${@parameter_id}" checkedValue="Y" defaultValue="N" required="${@required_flag}" uncheckedValue="N"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="NUMBERFIELD">
                        <c:process-config>
                            <a:field name="${@parameter_id}" required="${@required_flag}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="TEXTFIELD">
                        <c:process-config>
                            <a:field name="${@parameter_id}" required="${@required_flag}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="DATAPICKER">
                        <c:process-config>
                            <a:field name="${@parameter_id}" required="${@required_flag}"/>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
    </a:view-config>
    <script type="text/javascript"><![CDATA[
    	
    ]]></script>
</a:screen>