<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhuxianfei
    $Date: 2018/7/5 15:38
    $Revision: 1.0
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view package="leaf.ui.std" template="default">
        <script type="text/javascript"><![CDATA[
        function lock_list_window() {
            Leaf.Masker.mask($('${/parameter/@win_id}').wrap, '${l:HLS.EXECUTING}');
        }

        function unlock_list_window() {
            Leaf.Masker.unmask($('${/parameter/@win_id}').wrap);
        }

        function con706_exit() {
            $('trans_info_modify_link_winId').close();
        }

        function con706_reset() {
            $('contract_doc_query_ds').reset();
        }

        /*var a = '${/parameter/@contract_id}';
         alert(a);*/

        function con706_detail_modify_save() {
            var record = $('contract_doc_info_ds').getCurrentRecord();
            Leaf.request({
                url: '${/request/@context_path}/autocrud/cont.CON706.con_contract_et_result/update',
                para: {
                    contract_id: '${/parameter/@contract_id}',
                    cert_recipient01: record.get('cert_recipient01'),
                    cert_tracknum01: record.get('cert_tracknum01'),
                    cert_send_date01: record.get('cert_send_date01'),

                    cert_recipient02: '',
                    cert_tracknum02: '',
                    cert_send_date02: '',

                    trans_recipient01: record.get('trans_recipient01'),
                    trans_tracknum01: record.get('trans_tracknum01'),
                    trans_send_date01: record.get('trans_send_date01'),

                    trans_recipient02: '',
                    trans_tracknum02: '',
                    trans_send_date02: '',
                    note: record.get('note')


                },
                success: function (res) {
                    Leaf.SideBar.show({
                        msg: '操作成功',
                        duration: 2000
                    });
                },
                error: function () {
                },
                failure: function () {
                }
                ,
                sync: true,
                scope: this
            })
            ;

        }

        function editor_change(record, name) {
            var readonly = '${/parameter/@readonly}';
            if (readonly == 'Y') {
                return '';
            } else {
                if (name == 'cert_recipient01') {
                    return 'tf_id';
                }
                if (name == 'cert_tracknum01') {
                    return 'tf_id';
                }
                if (name == 'cert_send_date01') {
                    return 'dp_id';
                }
                /* if (name == 'cert_recipient02') {
                     return 'tf_id';
                 }
                 if (name == 'cert_tracknum02') {
                     return 'tf_id';
                 }
                 if (name == 'cert_send_date02') {
                     return 'dp_id';
                 }*/
                if (name == 'trans_recipient01') {
                    return 'tf_id';
                }
                if (name == 'trans_tracknum01') {
                    return 'tf_id';
                }
                if (name == 'trans_send_date01') {
                    return 'dp_id';
                }
                /* if (name == 'trans_recipient02') {
                     return 'tf_id';
                 }
                 if (name == 'trans_tracknum02') {
                     return 'tf_id';
                 }
                 if (name == 'trans_send_date02') {
                     return 'dp_id';
                 }*/
                if (name == 'note') {
                    return 'tf_id';
                }

            }
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="contract_doc_info_ds" autoQuery="true" fetchAll="true"
                       model="cont.CON706.con_contract_et_result"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON706.con_contract_et_result/query?contract_id=${/parameter/@contract_id}"
                       selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con706_exit" text="HLS.EXIT"/>
                <a:gridButton click="con706_detail_modify_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="cont_doc_detail_result_ds_id" bindTarget="contract_doc_info_ds" marginHeight="240"
                    marginWidth="40"
                    navBar="true">
                <a:columns>
                    <a:column prompt="合格证">
                        <a:column name="cert_recipient01" align="center" editorFunction="editor_change" prompt="收件人"
                                  width="200"/>
                        <a:column name="cert_tracknum01" align="center" editorFunction="editor_change" prompt="快递单"
                                  width="130"/>
                        <a:column name="cert_send_date01" align="center" editorFunction="editor_change"
                                  renderer="Leaf.formatDate" prompt="邮寄日期" width="130"/>
                    </a:column>
                    <!--<a:column prompt="第二次寄送合格证">
                        <a:column name="cert_recipient02" align="center" editorFunction="editor_change" prompt="收件人2" width="200" />
                        <a:column name="cert_tracknum02" align="center" editorFunction="editor_change" prompt="快递单2" width="130" />
                        <a:column name="cert_send_date02" align="center" editorFunction="editor_change" renderer="Leaf.formatDate"  prompt="邮寄日期2"  width="130"/>
                    </a:column>-->
                    <a:column prompt="所有权转移证书">
                        <a:column name="trans_recipient01" align="center" editorFunction="editor_change" prompt="收件人"
                                  width="200"/>
                        <a:column name="trans_tracknum01" align="center" editorFunction="editor_change" prompt="快递单"
                                  width="130"/>
                        <a:column name="trans_send_date01" align="center" editorFunction="editor_change"
                                  renderer="Leaf.formatDate" prompt="邮寄日期" width="130"/>
                    </a:column>
                    <!--  <a:column prompt="第二次寄送所有权转移证书">
                          <a:column name="trans_recipient02" align="center" editorFunction="editor_change" prompt="收件人2" width="200"/>
                          <a:column name="trans_tracknum02" align="center" editorFunction="editor_change" prompt="快递单2" width="130"/>
                          <a:column name="trans_send_date02" align="center" editorFunction="editor_change" renderer="Leaf.formatDate"  prompt="邮寄日期2"  width="130"/>
                      </a:column>-->
                    <a:column name="note" align="center" editorFunction="editor_change" prompt="备注" width="200"/>
                </a:columns>
                <a:editors>

                    <a:numberField id="nf_id" allowDecimals="false" allowNegative="false"/>
                    <a:textField id="tf_id"/>
                    <a:checkBox id="ck_id"/>
                    <a:datePicker id="dp_id"/>

                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>