trustApplySupplement.js
1.7 KB
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
/**
* 补货托管
*
* @author 仝玉甫
*/
var TrustApplySupplement = function() {
return {
search : function() {
$('#data-grid').datagrid({
url : '/ration/supplement/search?' + $('#search-form').serialize()
});
},
/**计算可托管量*/
applyAmount : function(value, row, index) {
var applicableAmount = row.totalAmount - row.turnover - row.applyCount;
if (applicableAmount != row.applicableAmount) {
$('#data-grid').datagrid('highlightRow', index);
}
return applicableAmount;
},
beforeUpdateTotalAmount: function() {
var row = $('#data-grid').datagrid('getSelected');
$('#add-form').form('reset');
if (row) {
$('#add-form').form('load', '/ration/supplement/queryByOtcCode?otcCode=' + row.otcCode);
}
$('#add-dialog').dialog('open');
},
/**修改入库总量*/
updateTotalAmount: function() {
$('#add-form').form('submit', {
url: '/ration/supplement/updateTotalAmount',
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
result = $.parseJSON(result);
if (result.success == true) {
$('#add-dialog').dialog('close');
$('#data-grid').datagrid('reload');
}
$.messager.show({
title: '信息',
msg: result.data
});
}
});
},
/**搜索补货托管记录*/
searchRecord : function() {
$('#data-grid').datagrid({
url : '/ration/supplement/searchRecord?' + $('#search-form').serialize()
});
},
formatBusinessFlag: function(value, row, index) {
switch (value) {
case '1':
return '补货托管';
case '2':
return '业务人员修改';
}
}
};
}();