You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/TruckMng/Viewsjs/MsWlBs/Edit.js

194 lines
5.7 KiB
JavaScript

Ext.BLANK_IMAGE_URL = '../../TruckMng/Content/Images/s.gif';
var panelEdit = null;
var inited = true;
var pcIndex = null;
var pcEdit = null;
var pcTabs = null;
var pcPanel = null;
var tabMainPc = null;
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var parentWin = window.parent.opener;
var btnOnlyQuery = false;
if (parentWin) {
var ret = parentWin.OprationSwap();
if (ret[3] == 'MsWlCheckAccIndex') {
btnOnlyQuery = true;
}
}
//托运单编辑界面
panelEdit = new window.DsTruck.MsWlBsEdit({
title: '托运单信息维护',
region: 'center',
layout: 'border'
});
if (btnOnlyQuery) {
panelEdit.setBtnOnlyQuery();//根据情况设置查询按钮的visible
}
//按钮面板 左边栏
var btnPanel = new Ext.Panel({
collapsible: true,//是否带收起panel的按钮
region: 'west',
width: 100,
frame: true,
layout: 'accordion',
title: '详细信息',
margins: '5 0 5 5',
split: true,
lbar: [
{
text: '托单信息',
textAlign: 'left',
handler: function(button, event) {
tabs.setActiveTab(0);
}
}, '-', {
text: '派车单信息',
textAlign: 'left',
handler: function(button, event) {
if (inited) {
//#region 派车
//派车单界面
pcIndex = new window.DsTruck.MsWlPcIndex({
region: 'center',
layout: 'border'
});
pcEdit = new window.DsTruck.MsWlPcEdit({
region: 'center',
layout: 'border',
alias:'widget.center'
});
if (btnOnlyQuery) {
pcIndex.setBtnOnlyQuery();
pcEdit.setBtnOnlyQuery();
}
pcTabs = Ext.create('Ext.tab.Panel', {
region: 'center', // a center region is ALWAYS required for border layout
deferredRender: false,
activeTab: 0, // first tab initially active
items: [
{
title: '查询',
layout: 'fit',
items: [pcIndex]
},
{
title: '编辑',
layout: 'fit',
items: [pcEdit],
itemId: 'pcedit'
}
]
});
pcIndex.TabPanel = pcTabs;
pcEdit.ParentPanel = pcIndex;
pcPanel = new Ext.Panel({
title: '派车单信息维护',
region: 'center',
layout: 'border',
items: [pcTabs]
});
tabMainPc = tabs.add({
layout: 'fit',
deferredRender: false,
items: [pcPanel]
});
pcTabs.on('beforetabchange', changehandlerPc, this);
inited = false;
}
//#endregion
var refbillno = panelEdit.GetBillNo();
if (refbillno == '*') {
//Ext.Msg.alert('提示', "请先保存托单信息!");
Ext.Msg.show({
title: '提示',
msg: "请先保存托单信息后,才能编辑派车单信息",
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
tabs.setActiveTab(1);
},
scope: this
}
]
});
//主体界面的tab
var tabs = Ext.create('Ext.tab.Panel', {
region: 'center', // a center region is ALWAYS required for border layout
deferredRender: false,
activeTab: 0//, // first tab initially active
//items: [panelEdit, pcPanel]
});
tabs.getTabBar().setVisible(false);
var tabMainBs = tabs.add({
layout: 'fit',
deferredRender: false,
items: [panelEdit]
}).show();
tabs.setActiveTab(tabMainBs);
var view = new Ext.Viewport({
layout: 'border',
renderTo: 'viewport',
border: false,
items: [
btnPanel, tabs
// tabs
]
});
var hasQryPc = false;
tabs.on('beforetabchange', changehandler, this);
function changehandler(tabpanel, newtab, oldtab) {
if (newtab == tabMainPc) {
if (hasQryPc==false) {
var refbillno = panelEdit.GetBillNo();
if (refbillno != '*') {
pcIndex.QryDataList(refbillno);
}
hasQryPc = true;
}
}
}
function changehandlerPc(tabpanel, newtab, oldtab) {
if (newtab == tabpanel.child('#pcedit')) {
pcEdit.InitData();
}
}
});