<%@ 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. iOS-封装静态库

    最近在做Apple的IOS开发,有开发静态库的需求,本身IOS的开发,只允许静态库或者Framework.在Xcode上没有找到允许编译,如同Android上的*.so和Win32上的dll这样的说法 ...

  2. [转]机器学习——C4.5 决策树算法学习

    1. 算法背景介绍 分类树(决策树)是一种十分常用的分类方法.它是一种监管学习,所谓监管学习说白了很简单,就是给定一堆样本,每个样本都有一组属性和一个类别,这些类别是事先确定的,那么通过学习得到一个分 ...

  3. 请阐述调用Activity有哪几种方法,并写出相关的Java代码

    请阐述调用Activity有哪几种方法,并写出相关的Java代码. 答案:可以采用两种方式调用Activity:显示调用和隐式调用.显示调用直接指定了Activity,代码如下: Intent int ...

  4. Android中的动画

    Android中的动画分为: 1.逐帧动画(Frame Animation):  把动画过程的每张静态图片都收集起来,然后由Android来控制依次显示这些静态图片,然后利用人眼”视觉暂留“的原理,给 ...

  5. mysql 5.5 升级到 mysql 5.6

    目前MySQL数据库软件升级到5..26版本,主要有两种方法.一种是停机升级,即在现有环境下先停止数据库,然后升级数据库软件版本和数据库版本:另外一种是采用不停机的主从升级(master--slave ...

  6. sql 当重复的数据有多条时,保留一条,删除其他重复

    delete from proj_info where   newcode in (select newcode    from proj_info group by newcode      hav ...

  7. Android Init进程命令的执行和服务的启动

    这里开始分析init进程中配置文件的解析,在配置文件中的命令的执行和服务的启动. 首先init是一个可执行文件,它的对应的Makfile是init/Android.mk. Android.mk定义了i ...

  8. java获取当前时间

    /////////////////获取时间方法一////////////////////////////// java.util.Date uDate=new java.util.Date(); Sy ...

  9. 02 - 替换SetInput方法 VTK 6.0 迁移 (2013-06-30 16:22)

    VTK6 引入了许多不兼容的变化,这其中就包括用SetInputData()和SetInputConnection()替换SetInput()方法.在先前的版本中,VTK4 引入了SetInput() ...

  10. pm2 安装使用

    pm2 是全新开发的进程守护服务, 同时集成了负载均衡功能. 以及开机启动, 自动重启有问题进程. 还可以查看各服务进程状态. 使用方法参照:https://github.com/Unitech/pm ...