|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
<title>Yoho!Buy运营平台</title>
|
|
|
<script src="/pfcms/js/include.js"></script>
|
|
|
<script src="/pfcms/js/ajaxfileupload.js"></script>
|
|
|
<style>
|
|
|
.btn-long {
|
|
|
width: 120px;
|
|
|
height: 37px;
|
|
|
line-height: 37px;
|
|
|
font-size: 15px;
|
|
|
color: white;
|
|
|
border-radius: 5px;
|
|
|
display: inline-block;
|
|
|
cursor: pointer;
|
|
|
text-align: center;
|
|
|
}
|
|
|
.btn-long:hover {
|
|
|
opacity: 0.9;
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
</head>
|
|
|
<body class="easyui-layout" >
|
|
|
<div region="north" style="height: 200px;">
|
|
|
<script>
|
|
|
document.write(addHead('运营管理', '标签管理'));
|
|
|
</script>
|
|
|
|
|
|
<div style="margin-left: 20px;margin-top: 10px">
|
|
|
|
|
|
<input class="easyui-textbox" id="labelNameParam" style="width: 140px">
|
|
|
|
|
|
</input>
|
|
|
<input class="easyui-combobox" id="groupIdParam" >
|
|
|
</input>
|
|
|
<input class="easyui-combobox" id="statusParam" >
|
|
|
</input>
|
|
|
|
|
|
<a id="searchBtn" class="btn-info">查询</a>
|
|
|
<!--<a id="addActivityBtn" class="btn-success">新增</a>-->
|
|
|
<a id="allBtn" class="btn-info">全部</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="margin-left: 20px;margin-top: 10px">
|
|
|
<a id="addBtn" class="btn-long" style="background-color: #5CB85C;">+新建标签</a>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div region="center" id="labelList" style="margin-left: 20px">
|
|
|
<table id="labelListTable"></table>
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
$(function() {
|
|
|
//用于页面刷新后的数据行定位
|
|
|
var index ="";
|
|
|
$("#allBtn").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
$("#labelListTable").datagrid("load", {});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
$("#labelNameParam").textbox({
|
|
|
required:false,
|
|
|
prompt: "请输入标签名称"
|
|
|
});
|
|
|
|
|
|
$("#groupIdParam").combobox({
|
|
|
valueField : "id",
|
|
|
textField : "groupName",
|
|
|
required:false,
|
|
|
prompt: "请选择分组",
|
|
|
url : contextPath + "/labelGroupManage/getAllLabelGroupInfo",
|
|
|
loadFilter: function (data) {
|
|
|
var data = defaultLoadFilter(data);
|
|
|
data.unshift({'id': '', 'groupName': '--请选择分组--'});
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
$("#statusParam").combobox({
|
|
|
valueField : "value",
|
|
|
textField : "text",
|
|
|
required:false,
|
|
|
prompt: "请选择状态",
|
|
|
data:[{text:"请选择状态",value:""},{text:"开启",value:"1"},{text:"关闭",value:"0"}]
|
|
|
});
|
|
|
|
|
|
|
|
|
$("#searchBtn").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
$("#labelListTable").datagrid("load", {
|
|
|
labelName: $("#labelNameParam").textbox("getValue"),
|
|
|
groupId:$("#groupIdParam").combobox("getValue"),
|
|
|
status: $("#statusParam").combobox("getValue")
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
$("#addBtn").click(function () {
|
|
|
getEditDialog(null);
|
|
|
});
|
|
|
|
|
|
|
|
|
// 检索按钮
|
|
|
$("#labelListTable").myDatagrid({
|
|
|
fit: true,
|
|
|
fitColumns: true,
|
|
|
striped: true,
|
|
|
/*queryParams: {
|
|
|
rewardName: $("#rewardName1").textbox("getValue"),
|
|
|
status: $("#rewardstatus1").combobox("getValue"),
|
|
|
type: $("#rewardtype1").combobox("getValue")
|
|
|
},*/
|
|
|
url: contextPath + "/grassLabelManage/getGrassLabelList",
|
|
|
method: 'POST',
|
|
|
loadFilter: function (data) {
|
|
|
var tmp = defaultLoadFilter(data);
|
|
|
tmp.rows = tmp.list;
|
|
|
return tmp;
|
|
|
},
|
|
|
columns: [[
|
|
|
{
|
|
|
title: "ID",
|
|
|
field: "id",
|
|
|
width: 15,
|
|
|
align: "center"
|
|
|
},
|
|
|
|
|
|
{
|
|
|
title: "标签名称",
|
|
|
field: "labelName",
|
|
|
width: 30,
|
|
|
align: "left"
|
|
|
},
|
|
|
{
|
|
|
title: "标签分组",
|
|
|
field: "groupName",
|
|
|
width: 20,
|
|
|
align: "left"
|
|
|
}, {
|
|
|
title: "状态",
|
|
|
field: "status",
|
|
|
width: 25,
|
|
|
align: "left",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
if(value == '0'){
|
|
|
return "关闭";
|
|
|
}
|
|
|
if(value == '1'){
|
|
|
return "开启";
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
title: "操作",
|
|
|
field: "ddg",
|
|
|
width: 40,
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
var str = "<a role='edit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #31b0d5' index='"+ rowIndex +"'>编辑</a>";
|
|
|
str += "<a role='close' style='margin-left:10px;background-color: #ffa951' dataId='"+ rowData.id +"' index='"+ rowIndex +"' groupId='"+rowData.groupId+"'>删除</a>";
|
|
|
return str;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
]],
|
|
|
cache: false,
|
|
|
pagination: true,
|
|
|
pageSize: 10,
|
|
|
pageList: [10],
|
|
|
idField: "id",
|
|
|
singleSelect: true,
|
|
|
onLoadSuccess: function (data) {
|
|
|
|
|
|
if(index != ""){
|
|
|
$(this).datagrid("scrollTo",index);
|
|
|
index = "";
|
|
|
}
|
|
|
$(this).datagrid("getPanel").find("a[role='close']").linkbutton({
|
|
|
iconCls: "icon-redo",
|
|
|
onClick: function () {
|
|
|
var close_id = $(this).attr("dataId");
|
|
|
var group_id = $(this).attr("groupId");
|
|
|
index = $(this).attr("index");
|
|
|
$.messager.confirm("确认", "确认删除该分组吗?", function (flag) {
|
|
|
if(flag){
|
|
|
$.post(contextPath + "/grassLabelManage/deleteGrassLabel", {
|
|
|
id : close_id,
|
|
|
groupId: group_id
|
|
|
}, function(data) {
|
|
|
if (data.code == CODE_SUCCESS) {
|
|
|
$("#labelListTable").datagrid("reload");
|
|
|
window.self.$.messager.show({
|
|
|
title : "提示",
|
|
|
msg : "删除成功!"
|
|
|
});
|
|
|
} else {
|
|
|
window.self.$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 编辑
|
|
|
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
|
|
|
iconCls : "icon-edit",
|
|
|
onClick : function() {
|
|
|
|
|
|
index = $(this).attr("index");
|
|
|
var row = $("#labelListTable").datagrid('getData').rows[index];
|
|
|
getEditDialog(row);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// 编辑分组
|
|
|
function getEditDialog(data){
|
|
|
var labelList = $("<div id='labelList'>").appendTo($(document.body));
|
|
|
var title = data == null ? "新建标签":"修改标签";
|
|
|
var textVar = data == null ? "保存":"保存";
|
|
|
var msgVar = data == null ? "确认新增标签吗?":"确认保存标签吗?";
|
|
|
|
|
|
window.self.paramObject.mkData = data;
|
|
|
$(labelList).myDialog({
|
|
|
title: title,
|
|
|
width: "70%",
|
|
|
height: "80%",
|
|
|
resizable:false,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:textVar,
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
|
|
|
|
|
|
$("#activityAddForm").form("submit", {
|
|
|
url: contextPath + "/grassLabelManage/addUpGrassLabel",
|
|
|
onSubmit: function (param) {
|
|
|
if(data != null){
|
|
|
param.id = data.id;
|
|
|
}
|
|
|
// param.status = $("input[name='statusRadio'][checked]").val();
|
|
|
if (!$("#activityAddForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var groupId = $("#groupId").combobox('getValue');
|
|
|
if(groupId == null || groupId == ""){
|
|
|
$.messager.alert("info", "提交失败,请选择分组", "info");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后..."
|
|
|
});
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(labelList).dialog("close");
|
|
|
$("#labelListTable").datagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
|
|
|
if(flag){
|
|
|
$(labelList).dialog("close");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/grass/labelManage/labelEdit.html",
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
</html> |
|
|
\ No newline at end of file |
...
|
...
|
|