Commit f096def7 authored by 李苏's avatar 李苏 💬

联动选择框

parent f8799290
<div id="gyglGylxEdit" class="e-dialog-container" data-options="width:1080,height:480">
<div class="e-single-dialog">
<input type="hidden" name="flag">
<input type="hidden" name="id" >
<input type="hidden" name="sysversion" >
<div class="gui-row" >
<!-- <div class="gui-col-sm6">
<label class="gui-form-label">工厂:</label>
<div class="gui-input-block">
<input type="text" name="gcid" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div> -->
<div class="gui-col-sm6">
<label class="gui-form-label">工作中心:</label>
<div class="gui-input-block">
<input type="text" name="gzzxid" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">序号:</label>
<div class="gui-input-block">
<input type="text" name="xh" data-toggle="gui-textbox" data-options="required:true">
</div>
</div>
</div>
<div class="gui-row">
<div class="gui-col-sm6">
<label class="gui-form-label">工序类型:</label>
<div class="gui-input-block">
<input type="text" name="gxlx" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">标准工序:</label>
<div class="gui-input-block">
<input type="text" name="bzgxid" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm6">
<label class="gui-form-label">工艺路线号:</label>
<div class="gui-input-block">
<input type="text" name="wlid" data-toggle="gui-textbox" data-title="gylxcode" data-options="required:true" >
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">工序名称:</label>
<div class="gui-input-block">
<input type="text" name="name" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm6">
<label class="gui-form-label">设备数量:</label>
<div class="gui-input-block">
<input type="text" name="sbsl" data-toggle="gui-numberbox">
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">作业人数:</label>
<div class="gui-input-block">
<input type="text" name="zyrsl" data-toggle="gui-numberbox">
</div>
</div>
</div>
<div class="gui-row">
<div class="gui-col-sm6">
<label class="gui-form-label">排队耗时:</label>
<div class="gui-input-block">
<input type="text" name="pdhs" data-toggle="gui-numberbox">
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">准备耗时:</label>
<div class="gui-input-block">
<input type="text" name="zbhs" data-toggle="gui-numberbox">
</div>
</div>
</div>
<div class="gui-row">
<div class="gui-col-sm6">
<label class="gui-form-label">加工耗时:</label>
<div class="gui-input-block">
<input type="text" name="jghs" data-toggle="gui-numberbox">
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">单位时间产量:</label>
<div class="gui-input-block">
<input type="text" name="dwsjcl" data-toggle="gui-numberbox">
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm6">
<label class="gui-form-label">转移耗时:</label>
<div class="gui-input-block">
<input type="text" name="zyhs" data-toggle="gui-numberbox">
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">排产倍数:</label>
<div class="gui-input-block">
<input type="text" name="pcbs" data-toggle="gui-numberbox">
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm6">
<label class="gui-form-label"></label>
<div class="gui-input-block" data-toggle="gui-checkbox" data-options="label:'关键工序'">
<input type="checkbox" name="gjgx" style="width: 100%" >
</div>
</div>
<div class="gui-col-sm6">
<label class="gui-form-label">工序标志:</label>
<div class="gui-input-block">
<input type="text" name="gxbz" data-toggle="gui-textbox" data-options="required:true" >
</div>
</div>
</div>
<div class="gui-row" >
<div class="gui-col-sm12">
<label class="gui-form-label">备注:</label>
<div class="gui-input-block">
<input type="text" name="bz" data-toggle="gui-textbox">
</div>
</div>
</div>
</div>
<div class="e-dialog-footer">
<a href="javascript:void(0);" class="e-dialog-ok1"></a>
<a href="javascript:void(0);" class="e-dialog-cancel"></a>
</div>
</div>
<script>
$(function () {
var $div=$('#gyglGylxEdit');
var $cbxGcid = $div.find('input[name="gcid"]');
var $cbxGzzxid = $div.find('input[name="gzzxid"]');
var $cbxGxlx = $div.find('input[name="gxlx"]');
var $cbxGxbz = $div.find('input[name="gxbz"]');
var $edtWlid = $div.find('input[name="wlid"]');
var $cbxBzgxid = $div.find('input[name="bzgxid"]');
var $edtName = $div.find('input[name="name"]');
var $edtSbsl = $div.find('input[name="sbsl"]');
var $edtZyrsl = $div.find('input[name="zyrsl"]');
var $edtPdhs = $div.find('input[name="pdhs"]');
var $edtZbhs = $div.find('input[name="zbhs"]');
var $edtJghs = $div.find('input[name="jghs"]');
var $edtZyhs = $div.find('input[name="zyhs"]');
var $bInit = true;
function pageInit(ops){
//$cbxGcid.iCombobox({valueField:'id', textField:'name', onSelect: doSelectGcid});
$cbxGzzxid.iCombobox({valueField:'id', textField:'name', onSelect: doSelectGzzxid});
$cbxGxlx.iCombobox({valueField:'id', textField:'name',onSelect:doldbzgx});
$cbxGxbz.iCombobox({valueField:'id', textField:'name'});
$cbxBzgxid.iCombobox({valueField:'id', textField:'name', onSelect: doSelectBzgxid});
Auxiliary.box($edtWlid, "WLID");
}
function dataInit(ops){
gas.post('jcsj/common/gc/query', {}, function(res){
if (res.success && res.data.records){
$cbxGcid.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/gzzx/query', {}, function(res){
if (res.success && res.data.records){
$cbxGzzxid.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/bzgx/queryNotTybzBzgx', {}, function(res){
if (res.success && res.data.records){
$cbxBzgxid.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/gylx/init/gxlx', {}, function(res){
if (res.success && res.data.records){
$cbxGxlx.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/gylx/init/gxbz', {}, function(res){
if (res.success && res.data.records){
$cbxGxbz.iCombobox('loadData', res.data.records);
}
}, ops);
}
function run(ops){
$bInit=false;
}
gas.load(pageInit, dataInit, run);
/* function doSelectGcid(a){
if( $div.closest("form").attr("tag")!="add" && $bInit) return false;
$cbxGzzxid.iCombobox('setValue', '');
gas.post('gygl/gzzx/query', {gcid: a.id}, function(res){
if (res.success && res.data.records){
$cbxGzzxid.iCombobox('loadData', res.data.records);
}
});
}*/
function doSelectGzzxid(a){
if( $div.closest("form").attr("tag")!="add" && $bInit) return false;
gas.post('gygl/bzgx/queryNotTybzBzgx', {gzzxid: a.id}, function(res){
if (res.success && res.data.records){
$cbxBzgxid.iCombobox('setValue', '');
$cbxBzgxid.iCombobox('loadData', res.data.records);
}
});
}
function doSelectBzgxid(a){
if( $div.closest("form").attr("tag")!="add" && $bInit) return false;
gas.post('gygl/bzgx/queryById', {id: a.id}, function(res){
if (res.success && res.data.records && res.data.records.length>0){
var bzgx = res.data.records[0];
$edtName.textbox('setValue', bzgx.name||"");
$edtSbsl.textbox('setValue', bzgx.sbsl||0);
$edtZyrsl.textbox('setValue', bzgx.zyrsl||0);
$edtPdhs.textbox('setValue', bzgx.pdhs||0);
$edtZbhs.textbox('setValue', bzgx.zbhs||0);
$edtJghs.textbox('setValue', bzgx.jghs||0);
$edtZyhs.textbox('setValue', bzgx.zyhs||0);
}
});
}
function doldbzgx(e){
gas.post('gygl/bzgx/queryNotTybzBzgx', {gxlx:e.id}, function(res){
if (res.success && res.data.records){
$cbxBzgxid.iCombobox('setValue', '');
$cbxBzgxid.iCombobox('loadData', res.data.records);
}
});
}
$div.find(".e-dialog-ok1").iMenubutton({
text:"确定",
iconCls:"fa fa-save",
btnCls:"gui-btn-save",
onClick:function (){
debugger;
if(!$div.parent('form').form('validate')){
return false
}
var data= getDataHolder($div);
var id="";var wlid="";var name="",bzgxid="";
var tag="add";
if(data.master.flag=="U"){
tag="update"
}else{
if(data['master']['id']){
delete data['master']['id'];
}
}
if(data.master){
if(data.master.id) id=data.master.id;
if(data.master.wlid) wlid=data.master.wlid;
if(data.master.name) name=data.master.name;
if(data.master.bzgxid) bzgxid=data.master.bzgxid;
}
var params = {
id:id,wlid:wlid,name:name,bzgxid:bzgxid
};
gas.post("gygl/gylx/validGylx", params,function (a) {
if(a.success){
gas.post("gygl/gylx/"+tag,data,function (res) {
if(res.success){
$div.closest("form").iDialog("setStatus",{"state":"ok",data:res.data});
}else{
$.messager.alert("提示",res.message);
}
})
}else{
$.messager.confirm('提示', a.message+" 是否继续?",function (r) {
if (r) {
HTTP.post("gygl/gylx/"+tag,data,function (res) {
if(res.success){
$div.closest("form").iDialog("setStatus",{"state":"ok",data:res.data});
}else{
$.messager.alert("提示",res.message);
}
})
}
})
}
})
}
});
})
</script>
<div id="gyglGylx" class="gui-div">
<table class="toolbar-table" data-options="id: 'gyglGylxTable',herf:'kzzx/gridset/query'"></table>
<!-- 表格工具栏开始 -->
<div id="gyglGylxTable-toolbar" class="gui-toolbar" data-options="grid:{type:'datagrid',id:'gyglGylxTable'}">
<div class="navbar-toolbar">
<a class="toolbar-print toolbar" href="javascript:void(0)"></a>
<a class="toolbar-export toolbar" href="javascript:void(0)"></a>
<a class="toolbar-review toolbar" href="javascript:void(0)"></a>
<a class="toolbar-add toolbar" href="javascript:void(0)"></a>
<a class="toolbar-copy toolbar" href="javascript:void(0)"></a>
<a class="toolbar-edit toolbar" href="javascript:void(0)"></a>
<a class="toolbar-delete toolbar" href="javascript:void(0)"></a>
<a class="toolbar-attachment toolbar" href="javascript:void(0)"></a>
<a class="toolbar-run toolbar" href="javascript:void(0)"></a>
</div>
<div class="form-sub">
<form class="query-criteria">
<ul>
<li class="gui-form-row" >
<!--<div class="gui-col-sm3">
<label class="gui-form-label">工厂:</label>
<div class="gui-input-block">
<input type="text" name="gcid" class="gui-textbox">
</div>
</div>-->
<div class="gui-col-sm3">
<label class="gui-form-label">工作中心:</label>
<div class="gui-input-block">
<input type="text" name="gzzxid" class="gui-textbox">
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">工序类型:</label>
<div class="gui-input-block">
<input type="text" name="gxlx" class="gui-textbox" style="width: 100%">
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">标准工序:</label>
<div class="gui-input-block">
<input type="text" name="bzgxid" class="gui-textbox">
</div>
</div>
<div class="gui-col-sm3">
<label class="gui-form-label">工艺号:</label>
<div class="gui-input-block">
<input type="text" name="code" class="gui-textbox">
</div>
</div>
</li>
</ul>
<span class="toolbar-search-span"><a class="toolbar-search" href="javascript:void(0)"></a></span>
</form>
</div>
</div>
</div>
<!-- 表格工具栏结束 -->
<script>
$(function () {
/*js初始化*/
var $div=$('#gyglGylx');
var $datagrid=$div.find(".toolbar-table");
var $cbxGcid = $div.find('input[name="gcid"]');
var $cbxBzgxid = $div.find('input[name="bzgxid"]');
var $cbxGxlx = $div.find('input[name="gxlx"]');
var $cbxGzzxid = $div.find('input[name="gzzxid"]');
var $gxlxArray = [];
var $gxbzArray = [];
function paramInit(ops){
gas.post('gygl/gylx/init/gxlx', {}, function(res){
$gxlxArray = res.data.records;
}, ops);
gas.post('gygl/gylx/init/gxbz', {}, function(res){
$gxbzArray = res.data.records;
}, ops);
}
function pageInit() {
var options = {
url: 'gygl/gylx',
noRequest: true,
columns: [[
{title: "序号1", field: "xh", fieldType: "int",align:"center",width: 60},
{title: "工艺路线号", field: "gylxcode", fieldType: "ftString",width:140},
{title: "工序名称", field: "name", fieldType: "ftString",width:140},
{title: "工作中心", field: "gzzxName", fieldType: "ftString",width:140},
{title: "标准工序", field: "bzgxName", fieldType: "ftString",width:140},
{title: "物料名称", field: "wlxxName", fieldType: "ftString",width:140},
/* {title: "规格", field: "wlxxGg", fieldType: "ftString",width:140},*/
{title: "工序类型", field: "gxlx", fieldType: "combobox",width:80, props: {data: $gxlxArray}},
{title: "工序标志", field: "gxbz", fieldType: "combobox",width:80, props: {data: $gxbzArray}},
{title: "设备数量", field: "sbsl", fieldType: "float"},
{title: "作业人数", field: "zyrsl", fieldType: "float"},
{title: "排队耗时", field: "pdhs", fieldType: "float"},
{title: "准备耗时", field: "zbhs", fieldType: "float"},
{title: "加工耗时", field: "jghs", fieldType: "float"},
{title: "转移耗时", field: "zyhs", fieldType: "float"},
{title: "关键工序", field: "gjgx", fieldType: "checkbox",width:80},
{title: "单位时间产量", field: "dwsjcl", fieldType: "float"},
{title: "排产倍数", field: "pcbs", fieldType: "float"},
{title: "状态", field: "tybz", fieldType: "tybz", width:80},
{title: "停用日期", field: "tyrq", fieldType: "ftDateTime"},
{title: "备注", field: "bz", fieldType: "ftString",width:200},
{title: "维护人", field: "whr", fieldType: "ftString"},
{title: "维护时间", field: "whsj", fieldType: "ftDateTime"},
{title: "附件数", field: "attachcount", fieldType:"int"}
]],
dialog: {
footerIn: true,
href: 'gygl/gylx/edit'
}
};
$div.Holder(options);
//$cbxGcid.iCombobox({valueField:'id', textField:'name', onSelect: doSelectGcid});
$cbxGzzxid.iCombobox({valueField:'id', textField:'name', allowNull:true,onSelect: doSelectBzgxid});
$cbxBzgxid.iCombobox({valueField:'id', textField:'name', allowNull:true});
$cbxGxlx.iCombobox({valueField:'id', textField:'name', allowNull:true});
}
/*数据初始化*/
function dataInit(ops){
gas.post('jcsj/common/gc/query', {}, function(res){
if (res.success && res.data.records){
$cbxGcid.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/gzzx/query', {}, function(res){
if (res.success && res.data.records){
$cbxGzzxid.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/gylx/init/gxlx', {}, function(res){
if (res.success && res.data.records){
$cbxGxlx.iCombobox('loadData', res.data.records);
}
}, ops);
gas.post('gygl/bzgx/queryNotTybzBzgx', {}, function(res){
if (res.success && res.data.records){
$cbxBzgxid.iCombobox('loadData', res.data.records);
}
}, ops);
}
/*用户操作*/
function run(ops){
$datagrid.datagrid("options").url="gygl/gylx/query";
$datagrid.datagrid("load",DataBind.collectData($div))
}
gas.load(paramInit,pageInit,dataInit,run);
function doSelectGcid(res){
gas.post('gygl/gzzx/query', {gcid: res.id}, function(res){
if (res.success && res.data.records){
$cbxGzzxid.iCombobox('setValue', '');
$cbxGzzxid.iCombobox('loadData', res.data.records);
}
});
}
function doSelectBzgxid(res){
gas.post('gygl/bzgx/queryNotTybzBzgx', {gzzxid: res.id}, function(res){
if (res.success && res.data.records){
$cbxBzgxid.iCombobox('setValue', '');
$cbxBzgxid.iCombobox('loadData', res.data.records);
}
});
}
})
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment