目的: V80201 – 生工OSM查詢 – 開啟子視窗
處理說明:
1>*.js 開啟子視窗的 source
1>> V80201A.js
Ext.Loader.loadScript({
url: '../JsFunction/V80201A1.js'
});
//[顯示子件資料]鈕 - 子視窗
function ShowPNBtn_click() {
console.log(" ShowPNBtn_click step1");
//按鈕 : [確認] [取消] - [顯示子件資料]鈕
var sub_ShowPN_Btns = [
{
xtype: 'button', text: '確定', id: 'sub_ShowPN_OkBtn',
listeners: {
click: function () {
//mysuccessalert("mysub2_確定 ");
ShowPNGridDetail();
}
}
},
2>>V80201A1.js
//[顯示子件明細資料]鈕 - 子視窗Grid
function ShowPNGridDetail() {
//按鈕 : [確認] [取消] - [顯示子件資料]鈕
var sub_ShowPNDetail_Btns = [
{
xtype: 'button', text: '瀏覽參考文件', id: 'sub_ShowRef_OkBtn',
listeners: {
click: function () {
//mysuccessalert("mysub2_確定 ");
ShowRefDetail();
}
}
},
{
xtype: 'button', text: '離開', id: 'sub_ShowRef_CancelBtn',
listeners: {
click: function () {
//mysuccessalert("mysub2_取消");
var Tmp_win = this.up("window");
if (Tmp_win == undefined) {
Ext.Msg.alert("取消時未取到Window Object");
}
this.up("window").close();
this.up("window").destroy();
}
}
},
];
// [顯示子件資料]鈕 - Grid子畫面欄位
var sub_Columns = [
{ header: "", xtype: "rownumberer", width: 50, align: "center", sortable: false },
{ header: "子件件號", dataIndex: "cmp_id", width: 100, TMType: "string" },
{ header: "件號名稱", dataIndex: "itm_name", width: 150, TMType: "string" },
{ header: "數量", dataIndex: "qty", width: 80, TMType: "string" },
{ header: "單位", dataIndex: "units", width: 60, TMType: "string" },
{ header: "製程", dataIndex: "mroutingtype", width: 80, TMType: "string" },
{ header: "製程名稱", dataIndex: "mroutingtype_name", width: 100, TMType: "string" },
//{ header: "替代件號", dataIndex: "SPN", width: 100, TMType: "string" },
//{ header: "參考文件", dataIndex: "FLNM", width: 100, TMType: "string" },
];
var sub_model = [
{ name: "cmp_id" },
{ name: "itm_name" },
{ name: "qty" },
{ name: "units" },
{ name: "mroutingtype" },
{ name: "mroutingtype_name" },
//{ name: "SPN" },
//{ name: "FLNM" },
];
console.log(" ShowPNGridDetail step2");
//子件明細 Grid
var sub_Grid = Ext.create('TMGrid', {
grid_id: 'sub_Grid',
columns: sub_Columns,
autoScroll: true,
flex: 1,
store: Ext.create('gridstore', { model: sub_model }),
});
console.log("sub_Grid:", sub_Grid);
var sub_ShowPNDetail_Flds = [
{
type: 'panel', bodyStyle: "background-color:transparent;", border: 5, padding: "1",
layout: 'border',
items: [
{
xtype: 'panel',
id: 'sub_panel1',
region: 'north',
layout: { type: 'hbox', align: 'stretch' },
items: [
{
xtype: "fieldcontainer", fieldLabel: "專案別", labelWidth: 80, flex: 5, border: 2,
items: [
{ id: "sub_PROJID1", name: "sub_PROJID1", xtype: "textfield", width: 80, padding: "0 4 0 0", },
]
},
{
xtype: "button", text: "顯示明細資料", labelWidth: 120, flex: 2, border: 2,
handler: function () {
var np = {};
Ext.getCmp('sub_Grid').store.getProxy().url = '../api/V80201A1API/getsubData';
Ext.getCmp('sub_Grid').store.getProxy().extraParams = np; //分頁OK,篩選條件OK
Ext.getCmp('sub_Grid').store.load();
}
},
],
},//end of 專案別
{
xtype: 'panel',
id: 'sub_panel2',
region: 'center', //自動填滿剩餘空間
layout: 'fit', //如此 Grid 才會充滿 panel2
flex: 5,
border: 1,
items: [sub_Grid]
},
] // end of layout: "vbox", padding: "5", items: [
} //end of sub_ShowPN_Flds , items[{
] //end of var sub_ShowPN_Flds
//"A1" : 區分不同 window_id
var win1 = getMyWindow("顯示子件明細資料", sub_ShowPNDetail_Flds, sub_ShowPNDetail_Btns, "A1");
win1.x = 450;
win1.setWidth(400);
win1.setHeight(300);
//顯示 sub Grid 資料
var np = {};
np["sub_BRP"] = "";
Ext.getCmp('sub_Grid').store.on("load", function (me, records, successful, eOpts) {
if (successful) {
console.log("successful");
console.log("Ext.getCmp('sub_Grid').store.data", Ext.getCmp('sub_Grid').store.data);
win1.show();
}
}
);
Ext.getCmp('sub_Grid').store.getProxy().url = '../api/V80201A1API/getsubData';
Ext.getCmp('sub_Grid').store.getProxy().extraParams = np; //分頁OK,篩選條件OK
//Ext.getCmp('sub_Grid').store.clearOnPageLoad = true;
//Ext.getCmp('sub_Grid').reloadGridData();
Ext.getCmp('sub_Grid').store.load();
console.log(" STEP 1 Ext.getCmp('sub_Grid').store.load() ");
//Ext.getCmp('sub_Grid_ptb').hide();
}; // end of function ShowPNBtn_click() {