tre_assets_contract_info.lview 12 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
<?xml version="1.0" encoding="utf-8"?>
<!--
    $author: zhuxianfei
    $date: 2018年6月26日 下午4:33:30
    $revision: 1.0
    $purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationenabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:init-procedure/>
    <a:view>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:link id="${/parameter/@layout_code}_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="tre_asset_contract_link"
                url="${/request/@context_path}/modules/tre/TRE1050/tre_assets_contract_select.lview"/>
        <a:link id="get_assets_number_link_id" model="tre.TRE1050.get_new_assets_number" modelaction="update"/>

        <a:link id="${/parameter/@layout_code}_update_mark_link" model="tre.TRE1050.get_new_assets_number"
                modelaction="execute"/>
        <a:link id="${/parameter/@layout_code}_cancel_mark_link" model="tre.TRE1050.tre_contract_result_line"
                modelaction="update"/>
        <a:link id="tre_asset_contract_modify_link"
                url="${/request/@context_path}/modules/tre/TRE1050/tre_assets_select_modify.lview"/>
        <a:link id="import_upload_link"
                url="${/request/@context_path}/modules/tre/TRE1050/tre_assets_contract_import_upload.lview"/>
        <script type="text/javascript"><![CDATA[
        //新增和加载时调用(form)
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var record = $(ds_id).getCurrentRecord();
            if (ds_id && '${/parameter/@form_readonly}' == 'Y') {
                record.getField('assets_name').setReadOnly(true);
                record.getField('loan_institution').setReadOnly(true);
                record.getField('loan_institution_n').setReadOnly(true);
            }
        };


        window['${/parameter/@layout_code}_G_RESULT_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var record = $(ds_id).getCurrentRecord();
            var status = record.get('status');
            if (status != 'NEW') {
                Leaf.showMessage('${l:PROMPT}', '当前单据状态不可新增数据,请先解绑!');
                return;
            }
            var asset_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            var param = {};
            param['function_code'] = 'TRE1050N';
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
            param['winid'] = '${/parameter/@layout_code}_winid';
            param['dsid'] = asset_ds_id;
            param['url_title'] = '合同信息';
            hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, 'tre_asset_contract_link');
        }
        //确认
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {

            var asset_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var tre_assets_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            var record = $(asset_ds_id).getAll();
            var status = record[0].get('status');
            if (status != 'NEW') {
                Leaf.showMessage('${l:PROMPT}', '单据状态不可确认!');
                return;
            }
            Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function () {
                Leaf.request({
                    url: $('${/parameter/@layout_code}_update_mark_link').getUrl(),
                    para: {
                        assets_id: record[0].get('assets_id')
                    },
                    success: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();

                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        $(asset_ds_id).query();
                        $(tre_assets_ln_ds_id).query();
                    },
                    failure: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            });

        }
        //解绑 add by zhuxianfei 20181005
        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {

            var asset_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var tre_assets_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            var record = $(asset_ds_id).getAll();
            var status = record[0].get('status');
            if (status == 'NEW') {
                Leaf.showMessage('${l:PROMPT}', '单据为新建状态,不需解绑!');
                return;
            }
            Leaf.showConfirm('${l:HLS.PROMPT}', '确认解绑?', function () {
                Leaf.request({
                    url: $('${/parameter/@layout_code}_cancel_mark_link').getUrl(),
                    para: {
                        assets_id: record[0].get('assets_id')
                    },
                    success: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        Leaf.SideBar.show({
                            msg: '解绑成功',
                            duration: 2000
                        });
                        $(asset_ds_id).query();
                        $(tre_assets_ln_ds_id).query();
                    },
                    failure: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            });

        }

        /*保存前调用,生成资产包编号*/
        window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
            var tre_assets_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var tre_assets_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            var tre_record = $(tre_assets_ds_id).getAt(0);
            var check_flag = false;
            if (tre_record.get('assets_number')) {
                return true;
            }
            window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
            Leaf.request({
                url: $('get_assets_number_link_id').getUrl(),
                para: {
                    document_category: 'LOAN_CONTRACT',
                    document_type: 'ASSETS',
                    function_code: '${/parameter/@function_code}'
                },
                success: function (res) {
                    var document_number = res.result.document_number;
                    tre_record.set('assets_number', document_number);
                    check_flag = true;
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                error: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                failure: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                sync: true,
                scope: this
            });
            return check_flag;

        };
        //保存submitsuccess调用
        window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res, bp_seq) {
            // 
            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            var tre_assets_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var tre_assets_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            $(tre_assets_ds_id).query();
            /* $(tre_assets_ln_ds_id).query();*/
        };


        //查询时调用(form,fieldboxcolumn)
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_query'] = function (ds, qpara, bp_seq) {
            // 
            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            var tre_assets_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var tre_assets_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');

            var ast_type = '${/parameter/@ast_type}';
            if (ast_type == 'TRE') {
                var assets_id = '${/parameter/@assets_id}';
            }
            else if (ast_type == 'CON') {
                var record = $(tre_assets_ds_id).getCurrentRecord();
                var assets_id = record.get('assets_id');
            }
            qpara.assets_id = assets_id;
        };

        //维护 add  by zhuxianfei  20181005
        window['${/parameter/@layout_code}_G_RESULT_USER_BUTTON3_layout_dynamic_tab_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var record = $(ds_id).getCurrentRecord();
            var status = record.get('status');
            if (status != 'NEW') {
                Leaf.showMessage('${l:PROMPT}', '当前单据状态不可维护数据,请先解绑!');
                return;
            }
            var asset_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract_ln');
            var param = {};
            param['function_code'] = 'TRE1050Q';
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
            param['winid'] = '${/parameter/@layout_code}_winid';
            param['dsid'] = asset_ds_id;
            param['assets_id'] = record.get('assets_id');
            param['url_title'] = '合同信息';
            hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, 'tre_asset_contract_modify_link', asset_ds_id);

        }

        //合同导入
        window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_assets_contract');
            var record = $(ds_id).getCurrentRecord();
            var assets_id = record.get('assets_id');
            if (Ext.isEmpty(assets_id)) {
                Leaf.showMessage('${l:PROMPT}', '请先保存生成资产包编号');
                return;
            } else {
                new Leaf.Window({
                    id: 'upload_window',
                    url: $('import_upload_link').getUrl() + '?assets_id=' + assets_id,
                    title: '导入实例',
                    width: 420,
                    height: 300
                });
            }

        }


        ]]></script>

    </a:view>
</a:screen>