<%@ 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">
|
//大类别
|
$(function () {
|
|
$("#upcodeID").combobox({
|
url: "${pageContext.request.contextPath }/pms/sys/eqptype/queryMdFixCodeUpCodeBean.do",
|
textField: 'name',
|
valueField: 'code',
|
required: false,
|
select: true,
|
onLoadSuccess: function (data) {
|
if (data != null && data.length > 0) {
|
$("#upcodeID").combobox("setValue", data[0].upcode);
|
}
|
}
|
});
|
$("#upcodeID").combobox({
|
onChange: function (newValue, oldValue) {
|
if (newValue != null) {
|
queryAll();
|
}
|
}
|
});
|
});
|
var dataGrid;
|
var dialog;
|
$(function () {
|
dataGrid = $('#dataGrid').datagrid({
|
rownumbers: true,
|
idField: 'id',
|
fit: true,
|
fitColumns: false,
|
border: false,
|
striped: true,
|
nowrap: true,
|
singleSelect: true,
|
checkOnSelect: false,
|
selectOnCheck: false,
|
remoteSort: false,
|
columns: [[{
|
title: '编号',
|
field: 'id',
|
checkbox: true
|
}, {
|
title: '上级编号(upcode)',
|
field: 'upcode'
|
}, {
|
field: 'type',
|
title: '类型编码(type)',
|
width: 100
|
}, {
|
field: 'code',
|
title: '类型(code)',
|
width: 100
|
}, {
|
field: 'name',
|
title: '名称(name)',
|
width: 150,
|
align: 'center',
|
formatter: function (value, row, index) {
|
return row.upcode == 0 ? '<span style="color:red">' + value + '<span>' : '<span>' + value + '<span>';
|
}
|
}, {
|
field: 'des',
|
title: '备注(des)',
|
width: 150
|
}, {
|
field: 'mesCode',
|
title: 'MES编码(mesCode)',
|
width: 100
|
}, {
|
field: 'bak',
|
title: '备用字段',
|
width: 150
|
}, {
|
field: 'createName',
|
title: '创建人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'createTime',
|
title: '创建时间',
|
align: 'center',
|
width: 150,
|
sortable: true,
|
hidden: 'true'
|
}, {
|
field: 'updateName',
|
title: '修改人姓名',
|
align: 'center',
|
width: 70,
|
sortable: true
|
}, {
|
field: 'updateTime',
|
title: '最后修改时间',
|
align: 'center',
|
width: 130,
|
sortable: true
|
}]],
|
toolbar: '#toolbar',
|
url: "${pageContext.request.contextPath}/pms/fixCode/queryFixCode.do",
|
queryParams: $("#searchForm").form("getData"),
|
onLoadSuccess: function () {
|
$(this).datagrid('tooltip');
|
},
|
onRowContextMenu: function (e, rowIndex, rowData) {
|
e.preventDefault();
|
$(this).datagrid('unselectAll').datagrid('uncheckAll');
|
$(this).datagrid('selectRow', rowIndex);
|
$('#menu').menu('show', {
|
left: e.pageX - 10,
|
top: e.pageY - 5
|
});
|
}
|
});
|
});
|
|
/**
|
*查询
|
*/
|
function queryAll() {
|
|
dataGrid.datagrid({
|
url: "${pageContext.request.contextPath}/pms/fixCode/queryFixCode.do",
|
queryParams: $("#searchForm").form("getData")
|
});
|
}
|
|
function clearForm() {
|
$("#searchForm input").val(null);
|
}
|
|
/**
|
刷新数据
|
**/
|
function refrush() {
|
$.post("${pageContext.request.contextPath}/pms/fixCode/refrushData.do", function (json) {
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
|
/**
|
* 跳转到父类添加页面
|
*/
|
function goToFatherFixCodeAddJsp() {
|
dialog = parent.$.modalDialog({
|
title: '综合基础数据添加',
|
width: 660,
|
height: 300,//addMdFixCodeJsp
|
href: "${pageContext.request.contextPath}/pms/md/fixcode/fixFatherCodeAdd.jsp",
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
$.post("${pageContext.request.contextPath}/pms/fixCode/editMdFixCode.do", f.form("getData"), function (json) {
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
//查询
|
refrush();
|
queryAll();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
|
}
|
}]
|
});
|
|
}
|
|
|
/**
|
* 跳转到子类添加页面
|
*/
|
function goToSonFixCodeAddJsp() {
|
var upcodeType = $("#upcodeID").combobox("getValue");
|
dialog = parent.$.modalDialog({
|
title: '综合基础数据添加',
|
width: 660,
|
height: 300,//addMdFixCodeJsp
|
href: "${pageContext.request.contextPath}/pms/md/fixcode/fixCodeAdd.jsp?upcodeType=" + upcodeType,
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
$.post("${pageContext.request.contextPath}/pms/fixCode/editMdFixCode.do", f.form("getData"), function (json) {
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
//查询
|
queryAll();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
|
}
|
}]
|
});
|
}
|
|
|
/**
|
* 跳转到编辑页面
|
*/
|
function goToFixCodeEditJsp() {
|
var row = dataGrid.datagrid('getSelected');
|
if (row == null) {
|
$.messager.show('提示', "请选择行", 'error');
|
return;
|
}
|
dialog = parent.$.modalDialog({
|
title: '综合基础数据添加',
|
width: 660,
|
height: 300,
|
href: "${pageContext.request.contextPath}/pms/fixCode/editMdFixCodeJsp.do?id=" + row.id + "&&del=0",
|
buttons: [{
|
text: '保存',
|
iconCls: 'icon-standard-disk',
|
handler: function () {
|
var f = dialog.find("#form");
|
if (f.form("validate")) {
|
$.post("${pageContext.request.contextPath}/pms/fixCode/editMdFixCode.do", f.form("getData"), function (json) {
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
dialog.dialog('destroy');
|
//查询
|
queryAll();
|
} else {
|
$.messager.show('提示', json.msg, 'error');
|
}
|
}, "JSON");
|
}
|
|
}
|
}]
|
});
|
}
|
|
function deleteDict() {
|
var row = dataGrid.datagrid('getSelected');
|
if (row == null) {
|
$.messager.show('提示', "请选择需要删除的行", 'error');
|
return;
|
} else {
|
parent.$.messager.confirm('确认', '确定删除吗?', function (r) {
|
if (r) {
|
parent.$.messager.progress({
|
title: '提示',
|
text: '数据处理中,请稍后....'
|
});
|
$.post('${pageContext.request.contextPath}/pms/fixCode/deleteMdFixCode.do?id=' + row.id,
|
function (json) {
|
parent.$.messager.progress('close');
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
queryAll();
|
} else {
|
$.messager.show('提示', json.msg, 'info');
|
}
|
}, "JSON");
|
}
|
});
|
}
|
|
|
}
|
|
/**
|
* 批量删除
|
*/
|
function beatchDeleteDict() {
|
var rows = dataGrid.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: '数据处理中,请稍后....'
|
});
|
$.post('${pageContext.request.contextPath}/pms/fixCode/batchDeleteMdFixCode.do',
|
{
|
ids: ids.join(','),
|
|
}, function (json) {
|
parent.$.messager.progress('close');
|
if (json.success) {
|
$.messager.show('提示', json.msg, 'info');
|
queryAll();
|
} else {
|
$.messager.show('提示', json.msg, 'info');
|
}
|
}, "JSON");
|
}
|
});
|
} else {
|
parent.$.messager.show({
|
title: '提示',
|
msg: '请勾选要需要操作的数据!'
|
});
|
}
|
}
|
|
</script>
|
</head>
|
<body class="easyui-layout" data-options="fit : true,border : false">
|
<div id="toolbar" style="display: none;">
|
<div class="topTool">
|
<form id="searchForm">
|
<fieldset>
|
<div>
|
<span class="label">名称:</span>
|
<input type="text" name="name" class="easyui-validatebox "
|
data-options="prompt: '支持模糊查询',width:120"/>
|
<th></th>
|
</div>
|
<div>
|
<span class="label">大类别:</span>
|
<input class="easyui-combobox" id="upcodeID" name="upcode"
|
data-options="prompt: '全部',panelHeight:120,panelWidth:120,width:120"></input>
|
<input name="del" type="hidden" value="0"></input>
|
</div>
|
</fieldset>
|
</form>
|
</div>
|
<div class="easyui-toolbar">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/queryFixCode.do/fix']}">
|
<a onclick="queryAll();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-zoom'">查询</a>
|
|
<a onclick="clearForm();" 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/fixCode/refrush.do/fix']}">
|
<a onclick="refrush();" 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/fixCode/goToFatherFixCodeAddJsp.do/fix']}">
|
|
<a onclick="goToFatherFixCodeAddJsp();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-user-add'">父类添加</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/goToSonFixCodeAddJsp.do/fix']}">
|
|
<a onclick="goToSonFixCodeAddJsp();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-user-add'">子类添加</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/deleteDict.do/fix']}">
|
|
<a onclick="deleteDict();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="plain:true,iconCls:'icon-standard-user-delete'">删除</a>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/beatchDeleteDict.do/fix']}">
|
<a onclick="beatchDeleteDict();" href="javascript:void(0);" class="easyui-linkbutton"
|
data-options="iconCls:'icon-standard-cancel',plain:true">批量删除</a>
|
</c:if>
|
</div>
|
</div>
|
|
<div data-options="region:'center',border:false">
|
<table id="dataGrid"></table>
|
</div>
|
<div id="menu" class="easyui-menu" style="width: 80px; display: none;">
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/goToFixCodeEditJsp.do/fix']}">
|
<div onclick="goToFixCodeEditJsp();" data-options="iconCls:'icon-standard-user-edit'">编辑</div>
|
</c:if>
|
<c:if test="${not empty sessionInfo.resourcesMap['/pms/fixCode/deleteDict.do/fix']}">
|
<div onclick="deleteDict();" data-options="iconCls:'icon-standard-user-delete'">删除</div>
|
</c:if>
|
|
</div>
|
</body>
|
</html>
|