<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-12-26 下午02:25:27  
    $Revision: 1.0  
    $Purpose: 项目报告审批暂挂
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:view>
        <a:link id="prj_project_status_hold_link" model="gj.GJPRJ544.prj_project_status_hold" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            function prj_project_status_hold() {
                
                var result_record = $('prj_project_result_ds').getCurrentRecord();
                if (!Ext.isEmpty(result_record)) {
                    var project_hold_status = 'Y';
                    var project_id = result_record.get('project_id');
                    change_status(project_hold_status, project_id);
                } else {
                    Leaf.showMessage('${l:HLS.PAOMPT}', '${l:GJPRJ554.CHOOSE_HOLD_PROJECT}');
                }
            }
            
            function prj_project_status_resume() {
                var result_record = $('prj_project_result_ds').getCurrentRecord();
                if (!Ext.isEmpty(result_record)) {
                    var project_hold_status = 'N';
                    var project_id = result_record.get('project_id');
                    change_status(project_hold_status, project_id);
                } else {
                    Leaf.showMessage('${l:HLS.PAOMPT}', '${l:GJPRJ554.CHOOSE_RESUME_PROJECT}');
                }
            }
            
            function change_status(project_hold_status, project_id) {
                var params = {
                    'project_hold_status': project_hold_status,
                    'project_id': project_id
                };
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                new Leaf.request({
                    url: $('prj_project_status_hold_link').getUrl(),
                    para: params,
                    success: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                         $('prj_project_result_ds').query($('prj_project_result_ds').currentPage);
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                         $('prj_project_result_ds').query($('prj_project_result_ds').currentPage);
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                        $('prj_project_result_ds').query($('prj_project_result_ds').currentPage);
                    },
                    scope: this
                });
            }
            
            function prj_project_result_ds_query(){
                $('prj_project_result_ds').query();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="prj_project_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="project_id"/>
                    <a:field name="project_name"/>
                    <a:field name="project_number" lovGridHeight="400" lovHeight="550" lovService="prj.PRJ501.prj_project_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="project_id" to="project_id"/>
                            <a:map from="project_number" to="project_number"/>
                            <a:map from="project_name" to="project_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="employee_name" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="basic.hls_salesman_v_for_lov" lovWidth="500" title="HLS.SALES_EMPLOYEE">
                        <a:mapping>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="employee_name"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="prj_project_result_ds" autoPageSize="true" autoQuery="true" model="gj.GJPRJ544.prj_project_v_hold_query" queryDataSet="prj_project_query_ds" selectable="true" selectionModel="single"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="prj_project_result_ds_query" text="HLS.QUERY"/>
                <a:gridButton click="prj_project_status_hold" text="GJPRJ554.HOLD"/>
                <a:gridButton click="prj_project_status_resume" text="GJPRJ554.RESUME"/>
            </a:screenTopToolbar>
            <a:form column="3" title="HLS.QUERY_TITLE">
                <a:lov name="project_number" bindTarget="prj_project_query_ds" prompt="HLS.PROJECT_NUMBER"/>
                <a:textField name="project_name" bindTarget="prj_project_query_ds" prompt="HLS.PROJECT_NAME"/>
                <a:lov name="employee_name" bindTarget="prj_project_query_ds" prompt="HLS.SALES_EMPLOYEE"/>
            </a:form>
            <a:grid bindTarget="prj_project_result_ds" marginHeight="170" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="project_number" prompt="HLS.PROJECT_NUMBER" width="150"/>
                    <a:column name="project_name" prompt="HLS.PROJECT_NAME" width="200"/>
                    <a:column name="employee_name" prompt="HLS.SALES_EMPLOYEE" width="100"/>
                    <a:column name="current_node_desc" prompt="GJPRJ554.CURRENT_NODE_DESC" width="180"/>
                    <a:column name="approve_user_name" prompt="GJPRJ554.APPROVE_USER_NAME" width="200"/>
                    <a:column name="prj_hold_status" prompt="GJPRJ554.PRJ_HOLD_STATUS" width="80"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>