hn_atm_complement.lview 11.4 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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2016-5-18 下午17:26:11  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <!-- <a:link id="hn1010_atm_complement_submit_link" model="hn.HN1010.hn1010_atm_complement" modelaction="execute"/> -->
        <script type="text/javascript"><![CDATA[
            function hn1010_editor_fuc(record, name) {
                if (record.isNew) {
                    if (name == 'function_description') {
                        return 'editor_lov1';
                    }
                    if (name == 'document_number') {
                        return 'editor_lov2';
                    }
                } else if (record.get('status') == 'NEW' || record.get('status') == 'CANCEL'||status == 'APPROVED_RETURN') {
                    if (name == 'function_description') {
                        return 'editor_lov1';
                    }
                    if (name == 'document_number') {
                        return 'editor_lov2';
                    }
                }
                return '';
            }
            
            function hn1010_open_detail(record_id, document_id,status,url) {
                var record = $('hn1010_atm_complement_result_ds').getSelected();
                //var status = record[0].get('status');
                var query_flag;
                if (status == 'NEW' || status == 'CANCEL'||status == 'APPROVED_RETURN') {
                    query_flag = 'N';
                } else {
                    query_flag = 'Y';
                }
                //var url = '${/request/@context_path}/' + record[0].get('screen_url');
                var win = new Leaf.Window({
                    id: 'hn1010_detail_window',
                    url: url,
                    params: {
                        'table_name':'HN_ATM_COMPLEMENT',
                        'header_id':record_id,
                        record_id: record_id,
                        document_id: document_id,
                        query_flag: query_flag,
                        winid: 'hn1010_detail_window'
                    },
                    fullScreen: true
                }).on('close', function() {
                    $('hn1010_atm_complement_result_ds').query();
                });
            }
            
            function hn1010_renderer(value, record, name) {
                if (!record.isNew) {
                    var url = '${/request/@context_path}/' + record.get('screen_url');
                    var status = record.get('status');              
                    return '<a href="javascript:hn1010_open_detail(' + record.get('record_id') + ',' + record.get('document_id') +','+'\''+status+'\','+'\''+url+'\''+'\);">' + record.get('url_desc') + '</a>';
                }
                return '';
            }
            
            function onfunCommit(lov, r1, r2) {
                
                var document_category = r1.get('document_category');
                if (!document_category) {
                    Leaf.showMessage("${l:PROMPT}", "请先选择功能操作!");
                } else {
                    var document_number = r1.getField('document_number');
                    var function_code = r1.get('function_code');
                    document_number.setLovPara('document_category', document_category);
                    
                    if(function_code=='CONTENT_CHANGE'){
                         document_number.setLovPara('document_type', 'CONTRACT');
                    }
                    if(function_code=='PRJ_ATM_ADD'){
                         document_number.setLovPara('document_type', 'PROJECT');
                    }
                }
            }
            
            function Onsuccess() {
                $('hn1010_atm_complement_result_ds').query();
            }
            
            function hn1010_atm_complement_submit() {
                var record = $('hn1010_atm_complement_result_ds').getSelected();
                var document_number = record[0].get('document_number');
                var document_name = record[0].get('document_name');
                var status = record[0].get('status');
                if (!$('hn1010_atm_complement_result_ds').validate(true)) {
                    return;
                } else if ($('hn1010_atm_complement_result_ds').isModified()) {
                    Leaf.showErrorMessage('错误', '页面有未保存数据,请先保存后再提交!');
                    return;
                }
                if (status != 'NEW' && status != 'CANCEL' && status != 'APPROVED_RETURN') {
                    Leaf.showErrorMessage('错误', '只有新建、审批退回和取消状态的单据才能提交!');
                    return;
                }
                Leaf.showConfirm('${HLS.PROMPT}', '您确定要提交' + document_name + '(' + document_number + ')' + '单据吗?', function() {
                    Leaf.request({
                        url: $('hn1010_atm_complement_submit_link').getUrl(),
                        para: {
                            record_id: record[0].get('record_id')
                        },
                        success: function(res) {
                            hn1010_atm_complement_query();
                        },
                        scope: this
                    });
                }, null);
            }
            
            function hn1010_atm_complement_query() {
                $('hn1010_atm_complement_result_ds').query();
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=PROJECT&amp;function_code=HN1010"/>
        <a:dataSets>
            <a:dataSet id="hn1010_status_ds" lookupCode="HN_ATM_COMPLEMENT_STATUS"/>
            <a:dataSet id="hn1010_atm_complement_query_ds">
                <a:fields>
                    <a:field name="function_description" lovGridHeight="350" lovHeight="550" lovService="hn.HN1010.hn1010_atm_complement_config_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="function_description" to="function_description"/>
                            <a:map from="function_code" to="function_code"/>
                            <a:map from="config_id" to="config_id"/>
                            <a:map from="workflow_code" to="workflow_code"/>
                            <a:map from="document_category" to="document_category"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="config_id"/>
                    <a:field name="status_desc" displayField="code_value_name" options="hn1010_status_ds" returnField="status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hn1010_atm_complement_result_ds" autoQuery="true" model="hn.HN1010.hn1010_atm_complement" queryDataSet="hn1010_atm_complement_query_ds" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="function_description" lovGridHeight="350" lovHeight="550" lovService="hn.HN1010.hn1010_atm_complement_config_lov" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="function_description" to="function_description"/>
                            <a:map from="function_code" to="function_code"/>
                            <a:map from="config_id" to="config_id"/>
                            <a:map from="workflow_code" to="workflow_code"/>
                            <a:map from="document_category" to="document_category"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="document_category"/>
                    <a:field name="config_id"/>
                    <a:field name="workflow_code"/>
                    <a:field name="function_code"/>
                    <a:field name="document_number" lovGridHeight="350" lovHeight="550" lovService="hn.HN1010.hn1010_atm_complement_document_lov?check_flag=Y" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="document_number" to="document_number"/>
                            <a:map from="document_id" to="document_id"/>
                            <a:map from="document_name" to="document_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="document_id"/>
                    <a:field name="document_name"/>
                </a:fields>
                <a:events>
                    <a:event name="query" handler="aut_authority_list_validate_query"/>
                    <a:event name="submitsuccess" handler="Onsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton bind="hn_atm_complement_grid" type="add"/>
                <a:gridButton bind="hn_atm_complement_grid" type="save"/>
                <a:gridButton bind="hn_atm_complement_grid" type="delete"/>
                <!-- <a:gridButton click="hn1010_atm_complement_submit" text="提交"/> -->
                <a:gridButton click="hn1010_atm_complement_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form marginWidth="100" title="查询条件">
                <a:hBox labelWidth="120">
                    <!-- <a:lov name="function_code" bindTarget="hn1010_atm_complement_query_ds" prompt="操作代码" /> -->
                    <a:lov name="function_description" bindTarget="hn1010_atm_complement_query_ds" prompt="操作描述"/>
                    <a:textField name="document_number" bindTarget="hn1010_atm_complement_query_ds" prompt="单据编号"/>
                    <a:textField name="document_name" bindTarget="hn1010_atm_complement_query_ds" prompt="单据名称"/>
                    <a:comboBox name="status_desc" bindTarget="hn1010_atm_complement_query_ds" prompt="审批状态"/>
                </a:hBox>
            </a:form>
            <a:grid id="hn_atm_complement_grid" bindTarget="hn1010_atm_complement_result_ds" marginHeight="180" marginWidth="100" navBar="true">
                <a:columns>
                    <!-- <a:column name="function_code" editorFunction="hn1010_editor_fuc" prompt="操作代码" width="200"/> -->
                    <a:column name="function_description" editorFunction="hn1010_editor_fuc" prompt="操作描述" width="240"/>
                    <a:column name="document_number" editorFunction="hn1010_editor_fuc" prompt="单据编号" width="150"/>
                    <a:column name="document_name" prompt="单据名称" width="280"/>
                    <a:column name="document_type_desc" align="center" prompt="单据类型" width="100"/>
                    <a:column name="detail" align="center" prompt="编辑" renderer="hn1010_renderer" width="150"/>
                    <a:column name="status_desc" align="center" prompt="审批状态" width="150"/>
                </a:columns>
                <a:editors>
                    <a:lov id="editor_lov1">
                        <a:events>
                            <a:event name="commit" handler="onfunCommit"/>
                        </a:events>
                    </a:lov>
                    <a:lov id="editor_lov2"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>