ext页面
<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%
String path = request.getContextPath();
%>
<%
// 接受后台传前台的货代个数
int huoDaiNum =(Integer) request.getAttribute("huoDaiNum");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> <s:text name="table.hyMonthInquiry"/><s:text name="common.manager"/> </title>
<%@include file="/common/js.inc" %>
<%@include file="/common/function.jsp" %>
<jsp:include page="../firmOffer/hyFirmOfferInquiry/include/tradePortSelect.jsp" /><!--表单和公共方法 -->
<script type="text/javascript">
function doEdit(){
if(null == listGrid.getSelectionModel().getSelected()){
Ext.Msg.alert("<s:text name='common.msg' />","<s:text name='errors.notselect' />");
return ;
}
var record = listGrid.getSelectionModel().getSelections()[0];
orderWin.show();
editForm.getForm().reset();
editForm.loadRecord(record);
}
//填写价格上浮
function doWriteUpPrice(){
if(null == listGrid.getSelectionModel().getSelected()){
Ext.Msg.alert("<s:text name='common.msg' />","<s:text name='table.odSaleTemplate.noselect' />");
return ;
}
var record = listGrid.getSelectionModel().getSelections()[0];
comboWin.show();
editFormUp.getForm().reset();
editFormUp.loadRecord(record);
}
function doQuery(){
listGrid.store.baseParams['queryData.batchNoEnd'] = Ext.getCmp('queryData.batchNoEnd').getValue();
listGrid.store.baseParams['queryData.airLine'] = Ext.getCmp('queryData.airLine').getValue();
listGrid.store.baseParams['queryData.batchNo'] = Ext.getCmp('queryData.batchNo').getValue();
listGrid.store.baseParams['queryData.shipType'] = Ext.getCmp('queryData.shipType').getValue();
listGrid.store.baseParams['queryData.detailType'] = Ext.getCmp('queryData.detailType').getValue();
listGrid.store.baseParams['queryData.suggestPrice'] = Ext.getCmp('queryData.suggestPrice').getValue();
listGrid.store.baseParams['queryData.partDestination'] = Ext.getCmp('queryData.partDestination').getValue();
listGrid.store.load({
params : {
'queryData.start' : 0,
'queryData.limit' : listGrid.getBottomToolbar().pageSize
},
callback :function(result,options,success){
if(success){
}else{
Ext.Msg.alert("<s:text name="common.error"/>","<s:text name="common.readfailer"/>");
}
}
})
}
//导出航线运价查询表
function downLoadAvgPrice(){
Ext.Ajax.request({
url : '<%=path%>/hyMonthInquiry/doDownloadHyAvgQuotation.html',
params:{
'queryData.batchNo':Ext.getCmp('queryData.batchNo').getValue(),
'queryData.shipType':Ext.getCmp('queryData.shipType').getRawValue(),
'queryData.detailType':Ext.getCmp('queryData.detailType').getRawValue(),
'queryData.partDestination':Ext.getCmp('queryData.partDestination').getValue()
},
waitTitle : '<s:text name="common.wait"/>',
waitMsg : '<s:text name="common.reading"/>',
success : function(response) {
var res = Ext.util.JSON.decode(response.responseText);
if(res.success){
window.open("<%=path%>/odDownloadLog/download.html?recordId="+res.msg);
}else{
Ext.Msg.alert("<s:text name="common.error"/>", res.msg);
}
},
failure : function() {
Ext.Msg.alert("<s:text name="common.error"/>", "<s:text name="common.readfailer"/>!");
}
})
}
// 查询加载费用总额
function doFreightQuery() {
var priceAvg = getNumber("hyMonthInquiry.priceAvg", 0);
var upPrice = getNumber("hyMonthInquiry.upPrice", 0);
var suggestPrice = parseFloat(priceAvg) + parseFloat(upPrice);
Ext.getCmp("hyMonthInquiry.suggestPrice").setValue(suggestPrice.toFixed(0));
}
</script>
<script type="text/javascript">
//LAYOUT
Ext.BLANK_IMAGE_URL="<%=path %>/js/ext3.3/resources/images/default/s.gif";
Ext.onReady(function(){
hiddenIndicator();
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var viewport = new Ext.gensoft.GenericViewport({
items: [{
region: 'north',
frame: true,
height: 75,
split: true,
collapseMode: 'mini',
layout: 'fit',
items: [queryForm]
}, {
region: 'center',
layout: 'fit',
items: [listGrid]
}]
});
doQuery();
});
var queryForm = new Ext.form.FormPanel({
labelAlign: 'right',
labelWidth: 70,
frame:true,
border: false,
buttonAlign: 'center',
items: [{
layout:'column',
items:[
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'textfield',
fieldLabel: '批次号起',
id: 'queryData.batchNo',
anchor:'95%'
}
]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'textfield',
fieldLabel: '批次号止',
id: 'queryData.batchNoEnd',
anchor:'95%'
}
]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'combo',
fieldLabel: '船舶类型',
allowBlank: true,
maxLength: 32,
hiddenName:'hyMonthInquiry.shipType',
store: new Ext.gensoft.data.ArrayStore({
fields:['value','text'] ,
data:<s:property value="shipType"/>
}),
mode: 'local',
triggerAction: 'all',
valueField: 'value',
forceSelection: true,
editable: false,
displayField: 'text',
id: 'queryData.shipType',
anchor:'95%'
}
]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'combo',
fieldLabel: '详细船型',
allowBlank: true,
maxLength: 32,
hiddenName:'queryData.detailType',
store: new Ext.gensoft.data.ArrayStore({
fields:['value','text'] ,
data:<s:property value="detailType"/>
}),
mode: 'local',
triggerAction: 'all',
valueField: 'value',
forceSelection: true,
editable: false,
displayField: 'text',
id: 'queryData.detailType',
anchor:'95%'
}
]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'combo',
fieldLabel: '建议备案价',
allowBlank: true,
maxLength: 32,
hiddenName:'queryData.suggestPrice',
store: new Ext.gensoft.data.ArrayStore({
fields:['value','text'] ,
data:<s:property value="suggestPriceList"/>
}),
mode: 'local',
triggerAction: 'all',
valueField: 'value',
forceSelection: true,
editable: false,
displayField: 'text',
id: 'queryData.suggestPrice',
anchor:'95%'
}
]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'hidden',
hiddenName:'hyMonthInquiry.partDestination',
id:'queryData.partDestination',
},
{
xtype: 'trigger' ,
fieldLabel: '<s:text name="table.hyMonthInquiry.partDestination"/>',
editable: false ,
onTriggerClick:function(){
__tradePortSingleSelectList.menu = __tradePortMenu;
if(this.menu == null){
this.menu = __tradePortMenu;
}
this.menu.show(this.el,"tl-bl?");
portType = "RECEIVING_PORT";
__tradePortSingleSelectList.labelSrc = this;
__tradePortSingleSelectList.valueSrc = Ext.getCmp('queryData.partDestination');
Ext.getCmp('__queryData.portName').setValue("");
__doQueryTradePort();
},
anchor:'95%'
}]
},
{
columnWidth:.25,
layout: 'form',
items: [
{
xtype:'textfield',
fieldLabel: '航线',
id: 'queryData.airLine',
anchor:'95%'
}
]
},
{
columnWidth:.12,
layout: 'form',
items: [{
xtype:'button',
text: '<s:text name="common.query"/>',
width: 100,
handler: doQuery
}]
},
{
columnWidth:.12,
layout: 'form',
items: [{
xtype:'button',
text: '<s:text name="common.clean"/>',
width: 100,
handler: function(){
queryForm.getForm().reset();
}
}]
}
]
}]
});
//船舶类型
var shipTypeRender =function (value) {
var comboData = {};
<s:iterator value="shipType">
comboData['<s:property value="value"/>'] = '<s:property value="label"/>';
</s:iterator>
if(null == comboData[value]) return value;
return comboData[value];
};
//发布状态
var publishRender = function(value){
var comboData = {};
comboData['weifabu'] = '未发布';
comboData['yifabu'] = '已发布';
if(null == comboData[value]) return value;
return comboData[value];
};
//询价单状态
var inquiryStatusRender = function(value){
var comboData = {};
<s:iterator value="inquiryStatus">
comboData['<s:property value="value"/>'] = '<s:property value="label"/>';
</s:iterator>
if(null == comboData[value]) return value;
return comboData[value];
};
var confirmStatusRender = function(value){
var comboData = {};
comboData['weiqueren'] = '未确认';
comboData['yiqueren'] = '已确认';
if(null == comboData[value]) return value;
return comboData[value];
};
//装运条款
var hyPaymentTypeListRender =function (value) {
var comboData = {};
<s:iterator value="hyPaymentTypeList">
comboData['<s:property value="value"/>'] = '<s:property value="label"/>';
</s:iterator>
if(null == comboData[value]) return value;
return comboData[value];
};
//DATA STRUCTURE
var hyMonthInquiryAvgFields = [
{name: 'id', type: 'string', label: '<s:text name="table.hyMonthInquiry.id"/>', sortable: false, isList: false , isProperty: false } ,
{name: 'batchNo', type: 'string', label: '<s:text name="table.hyMonthInquiry.batchNo"/>', sortable: false, isList: true , isProperty: true ,width:80} , //批次号
{name: 'shipType', type: 'string', label: '船舶类型', sortable: false, isList: true , isProperty: true ,render:shipTypeRender ,width:80} , //船舶类型
{name: 'detailType', type: 'string', label: '<s:text name="table.hyMonthInquiry.detailType"/>', sortable: false, isList: true , isProperty: true,width:80 } , //详细船型
{name: 'partDestinationName', type: 'string', label: '<s:text name="table.hyMonthInquiry.partDestination"/>', sortable: false, isList: true , isProperty: true } ,//目的港
{name: 'partDestination', type: 'string', label: '<s:text name="table.hyMonthInquiry.partDestination"/>', sortable: false, isList: false , isProperty: true } , //目的港
{name: 'airLine', type: 'string', label: '航线', sortable: false, isList:true , isProperty: true ,width:65 } , //航线
{name: 'startShipDate', type: 'string', label: '<s:text name="table.hyMonthInquiry.startShipDate"/>', sortable: false, isList: true , isProperty: true,width:80} , //船期起
{name: 'endShipDate', type: 'string', label: '<s:text name="table.hyMonthInquiry.endShipDate"/>', sortable: false, isList: true , isProperty: true,width:80 } , //船期止
{name: 'termsShipment', type: 'string', label: '<s:text name="table.hyMonthInquiryItem.termsShipment"/>', sortable: false, isList: false , isProperty: true,render:hyPaymentTypeListRender,width:200 } , //装运条款
{name: 'monthInquiryId', type: 'string', label: '<s:text name="table.hyMonthInquiryItem.monthInquiryId"/>', sortable: false, isList: false , isProperty: true } , //id
{name: 'priceAvg', type: 'string', label: '航线平均运价(美元)', sortable: false, isList: true , isProperty: true ,width:130}, //航线平均运价
{name: 'upPrice', type: 'string', label: '价格上浮', sortable: false, isList: true , isProperty: true,width:80 }, //价格上浮
//指在表单上 红色特别显示
// 
{name: 'suggestPrice', type: 'string', label: '建议备案运价(美元)', sortable: false, isList: true , isProperty: true ,width:125,
render: function(value, metadata, record, rowIndex, columnIndex, store){
metadata.attr = 'ext:qtip="建议备案运价(美元):<br/>' + value +'"';
return "<font color='red'>"+value+"</font>";}
}, //建议备案运价
{name: 'hyVoyageMin', type: 'string', label: '最小航程(天)', sortable: false, isList: true , isProperty: true ,width:80}, //最短航程
{name: 'hyVoyageMax', type: 'string', label: '最大航程(天)', sortable: false, isList: true , isProperty: true ,width:80}, //最长航程
{name: 'shippingSample', type: 'string', label: '船期频次(班/月)', sortable: false, isList: true , isProperty: true }, //船期频次
//
<% for(int i=0;i <huoDaiNum; i++ ){ %>
{name: 'quotation<%= i %>', type: 'string', label: '货代<%= i+1 %> ', sortable: false, isList: true , isProperty: true,width:80 },//货代报价
<% } %>
{name: 'chiefNote', type: 'string', label: '备注', sortable: false, isList: true , isProperty: true,
render: function(value, metadata, record, rowIndex, columnIndex, store){
metadata.attr = 'ext:qtip="备注:<br/>' + value +'"';
return "<font color='black'>"+value+"</font>" }
}]; //备注
//LIST_GRID
var listGrid = new Ext.gensoft.grid.ListGrid({
title: '<s:text name="table.hyMonthInquiry"/><s:text name="common.list"/>',
queryUrl: '<%=path%>/hyMonthInquiry/queryHyMonthInquiryAvgPriceQueryList.html',
fields: hyMonthInquiryAvgFields,
forceFit:false,
hasBbar: true,
tbar: [ '-',
{text : '填写价格上浮',iconCls: "edit_btn_gen",handler : function(btn, pressed) {doWriteUpPrice();}},'-',
// {text : '修改价格上浮',iconCls: "edit_btn_gen",handler : function(btn, pressed) {doEdit();}},'-',
{text : '下载航线运价查询表',iconCls: "excel_btn_gen",id:"downLoadAvg", handler : function(btn, pressed) {downLoadAvgPrice();}},'-'
]
});
var editFormUp = new Ext.gensoft.FormPanel({
foName: 'hyMonthInquiryUp',
bodyStyle: 'padding:5',
width: '100%',
labelAlign: 'left',
region: 'center',
labelAlign: 'right',
labelWidth: 100,
frame: true,
layout: "column",
items: [
{
xtype: 'hidden',
id: 'hyMonthInquiryUp.id',
name: 'hyMonthInquiryUp.id'
},
{
columnWidth: .99,
layout: 'form',
items: [
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '价格上浮(美元)',
name: 'hyMonthInquiryUp.upPrice',
id: 'hyMonthInquiryUp.upPrice',
allowBlank: false,
enableKeyEvents:true,
listeners:{
'keyup': function (field) {
doFreightQuery();
}
},
maxLength: 128,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '船期频次(班/月)',
name: 'hyMonthInquiryUp.shippingSample',
id:'hyMonthInquiryUp.shippingSample',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '最小航程',
name: 'hyMonthInquiryUp.hyVoyageMin',
id:'hyMonthInquiryUp.hyVoyageMin',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '最大航程',
name: 'hyMonthInquiryUp.hyVoyageMax',
id:'hyMonthInquiryUp.hyVoyageMax',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.99,
layout: 'form',
items: [
{
xtype: 'textarea' ,
fieldLabel: '备注',
name: 'hyMonthInquiryUp.chiefNote',
id:'hyMonthInquiryUp.chiefNote',
height: 50,
allowBlank: true,
maxLength: 255,
anchor: '85%'
}]
}
]
}
]
});
var comboWin = new Ext.Window({
title:'请填写相关信息',
layout:'fit',
maximized :false,
width:600,
height:350,
closeAction:'hide',
resizable : false,
shadow : true,
modal :true,
closable:true,
plain : true,
animCollapse:true,
buttonAlign: 'center',
items:[editFormUp],
buttons: [
{
text: '确定',
iconCls: "accept_btn_gen",
handler:function(){
debugger;
var upPrice = Ext.getCmp("hyMonthInquiryUp.upPrice").getValue();
var shippingSample = Ext.getCmp("hyMonthInquiryUp.shippingSample").getValue();
var hyVoyageMin = Ext.getCmp("hyMonthInquiryUp.hyVoyageMin").getValue();
var hyVoyageMax = Ext.getCmp("hyMonthInquiryUp.hyVoyageMax").getValue();
var chiefNote = Ext.getCmp("hyMonthInquiryUp.chiefNote").getValue();
if(upPrice == ""||upPrice==undefined){
Ext.Msg.alert("<s:text name="common.error"/>", "请填写价格上浮!");
return;
}
doSubmitUpPrice(upPrice,shippingSample,hyVoyageMin,hyVoyageMax,chiefNote);
}
},
{
text: '<s:text name="common.close"/>',
iconCls: "close_btn_gen",
handler:function(){
comboWin.hide();
}
}]
});
//统一设置价格上浮
function doSubmitUpPrice(upPrice,shippingSample,hyVoyageMin,hyVoyageMax,chiefNote){
Ext.Msg.confirm("<s:text name="common.confirm"/>","<s:text name="common.confirm"/>统一设置相关信息?",function(button,text){
if(button=='yes'){
var checkItems =listGrid.getSelectionModel().getSelections();
var ids='';
for(i=0; i<checkItems.length; i++){
ids+=checkItems[i].data.id+",";
}
var myMask = new Ext.LoadMask(document.body, {
msg: '<s:text name='common.wait'/>..',
removeMask: true //完成后移除
});
myMask.show();
Ext.Ajax.request({
url: 'upPriceTongYi.html',
params: {'ids':ids,"upPrice":upPrice,"shippingSample":shippingSample,"hyVoyageMin":hyVoyageMin,"hyVoyageMax":hyVoyageMax,"chiefNote":chiefNote},
waitTitle : '<s:text name="common.wait"/>',
waitMsg : '<s:text name="common.wait"/>',
timeout: 600000,
success : function(response) {
var res = Ext.util.JSON.decode(response.responseText);
if(res.success) {
listGrid.store.reload();
}else{
Ext.Msg.alert("<s:text name="common.error"/>", res.msg);
}
myMask.hide();
comboWin.hide();
},
failure : function() {
myMask.hide();
Ext.Msg.alert("<s:text name="common.error"/>", "<s:text name="common.failer"/>!");
}
});
}
});
}
//EDIT_FORM
var editForm = new Ext.gensoft.FormPanel({
foName: 'hyMonthInquiry',
bodyStyle: 'padding:5',
width: '100%',
labelAlign: 'left',
region: 'center',
labelAlign: 'right',
labelWidth: 100,
frame: true,
layout: "column",
items: [
{
xtype: 'hidden',
id: 'hyMonthInquiry.id',
name: 'hyMonthInquiry.id'
}
,
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'hidden' ,
fieldLabel: '批次号',
name: 'hyMonthInquiry.batchNo',
id: 'hyMonthInquiry.batchNo',
allowBlank: true,
maxLength: 128,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '航线平均运价',
name: 'hyMonthInquiry.priceAvg',
id: 'hyMonthInquiry.priceAvg',
allowBlank: true,
enableKeyEvents:true,
listeners:{
'keyup': function (field) {
doFreightQuery();
}
},
maxLength: 128,
readOnly: true,
style: {background: '#DFE8F6'},
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '价格上浮(美元)',
name: 'hyMonthInquiry.upPrice',
id: 'hyMonthInquiry.upPrice',
allowBlank: false,
enableKeyEvents:true,
listeners:{
'keyup': function (field) {
doFreightQuery();
}
},
maxLength: 128,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '建议备案运价',
name: 'hyMonthInquiry.suggestPrice',
id: 'hyMonthInquiry.suggestPrice',
allowBlank: true,
maxLength: 128,
readOnly: true,
style: {background: '#DFE8F6'},
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '船期频次(班/月)',
name: 'hyMonthInquiry.shippingSample',
id:'hyMonthInquiry.shippingSample',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '最小航程',
name: 'hyMonthInquiry.hyVoyageMin',
id:'hyMonthInquiry.hyVoyageMin',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.49,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '最大航程',
name: 'hyMonthInquiry.hyVoyageMax',
id:'hyMonthInquiry.hyVoyageMax',
allowBlank: true,
maxLength: 64,
anchor: '85%'
}]
},
{
columnWidth:.99,
layout: 'form',
items: [
{
xtype: 'textfield' ,
fieldLabel: '备注',
name: 'hyMonthInquiry.chiefNote',
id:'hyMonthInquiry.chiefNote',
height: 50,
allowBlank: true,
maxLength: 255,
anchor: '85%'
}]
}
]
});
var orderWin = new Ext.Window({
title:'<s:text name="table.hyMonthInquiry"/><s:text name="common.manager"/>',
layout:'fit',
maximized :false,
width:600,
height:350,
closeAction:'hide',
resizable : false,
shadow : true,
modal :true,
closable:true,
plain : true,
animCollapse:true,
buttonAlign: 'center',
items:[editForm],
buttons: [{
text: '<s:text name="common.save"/>',
iconCls: "save_btn_gen",
id:"save_Btn",
handler: function(){
if(!editForm.getForm().isValid()){
return false;
}
Ext.getCmp("save_Btn").setDisabled(true);
var myMask = new Ext.LoadMask(document.body, {
msg: '<s:text name='common.wait'/>..',
removeMask: true
});
myMask.show();
editForm.getForm().submit({
url: Ext.isEmpty(Ext.getCmp('hyMonthInquiry.id').getValue()) ? 'createHyMonthInquiry.html' : 'updateHyMonthInquiry.html',
success: function(editFormSucc, action){
Ext.getCmp("save_Btn").setDisabled(false);
myMask.hide();
listGrid.store.reload();
orderWin.hide();
var s = action.result.msg.split("-");
Ext.getCmp('hyMonthInquiry.id').setValue(s[0]);
Ext.getCmp('hyMonthInquiry.batchNo').setValue(s[1]);
// Ext.getCmp('hyMonthInquiry.id').setValue(action.result.msg);
Ext.Msg.alert('<s:text name="common.msg"/>','<s:text name="common.savesuccess"/>');
},
failure: function(editFormFailure,action){
Ext.getCmp("save_Btn").setDisabled(false);
myMask.hide();
switch (action.failureType) {
case Ext.form.Action.CONNECT_FAILURE:
Ext.Msg.alert('Failure', '<s:text name="common.linkfailer"/>');
break;
case Ext.form.Action.SERVER_INVALID:
Ext.Msg.alert('Failure', action.result.msg);
}
}
})
}
},
{
text: '<s:text name="common.close"/>',
iconCls: "close_btn_gen",
handler:function(){
orderWin.hide();
}
}]
});
</script>
</head>
<body>
<div id="head" style="font-weight:bold;font-size:14px;vertical-align: bottom; margin-left: 10px"> <s:text name="table.hyMonthInquiry"/><s:text name="common.manager"/> </div>
</body>
</html>