<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
<!DOCTYPE html>
|
<html>
|
<head>
|
<title>物料组与物料类型</title>
|
<jsp:include page="../../../initlib/initAll.jsp"></jsp:include>
|
<script type="text/javascript">
|
var typeGrid = null;
|
var grpGrid = null;
|
$(function () {
|
typeGrid = $('#typeGrid').datagrid({
|
rownumbers: true,
|
fit: true,
|
fitColumns: false,
|
border: false,
|
//pagination : true,
|
idField: 'id',
|
striped: true,
|
remoteSort: false,
|
/* pageSize : 10,
|
pageList : [ 10, 20, 30, 40, 50 ],
|
sortName : 'id',
|
sortOrder : 'desc', */
|
singleSelect: true,
|
checkOnSelect: false,
|
selectOnCheck: false,
|
nowrap: false,
|
showPageList: false,
|
columns: [[{
|
field: 'id',
|
title: 'id',
|
checkbox: true
|
}, {
|
field: 'code',
|
title: '类型编号',
|
width: 100,
|
align: 'center'
|
}, {
|
field: 'name',
|
title: '类型名称',
|
width: 100,
|
align: 'center'
|
}, {
|
field: 'matGrp',
|
title: '物料组',
|
align: 'center',
|
width: 60
|
}
|
, {
|
field: 'des',
|
title: '类型描述',
|
align: 'left',
|
width: 150
|
}, {
|
field: 'enable',
|
title: '是否启用',
|
align: 'center',
|
width: 70,
|
formatter: function (value, row, index) {
|
return value == 1 ? '<span style="color:green;background-color:white">启用<span>' : '<span style="color:red">禁用<span>';
|
}
|
}, {
|
field: 'createUserName',
|
title: '创建人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'createUserTime',
|
title: '创建时间',
|
align: 'center',
|
width: 150,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'updateUserName',
|
title: '修改人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true
|
}, {
|
field: 'updateUserTime',
|
title: '最后修改时间',
|
align: 'center',
|
width: 130,
|
sortable: true
|
}]],
|
toolbar: '#typeToolbar',
|
onLoadSuccess: function () {
|
$(this).datagrid('tooltip');
|
},
|
onRowContextMenu: function (e, rowIndex, rowData) {
|
e.preventDefault();
|
$(this).datagrid('unselectAll').datagrid('uncheckAll');
|
$(this).datagrid('selectRow', rowIndex);
|
$('#typeMenu').menu('show', {
|
left: e.pageX - 10,
|
top: e.pageY - 5
|
});
|
}
|
});
|
|
grpGrid = $('#grpGrid').datagrid({
|
rownumbers: true,
|
fit: true,
|
fitColumns: false,
|
border: false,
|
//pagination : true,
|
idField: 'id',
|
striped: true,
|
pageSize: 10,
|
pageList: [10, 20, 30, 40, 50],
|
/*sortName : 'id',
|
sortOrder : 'desc',*/
|
singleSelect: true,
|
checkOnSelect: false,
|
remoteSort: false,
|
selectOnCheck: false,
|
nowrap: false,
|
showPageList: false,
|
columns: [[{
|
field: 'id',
|
title: '物料组名称',
|
checkbox: true
|
}, {
|
field: 'code',
|
title: '物料组编号',
|
width: 100,
|
align: 'center'
|
}, {
|
field: 'name',
|
title: '物料组名称',
|
width: 100,
|
align: 'center'
|
}, {
|
field: 'des',
|
title: '物料组描述',
|
align: 'left',
|
width: 150
|
}, {
|
field: 'enable',
|
title: '是否启用',
|
align: 'center',
|
width: 70,
|
formatter: function (value, row, index) {
|
return value == 1 ? '<span style="color:green;background-color:white">启用<span>' : '<span style="color:red">禁用<span>';
|
}
|
}, {
|
field: 'createUserName',
|
title: '创建人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'createUserTime',
|
title: '创建时间',
|
align: 'center',
|
width: 150,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'updateUserName',
|
title: '修改人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'updateUserTime',
|
title: '最后修改时间',
|
align: 'center',
|
width: 130,
|
sortable: true,
|
hidden: 'true'
|
}]],
|
toolbar: '#grpToolbar',
|
url: "${pageContext.request.contextPath}/pms/matgrp/getAllMatGrps.do",
|
queryParams: $("#grpForm").form("getData"),
|
onLoadError: function (data) {
|
$.messager.show('提示', "查询异常", 'error');
|
},
|
onLoadSuccess: function () {
|
$(this).datagrid('tooltip');
|
},
|
onRowContextMenu: function (e, rowIndex, rowData) {
|
e.preventDefault();
|
$(this).datagrid('unselectAll').datagrid('uncheckAll');
|
$(this).datagrid('selectRow', rowIndex);
|
$('#grpMenu').menu('show', {
|
left: e.pageX - 10,
|
top: e.pageY - 5
|
});
|
},
|
onClickRow: function (rowIndex, rowData) {
|
getAllTypesByGrp(rowData.id);
|
}
|
});
|
});
|
|
/**-----------------------------------------物料组处理----------------------------------------*/
|
/**
|
* 查询
|
*/
|
function getAllMatGrps() {
|
grpGrid.datagrid({
|
url: "${pageContext.request.contextPath}/pms/matgrp/getAllMatGrps.do",
|
queryParams: $("#grpForm").form("getData"),
|
onLoadError: function (data) {
|
$.messager.show('提示', "查询异常", 'error');
|
}
|
});
|
}
|
|
function clearGrpForm() {
|
$("#grpForm input").val(null);
|
}
|
|
function deleteMatGrp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var row = grpGrid.datagrid('getSelected');
|
parent.$.messager.confirm('操作提示', '您是否要删除当前物料组?', function (b) {
|
if (b) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post('${pageContext.request.contextPath}/pms/matgrp/deleteMatGrp.do', {
|
id: row.id
|
}, function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
getAllMatGrps();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, 'JSON');
|
}
|
}
|
});
|
}
|
|
/**
|
* 批量删除
|
*/
|
function beatchDeleteMatGrp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var rows = grpGrid.datagrid('getChecked');
|
var ids = [];
|
|
if (rows.length > 0) {
|
parent.$.messager.confirm('操作提示', '您是否要删除当前物料组?', function (r) {
|
if (r) {
|
for (var i = 0; i < rows.length; i++) {
|
ids.push(rows[i].id);
|
}
|
parent.$.messager.progress({
|
title: '提示',
|
text: '数据处理中,请稍后....'
|
});
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post('${pageContext.request.contextPath}/pms/matgrp/batchDeleteMatGrp.do',
|
{
|
ids: ids.join(','),
|
|
}, function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
parent.$.messager.progress('close');
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
getAllMatGrps();
|
} else {
|
$.messager.show('提示', json.msg, 'info');
|
}
|
}, "JSON");
|
}
|
}
|
});
|
} else {
|
parent.$.messager.show({
|
title: '提示',
|
msg: '请勾选要需要操作的物料组!'
|
});
|
}
|
}
|
|
function goToMatGrpAddJsp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var dialog = parent.$.modalDialog({
|
title: '物料组添加',
|
width: 620,
|
height: 290,
|
href: '${pageContext.request.contextPath}/pms/matgrp/goToMatGrpAddJsp.do',
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post("${pageContext.request.contextPath}/pms/matgrp/addMatGrp.do", f.form("getData"), function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
getAllMatGrps();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
}
|
}
|
}]
|
});
|
}
|
|
function goToMatGrpEditJsp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var dialog = parent.$.modalDialog({
|
title: '类型编辑',
|
width: 620,
|
height: 290,
|
href: '${pageContext.request.contextPath}/pms/matgrp/goToMatGrpEditJsp.do?id=' + grpGrid.datagrid('getSelected').id,
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post("${pageContext.request.contextPath}/pms/matgrp/editMatGrp.do", f.form("getData"), function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
getAllMatGrps();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
}
|
}
|
}]
|
});
|
}
|
|
function getAllTypesByGrp(id) {
|
typeGrid.datagrid({
|
url: "${pageContext.request.contextPath}/pms/mattype/getAllTypesByGrp.do?gid=" + id
|
});
|
}
|
|
function clearTypeForm() {
|
$("#typeForm input").val(null);
|
}
|
|
//查询物料组
|
function getAllMatTypes() {
|
var row = grpGrid.datagrid('getSelected');
|
var param = $("#typeForm").form("getData");
|
if (row && row != null){
|
param.matGrp = row.id;
|
}
|
typeGrid.datagrid({
|
url: "${pageContext.request.contextPath}/pms/mattype/getAllMatTypes.do",
|
queryParams: param
|
});
|
}
|
|
function deleteMatType() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var row = typeGrid.datagrid('getSelected');
|
parent.$.messager.confirm('操作提示', '您是否要删除当前物料类型?', function (b) {
|
if (b) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post('${pageContext.request.contextPath}/pms/mattype/deleteMatType.do', {
|
id: row.id
|
}, function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
getAllMatTypes();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, 'JSON');
|
}
|
}
|
});
|
}
|
|
/**
|
* 批量删除
|
*/
|
function beatchDeleteMatType() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var rows = typeGrid.datagrid('getChecked');
|
var ids = [];
|
|
if (rows.length > 0) {
|
parent.$.messager.confirm('操作提示', '您是否要删除当前物料类型?', function (r) {
|
if (r) {
|
for (var i = 0; i < rows.length; i++) {
|
ids.push(rows[i].id);
|
}
|
parent.$.messager.progress({
|
title: '提示',
|
text: '数据处理中,请稍后....'
|
});
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post('${pageContext.request.contextPath}/pms/mattype/batchDeleteMatType.do',
|
{
|
ids: ids.join(',')
|
}, function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
parent.$.messager.progress('close');
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
getAllMatTypes();
|
} else {
|
$.messager.show('提示', json.msg, 'info');
|
}
|
}, "JSON");
|
}
|
}
|
});
|
} else {
|
parent.$.messager.show({
|
title: '提示',
|
msg: '请勾选要需要操作的物料类型!'
|
});
|
}
|
}
|
|
|
//跳转到类型添加页面
|
function goToMatTypeAddJsp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var dialog = parent.$.modalDialog({
|
title: '物料类型添加',
|
width: 620,
|
height: 290,
|
href: '${pageContext.request.contextPath}/pms/mattype/goToMatTypeAddJsp.do',
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post("${pageContext.request.contextPath}/pms/mattype/addMatType.do", f.form("getData"), function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
getAllMatTypes();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
}
|
}
|
}]
|
});
|
}
|
|
//跳转到类型编辑页面
|
function goToMatTypeEditJsp() {
|
//按钮是否点击标志(默认为true:可被点击)
|
var isClick = true;
|
var dialog = parent.$.modalDialog({
|
title: '物料类型编辑',
|
width: 620,
|
height: 290,
|
href: '${pageContext.request.contextPath}/pms/mattype/goToMatTypeEditJsp.do?id=' + typeGrid.datagrid('getSelected').id,
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
//未点击过则执行里面的内容
|
if (isClick) {
|
//改变为点击无效状态
|
isClick = false;
|
$.post("${pageContext.request.contextPath}/pms/mattype/editMatType.do", f.form("getData"), function (json) {
|
//恢复点击有效状态
|
isClick = true;
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
getAllMatTypes();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
}
|
}
|
}]
|
});
|
}
|
</script>
|
</head>
|
<body class="easyui-layout" data-options="fit : true,border : false">
|
<div data-options="region:'west',border:true,split:false,title:'物料组'" style="width:560px;">
|
<div id="grpToolbar" style="display: none;width:100%;">
|
<form id="grpForm" style="margin:4px 0px 0px 0px">
|
<div class="topTool">
|
<fieldset>
|
<div>
|
<span class="label">类型名称:</span>
|
<input type="text" name="name" class="easyui-validatebox "
|
data-options="prompt: '请输入物料组名称',width:120"/>
|
</div>
|
</fieldset>
|
</div>
|
</form>
|
<div class="easyui-toolbar">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/matgrp/getAllMatGrps.do/wllb']}">
|
<a onclick="getAllMatGrps()" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-zoom'">查询</a>
|
<a onclick="clearGrpForm();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-table-refresh'">重置</a>
|
</c:if>
|
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/matgrp/addMatGrp.do/wllb']}">
|
<a onclick="goToMatGrpAddJsp();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-plugin-add'">添加</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/matgrp/batchDeleteMatGrp.do/wllb']}">
|
<a onclick="beatchDeleteMatGrp();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="iconCls:'icon-standard-cancel',plain:true">批量删除</a>
|
</c:if>
|
</div>
|
</div>
|
<table id="grpGrid"></table>
|
</div>
|
|
<div data-options="region:'center',border:true,title:'物料类型'">
|
<div id="typeToolbar" style="display: none;">
|
<form id="typeForm" style="margin:4px 0px 0px 0px">
|
<div class="topTool">
|
<fieldset>
|
<div>
|
<span class="label">型号名称:</span>
|
<input type="text" name="name" class="easyui-validatebox "
|
data-options="prompt: '请输入类型名称',width:120"/>
|
</div>
|
</fieldset>
|
</div>
|
</form>
|
<div class="easyui-toolbar">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/mattype/getAllMatTypes.do/wllb']}">
|
<a onclick="getAllMatTypes()" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-zoom'">查询</a>
|
<a onclick="clearTypeForm();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-table-refresh'">重置</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/mattype/addMatType.do/wllb']}">
|
<a onclick="goToMatTypeAddJsp();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-plugin-add'">添加类型</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/mattype/batchDeleteMatType.do/wllb']}">
|
<a onclick="beatchDeleteMatType();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="iconCls:'icon-standard-cancel',plain:true">批量删除</a>
|
</c:if>
|
</div>
|
</div>
|
<table id="typeGrid"></table>
|
</div>
|
<div id="typeMenu" class="easyui-menu" style="width: 80px; display: none;">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/mattype/editMatType.do/wllb']}">
|
<div onclick="goToMatTypeEditJsp()" data-options="iconCls:'icon-standard-plugin-add'">编辑</div>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/mattype/deleteMatType.do/wllb']}">
|
<div onclick="deleteMatType();" data-options="iconCls:'icon-standard-plugin-delete'">删除</div>
|
</c:if>
|
</div>
|
<div id="grpMenu" class="easyui-menu" style="width: 80px; display: none;">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/matgrp/editMatGrp.do/wllb']}">
|
<div onclick="goToMatGrpEditJsp()" data-options="iconCls:'icon-standard-plugin-add'">编辑</div>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/matgrp/deleteMatGrp.do/wllb']}">
|
<div onclick="deleteMatGrp();" data-options="iconCls:'icon-standard-plugin-delete'">删除</div>
|
</c:if>
|
</div>
|
</body>
|
</html>
|