configList.html
3.93 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
<style>
.btn-download span {
line-height: 40px;
color: #87CEFA;
}
</style>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 160px">
<script>
document.write(addHead('配置管理', ''));
</script>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="configTable"></table>
</div>
</div>
<script type="text/javascript">
var param = {};
$(function () {
$("#configTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/ResourcesGoodsPool/selectAll",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "配置说明",
field: "poolName",
width: 40,
align: "center"
}, {
title: "配置值",
field: "poolId",
width: 80,
align: "center",
formatter: function (value, rowData) {
var v = value==null?"":value;
var str = "<input id='pool_id_"+rowData.id+"' type='text' value='"+v+"'>";
return str;
}
}, {
title: "操作",
field: "operations",
width: 80,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #5bc0de'>提交</a>";
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
$.parser.parse($("#configTable").parent());
// 编辑
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
editRow(id);
}
});
}
});
function editRow(id) {
debugger
var pool_id = document.getElementById("pool_id_"+id).value;
var ajaxData = {};
ajaxData.poolId = pool_id;
ajaxData.id = id;
$.ajax({
url: contextPath + '/ResourcesGoodsPool/updatePoolIdById',
contentType: "application/json",
dataType: "json",
type: "POST",
data: JSON.stringify(ajaxData),
success: function(ret) {
$.messager.progress("close");
if (ret && ret.code == 200 && ret.data == 1) {
$.messager.show({
title:'操作提示',
msg:'提交成功'
});
$("#configTable").myDatagrid("load", param);
} else {
$.messager.alert('操作提示', '提交失败');
}
},
error: function(err) {
$.messager.progress("close");
$.messager.alert('操作提示', err.message || '提交失败');
}
});
}
});
</script>
</body>
</html>