first commit
This commit is contained in:
176
bin/WebRoot/jsp/equipment/maintenancePlanEdit.jsp
Normal file
176
bin/WebRoot/jsp/equipment/maintenancePlanEdit.jsp
Normal file
@ -0,0 +1,176 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="../inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
|
||||
function getids(){
|
||||
var rows= $('#grid').datagrid("getRows");
|
||||
var ids="";
|
||||
$.each(rows, function(index, item){
|
||||
ids+=item.id+",";
|
||||
});
|
||||
ids=ids.replace(/,$/gi,"");
|
||||
return ids;
|
||||
}
|
||||
|
||||
function doupdate(dialog,grid) {
|
||||
if ($(".form").form('validate')) {
|
||||
$.post(ext.contextPath + "/equipment/maintenanceplan/update.do", $(".form").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$.post(ext.contextPath + "/equipment/maintenanceplan/saveEquipmentCard.do",{maintenanceplanid:data.id,ids:getids()},function(data1){
|
||||
top.$.messager.alert('提示', "保存成功", 'info', function() {
|
||||
grid.datagrid('reload');
|
||||
dialog.dialog('destroy');
|
||||
});
|
||||
});
|
||||
}else if(data.res == 0){
|
||||
top.$.messager.alert('提示', "保存失败", 'info');
|
||||
}else{
|
||||
top.$.messager.alert('提示', data.res, 'info');
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
function doadd(){
|
||||
$("#mids").val(getids());
|
||||
localStorage.setItem("mids",$("#mids").val());
|
||||
var dialog = parent.ext.modalDialog({
|
||||
title : '添加设备',
|
||||
height:500,
|
||||
url : ext.contextPath + '/equipment/showEquipmentCardForSelects.do?',
|
||||
buttons : [ {
|
||||
iconCls:'icon-ok',
|
||||
text : '确认',
|
||||
handler : function() {
|
||||
var data = dialog.find('iframe').get(0).contentWindow.selectFun(dialog, grid);
|
||||
var datas= $.parseJSON(data);
|
||||
//console.log('enter',datas);
|
||||
if(datas.length>0){
|
||||
for(var i=0;i<datas.length;i++){
|
||||
$("#grid").datagrid('appendRow',{
|
||||
id:datas[i].id,
|
||||
equipmentcardid:datas[i].equipmentcardid,
|
||||
equipmentname:datas[i].equipmentname,
|
||||
equipmentmodel:datas[i].equipmentmodel,
|
||||
equipmentclassid:datas[i].equipmentclass,
|
||||
areaid:datas[i].geographyarea
|
||||
});
|
||||
}
|
||||
}
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
} ]
|
||||
});
|
||||
}
|
||||
|
||||
function dodelete(){
|
||||
var rows = $('#grid').datagrid('getChecked');
|
||||
if(rows.length==0){
|
||||
top.$.messager.alert("提示","请选择需要删除的数据","info");
|
||||
}else{
|
||||
top.$.messager.confirm("提示", "确定删除这些数据?", function(r) {
|
||||
if (r) {
|
||||
//复制rows,否则deleteRow的index会出错
|
||||
var copyRows = [];
|
||||
for ( var j= 0; j < rows.length; j++) {
|
||||
copyRows.push(rows[j]);
|
||||
}
|
||||
|
||||
$.each(copyRows, function(index, item){
|
||||
$('#grid').datagrid('deleteRow',$('#grid').datagrid('getRowIndex',copyRows[index]));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#p').panel({
|
||||
width:"100%",
|
||||
height:"300",
|
||||
title: '相关设备',
|
||||
tools: [{
|
||||
iconCls:'icon-add',
|
||||
handler:function(){doadd();}
|
||||
},{
|
||||
iconCls:'icon-remove',
|
||||
handler:function(){dodelete();}
|
||||
}]
|
||||
});
|
||||
grid = $('#grid').datagrid({
|
||||
title : '',
|
||||
striped : true,
|
||||
rownumbers : true,
|
||||
idField : 'id',
|
||||
columns : [ [
|
||||
{checkbox:true , field : 'ck'},
|
||||
{width : '100', title : '设备编号', field : 'equipmentcardid', sortable : true, editor:'textbox',halign:'center'},
|
||||
{width : '120', title : '设备名称', field : 'equipmentname', sortable : true, editor:'textbox',halign:'center'},
|
||||
{width : '100', title : '设备型号', field : 'equipmentmodel', sortable : true, editor:'textbox',halign:'center'},
|
||||
{width : '100', title : '设备类型', field : 'equipmentclassid', sortable : true, editor:'textbox',halign:'center'},
|
||||
{width : '100', title : '存放位置', field : 'areaid', sortable : true, editor:'textbox',halign:'center'}
|
||||
] ],
|
||||
data:${equipmentcardList}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input id="mids" name="mids" type="hidden" value="" />
|
||||
|
||||
<form method="post" class="form">
|
||||
<input name="id" type="hidden" value="${maintenanceplan.id}"/>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>保养计划类型</th>
|
||||
<td>
|
||||
<select name="plantype" class="easyui-combobox" data-options="panelHeight:'auto',editable:false">
|
||||
<option value="0" <c:if test="${maintenanceplan.plantype=='0'}">selected</c:if>>周计划</option>
|
||||
<option value="1" <c:if test="${maintenanceplan.plantype=='1'}">selected</c:if>>月计划</option>
|
||||
<option value="2" <c:if test="${maintenanceplan.plantype=='2'}">selected</c:if>>年计划</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>保养计划编号</th>
|
||||
<td><input name="plannumber" class="easyui-textbox"
|
||||
data-options="required:true,validType:'isBlank'" value="${maintenanceplan.plannumber}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>保养计划内容</th>
|
||||
<td><input name="plancontent" class="easyui-textbox"
|
||||
data-options="required:true,validType:'isBlank'" value="${maintenanceplan.plancontent}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>计划执行时间</th>
|
||||
<td><input id="plantime" name="plantime" class="Wdate"
|
||||
value="${fn:substring(maintenanceplan.plantime,0,10)}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"readonly/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th>备注</th>
|
||||
<td>
|
||||
<textarea name="remark" class="easyui-textbox" data-options="multiline:true" style="height:25px;width:100%" validtype="length[0,250]" invalidMessage="有效长度0-250">${maintenanceplan.remark}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br/>
|
||||
|
||||
<div id="p">
|
||||
<table id="grid" data-options="border:false"></table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user