1.级联grid的写法
{
region: "south",
height: Ext.getBody().getHeight() * 0.5,
layout: "border",
split: true,
defaults: {
xtype: "zlgrid",
split: true
},
items: [
{
region: "center",
xtype: "zlgrid",
id: "paramGrid",
zlds: {
objectType: "com.zl.mom.quality.ParamControl",
hoster: {
component: "planGrid",
path: "paramControls"
},
fixedColumns: ["paramName","valueMin", "valueMax", "valueRange", "brief"],
pageSize: 20
},
dialog: "ParamControl",
actions: [
"T-参数控制",
{
action: "new",
zlv: {
validate: function (rows) {
let selection = Ext.getCmp("planGrid").getSelection();
if (!selection) {
return "请选择一个质检计划";
}
}
}
},
{
action: "update"
},
{
action: "delete"
}
]
},
{
region: "south",
id: "processGrid",
height:Ext.getBody().getHeight() * 0.25,
zlds: {
objectType: "com.zl.mom.quality.ProcessParam",
hoster: {
component: "planGrid",
path: "processParams"
},
fixedColumns: ["name","minValue", "maxValue", "brief"],
pageSize: 20
},
dialog: "ProcessControl",
actions: [
"T-过程参数",
{
action: "new",
zlv: {
validate: function (rows) {
let selection = Ext.getCmp("planGrid").getSelection();
if (!selection) {
return "请选择一个质检计划";
}
}
}
},
{
action: "update"
},
{
action: "delete"
}
]
},
]
}
ProcessControlDialog = new Ext.extend(ZLDialog, {
width: 400,
height: 400,
title: "过程参数",
formConfig: {
relations: {
testPlan: "planGrid"
}
},
fieldDefaults: {
anchor: "90%",
clearModes: ["NEW"]
},
fields: [
"name","minValue", "maxValue","brief-texts"
]
});
ParamControlDialog = new Ext.extend(ZLDialog, {
width: 400,
height: 400,
title: "参数控制",
formConfig: {
relations: {
testPlan: "planGrid"
}
},
fieldDefaults: {
anchor: "90%",
clearModes: ["NEW"]
},
fields: [
{
fieldLabel: "工艺参数",
xtype: "selfield",
zlds: {
objectType: "com.zl.mom.quality.TechnicalParam",
fixedColumns: ["name", "brief"]
},
column: "name",//方框中显示的字段为名称(如巡检确认)
name: "relations.technicalParam",//为technicalParam赋值
allowBlank: false
}, "valueMax", "valueMin", "valueRange", "paramName", "brief-texts"
]
});
2.筛选boxcheck写法
{
xtype: "checkbox",
id: "dataCatch",
boxLabel: "过程参数",
handler: function (btn) {
btn.ownerCt.ownerCt.reloadPage();
}
},
{
xtype: "checkbox",
id: "showPic",
boxLabel: "显示图片",
handler: function (btn) {
btn.ownerCt.ownerCt.reloadPage();
}
},
zlds: {
objectType: "com.zl.mom.em.ProducingLine",
fixedColumns: ["nr", "name", "typeName", "createdBy", "createdAt", "modifiedBy", "modifiedAt", "disabled"],
pageSize: 20,
getExtraFilter: function () {//该方法筛选
let filter = ""
let result = [];
let equipmentList = Ext.getCmp("equipmentList");
let dataCatched = Ext.getCmp("dataCatch").checked;
let isShowed = Ext.getCmp("showPic").checked;
if (dataCatched) {
result.push("(processVisible=true)");
}else {
result.push("(processVisible=false)")
}
if (isShowed) {
result.push("(showProductIcon=true)");
}else {
result.push("(showProductIcon=false)")
}
filter = result.join("and");
return filter;
}
},
3.dialog中添加grid,selfield的写法
StepBomItemDialog = Ext.extend(GridDialog, {
height: 400,
width: 600,
title: "工单Bom",
leading: true,
fieldDefaults: {
anchor: "90%"
},
gridConfig: {
id: "bItems",
dialog:"BomItemAlter",
actions: [
{
action: "new",
},
{
action: "update",
},
{
action: "delete",
}
]
},
zlds: {
objectType: "com.zl.mom.common.StepBomItem",
hoster: {
component: "mainList",
path: "bomItems"
},
fixedColumns: ["sequenceNr", "materialNr", "materialName", "quantityMaterial", "quantityProduct", "feedable", "quantityFed", "quantityPicked", "fed"],
orderBy: "sequenceNr,objectId",
pageSize: Model.defaultPageSize,
},
buttonClicked: function (btn) {
if (!btn.ok) {
return;
}
var dialog = btn.ownerCt.ownerCt;
dialog.hide();
}
});
BomItemAlterDialog = Ext.extend(ZLDialog, {
title: "BOM组成",
height: 250,
width: 380,
fieldDefaults: {
anchor: "90%",
},
formConfig: {
relations: {
step: "mainList"
}
},
fields: [
{
id: "itemMaterial",
xtype: "selfield",
zlds: {
objectType: "com.zl.mom.common.Material",
pageSize: 20,
fixedFilter: "(disabled=false)",
fixedColumns: ["logicStockName", "nr", "name"],
getExtraFilter: function () {//不能重复添加同一物料bom
var selection = Ext.getCmp("bItems").getSelection();
var materialNr = selection.data.materialNr;
var filter = Model.filterByFactoryNr(page.factoryNr);
if (filter) {
filter += "and(nr!=" + materialNr + ")";
} else {
filter = "(nr!=" + materialNr + ")";
}
return filter;
}
},
column: "name",//方框里显示的信息
dataId: "materialName",//要给后台赋值的字段
toFields:[
{column:"nr",field:"itemNr"}//nr的数据传给另一个field
]
},
{
id:"itemNr",
xtype:"textfield",
dataId:"materialNr"//nr的值传给后台字段materialNr
},
"sequenceNr", "quantityProduct", "quantityMaterial",
],
});