Ext.namespace('Shipping'); Shipping.MsOpLetterIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpLetterIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpLetterIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, EditRecord: null, BsNo: "", oplb: '', initUIComponents: function () { //定义数据集 var mainform = window.parent.panelEdit; if (mainform == undefined) { parentWin = window.parent.opener; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.EditRecord = ret[2]; this.oplb = ret[4]; } this.BsNo = this.EditRecord.get('BSNO'); } else { this.EditRecord = mainform.editRecord; this.BsNo = this.EditRecord.get('BSNO'); this.oplb = mainform.stroplb; } this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpLetter', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpLetter/GetListData', reader: { id: 'BsNo', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [{ sortable: true, dataIndex: 'LE_ID', header: 'LE_ID', hidden: true, width: 150 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 150 }, { sortable: true, dataIndex: 'LETTERNAME', header: Zi.LAN.LETTERNAME, width: 120, renderer: function (value, meta) { if (value == '入货通知') { return Zi.LAN.RuHuoTongZhi; } else if (value == '派车通知') { return Zi.LAN.TRUCKLETTER; } else if (value == '电放保函') { return Zi.LAN.DIANFANGBAOHAN; } else if (value == '更改通知') { return Zi.LAN.GENGGAITONGZHI; } else { return ""; } } }, { sortable: true, dataIndex: 'INPUTBY', header: Zi.LAN.INPUTBY, width: 80 }, { sortable: true, dataIndex: 'INPUTTIME', header: Zi.LAN.INPUTTIME, width: 80 } ]; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.ZhengZaiChaXunShuJu }, trackMouseOver: true, disableSelection: false, columns: this.girdcolums, bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: Zi.LAN.displayMsg, emptyMsg: Zi.LAN.emptyMsg }) }); _this = this; this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { _this.SelectedRecord = record; _this.OprationStatus = 'edit'; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; if (record.data.LETTERNAME == '入货通知') openUrl = "../../MvcShipping/MsOpLetter/YardEdit"; //window.open('/MvcShipping/MsOpLetter/YardEdit', "函电", "height=" + (window.screen.availHeight - 155) + ", width=900px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"); else if (record.data.LETTERNAME == '派车通知') openUrl = "../../MvcShipping/MsOpLetter/TruckEdit"; //window.open('/MvcShipping/MsOpLetter/TruckEdit', "函电", "height=" + (window.screen.availHeight - 155) + ", width=900px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"); else if (record.data.LETTERNAME == '电放保函') openUrl = "../../MvcShipping/MsOpLetter/SurEdit"; //window.open('/MvcShipping/MsOpLetter/SurEdit', "函电", "height=" + (window.screen.availHeight - 155) + ", width=900px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"); else if (record.data.LETTERNAME == '更改通知') openUrl = "../../MvcShipping/MsOpLetter/ChangeEdit"; //window.open('/MvcShipping/MsOpLetter/ChangeEdit', "函电", "height=" + (window.screen.availHeight - 155) + ", width=900px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"); window.open(openUrl, openType, openSet); }, this); //查询工具条 _this; this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.btnNew, iconCls: "btnadd", menu: [ { text: Zi.LAN.RuHuoTongZhi, handler: function (menu, event) { _this.OprationStatus = 'add'; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpLetter/YardEdit"; window.open(openUrl, openType, openSet); } }, { text: Zi.LAN.TRUCKLETTER, handler: function (menu, event) { _this.OprationStatus = 'add'; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpLetter/TruckEdit"; window.open(openUrl, openType, openSet); } }, { text: Zi.LAN.DIANFANGBAOHAN, handler: function (menu, event) { _this.OprationStatus = 'add'; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpLetter/SurEdit"; window.open(openUrl, openType, openSet); } }, { text: Zi.LAN.GENGGAITONGZHI, handler: function (menu, event) { _this.OprationStatus = 'add'; var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpLetter/ChangeEdit"; window.open(openUrl, openType, openSet); } }], scope: this }, { text: Zi.LAN.btnDelete, iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: Zi.LAN.refresh, 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] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.onRefreshClick(); this.storeList.on('beforeload', function (store) { var sql = "BSNO='" + this.BsNo + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { var sql = "BSNO='" + this.BsNo + "'"; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsOpLetter/Delete', 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: Zi.LAN.TiShi, msg: jsonresult.Message.replace("删除数据成功", Zi.LAN.DeleteSuccess), icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message.replace("删除错误", Zi.LAN.DeleteErro), icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, //onDeleteClick OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.EditRecord; ret[4] = this.oplb; return ret; } });