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/MsOpAirn/MsOpBillIndex.js

280 lines
9.2 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsOpBillIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpBillIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpBillIndex, Ext.Panel, {
PageSize: 20,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
BsNo: '',
initUIComponents: function () {
// var mainform = window.window._this;
var mainform = window.panelEdit;
// this.EditRecord = mainform.editRecord;
this.EditRecord = mainform.Editdata;
this.BsNo = this.EditRecord.BSNO;
this.formname = "formMsOpBillIndex"; //页面名称
//定义数据集
this.storectndisp = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CtnDispModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' }
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpBillModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpAirn/GetBillList',
reader: {
id: 'AS_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表显示信息
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolums = [{
sortable: true,
dataIndex: 'AS_ID',
header: 'AS_ID',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
hidden: true,
header: '业务编号',
width: 0
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主单号',
width: 140
},
{
sortable: true,
dataIndex: 'HBLNO',
header: '分单号',
width: 140
}, {
sortable: true,
dataIndex: 'TEMPLATE',
header: '模板名称',
width: 120
},
{
sortable: true,
dataIndex: 'BILLTYPE',
header: '提单类型',
width: 120
},
{
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATEDATE',
header: '录入时间',
width: 80
}];
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
// /////////////以下部分为获取存储的gridpanel显示样式
// this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
window.open('/MvcShipping/MsOpAirn/BillEdit', "提单信息", 'width=' + (window.screen.availWidth - 110) + ',height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
}, this);
//按钮工具条
me = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
window.open('/MvcShipping/MsOpAirn/BillEdit', "提单信息", 'width=' + (window.screen.availWidth - 110) + ',height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
},
scope: this
}, {
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-', {
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.onRefreshClick();
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
//var girdcolums = this.gridList.getColumnMode();
var sql = "BSNO='" + this.BsNo + "'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (this.StoreOpRange.getCount() == 0) {
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
} else {
var inputby = record.data.INPUTBY;
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
if (records.getCount() > 0) {
} else {
canedit = false;
Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpAirn/BillDelete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.EditRecord;
return ret;
}
});