Authored by kun

add new files

<!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('品牌管理 /品牌系列', ''));
</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">
<a id="addBrandSeries" class="easyui-linkbutton btn-success">添加品牌系列</a>
</div>
<div style="margin-left: 30px;" class="div_search">
<input id="seriesName" type="text">
<input id="brandName" type="text"/>
<input id="seriesStatus" 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>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="brandSeriesTable"></table>
</div>
</div>
<script type="text/javascript">
var brandSeriesId;
$(function () {
$("#seriesName").textbox({
prompt: "系列名称"
});
$('#addBrandSeries').linkbutton({
iconCls: "icon-edit",
onClick: function () {
editRow(0);
}
});
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
url: contextPath + '/brand/getBrandName',
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
return;
}
$("#brandName").myCombobox({
prompt: "选择品牌",
width: 200,
data: data.data,
valueField: "id",
textField: "text"
});
}
});
$("#seriesStatus").myCombobox({
prompt: "选择状态",
width: 200,
data: [{
id: '1',
text: '开启'
}, {
id: '2',
text: '关闭'
}],
valueField: "id",
textField: "text"
});
$("#brandSeriesTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/brandSeries/getBrandSeriesPageList",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "系列ID",
field: "id",
width: 40,
align: "center"
}, {
title: "系列名称",
field: "seriesName",
width: 80,
align: "center"
}, {
title: "所属品牌",
field: "brandName",
width: 100,
align: "center"
}, {
title: "系列搜索词",
field: "seriesSearch",
width: 80,
align: "center"
}, {
title: "状态",
field: "status",
width: 80,
align: "center",
formatter: function (value, rowData) {
if (value == 1) {
return '开启';
}
return '关闭';
}
}, {
title: "创建时间",
field: "createTime",
width: 170,
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'>编辑</a>";
if (1 == rowData.status) {
str += "<a role='closeBrandSeries' dataId='" + rowData.id + "' style='margin-left:10px'>关闭</a>";
} else {
str += "<a role='openBrandSeries' dataId='" + rowData.id + "' style='margin-left:10px'>开启</a>";
}
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
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='closeBrandSeries']").linkbutton({
iconCls: "icon-more",
onClick: function () {
updateBrandSeriesStatus($(this).attr("dataId"), 2);
}
});
// 开启品牌
$(this).myDatagrid("getPanel").find("a[role='openBrandSeries']").linkbutton({
iconCls: "icon-more",
onClick: function () {
updateBrandSeriesStatus($(this).attr("dataId"), 1);
}
});
}
});
// 搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
$("#brandSeriesTable").myDatagrid("load", param);
}
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$('#brandName').combobox('clear');
$('#seriesStatus').combobox('clear');
$('#seriesName').textbox('clear');
var param = {};
$("#brandSeriesTable").myDatagrid("load", param);
}
});
/**
* 提取出搜索参数
*/
function getParams() {
// 系列名称
var seriesName = $('#seriesName').textbox('getText');
// 品牌名称
var brandName = $('#brandName').combobox('getText');
// 状态
var status = $('#seriesStatus').combobox('getValue');
var param = {};
if (undefined !== seriesName && null !== seriesName && "" !== seriesName) {
param.seriesName = seriesName;
}
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.brandName = brandName;
}
if (undefined !== status && null !== status && "" !== status) {
param.status = status;
}
return param;
}
function editRow(id) {
brandSeriesId = id;
var div = $("<div>").appendTo($(document.body));
var title = "编辑品牌系列";
var message = "确认修改品牌系列信息吗?";
if (id == 0) {
title = "添加品牌系列";
message = "确认添加品牌系列信息吗?";
}
$(div).myDialog({
width: "600px",
height: "380px",
title: title,
href: contextPath + "/html/brandManage/brandSeries/editBrandSeries.html",
queryParams: {
id: id
},
modal: true,
collapsible: true,
cache: false,
buttons: [{
id: "saveBtn",
text: "保存",
handler: function () {
$.messager.confirm("确认", message, function (flag) {
if (flag) {
var sortId = $('#brandSeriesEditForm #brandId').combobox("getValue");
if (sortId == '' || sortId == null || sortId == undefined) {
$.messager.alert("提示", '请选择品牌!', "error");
return false;
}
var url = contextPath + "/brandSeries/saveOrUpdateBrandSeries";
$("#brandSeriesEditForm").form("submit", {
url: url,
onSubmit: function () {
if (!$("#brandSeriesEditForm").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");
$("#brandSeriesTable").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 updateBrandSeriesStatus(id, status) {
var message = "";
var msg = "";
if (status == 1) {
message = "确认要开启吗?";
msg = "开启成功!";
} else {
message = "确认要关闭吗?";
msg = "关闭成功!";
}
window.top.$.messager.confirm("确认", message, function (flag) {
if (flag) {
window.top.$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
$.post(contextPath + "/brandSeries/updateBrandSeriesStatus", {
"id": id,
"status": status
}, function (data) {
window.top.$.messager.progress("close");
if (data.code == 200) {
$("#brandSeriesTable").myDatagrid("reload");
window.top.$.messager.show({
title: "提示",
msg: msg,
height: 120
});
} else {
window.top.$.messager.alert("失败", data.message, "error");
}
}, "json");
}
});
}
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="brandSeriesEditForm" id="brandSeriesEditForm" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" id="id"/>
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td width="12%"><span style="color:red">*</span><label>品牌</label></td>
<td>
<input class="easyui-textbox" id="brandId" name="brandId" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td width="12%"><span style="color:red">*</span>系列名称</td>
<td width="50%">
<input id="seriesName" name="seriesName" class="easyui-textbox" data-options="validType:'length[1,50]'" style="width: 380px;"/></td>
</tr>
<tr class="coupon" style="height: 60px">
<td width="12%">系列搜索词</td>
<td width="50%">
<input id="seriesSearch" name="seriesSearch" class="easyui-textbox" data-options="validType:'length[0, 500]'" style="width: 380px;"/>
</td>
</tr>
<tr style="line-height: 0px">
<td width="12%"></td>
<td width="50%">
<div style="color: #ab1e1e;margin-top: 0px">*多个搜索词中间用英文逗号分隔</div>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
// 隐藏域赋值
$('#brandSeriesEditForm #id').val(brandSeriesId);
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
url: contextPath + '/brand/getBrandName',
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
return;
}
$("#brandId").myCombobox({
prompt: "请选择",
width: 200,
data: data.data,
valueField: "id",
textField: "text"
});
}
});
$("#brandSeriesEditForm #seriesName").textbox({
required: true,
missingMessage: "系列名称不能为空",
prompt: "请输入"
//width: 240
});
$("#brandSeriesEditForm #seriesSearch").textbox({
required: false,
prompt: "请输入"
//width: 240
});
if (brandSeriesId > 0) {
$.post(contextPath + "/brandSeries/getBrandSeriesById", {
id: brandSeriesId
}, function (data) {
$("#brandSeriesEditForm").form("load", data.data);
$("#brandSeriesEditForm #brandId").myCombobox('select', data.data.brandId);
});
}
});
</script>
\ No newline at end of file
... ...