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: 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>
<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"/>
</a:init-procedure>
<a:view>
<a:link id="hn1150_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="hls361_hls_bp_master_credit_tenant_detail_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_entrance_detail.lview"/>
<a:link id="hls361_hls_bp_master_create_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_credit.lview"/>
<a:link id="hls361_hls_bp_master_maintain_link" url="${/request/@context_path}/modules/hls/HLS361N/credit_credit_maintain.lview"/>
<a:link id="hls361_hls_bp_master_credit_agent_detail_link" url="${/request/@context_path}/modules/hls/HLS362N/credit_entrance_detail_confirm.lview"/>
<a:link id="hls361N_update_credit_status_link_id" model="hls.HLS361N.hls_bp_master_credit_update_status" modelaction="update"/>
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="check_roles" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<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"/>
<script type="text/javascript"><![CDATA[
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) {
//console.log(record);
var link_function = '';
window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'bp_code' && value) {
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';
}
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + value + '</a>';
}
}
//
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);
}
//1. 营业副部长/营业担当勾选授信状态为“启用”或“停用
window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
//授信额度变更
var param={};
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;
}
//启用和审批冻结判断
var credit_status=datas[0].data.credit_status;
// 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("提示",'只有营业副部长和营业担当才能操作数据!');
return;
}
if(datas[0].get('credit_status')=='APPROVING'){
$L.showInfoMessage("提示",'该授信记录审批中,无法维护!');
return;
}
//跳转到维护页面
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');
param['bp_id']=datas[0].get('bp_id');
param['credit_status']=datas[0].get('credit_status');
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);
/* var credit_date_from=Leaf.formatDate(datas[0].data.credit_date_from)
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
});
})*/
}
//商业伙伴创建按钮
window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
var credit_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_credit_hd');
var param={};
param['function_code'] = 'HLS36105';
param['function_usage'] = 'MODIFY';
param['maintain_type'] = 'UPDATE';
param['url_title'] = '商业伙伴授信维护';
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);
}
//--承租人的详细信息
function on_business_tenant_detail_window(id, name) {
//获得该条record的所有数据
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var param = record.data;
param['function_code'] = 'HLS36101';
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_tenant_detail_link', null);
}
//--经销商的详细信息
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);
}
// //变更履历按钮
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
});
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>