con_contract_content_query.lview 15.7 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 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-4-20 上午10:19:19  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.hls_sys_time_default_value" rootPath="default_value_path"/>
    </a:init-procedure>
    <a:view>
        <!--   <a:link id="con_content_record_id" url="${/request/@context_path}/modules/cont/CON555A/con_contract_content.lview"/> -->
        <a:link id="wfl_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="wfl_prj_chance_create_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain.lview"/>
        <a:link id="con_application_archive_link" url="${/request/@context_path}/modules/cont/CON555A/con_contract_archive.lview"/>
        <a:link id="courier_number_query_link" url="${/request/@context_path}/modules/cont/CON555A/courier_number_query.lview"/>
        <a:link id="con_contract_storage_apply_link" url="${/request/@context_path}/modules/cont/CON570/con_contract_storage_apply.lview"/>
        <a:link id="con_contract_storage_apply_rd_link" url="${/request/@context_path}/modules/cont/CON575/con_contract_storage_apply.lview"/>
        <a:link id="submit_approval_link" model="cont.CON555A.contract_workflow_start" modelaction="batch_update"/>
        <a:link id="con_contract_send_sms_link" url="${/request/@context_path}/modules/cont/CON570/con_contract_content_send_sms.lsc"/>
        <a:link id="con_contract_archive_link" model="cont.CON570.contract_archive" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
            function application_archive() {
                var recodes = $('con_contract_v_for_query_result_ds').getSelected();
                if (recodes.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '未选择合同不能进行归档操作!');
                    return;
                }
                // for (var i = 0;i < recodes.length;i++) {
                // if (Ext.isEmpty(recodes[i].get('collect_complete_date'))) {
                // Leaf.showMessage('${l:HLS.PROMPT}', '有合同收集资料未完成,不能进行归档!');
                // return;
                // }
            
                // }
                for (var j = 0;j < recodes.length;j++) {
            
                    var archive_status = recodes[j].get('archive_status');
            
                    if (archive_status != '10') {
                        Leaf.showMessage('${l:HLS.PROMPT}', '该合同正在归档中或归档完毕,不能重复发起!');
                        return;
                    }
                }
                // var cons={};
                // // for(var data in recodes){
                // // cons.push(data.get('contract_id'));
                // // }
                // for(var i=0;i<recodes.length;i++){
                // //cons.push(recodes[i].get('contract_id'));
                // cons[i]=recodes[i].get('contract_id');
                // }
                // //cons['invoice_agent_desc']='代理商'
                // alert(cons);
                var url = $('con_application_archive_link').getUrl();
                var win = new Leaf.Window({
                    id: 'application_archive_mail_window',
                    url: url,
                    params: {
                        invoice_agent_desc: '代理商'
                    },
                    title: '资料收集',
                    fullScreen: true
                });
                win.on('close', function() {
                    $('con_contract_v_for_query_result_ds').query();
                });
            
            }
            
            function query_con_contract_v_for_query_result_ds() {
            
                $('con_contract_v_for_query_result_ds').query();
            }
            
            function reset_con_contract_v_for_query_query_ds() {
                $('con_contract_v_for_query_query_ds').reset();
            }
            
            
            function con555_con_contract_archive(record_id) {
                var record = $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').findById(record_id);
            
                con555_contractMaintainDs_grid_update2(record.get('contract_id'), record.get('cdd_list_id'), record.get('archive_status'));
                // if ($('con_contract_v_for_query_result_ds').getCurrentRecord()) {
                // var record = $('con_contract_v_for_query_result_ds').getCurrentRecord();
                // con555_contractMaintainDs_grid_update2(record.get('contract_id'), record.get('cdd_list_id'));
                // }
            }
            
            function con555_contractMaintainDs_grid_update2(contract_id, cdd_list_id, archive_status) {
                var url;
                if (archive_status == '30') {
                    url = $('con_contract_storage_apply_rd_link').getUrl();
                } else {
                    url = $('con_contract_storage_apply_link').getUrl();
                }
                var win = new Leaf.Window({
                    id: 'con_contract_storage_apply_window',
                    url: url,
                    params: {
                        contract_id: contract_id,
                        cdd_list_id: cdd_list_id
                    },
                    title: '资料收集',
                    fullScreen: true
                });
                win.on('close', function() {
                    $('con_contract_v_for_query_result_ds').query();
                });
            }
            
            function con555_render_contractMaintainDs_grid(value, record, name) {
                if (name == 'contract_number') {
                    return '<a href="javascript:con555_con_contract_archive(' + record.id + ');">' + value + '</a>';
                    //return '<a href="javascript:con555_contractMaintainDs_grid_update(' + record.id + ');">' + value + '</a>';
            
                    //record.id是啥子呦。
            
                }
            }
            
            
            
            function on_base_ds_project_number_render(value, record, name) {
            
                return '<a href="javascript:do_open_prj(\'' + record.ds.id + '\')" >' + value + '</a>';
            }
            
            function do_open_prj(ds_id) {
            
                var record = $(ds_id).getCurrentRecord();
                record.set('function_code', 'PRJ501W');
                record.set('function_usage', 'QUERY');
                record.set('document_category', 'PROJECT');
                record.data['url_title'] = '租赁申请查询';
                record.data['window_open_flag'] = 'Y';
                record.data['show_history_flag'] = 'Y';
                var param = record.data;
                hls_doc_get_layout_code('wfl_con_contract_get_layout_code_link_id', param, 'wfl_prj_chance_create_link');
            }
            
            function archive_status_renderer(value, record, name) {
                if (value == '延迟催促') {
                    return "<font color='red'>" + value + "</font>";
                }
                return value;
            
            }
            
            function delay_day_renderer(value, record, name) {
                var reg_status_n = record.get('reg_status_n');
                if (reg_status_n == '已归档') {
                    return;
                }
                return value;
            }
            
            function collect_complete_n_renderer(value, record, name) {
                if (value == '是') {
                    var days = record.get('days');
                    if (days > 5) {
                        return "<font color='red'>" + value + "</font>";
                    }
                }
                return value;
            
            }
            
            function courier_query() {
                var url = $('courier_number_query_link').getUrl();
                var win = new Leaf.Window({
                    id: 'courier_number_query_window',
                    url: url,
                    title: '资料收集',
                    fullScreen: true
                });
            
            }
            
            function submit_approval() {
                //
                var records = $('con_contract_v_for_query_result_ds').getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '未选择合同不能进行归档操作!');
                    return;
                }
                var prams = [];
                for (var i = 0;i < records.length;i++) {
                    // var contract_id=records[i].get('contract_id');
                    // var data={'contract_id':contract_id,
                    // status:'archive'
                    // };
                    //prams.push(data);
                    var data = {};
                    data['contract_id'] = records[i].get('contract_id');
            
                    data['_status'] = 'update';
                    prams[i] = data;
                }
            
                Leaf.request({
                    url: $('submit_approval_link').getUrl(),
                    para: prams,
                    success: function() {
            
                        $('application_archive_mail_window').close();
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                    },
                    failure: function() {
            
                       },
                    error: function() {
            
                       },
                    scope: this
                });
            
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                var link_function = '';
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'contract_number') {
                    link_function = 'con555_con_contract_archive';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\');">' + value + '</a>';
                }
            };
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                $('CONTRACT_ARCHIVE_G_LIST_con_contract_layout_grid_id')._export('xls', '合同档案归档导出文件_${/model/default_value_path/record/@now_time}');
            };
            
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var records = $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请选择一个合同进行归档操作!');
                    return;
                }
                var url = $('con_contract_storage_apply_link').getUrl();
                var contract_id = records[0].get('contract_id');
                var cdd_list_id = records[0].get('cdd_list_id');
                var win = new Leaf.Window({
                    id: 'con_contract_storage_apply_window',
                    url: url,
                    params: {
                        contract_id: contract_id,
                        cdd_list_id: cdd_list_id
                    },
                    title: '资料收集',
                    fullScreen: true
                });
                win.on('close', function() {
                    $('con_contract_v_for_query_result_ds').query();
                });
            };
            
            window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
                var records = $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一个合同进行归档操作!');
                    return;
                }
                var prams = [];
                for (var i = 0;i < records.length;i++) {
                    // var contract_id=records[i].get('contract_id');
                    // var data={'contract_id':contract_id,
                    // status:'archive'
                    // };
                    //prams.push(data);
                    var data = {};
                    data['contract_id'] = records[i].get('contract_id');
            		data['archive_status'] = '30';
                    data['_status'] = 'update';
                    prams[i] = data;
                }
            	Leaf.showConfirm('${l:HLS.PROMPT}', '是否确认批量归档?', function() {
                    Leaf.request({
                    url: $('con_contract_archive_link').getUrl(),
                    para: prams,
                    success: function() {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').query();
                    },
                    failure: function() {
            
                       },
                    error: function() {
            
                       },
                    scope: this
                });
                });
                
            };
            
            //短信通知
            window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
                var records = $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').getSelected();
                if (records.length == 0) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一个合同发送短信!');
                    return;
                }
                for (var i = 0;i < records.length;i++) {
                    var archive_status = records[i].get('archive_status');
                    if (archive_status != '20') {
                        Leaf.showMessage('${l:HLS.PROMPT}', '请勾选问题件合同发送短信!');
                        return;
                    }
                }
                Leaf.showConfirm('${l:HLS.PROMPT}', '是否确认发送短信?', send_con_storage_sms, function() {
                    return;
                });
            };
            
            
            function send_con_storage_sms() {
                var records = $('CONTRACT_ARCHIVE_G_LIST_con_contract_ds').getSelected();
                var url = $('con_contract_send_sms_link').getUrl();
                var prams = [];
                for (var i = 0;i < records.length;i++) {
                    var data = {};
                    data['contract_id'] = records[i].get('contract_id');
                    data['_status'] = 'update';
                    prams[i] = data;
                }
                Leaf.request({
                    url: url,
                    para: prams,
                    success: function(res) {
                        //alert(1)
                        // Leaf.SideBar.show({
                        // msg: '操作成功!',
                        // duration: 5000
                        // });
                        Leaf.showMessage('${l:HLS.PROMPT}', '操作成功!');
                    },
                    failure: function() {},
                    error: function() {},
                    scope: this
                });
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>