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/MvcShipping/Viewsjs/MsChFee/QuotationList.js

340 lines
12 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.QuotationList = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.QuotationList.superclass.constructor.call(this);
};
Ext.extend(Shipping.QuotationList, Ext.Panel, {
PageSize: 10,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
StoreDateCurr: null,
StoreCurr: null,
storeCustomerNameRef: null,
MBLNO: "",
condition:"",
initUIComponents: function () {
//需要在引用页面声明的Ext.onready层级声明stroplb
_this = this;
this.OPLB = window.parent.opener.stroplb;
this.sqlcontext = '';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsPrice_QuotationSmallmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsPrice/GetSmallQuotationList',
reader: {
id: 'ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
//height: 268,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [
{
sortable: true,hidden:true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '报价单位',
width: 100
},
{
sortable: true,
dataIndex: 'EFFECTIVEDATE',
header: '生效日期',
width: 120
},
{
sortable: true,
dataIndex: 'VALIDDATE',
header: '失效日期',
width: 120
},
{
sortable: true,
dataIndex: 'CREATOR',
header: '报价人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '报价日期',
width: 100
},
{
sortable: true,
dataIndex: 'PDFURL',
header: '报价文件',
width: 120,
renderer: function (value, p, record) {
if (value == '') {
//return '<input type="button" value="上传" onClick="javascript:this.UpLoadFile('+record.data.BillNo+')"';
return '';
} else
return '<a href="' + value + '" style=' + '"text-decoration:none" target="_blank"' + ' > 下载 </a>';
}
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 120
},
{
sortable: true,
dataIndex: 'HAVEMBLNO',
header: '是否已关联报价',
width: 120,
renderer: function (value, metaData, record) {
if (value == "0") { }
if (value == "1") { return "是" }
}
},
{
sortable: true,
dataIndex: 'DOMBLNO',
header: '关联操作',
width: 120,
renderer: function (value, metaData, record) {
var id = record.data.BSNO;
if (record.data.HAVEMBLNO == "0") {
Ext.defer(function () {
id = record.data.BSNO;
metaData.tdAttr = 'data-qtip="为提单号和报价单建立关联"';
Ext.widget('button', {
renderTo: id,
id: id,
height: 17,
width: 60,
// style:"margin-left:5px;background:blue;",
text: '关联',
handler: function () {
//相应事件方法
_this.onAddMblnoClick(id, _this.MBLNO);
}
});
}, 50);
return Ext.String.format('<div id="{0}"></div>', id);
}
else {
Ext.defer(function () {
id = record.data.BSNO;
metaData.tdAttr = 'data-qtip="解除提单号和报价单的关联"';
Ext.widget('button', {
renderTo: id,
id: id,
height: 17,
width: 60,
// style:"margin-left:5px;background:blue;",
text: '取消关联',
handler: function () {
//相应事件方法
_this.onDelMblnoClick(id, _this.MBLNO);
}
});
}, 50);
return Ext.String.format('<div id="{0}"></div>', id);
}
}
},
{
sortable: true,
dataIndex: 'CONN_CREATOR',
header: '业务关联建立人',
width: 80
},
{
sortable: true,
dataIndex: 'CONN_CREATETIME',
header: '业务关联建立时间',
width: 80
}],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 布局
Ext.apply(this, {
items: [this.gridList]
});
//#endregion
this.parentWin = window.parent.opener._thisfee;
if (this.parentWin) {
//this.feeType = this.parentWin.feeType;
//if (this.feeType == 1) {
// this.StoreFee = this.parentWin.storeDrChFee;
//} else if (this.feeType == 2) {
// this.StoreFee = this.parentWin.storeCrChFee;
//}
//this.StoreFeeUnit = this.parentWin.StoreUnit;
//this.StoreFeeCust = this.parentWin.StoreCustType;
//this.StoreDateCurr = this.parentWin.StoreDateCurr;
//this.StoreCurr = this.parentWin.StoreCurr;
this.EditRecord = this.parentWin.EditRecord;
//this.storeCustomerNameRef = this.parentWin.storeCustomerNameRef;
this.MBLNO = this.EditRecord.get("MBLNO");
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: this.condition, mblno: this.MBLNO });
}, this);
//this.storeList.on('load', function (store, records) {
// if (store.getCount() > 0) {
// this.gridList.getSelectionModel().select(0);
// //this.gridListCheckBoxModel.selectAll();
// }
//}, this);
//this.gridList.getSelectionModel().on('select', function (model, record, index) {
// //alert(record.data.BillNo);
// var bsno = record.data.BSNO;
// this.storeBodyChFee.load({ params: { billno: bsno, type: this.feeType, optype:this.OPLB } });
//}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
//this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
this.LoadData(this.EditRecord.data);
}, //end initUIComponents
LoadData: function (rec) {
this.condition = " CUSTOMERNAME='" + rec.CUSTOMERNAME + "' ";
this.MBLNO = rec.MBLNO;
this.DoLoadData();
},
DoLoadData: function () {
this.storeList.load({ params: { condition: this.condition, mblno: this.MBLNO } });
},
onAddMblnoClick: function (BSNO, MBLNO) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsPrice/QuotationAddMblno',
params: {
BSNO: BSNO,
MBLNO: MBLNO
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
this.DoLoadData();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
,
onDelMblnoClick: function (BSNO, MBLNO) {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsPrice/QuotationDelMblno',
params: {
BSNO: BSNO,
MBLNO: MBLNO
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
this.DoLoadData();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
}
});