|
|
<!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>
|
|
|
</head>
|
|
|
<body class="easyui-layout" fit="true">
|
|
|
<div region="north" style="height: 230px">
|
|
|
<script>
|
|
|
document.write(addHead('UFO推荐商品配置', ''));
|
|
|
</script>
|
|
|
<style>
|
|
|
.div_search input {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
|
|
|
.div_search .textbox {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
|
|
|
.div_search .easyui-linkbutton {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
</style>
|
|
|
<div style="margin-left: 30px;" class="div_search">
|
|
|
<input id="productId" type="text">
|
|
|
<input id="productName" type="text">
|
|
|
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
|
|
|
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
|
|
|
<a id="addProduct" class="easyui-linkbutton btn-success" data-options="iconCls:'icon-search'">新增</a>
|
|
|
<a id="addProductBatch" class="easyui-linkbutton btn-success" style="margin-left: 50px">批量新增</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div region="center">
|
|
|
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
|
|
|
<table id="productRecommendListTable"></table>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
var editId;
|
|
|
function getEditDialog(){
|
|
|
var title="批量新增";
|
|
|
var url = contextPath + "/productRecommend/insertBatch";
|
|
|
var div = $("<div>").appendTo($(window.self.document.body));
|
|
|
window.self.$(div).myDialog({
|
|
|
title: title,
|
|
|
width: "30%",
|
|
|
height: "30%",
|
|
|
resizable:true,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:'保存',
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
window.self.$("#insertBatchForm").form("submit", {
|
|
|
url : url,
|
|
|
onSubmit : function(param) {
|
|
|
|
|
|
},
|
|
|
success : function(data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(div).dialog("close");
|
|
|
$("#productRecommendListTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},{
|
|
|
id : "closeBtn",
|
|
|
text:'取消',
|
|
|
iconCls : "icon-cancel",
|
|
|
handler:function(){
|
|
|
window.self.$(div).dialog('close');
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/productRecommend/productRecommendAddBatch.html",
|
|
|
onOpen : function() {
|
|
|
window.setTimeout(function() {
|
|
|
$("#saveBtn").addClass("btn-success");
|
|
|
$("#closeBtn").addClass("btn-danger");
|
|
|
}, 100);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
$("#productId").textbox({
|
|
|
prompt: "商品Id"
|
|
|
});
|
|
|
$("#productName").textbox({
|
|
|
prompt: "商品名称"
|
|
|
});
|
|
|
|
|
|
$('#addProduct').linkbutton({
|
|
|
iconCls: "icon-edit",
|
|
|
onClick: function () {
|
|
|
editRow(0);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#addProductBatch").linkbutton({
|
|
|
text : "批量新增",
|
|
|
iconCls : "icon-del",
|
|
|
onClick : function() {
|
|
|
getEditDialog(null);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#productRecommendListTable").myDatagrid({
|
|
|
fit: true,
|
|
|
fitColumns: true,
|
|
|
nowrap: false,
|
|
|
url: contextPath + "/productRecommend/list",
|
|
|
method: 'POST',
|
|
|
loadFilter: function (data) {
|
|
|
var temp = defaultLoadFilter(data);
|
|
|
temp.rows = temp.list;
|
|
|
return temp;
|
|
|
},
|
|
|
columns: [[{
|
|
|
title: "ID",
|
|
|
field: "id",
|
|
|
align: "center",
|
|
|
hidden: true
|
|
|
}, {
|
|
|
title: "商品Id",
|
|
|
field: "productId",
|
|
|
width: 80,
|
|
|
align: "center"
|
|
|
}, {
|
|
|
title: "商品名称",
|
|
|
field: "productName",
|
|
|
width: 120,
|
|
|
align: "center",
|
|
|
},{
|
|
|
title: "次序",
|
|
|
field: "orderBy",
|
|
|
width: 80,
|
|
|
align: "center"
|
|
|
},{
|
|
|
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>";
|
|
|
str += "<a role='del' dataId='" + rowData.id + "' style='margin-left:10px;background-color: red'>删除</a>";
|
|
|
return str;
|
|
|
}
|
|
|
}]],
|
|
|
cache: false,
|
|
|
pagination: true,
|
|
|
pageSize: 20,
|
|
|
pageList: [20],
|
|
|
idField: "id",
|
|
|
singleSelect: false,
|
|
|
checkOnSelect: false,
|
|
|
onLoadSuccess: function () {
|
|
|
// 编辑
|
|
|
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
|
|
|
iconCls: "icon-edit",
|
|
|
onClick: function () {
|
|
|
var id = $(this).attr("dataId");
|
|
|
editRow(id);
|
|
|
}
|
|
|
});
|
|
|
// 删除
|
|
|
$(this).myDatagrid("getPanel").find("a[role='del']").linkbutton({
|
|
|
iconCls: "icon-more",
|
|
|
onClick: function () {
|
|
|
del($(this).attr("dataId"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
// 搜索
|
|
|
$("#searchLinkButton").linkbutton({
|
|
|
onClick: function () {
|
|
|
var param = getParams();
|
|
|
$("#productRecommendListTable").myDatagrid("load", param);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 搜索全部
|
|
|
$("#searchAllLinkButton").linkbutton({
|
|
|
onClick: function () {
|
|
|
$('#productId').textbox('clear');
|
|
|
$('#productName').textbox('clear');
|
|
|
var param = {};
|
|
|
$("#productRecommendListTable").myDatagrid("load", param);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 提取出搜索参数
|
|
|
*/
|
|
|
function getParams() {
|
|
|
// id
|
|
|
var productId = $('#productId').textbox('getText');
|
|
|
|
|
|
// 产品名称
|
|
|
var productName = $('#productName').textbox('getText');
|
|
|
var param = {};
|
|
|
if (undefined !== productId && null !== productId && "" !== productId) {
|
|
|
param.productId = productId;
|
|
|
}
|
|
|
if (undefined !== productName && null !== productName && "" !== productName) {
|
|
|
param.productName = productName;
|
|
|
}
|
|
|
return param;
|
|
|
}
|
|
|
|
|
|
|
|
|
function editRow(id) {
|
|
|
editId = id;
|
|
|
var div = $("<div>").appendTo($(document.body));
|
|
|
var title = "编辑";
|
|
|
var message = "确认修改吗?";
|
|
|
if (id == 0) {
|
|
|
title = "添加";
|
|
|
message = "确认添加吗?";
|
|
|
}
|
|
|
$(div).myDialog({
|
|
|
width: "600px",
|
|
|
height: "400px",
|
|
|
title: title,
|
|
|
href: contextPath + "/html/productRecommend/editProductRecommend.html",
|
|
|
queryParams: {
|
|
|
id: id
|
|
|
},
|
|
|
modal: true,
|
|
|
collapsible: true,
|
|
|
cache: false,
|
|
|
buttons: [{
|
|
|
id: "saveBtn",
|
|
|
text: "保存",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", message, function (flag) {
|
|
|
if (flag) {
|
|
|
var url = contextPath + "/productRecommend/addOrUpdate";
|
|
|
$("#productEditForm").form("submit", {
|
|
|
url: url,
|
|
|
onSubmit: function () {
|
|
|
if (!$("#productEditForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后..."
|
|
|
});
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(div).dialog("close");
|
|
|
$("#productRecommendListTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$(div).dialog("close");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function del(id) {
|
|
|
var message = "确定要删除吗?";
|
|
|
var msg = "删除成功";
|
|
|
$.messager.confirm("确认", message, function (flag) {
|
|
|
if (flag) {
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后...",
|
|
|
interval: 500,
|
|
|
text: ""
|
|
|
});
|
|
|
$.post(contextPath + "/productRecommend/deleteProductRecommendById", {
|
|
|
"id": id
|
|
|
}, function (data) {
|
|
|
$.messager.progress("close");
|
|
|
if (data.code == 200) {
|
|
|
$("#productRecommendListTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: msg,
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}, "json");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
</html> |
|
|
\ No newline at end of file |
...
|
...
|
|