Files
SIPAIIS_WMS_JSSW/bin/WebRoot/jsp/equipment/maintenancePlanAdd.jsp
2026-01-16 14:13:44 +08:00

172 lines
5.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>xxx</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 dosave(dialog,grid) {
if ($(".form").form('validate')) {
$.post(ext.contextPath + "/equipment/maintenanceplan/save.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,
equipmentclass:datas[i].equipmentclass,
geographyarea: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 : 'equipmentclass', sortable : true, editor:'textbox',halign:'center'},
{width : '100', title : '存放位置', field : 'geographyarea', sortable : true, editor:'textbox',halign:'center'}
] ]
});
});
</script>
</head>
<body>
<input id="mids" name="mids" type="hidden" value="" />
<form method="post" class="form">
<table class="table">
<tr>
<th >保养计划类型</th>
<td ><select id="plantype" name="plantype" class="easyui-combobox" data-options="panelHeight:'auto'">
<option value="0">周计划</option>
<option value="1">月计划</option>
<option value="2">年计划</option>
</select></td>
<tr>
<th>保养计划编号</th>
<td><input name="plannumber" class="easyui-textbox"
data-options="required:true,validType:'isBlank'" value="" />
</td>
</tr>
<tr>
<th>保养计划内容</th>
<td><input name="plancontent" class="easyui-textbox"
data-options="required:true,validType:'isBlank'" value="" />
</td>
</tr>
<tr>
<th>计划执行时间</th>
<td><input id="plantime" name="plantime" class="Wdate"
value="" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"readonly/>
</td>
</tr>
<tr>
<th>备注</th>
<td>
<input name="remark" class="easyui-textbox" style="width:100%;height:25px" value=""
data-options="multiline:true" validtype="length[0,250]" invalidMessage="有效长度0-250" />
</td>
</tr>
</table>
</form>
<br/>
<div id="p">
<table id="grid" data-options="border:false"></table>
</div>
</body>
</html>