inventory.js
1.84 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
73
74
75
76
/**
* 网点库存
*/
var Inventory = function(){
return {
search : function(){
$('#data-grid').datagrid({
url : '/user/inventory/search',
queryParams : App.dataGridQueryParams('search-form')
});
},
formatStatus : function(value, row, index){
switch (value) {
case '0':
return '禁用';
case '1':
return '可用';
}
},
operateInventory : function(){
var row = $("#data-grid").datagrid("getSelected");
if(row){
if(row.status == '1'){
$("#id").val(row.id);
$("#warehouseName").html(row.warehouseName);
$("#otcCode").html(row.otcCode);
$("#otcName").html(row.otcName);
$("#usefulAmount").html(row.usefulAmount);
$("#occurAmount").textbox("setValue", '');
$("#occurAmount").textbox("setText", '');
$("#remark").textbox('setValue', '');
$("#remark").textbox('setText', '');
$("input[name='type']").removeAttr("checked");
$("#operate-inventory-dialog").dialog('open');
} else {
$.messager.alert("提示", "禁用的网点不可操作");
}
}else{
$.messager.alert("提示", "请选择要操作的数据");
}
},
/**网点信息提交*/
formSubmit : function(){
$('#operate-form').form('submit', {
onSubmit : function(param) {
if($("input[name='type']:checked").val() == null){
$.messager.alert("Warning", "操作类型必选");
return false;
}
return $(this).form('validate');
},
success : function(data) {
var result = $.parseJSON(data);
if(result.success == true){
$('#operate-inventory-dialog').dialog('close');
$('#data-grid').datagrid("reload");
}
$.messager.alert('操作结果', result.data);
},
error : function() {
}
});
},
export : function(){
window.open('/user/inventory/export?' + $('#search-form').serialize());
}
}
}();