hls_bp_master_credit.lview 12.4 KB
Newer Older
stone's avatar
stone committed
1 2 3 4 5 6 7 8 9 10
<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author: chenlingfeng7543
$Date: 2018/12/20 21:19
$Revision: 1.0
$Purpose: 商业伙伴授信维护
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
11
        <a:model-query  defaultWhereClause="t1.user_id=${/session/@user_id} and position_code in(005,006)" fetchAll="true" model="csh.CSH509.query_roles_info" rootPath="position_code"/>
stone's avatar
stone committed
12

stone's avatar
stone committed
13 14
    </a:init-procedure>
    <a:view>
stone's avatar
stone committed
15
        <a:link id="hn1150_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
16
        <a:link id="hls361_hls_bp_master_credit_tenant_detail_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_entrance_detail.lview"/>
17
        <a:link id="hls361_hls_bp_master_create_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_credit.lview"/>
stone's avatar
stone committed
18
        <a:link id="hls361_hls_bp_master_maintain_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_credit_maintain.lview"/>
19
        <a:link id="hls361_hls_bp_master_credit_agent_detail_link" url="${/request/@context_path}/modules/hls/HLS362N/credit_entrance_detail_confirm.lview"/>
stone's avatar
stone committed
20
        <a:link id="hls361N_update_credit_status_link_id" model="hls.HLS361N.hls_bp_master_credit_update_status" modelaction="update"/>
stone's avatar
stone committed
21
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
stone's avatar
stone committed
22
        <a:link id="check_roles" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
23 24 25
        <a:link id="check_create_record_link_id" model="hls.HLS361N.hls_bp_master_create_record"
                modelaction="update"/>
        <a:link id="credit_detail_link" url="${/request/@context_path}/modules/hls/HLS361N/hls_bp_mster_credit_record.lview"/>
stone's avatar
stone committed
26
        <script type="text/javascript"><![CDATA[
stone's avatar
stone committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
        var user_code='';
        Leaf.onReady(function(){
            user_code='${/model/position_code/record/@position_code}';
        })
        //判断角色是否可以操作
        function judgeRoles(position_code){
            var datas='${/model/position_code}'.data;
            for(var i=0;i<datas.length;i++){
                if(datas[i].data.position_code==position_code){
                    return true;
                }
            }
            return false;
        }
        //超链接渲染
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
43
            //console.log(record);
stone's avatar
stone committed
44 45 46
            var link_function = '';
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'bp_code' && value) {
47 48 49 50 51
                if (record.get('bp_category')=='TENANT'){
                    link_function = 'on_business_tenant_detail_window';
                }else if ( record.get('bp_category')=='AGENT'){
                    link_function = 'on_business_agent_detail_window';
                }
stone's avatar
stone committed
52 53
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + value + '</a>';
            }
stone's avatar
stone committed
54 55
        }

stone's avatar
stone committed
56 57 58 59 60 61 62 63 64 65 66 67 68
        //
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            //获取ds
            var credit_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_credit_hd');
            var  datas=$(credit_ds).selected;
            //只能选择一条数据
            if(datas.length!=1){
                $L.showInfoMessage("提示",'请选择一条数据',null,null)
                  return;
            }
            //设置为可以修改
            //datas[0].getField('credit_total_amount').setReadOnly(false);
        }
69
        //1.	营业副部长/营业担当勾选授信状态为“启用”或“停用
stone's avatar
stone committed
70 71
        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
           //授信额度变更
stone's avatar
stone committed
72
            var param={};
stone's avatar
stone committed
73 74 75
            var credit_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_credit_hd');
            var  datas=$(credit_ds).selected;
            if(datas.length!=1){
stone's avatar
stone committed
76
                $L.showInfoMessage("提示",'请选择要变更的数据',null,null)
stone's avatar
stone committed
77 78 79 80
                return;
            }
            //启用和审批冻结判断
            var credit_status=datas[0].data.credit_status;
81 82 83 84 85 86 87 88 89
            // if(credit_status!='ENABLE'&&credit_status!='DISABLE'&&credit_status!='REFUSE'){
            //     $L.showInfoMessage("提示",'请选择状态为启用,停用和审批拒绝的数据!',null,null)
            //     return;
            // }

            //005   营业副部长
            //006  营业担当
           if(user_code==''||user_code==undefined){
                $L.showInfoMessage("提示",'只有营业副部长和营业担当才能操作数据!');
stone's avatar
stone committed
90 91
                return;
            }
92 93
            if(datas[0].get('credit_status')=='APPROVING'){
                $L.showInfoMessage("提示",'该授信记录审批中,无法维护!');
stone's avatar
stone committed
94 95 96
                return;
            }

stone's avatar
stone committed
97 98 99 100 101 102 103 104 105 106 107
            //跳转到维护页面
            param['function_code'] = 'HLS36105_M';
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
            param['url_title'] = '商业伙伴授信维护';
            param['bp_category_n']=datas[0].get('bp_category_n');
            param['bp_credit_hd_id']=datas[0].get('bp_credit_hd_id');
            param['bp_name']=datas[0].get('bp_name');
            param['credit_date_from']=datas[0].get('credit_date_from');
            param['credit_total_amount']=datas[0].get('credit_total_amount');
            param['bp_code']=datas[0].get('bp_code');
108
          //  param['bp_id']=datas[0].get('bp_id');
109
            param['credit_status']=datas[0].get('credit_status');
110 111 112
            param['winid']='hls_bp_credit_winId';

            hls_doc_get_layout_code('hn1150_get_layout_code_link_id', param, 'hls361_hls_bp_master_maintain_link', credit_ds);
stone's avatar
stone committed
113 114 115


           /* var credit_date_from=Leaf.formatDate(datas[0].data.credit_date_from)
stone's avatar
stone committed
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
            var credit_date_to=Leaf.formatDate(datas[0].data.credit_date_to)
            //进行数据的校验
            //1)	“授信总额度”录入值不能小于“已使用额度”;若小于,则报错提示:“修改后剩余授信额度小于0!”;
            //2)	“授信时间到”录入值需大于“授信时间从”录入值;若小于,则报错提示:“终止日需大于生效日!”;
            // 3)	“授信时间到”录入值需大于系统当前时间;若小于,则报错提示:“终止日早于当前时间!”
            var total_amount=datas[0].data.credit_total_amount;
            var used_credit_amount=datas[0].data.used_amount;
            if(total_amount<used_credit_amount){
                $L.showErrorMessage("错误",'修改后剩余授信额度小于0',null,null);
                return;
            }
            if(credit_date_from>credit_date_to){
                $L.showErrorMessage("错误",'终止日需大于生效日',null,null);
                return;
            }
            if(datas[0].data.credit_date_to<new Date()){
                $L.showErrorMessage("错误",'终止日早于当前时间',null,null);
                return;
            }
            //用户点击“授信额度变更”按钮后,授信状态变为“审批冻结”,该商业伙伴无法提报单据,同时需要记录变更前的“授信总额度”录入值(后台表);
           //锁屏

            $L.showConfirm("提示",'确认变更该条记录的相关信息?',function(){
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: $('hls361N_update_credit_status_link_id').getUrl(),
                    para: {
                        bp_credit_hd_id    :   datas[0].data.bp_credit_hd_id,
                        credit_total_amount:   total_amount,
                        credit_date_from   :   credit_date_from,
                        credit_date_to     :   credit_date_to
                    },
                    success: function ()  {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        $(credit_ds).query();
                    },
                    error: function() {
                    },
                    failure: function() {
                    },
                    sync: true,
                    scope: this
                });
stone's avatar
stone committed
163
            })*/
stone's avatar
stone committed
164 165 166



167 168 169
        }
        //商业伙伴创建按钮
        window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
170
            var credit_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_credit_hd');
171 172 173 174 175
            var param={};
            param['function_code'] = 'HLS36105';
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
            param['url_title'] = '商业伙伴授信维护';
176 177
            param['winid']='hls_bp_create_winid';
            hls_doc_get_layout_code('hn1150_get_layout_code_link_id', param, 'hls361_hls_bp_master_create_link', credit_ds);
stone's avatar
stone committed
178
        }
179 180
        //--承租人的详细信息
        function on_business_tenant_detail_window(id, name) {
stone's avatar
stone committed
181
            //获得该条record的所有数据
stone's avatar
stone committed
182 183
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var param = record.data;
stone's avatar
stone committed
184
            param['function_code'] = 'HLS36101';
stone's avatar
stone committed
185 186
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
stone's avatar
stone committed
187
            param['url_title'] = '商业伙伴授信详细';
188
            hls_doc_get_layout_code('hn1150_get_layout_code_link_id', param, 'hls361_hls_bp_master_credit_tenant_detail_link', null);
stone's avatar
stone committed
189
        }
190 191 192 193 194 195 196 197 198 199 200 201
        //--经销商的详细信息
        function on_business_agent_detail_window(id, name) {
            //获得该条record的所有数据
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var param = record.data;
            param['function_code'] = 'HLS36103';
            param['function_usage'] = 'MODIFY';
            param['maintain_type'] = 'UPDATE';
            param['url_title'] = '商业伙伴授信详细';
            hls_doc_get_layout_code('hn1150_get_layout_code_link_id', param, 'hls361_hls_bp_master_credit_agent_detail_link', null);
        }

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
        // //变更履历按钮
        window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
            var credit_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_credit_hd');
            var record = $(credit_ds).getCurrentRecord();
            Leaf.Masker.mask(Ext.getBody(), '正在执行...');
            Leaf.request({
                url: $('check_create_record_link_id').getUrl(),
                para: {
                    bp_credit_hd_id: record.get('bp_credit_hd_id')
                },
                success: function () {
                    Leaf.Masker.unmask(Ext.getBody());

                    var win = new Leaf.Window({
                        id: 'hls_bp_credit_record_window',
                        params: {
                            bp_credit_hd_id: record.get('bp_credit_hd_id'),
                            winid: 'hls_bp_credit_record_window'
                        },
                        url: $('credit_detail_link').getUrl(),
                        title: '授信额度变更履历',
                        fullScreen: true
                    });
                    win.on('close', function () {
                       // ds.query(ds.currentPage);
                    });
                },
                failure: function () {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                error: function () {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                scope: this
            });
        }

stone's avatar
stone committed
239 240 241 242 243 244


        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>