275 lines
7.9 KiB
Plaintext
275 lines
7.9 KiB
Plaintext
<!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 dosave(dialog,grid) {
|
||
if ($(".form").form('validate')) {
|
||
$.post(ext.contextPath + "/work/workstation/update.do", $(".form").serialize(), function(data) {
|
||
if (data.res == 1) {
|
||
console.log("getWids()",getWids());
|
||
$.post(ext.contextPath + "/work/workstation/saveProcedure.do",{workstationid:data.id,wids:getWids()},function(data1){
|
||
if(JSON.parse(data1).res>0)
|
||
{
|
||
top.$.messager.alert('提示', "保存成功", 'info', function() {
|
||
grid.datagrid('reload');
|
||
dialog.dialog('destroy');
|
||
});
|
||
}
|
||
else if(JSON.parse(data1).res == 0){
|
||
top.$.messager.alert('提示', "工位已保存,工序未添加", 'info');
|
||
grid.datagrid('reload');
|
||
dialog.dialog('destroy');
|
||
}else{
|
||
top.$.messager.alert('提示', data1.res, 'info');
|
||
}
|
||
});
|
||
}else if(data.res == 0){
|
||
top.$.messager.alert('提示', "保存失败", 'info');
|
||
}else{
|
||
top.$.messager.alert('提示', data.res, 'info');
|
||
}
|
||
},'json');
|
||
}
|
||
}
|
||
$(function() {
|
||
$("#equipmentname").textbox('textbox').bind("click", function () {
|
||
selectId("equipmentname","equipmentid");
|
||
});
|
||
});
|
||
|
||
function selectId(equipmentname,equipmentid){
|
||
var dialog = parent.ext.modalDialog({
|
||
title : '选择设备id',
|
||
width: 700,
|
||
height:420,
|
||
closeOnEscape:true,
|
||
url : ext.contextPath + '/equipment/showEquipmentForSelect.do?',
|
||
toolbar:'',
|
||
buttons : [{
|
||
text : '确定',
|
||
iconCls:'icon-ok',
|
||
handler : function() {
|
||
var res=dialog.find('iframe').get(0).contentWindow.selectID();
|
||
if(res!=null){
|
||
dialog.dialog('destroy');
|
||
$("#"+equipmentname).textbox("setValue",res.equipmentcard);
|
||
$("#"+equipmentid).val(res.id);
|
||
}
|
||
|
||
}
|
||
},
|
||
{
|
||
text : '取消',
|
||
iconCls:'icon-cancel',
|
||
handler : function() {
|
||
dialog.dialog('destroy');
|
||
|
||
}
|
||
}
|
||
]
|
||
});
|
||
}
|
||
|
||
$(function() {
|
||
$('#deptid').combotree({
|
||
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
|
||
parentField : 'pid',
|
||
method:'get',
|
||
onBeforeSelect:function(node){
|
||
if(node.id=="-1"){
|
||
$("#deptid").combotree("unselect");
|
||
}
|
||
},
|
||
onLoadSuccess:function(){
|
||
$('#deptid').combotree('setValue','${workstation.deptid}');
|
||
}
|
||
});
|
||
|
||
$('#typeid').combobox({
|
||
url : ext.contextPath + '/work/workstationType/getselectlist.do?random=' + Math.random(),
|
||
valueField:'id',
|
||
textField:'name',
|
||
method:'get',
|
||
onLoadSuccess:function(){
|
||
$('#typeid').combobox('setValue','${workstation.typeid}');
|
||
}
|
||
|
||
|
||
});
|
||
|
||
$(document).ready(function () {
|
||
var typename = '${workstation.typename}';
|
||
if (typename!= '自动工位'){
|
||
$("#tr").hide();
|
||
}
|
||
$("#typeid").combobox({
|
||
onSelect: function () {
|
||
var typeid = $('#typeid').combobox('getText');
|
||
if(typeid == '自动工位'){
|
||
$("#tr").show();
|
||
}else{
|
||
$("#tr").hide();
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
});
|
||
});
|
||
function getWids(){
|
||
var wrows= $('#grid').datagrid("getRows");
|
||
var wids="";
|
||
$.each(wrows, function(index, item){
|
||
wids+=item.id+",";
|
||
});
|
||
wids=wids.replace(/,$/gi,"");
|
||
return wids;
|
||
}
|
||
function doadd(){
|
||
$("#wids").val(getWids());
|
||
localStorage.setItem("wids",$("#wids").val().split(","));
|
||
var dialog = parent.ext.modalDialog({
|
||
title : '添加工序',
|
||
height:500,
|
||
url : ext.contextPath + '/work/workstation/showProcedurelistForSelects.do?iframeId=workstationEdit',
|
||
buttons : [ {
|
||
iconCls:'icon-ok',
|
||
text : '确认',
|
||
handler : function() {
|
||
var data = dialog.find('iframe').get(0).contentWindow.selectFun(dialog, grid);
|
||
if(data.res.length>0){
|
||
for(var i=0;i<data.res.length;i++){
|
||
grid.datagrid('appendRow',{
|
||
id:data.res[i].id,
|
||
procedurename:data.res[i].procedurename,
|
||
procedurecode:data.res[i].procedurecode,
|
||
keywords:data.res[i].keywords,
|
||
type:data.res[i].type,
|
||
semiflag:data.res[i].semiflag
|
||
});
|
||
}
|
||
}
|
||
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:"170",
|
||
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 : 'procedurename', sortable : true, halign:'center'},
|
||
{width : '100', title : '工序编号', field : 'procedurecode', sortable : true, halign:'center'},
|
||
{width : '100', title : '关键字', field : 'keywords', sortable : true, halign:'center'},
|
||
{width : '100', title : '类型', field : 'type', sortable : true, halign:'center',formatter : function(value, row) {
|
||
if(row.type=='${Type_Inspect}'){
|
||
return '检测工序';
|
||
}else{
|
||
return '生产工序';
|
||
}
|
||
}},
|
||
{width : '80', title : '半成品工序', field : 'semiflag', sortable : true, halign:'center',formatter : function(value, row) {
|
||
if(row.semiflag=='${Flag_Semi}'){
|
||
return '是';
|
||
}else{
|
||
return '否';
|
||
}
|
||
}},
|
||
]],
|
||
data:${ProcedureList}
|
||
});
|
||
|
||
});
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<input id="wids" name="wids" type="hidden" value="" />
|
||
<form method="post" class="form">
|
||
<input name="id" type="hidden" value="${workstation.id}"/>
|
||
<table class="table">
|
||
<tr>
|
||
<th>工位类型</th>
|
||
<td><input id="typeid" name="typeid" class="easyui-combobox"
|
||
data-options="required:true,validType:'isBlank'" value="" />
|
||
</td>
|
||
</tr>
|
||
<tr id="tr">
|
||
<th>关联设备</th>
|
||
<td><input id="equipmentname" name="equipmentname" class="easyui-textbox"
|
||
value="${workstation.equipmentname}" />
|
||
<input id="equipmentid" name="equipmentid" type="hidden" value="" />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>工位编号</th>
|
||
<td><input name="serial" class="easyui-textbox"
|
||
data-options="required:true,validType:'isBlank'" value="${workstation.serial}" />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>工位名称</th>
|
||
<td><input name="name" class="easyui-textbox"
|
||
data-options="required:true,validType:'isBlank'" value="${workstation.name}" />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>工位概述</th>
|
||
<td>
|
||
<textarea name="intro" class="easyui-textbox" data-options="multiline:true" validtype="length[0,250]" invalidMessage="有效长度0-250"
|
||
style="width:100%;height:100px">${workstation.intro}</textarea>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</form>
|
||
</br></br>
|
||
<div id="p">
|
||
<table id="grid" data-options="border:false"></table>
|
||
</div>
|
||
</body>
|
||
</html>
|