<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<jsp:include page="/jsp/common/header.jsp"></jsp:include>
<script src="${ctx }/js/hrt/hrtMinatoSingleGoods.js"></script>
<table class="queryTable" >
<tr>
<td class="queryTitle" width="80px">客户端</td>
<td class="queryContent">
<select id="client" class="easyui-combobox" style="width: 148px" panelHeight="auto" editable="false">
<option value="">请选择</option>
<option value="1" >pc</option>
<option value="2">m站 app</option>
</select>
</td>
<td class="queryTitle" width="80px">商品编码</td>
<td class="queryContent">
<input class="inputText" type="text" id="goodsNo">
</td>
<td class="queryBtnTd" colspan="2">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="doQuery()">查&nbsp;&nbsp;询</a>
</td>
</tr>
</table>

<table id="hrtMinatoSingleGoodsGrid"></table>

<!-- 添加凑单商品Div -->
<div id="addHrtMinatoSingleGoodsDiv" class="easyui-window" title="" iconCls="icon-edit" style="width:600px; height:200px;text-align:center; background: #fafafa;">
<div class="easyui-layout" fit="true">
<div region="center" border="false" style="background:#fff;border:1px solid #ccc;">
<form id="addForm" method="POST">
<table class="queryTable" width="100%" >
<tr>
<td class="queryTitle" width="100">商品编码</td>
<td class="queryContent" >
<input class="inputText" type="text" id="addGoodsNo">
<div id="addGoodsNoMsg" style="color:#F00;display:none" ></div>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">客户端</td>
<td class="queryContent" >
<select id="addClient" class="easyui-combobox" style="width: 100px" panelHeight="auto" editable="false">
<option value="web" >web</option>
<option value="wap">wap</option>
<option value="app">app</option>
</select>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">优先级</td>
<td class="queryContent" >
<input type="text" id="addGoodsOrder" min="1" precision="0" class="easyui-numberbox" style="width:100px"/>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">商品描述</td>
<td class="queryContent" >
<input id="addGoodsNotes" class="inputText" style="width:200px"/>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">商品标签</td>
<td class="queryContent" >
<input id="addMinatoGoodsCategoryId" class="easyui-combobox" style="width: 100px" panelHeight="auto" editable="false">
</td>
</tr>
</table>
</form>
</div>
<div region="south" border="false" style="text-align:center;height:30px;line-height:30px;">
<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0);" onclick="saveHrtMinatoSingleGoods('add');">保存凑单商品</a>&nbsp;&nbsp;
<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0);" onclick="closeWin('addHrtMinatoSingleGoodsDiv');">取消</a>
</div>
</div>
</div>

<!-- 编辑凑单商品Div -->
<div id="updHrtMinatoSingleGoodsDiv" class="easyui-window" title="" iconCls="icon-edit" style="width:600px; height:200px;text-align:center; background: #fafafa;">
<div class="easyui-layout" fit="true">
<div region="center" border="false" style="background:#fff;border:1px solid #ccc;">
<form id="updForm" method="POST">
<input type="hidden" id="hrtMinatoSingleGoodsIdHidden" name="hrtMinatoSingleGoodsIdHidden" value="" />
<table class="queryTable" width="100%" >
<tr>
<td class="queryTitle" width="100">商品编码</td>
<td class="queryContent" >
<input class="inputText" type="text" id="updGoodsNo">
<div id="updGoodsNoMsg" style="color:#F00;display:none" ></div>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">客户端</td>
<td class="queryContent" >
<select id="updClient" class="easyui-combobox" style="width: 100px" panelHeight="auto" editable="false">
<option value="web" >web</option>
<option value="wap">wap</option>
<option value="app">app</option>
</select>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">优先级</td>
<td class="queryContent" >
<input type="text" id="updGoodsOrder" min="1" precision="0" class="easyui-numberbox" style="width:100px"/>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">商品描述</td>
<td class="queryContent" >
<input id="updGoodsNotes" class="inputText" style="width:200px"/>
</td>
</tr>
<tr>
<td class="queryTitle" width="100">商品标签</td>
<td class="queryContent" >
<input id="updMinatoGoodsCategoryId" class="easyui-combobox" style="width: 100px" panelHeight="auto" editable="false">
</td>
</tr>
</table>
</form>
</div>
<div region="south" border="false" style="text-align:center;height:30px;line-height:30px;">
<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0);" onclick="saveHrtMinatoSingleGoods('upd');">更新凑单商品</a>&nbsp;&nbsp;
<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0);" onclick="closeWin('updHrtMinatoSingleGoodsDiv');">取消</a>
</div>
</div>
</div>


$(function() {
createParentHiddenDom("frameName");
$('#addHrtMinatoSingleGoodsDiv').window('close');
$('#updHrtMinatoSingleGoodsDiv').window('close');
$("#hrtMinatoSingleGoodsGrid")
.datagrid(
{
url : appPath
+ '/page/hrtMinatoSingleGoods/getHrtMinatoSingleGoods',
height : 'full',
striped : true,
remoteSort : false,
pagination : true,
rownumbers : true,
singleSelect : false,
queryParams : getQueryParam(),
frozenColumns : [ [
{
field : 'ck',
checkbox : true
},
{
field : 'opt',
title : '操作',
width : 40,
align : 'center',
formatter : function(value, rowData,
rowIndex) {
var html = "<img class='op-enable' src='"
+ appPath
+ "/js/lib/jquery-easyui/themes/icons/pencil.png' onClick='opreateHrtMinatoSingleGoods(\""
+ rowData.id
+ "\")' title='编辑'/>";
return html;
}
} ] ],
columns : [ [ {
field : 'goodsNo',
title : '商品编号',
width : 100,
align : 'left',
sortable : true
}, {
field : 'productName',
title : '商品名称',
width : 200,
align : 'left',
sortable : true
}, {
field : 'ecPrice',
title : '商品价格',
width : 100,
align : 'left',
sortable : true
}, {
field : 'goodsNotes',
title : '商品描述',
width : 150,
align : 'left',
sortable : true
}, {
field : 'goodsOrder',
title : '优先级',
width : 100,
align : 'left',
sortable : true
}, {
field : 'mul',
title : '客户端',
width : 100,
align : 'left',
sortable : true
}, {
field : 'minatoGoodsCategoryName',
title : '商品标签',
width : 100,
align : 'left',
sortable : true
}, {
field : 'addTime',
title : '添加时间',
width : 150,
align : 'left',
sortable : true
}, ] ],
toolbar : [ {
id : 'btnadd',
text : '添加凑单商品',
iconCls : 'icon-add',
handler : function() {
// 清空表单
$('#addForm').form('clear');
// 设置客户端选中项
$('#addClient').combobox("select", 'web');
// 绑定商品编号失去焦点事件
goodNoBlur('add');
getMinatoSingleGoodsCategorys("add");
$('#addHrtMinatoSingleGoodsDiv').window({
title : '添加凑单商品',
iconCls : 'icon-add',
width : 450,
height : 250,
left : 550,
top : 150,
modal : true,
shadow : true,
collapsible : false,
minimizable : false,
maximizable : false
});
}
}, "-", {
id : 'btnPass',
text : '批量删除',
iconCls : 'icon-ok',
handler : function() {
deleteHrtMinatoSingleGoods();
}
} ]
});
});

/**
* 查询
*/
function doQuery() {
$("#hrtMinatoSingleGoodsGrid").datagrid('load', getQueryParam());
}

/*******************************************************************************
* 获得参数
*/
function getQueryParam() {
var HrtMinatoSingleGoods = new Object();
HrtMinatoSingleGoods.mul = $("#client").combobox(
"getValue");
if ($("#goodsNo").val()) {
HrtMinatoSingleGoods.goodsNo = $("#goodsNo").val();
}
return HrtMinatoSingleGoods;
}

/*******************************************************************************
* 显示凑单信息
*/
function opreateHrtMinatoSingleGoods(hrtMinatoSingleGoodsId) {
getMinatoSingleGoodsCategorys("upd");
doAjax({
url : appPath + '/page/hrtMinatoSingleGoods/opreateHrtMinatoSingleGoods/'
+ hrtMinatoSingleGoodsId,
type : 'post',
dataType : "json",
success : function(data) {
// 凑单商品Id
$("#hrtMinatoSingleGoodsIdHidden").val(data.id);
// 商品编号
$("#updGoodsNo").val(data.goodsNo);
// 客户端
$('#updClient').combobox("select", data.mul);
// 优先顺
$('#updGoodsOrder').val(data.goodsOrder);
// 商品描述
$("#updGoodsNotes").val(data.goodsNotes);
// 商品标签
$('#updMinatoGoodsCategoryId').combobox("select", data.minatoGoodsCategoryId);
$('#updHrtMinatoSingleGoodsDiv').window({
title : '修改凑单商品',
iconCls : 'icon-edit',
width : 450,
height : 250,
left : 550,
top : 150,
modal : true,
shadow : true,
collapsible : false,
minimizable : false,
maximizable : false
});
$('#updHrtMinatoSingleGoodsDiv').window('open');
// 绑定商品编号失去焦点事件
goodNoBlur('upd');
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$.messager.alert('提示信息', '抱歉,保存失败,' + textStatus, 'error');
}
});
}

/**
* 保存凑单商品(添加、更新)
*/
function saveHrtMinatoSingleGoods(type) {
if ($('#' + type + 'GoodsNo').val() == ""
|| $('#' + type + 'GoodsNoMsg').html() != "") {
$.messager.alert("提示", "请输入正确的商品编号!", "info");
return;
} else if (!$('#' + type + 'GoodsOrder').val()) {
$.messager.alert("提示", "请输入优先级!", "info");
return;
}
console.log($("#" + type + "MinatoGoodsCategoryId").combobox("getValue"));
if($("#" + type + "MinatoGoodsCategoryId").combobox("getValue")=="--请选择--"
|| $("#" + type + "MinatoGoodsCategoryId").combobox("getValue")=="0"){
$.messager.alert("提示", "请选择商品标签!", "info");
return;
}
// 商品编号
var goodsNo = $.trim($('#' + type + 'GoodsNo').val());
// 客户端
var client = $("#" + type + "Client").combobox("getValue");
// 优先级
var goodsOrder = $('#' + type + 'GoodsOrder').val();
// 商品描述
var goodsNotes = $.trim($('#' + type + 'GoodsNotes').val());
var hrtMinatoSingleGoods = new Object();
// 商品标签
var minatoGoodsCategoryId = $("#" + type + "MinatoGoodsCategoryId").combobox("getValue");
// 更新的场合,设置凑单商品Id
if (type == 'upd') {
hrtMinatoSingleGoods.id = $("#hrtMinatoSingleGoodsIdHidden").val();
}
hrtMinatoSingleGoods.goodsNo = goodsNo;
hrtMinatoSingleGoods.mul = client;
hrtMinatoSingleGoods.goodsOrder = goodsOrder;
hrtMinatoSingleGoods.goodsNotes = goodsNotes;
hrtMinatoSingleGoods.minatoGoodsCategoryId = minatoGoodsCategoryId;
doAjax({
url : appPath + "/page/hrtMinatoSingleGoods/saveHrtMinatoSingleGoods",
type : 'post',
data : hrtMinatoSingleGoods,
success : function(data) {
switch (data) {
case "ok":
if (type == 'add') {
$.messager.alert('提示信息', '保存成功', 'info');
} else {
$.messager.alert('提示信息', '更新成功', 'info');
}
break;
default:
$.messager.alert('提示信息', '抱歉,失败了', 'error');
break;
}
$('#' + type + 'HrtMinatoSingleGoodsDiv').window('close');
doQuery();
return;
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$.messager.alert('提示信息', '抱歉,保存失败,' + textStatus, 'error');
}
});
}

// 批量删除推荐商品
function deleteHrtMinatoSingleGoods() {
var selections = $("#hrtMinatoSingleGoodsGrid").datagrid('getSelections');
if (selections == null || selections == '') {
$.messager.alert('提示信息', '请选操作的记录', '');
return;
} else {
var hrtMinatoSingleGoodsIds = '';
for (var i = 0; i < selections.length; i++) {
hrtMinatoSingleGoodsIds += selections[i].id + ',';
}
hrtMinatoSingleGoodsIds = hrtMinatoSingleGoodsIds.substring(0,
hrtMinatoSingleGoodsIds.lastIndexOf(','));
$.messager
.confirm(
'提示信息',
"您确定批量删除凑单商品?",
function(r) {
if (r) {
doAjax({
url : appPath
+ "/page/hrtMinatoSingleGoods/deleteHrtMinatoSingleGoods",
type : 'post',
data : {"hrtMinatoSingleGoodsIds":hrtMinatoSingleGoodsIds},
success : function(data) {
switch (data) {
case "ok":
$.messager
.alert('提示信息', '删除成功', '');
break;
default:
$.messager.alert('提示信息', '抱歉,失败了',
'error');
break;
}
doQuery();
return;
},
error : function(XMLHttpRequest,
textStatus, errorThrown) {
$.messager.alert('提示信息', '抱歉,删除失败,'
+ textStatus, 'error');
}
});
}
});
}
}

/*******************************************************************************
* 绑定goodNo失去焦点后,查询商品编号事件
*/
function goodNoBlur(type) {
var goodsNo = $('#' + type + 'GoodsNo');
var goodsNoMsg = $('#' + type + 'GoodsNoMsg');
goodsNo.blur(function() {
if (goodsNo.val() == '') {
goodsNoMsg.html('');
return;
}
doAjax({
url : appPath + "/page/hrtMinatoSingleGoods/" + goodsNo.val()
+ "/checkGoodNo",
success : function(data) {
if (data == 'error') {
goodsNoMsg.css('display', 'inline');
goodsNoMsg.html('该商品编号不存在');
} else {
goodsNoMsg.css('display', 'none');
goodsNoMsg.html('');
}
}
});
});
}

function getMinatoSingleGoodsCategorys(type){
$("#"+type+"MinatoGoodsCategoryId").combobox({
url:appPath + "/page/hrtMinatoSingleGoods/getAllMinatoGoodsCategorys",
valueField:"id",
textField:"name"
});
$("#"+type+"MinatoGoodsCategoryId").combobox("select", '--请选择--');
}

/**
* 关闭窗口
*/
function closeWin(dlg) {
$('#' + dlg).window('close');
}

jquery之鼠标失去焦点事件的更多相关文章

  1. jquery获取焦点和失去焦点事件代码

    input失去焦点和获得焦点 鼠标在搜索框中点击的时候里面的文字就消失了. 我们在做网站的时候经常会用到搜索框的获得焦点和失去焦点的事件,因为懒,每次都去写非常的烦,于是就一劳永逸,遇到类似情况就来调 ...

  2. Knockout: 实践CSS绑定和jQuery的blur失去焦点事件, 给未通过校验的输入框添加红色边框突出显示.

    目的: 实践一下Knockout提供的CSS绑定功能和JQuery的blur失去焦点事件, 这次不使用Knockout的afterkeydown事件了. 步骤: 先在htm中添加.error的css样 ...

  3. jQuery模拟鼠标点击事件失效的问题

    最近使用jQuery操作浏览器获取数据,需要对分页的信息进行处理,发现直接使用$('div#pager a.next').click();的这种写法无法触发点击事件. 使用trigger('click ...

  4. jquery的鼠标移入移出事件hover、mouseenter、mouseleave、mouseover、mouseout

    hover:鼠标进入元素的子元素时不会触发‘鼠标移开’的事件: mouseenter.mouseleave:效果与hover相同: mouseover: 鼠标进入元素和进入它的子元素时都会触发‘mou ...

  5. JavaScript与jQuery关于鼠标点击事件

    即实现鼠标点击其中一个菜单发生样式的改变,当点击下一个菜单时,当前菜单样式改变,其他菜单均变为之前样式. 用JavaScript,jQuery都可以实现,只是后者是封装的JavaScript库,具有s ...

  6. onblur鼠标失去焦点事件

  7. Knockout: 使用CSS绑定和event的blur失去焦点事件, 给未通过校验的输入框添加红色边框突出显示.

    目的:使用knockout提供的机制实现输入框失去焦点后的校验工作,并使用CSS绑定给未通过校验的输入框添加红色边框突出显示. 步骤: 先在htm中添加.error的css样式, 并在输入框中的dat ...

  8. jquery 触发/失去焦点事件例子详解

    触发焦点: $("Element").focus() 触发每一个匹配元素获得焦点事件. $("Element").focus(function) 事件会在获得焦 ...

  9. jquery div 下拉框焦点事件

    这章与上一张<jquery input 下拉框(模拟select控件)焦点事件>类似 这章讲述div的焦点事件如何使用 div的焦点事件与input的焦点事件区别在于 需要多添加一个属性: ...

随机推荐

  1. web项目环境搭建(3):搭建Spring+MyBatis

    spring 4.1.7 + MyBatis 3.3 正式开始配置关键内容,这是硬货 一. 新建spring配置文件,起名为 applicationContext.xml,放在src/main/res ...

  2. impdp/expdp 总结

      impdp/expdp   1.创建DIRECTORY create directory dir_dp as '/tmp';   --建议将DIRECTORY 建在 /tmp 表下面,该目录肯定存 ...

  3. Java编程之字符集问题研究

    1. 概述 本文主要包括以下几个方面:编码基本知识,java,系统软件,url,工具软件等. 在下面的描述中,将以"中文"两个字为例,经查表可以知道其GB2312编码是" ...

  4. jquery升级到新版本报错[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法(转)

    最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property 'msie' of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...

  5. 配置android开发环境eclipse获取ADT获取不到

    在安装完Android SDK后eclipse要获取ADT, 可是由于GFW的存在, eclipse经常无法从http://dl-ssl.google.com/android/eclipse 获取到任 ...

  6. ural 1126 Magnetic Storms

    http://acm.timus.ru/problem.aspx?space=1&num=1126 #include <cstdio> #include <cstring&g ...

  7. jboss部署应用

    简单的部署应用. 第一种方法是直接写JSP代码,然后放到指定的WAR文件夹中. 第二种,是同时META-INF下的application.xml文件,然后用JAR -CF编成WAR,再集合JSP形成E ...

  8. PCB敷铜小结

    有人说加大敷铜可以加大散热面,其实,对于此我不以为然.我说过铜是一种散热吸热快的金属,如果加大散热面要靠加大敷铜的面积的话,那就没有必要给很多的器件加热片了,我想大家对于计算机都颇有心得,一定攒过电脑 ...

  9. BZOJ3403: [Usaco2009 Open]Cow Line 直线上的牛

    3403: [Usaco2009 Open]Cow Line 直线上的牛 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 48  Solved: 41[S ...

  10. POJ_1321——棋盘问题,回溯+剪枝

    Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子 ...