Ext.namespace('Shipping'); Shipping.MsOpSeaePreIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSeaePreIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSeaePreIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 OprationType: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', selectbsno: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formMsOpSeaePreIndex"; //页面名称 //定义数据集 this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataCtnList' } }); this.storePLList = Ext.create('Ext.data.Store', { model: 'MsOpSeaePre' }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpSeaePre', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeaePre/GetDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 50 }); _this = this; this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.initgirdcolums = [{ sortable: true, id: '', dataIndex: '', header: '', width: 0 },{ sortable: true, id: '', dataIndex: 'BSNO', header: '业务编号', width: 0 }, { sortable: true, dataIndex: 'BSSTATUS', header: '业务状态', width: 80, renderer: function (value, meta) { if (value == '已分配操作使用') { meta.tdCls = 'feestatus_pass'; } else if (value == '订舱修改中') { meta.tdCls = 'feestatus_shendelete'; } else if (value == '船公司已放舱未使用') { meta.tdCls = 'feestatus_refer'; } else if (value == '船公司处理中') { meta.tdCls = 'feestatus_settle'; } else if (value == '已退舱') { meta.tdCls = 'feestatus_nopass'; } return value; } }, { sortable: true, dataIndex: 'OP', header: '操作员', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 120 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 80 }, { sortable: true, dataIndex: 'CONTRACTNO', header: '约号', width: 80 }, { sortable: true, dataIndex: 'FORWARDER', header: '订舱代理', width: 80 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 80 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 100 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 80 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 80 }, { sortable: true, dataIndex: 'CLOSINGDATE', header: '截港时间', width: 100 }, { sortable: true, dataIndex: 'CLOSEDOCDATE', header: '截单时间', width: 100 }, { sortable: true, dataIndex: 'PORTLOAD', header: '装货港', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '卸货港', width: 80 }, { sortable: true, dataIndex: 'LANE', header: '航线', width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: '箱型箱量', width: 120 }, { sortable: true, dataIndex: 'CREATEUSER', header: '创建人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '创建日期', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: '修改人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '修改日期', width: 80 }]; this.girdcolums = this.initgirdcolums; //定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); _this = this; this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, columns: this.girdcolums, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { var LISTSTATUS = record.get('LISTSTATUS'); if (LISTSTATUS == '1') return 'feestatus_nopass'; } }, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.columns[1] = new Ext.grid.RowNumberer(); //////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; this.OprationType = 'op'; // DsOpenEditWin('/MvcShipping/MsOpSeaePre/Edit', record.data.BSNO); var openSet = "height=500, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/Edit"; window.open(openUrl, openType, openSet); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch 查询条件 _this = this; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOpOtherList"} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //操 作 this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操 作', store: this.storeOpCode, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } }); // this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { //specialkey: function (field, e) { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //客户加载_船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); //船公司 this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', //'船公司', store: this.storeCARRIER, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_订舱代理 this.storeFORWARDER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListFORWARDER' } }); //船公司 this.comboxFORWARDER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订舱代理', //'订舱代理', store: this.storeFORWARDER, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'FORWARDER', valueField: 'CustName', displayField: 'CodeAndName' }); //箱型_集装箱列表中的下拉框加载 this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.Lane', proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } }); this.storeLANE.load(); this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航线', //'航线', store: this.storeLANE, forceSelection: true, name: 'LANE', valueField: 'LANE', displayField: 'LANE' }); this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load(); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', //'船 名', store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', displayField: 'VESSEL' }); this.storeVoyNo = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VoyNoModel', proxy: { url: '/CommMng/BasicDataRef/GetVoyNoList' } }); this.comboxVoyNo = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', //'航次', store: this.storeVoyNo, name: 'VOYNO', valueField: 'VOYNO', forceSelection: false, displayField: 'VOYNO' }); this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportListRm' } }); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', //'装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName', queryMode: 'remote', minChars: 2, queryParam: 'PORT', matchFieldWidth: false }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', //'卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', matchFieldWidth: false, valueField: 'PORT', queryMode: 'remote', minChars: 2, queryParam: 'PORT', displayField: 'CodeAndName' }); this.storeBSSTATUS = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeBSSTATUS.add({ "FSTATUS": "船公司处理中"}); this.storeBSSTATUS.add({ "FSTATUS": "船公司已放舱未使用"}); this.storeBSSTATUS.add({ "FSTATUS": "已分配操作使用"}); this.storeBSSTATUS.add({ "FSTATUS": "订舱修改中" }); this.storeBSSTATUS.add({ "FSTATUS": "已退舱" }); this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '业务状态', store: this.storeBSSTATUS, valueField: 'FSTATUS', displayField: 'FSTATUS', forceSelection: true, name: 'BSSTATUS', value: '', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 60, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '主提单号', name: 'MBLNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '约号', name: 'CONTRACTNO', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, this.comboxCARRIER, this.comboxFORWARDER, this.comboxOP,{ xtype: 'button', width: 90, text: "查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDBgn', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDEnd', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxVoyVeg, this.comboxVoyNo, this.comboxPORTLOAD, this.comboxPORTDISCHARGE, { text: "重置", xtype: 'button', width: 90, iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxLANE, this.comboxBSSTATUS, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'button', width: 90, text: "更多", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this }] }] }] }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; this.OprationType = 'bs'; //DsOpenEditWin('/MvcShipping/MsOpSeaePre/Edit', '添加订舱', 500, 700); var openSet = "height=500, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/Edit"; window.open(openUrl, openType, openSet); }, scope: this }, { text: "复制新建", //"复制新建", iconCls: "btnadd", handler: 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]; this.SelectedRecord = record; this.OprationStatus = 'copyadd'; this.OprationType = 'bs'; var openSet = "height=500, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/Edit"; window.open(openUrl, openType, openSet); }, scope: this }, { text: "批量修改", //"复制新建", iconCls: "btnadd", handler: function (button, event) { _this.winModifyShow.show(); }, scope: this }, { text:'提取仓位', //"复制新建", iconCls: "btnedit", handler: 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]; this.SelectedRecord = record; this.OprationStatus = 'edit'; this.OprationType = 'op'; var openSet = "height=500, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/Edit"; window.open(openUrl, openType, openSet); }, scope: this }, { text: '订舱更改申请', //"复制新建", iconCls: "btnedit", handler: 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 (record.data.BSSTATUS == '船公司已放舱未使用' || record.data.BSSTATUS == '已分配操作使用') { } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许订舱更改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.SelectedRecord = record; this.OprationStatus = 'edit'; this.OprationType = 'op'; var openSet = "height=650, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 650) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/ModifyEdit"; window.open(openUrl, openType, openSet); }, scope: this }, { text: "删除", iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, '-', { text: "保存列表样式", id: "btntest", menu: [ { text: "保存", handler: function (button, event) { this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true); } }, { text: "初始化", handler: function (menu, event) { _this.InitGrid(_this.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], scope: this }, '-', { text: "打印", iconCls: 'btnprint', menu: [ { text: "全部", handler: function (menu, event) { _this.Print(); } }, { text: "选择打印", handler: function (menu, event) { _this.PrintSelect(); } }], scope: this }, '-' ,{ text:'导出EXCEL', //"EXCEL模板导出", iconCls: "btnexportexcel", handler: function (button, event) { _this.ExpExcel(); }, scope: this }, '-', { text: "其他操作", menu: [{ text: "查看订舱更改历史", handler: function (menu, 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]; _this.SelectedRecord = record; _this.OprationStatus = 'edit'; _this.OprationType = 'op'; var openSet = "height=700, width=800, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 650) / 2 + ",Left= " + (screen.width - 800) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../../MvcShipping/MsOpSeaePre/ModifyHisEdit"; window.open(openUrl, openType, openSet); } } ], scope: this }] }); //#region 合计列表 this.SumField = [ { name: 'NOBILL', type: 'number' }, { name: 'CNTR1', type: 'number' }, { name: 'CNTR2', type: 'number' }, { name: 'CNTR3', type: 'number' }, { name: 'CNTR4', type: 'number' }, { name: 'CNTR5', type: 'number' }, { name: 'CNTR6', type: 'number' }, { name: 'CNTR7', type: 'number' }, { name: 'CNTR8', type: 'number' }, { name: 'CNTR9', type: 'number' }, { name: 'CNTR10', type: 'number' } ]; this.storeSumList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: this.SumField, remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeaePre/GetDataListSum', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolumsSum = [{ sortable: true, dataIndex: 'NOBILL', header: '票数', align: 'right', width: 80 }, { sortable: true, id: '', dataIndex: 'CNTR1', hidden: true, header: '箱型1', //'箱型1', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR2', hidden: true, header: '箱型2', //'箱型2', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR3', hidden: true, header: '箱型3', //'箱型3', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR4', hidden: true, header: '箱型4', //'箱型4', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR5', hidden: true, header: '箱型5', //'箱型5', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR6', hidden: true, header: '箱型6', //'箱型6', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR7', hidden: true, header: '箱型7', //'箱型7', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR8', hidden: true, header: '箱型8', //'箱型8', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR9', hidden: true, header: '箱型9', //'箱型9', width: 60 }, { sortable: true, id: '', dataIndex: 'CNTR10', hidden: true, header: '箱型10', //'箱型10', width: 60 } ]; this.gridListSum = new Ext.grid.GridPanel({ store: this.storeSumList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolumsSum }); this.panelSum = new Ext.Panel({ // title: '合 计', layout: "border", height: 70, region: 'south', margin: '0 0', frame: true, items: [this.gridListSum] }); //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 126, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList, this.panelSum] }); this.InitGrid(this.girdcolums); //this.onRefreshClick(); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); this.storeVoyVegm = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVegm.load(); this.comboxVoyVegm = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', //'船 名', store: this.storeVoyVegm, flex: 2, name: 'VESSEL', valueField: 'VESSEL', displayField: 'VESSEL' }); this.storeVoyNom = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VoyNoModel', proxy: { url: '/CommMng/BasicDataRef/GetVoyNoList' } }); this.comboxVoyNom = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航次', //'航次', store: this.storeVoyNom, name: 'VOYNO', valueField: 'VOYNO', forceSelection: false, displayField: 'VOYNO' }); this.formModify = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 60, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxVoyVegm, this.comboxVoyNom ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '开船日期', //'ETD', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'ETD' }, { fieldLabel: '截港日期', //'截港日期', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'CLOSINGDATE', listeners: { scope: this, 'select': function (combo, mdate) { var mydate = new Date(mdate); var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00'); combo.setValue(mydatestr); } } }, { fieldLabel: '截单日期', //'截单日期', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'CLOSEDOCDATE', listeners: { scope: this, 'select': function (combo, mdate) { var mydate = new Date(mdate); var mydatestr = Ext.util.Format.date(mydate, 'Y-m-d 12:00:00'); combo.setValue(mydatestr); } } } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit me = this; this.winModifyShow = Ext.create('Ext.window.Window', { title: "批量修改", //"批量修改", width: 820, //height : 120, //plain : true, iconCls: "addicon", resizable: false, // 是否可以拖动 // draggable:false, collapsible: true, // 允许缩放条 closeAction: 'close', closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:0 0 0 0", items: [this.formModify], buttons: [{ text: "确认修改", //"确认修改", minWidth: 70, handler: function () { me.onModifyClick() } }, { text: "关闭", //"关闭", minWidth: 70, handler: function () { me.winModifyShow.close(); } }] }); //#endregion }, //end initUIComponents InitGrid: function (grid) { //var agirdcolums = Ext.clone(this.gridList.columns); this.storecodeservice.load({ params: { condition: "OPTYPE='1'" }, callback: function (r, options, success) { if (success) { if (r.length != 0) { for (i = 0; i < this.storecodeservice.getCount(); i += 1) { var itemindex = i + 1; var memberyf = this.storecodeservice.getAt(i); for (var j = 0; j < this.girdcolumsSum.length; j++) { if (this.girdcolumsSum[j].dataIndex == memberyf.data.OPField) { this.girdcolumsSum[j].header = memberyf.data.SERVICENAME; this.girdcolumsSum[j].hidden = false; } } }; } this.gridListSum.reconfigure(this.storeSumList, this.girdcolumsSum); } }, scope: this }); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.onRefreshSumClick(sql); }, onRefreshSumClick: function (sql) { this.storeSumList.load({ params: { condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onDsQuery: function () { //var girdcolums = this.gridList.getColumnMode(); var sql = this.sqlcontext; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.onRefreshSumClick(sql); }, 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 (record.data.BSSTATUS != '' && record.data.BSSTATUS != '已退舱') { Ext.Msg.show({ title: '警告', msg: '当前状态不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } //if (this.StoreOpRange.getCount() == 0) { // Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); // return; //} else { // var op = record.data.OP; // var CREATEUSER = record.data.CREATEUSER; // var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op); // if (records.getCount() > 0) { // } else { // var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', CREATEUSER); // if (recordins.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/MsOpSeaePre/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: '提示', 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); }, //#region 批量修改 onModifyClick: function (menu, event) { var GidStr = ''; var records = this.GridCheckBoxModel.selected.items; if (records.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要修改的业务! return; } var data = this.formModify.getForm().getValues(); var bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; bodyAddDatas.push(rec); } _this = this; if (bodyAddDatas.length == 0) { Ext.Msg.show({ title: '提示', msg: '没有要修改的业务', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg: '正在修改业务...', url: '/MvcShipping/MsOpSeaePre/modify', params: { data: jsonbodyAddDatas, modifydata: Ext.JSON.encode(data) }, 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; } else { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); _this.storeList.reload(); _this.winModifyShow.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, //#endregion onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var MBLNO = form.findField('MBLNO').getValue(); sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'"); var CONTRACTNO = form.findField('CONTRACTNO').getValue(); sql = sql + getAndConSql(sql, CONTRACTNO, "CONTRACTNO like '%" + CONTRACTNO + "%'"); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); var LANE = form.findField('LANE').getValue(); sql = sql + getAndConSql(sql, LANE, "LANE='" + LANE + "'"); var CARRIER = form.findField('CARRIER').getValue(); sql = sql + getAndConSql(sql, CARRIER, "CARRIER='" + CARRIER + "'"); var FORWARDER = form.findField('FORWARDER').getValue(); sql = sql + getAndConSql(sql, FORWARDER, "FORWARDER='" + FORWARDER + "'"); var VESSEL = form.findField('VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "VESSEL='" + VESSEL + "'"); var VOYNO = form.findField('VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "VOYNO='" + VOYNO + "'"); var PORTLOAD = form.findField('PORTLOAD').getValue(); sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD='" + PORTLOAD + "'"); var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue(); sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE='" + PORTDISCHARGE + "'"); var OP = form.findField('OP').getValue(); sql = sql + getAndConSql(sql, OP, "OP= '" + OP + "'"); var BSSTATUS = form.findField('BSSTATUS').getValue(); sql = sql + getAndConSql(sql, BSSTATUS, "BSSTATUS= '" + BSSTATUS + "'"); var ETDBgn = form.findField('ETDBgn').getRawValue(); sql = sql + getAndConSql(sql, ETDBgn, "CONVERT(char(10), ETD, 20) >='" + ETDBgn + "'"); var ETDEnd = form.findField('ETDEnd').getRawValue(); sql = sql + getAndConSql(sql, ETDEnd, "CONVERT(char(10), ETD, 20) <='" + ETDEnd + "'"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.selectbsno; ret[4] = 'op_seaepre'; ret[5] = this.storePLList; ret[6] = this.OprationType; return ret; }, ExpExcel: function () { _this = this; if (this.storeList.getCount() == 0) { return; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsOpSeaePre/GetDataListStr', scope: this, params: { condition: _this.sqlcontext, printstr: 'true' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.data; var printType = 'MSOPSEAEPRELIST'; var sql1 = returnstr; sql1 = sql1.replace(/\+/g, "@@@") if (sql1 != '') { GridExportBySql(sql1, this.formname, '预订舱列表.xls'); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsOpSeaePre/GetDataListStr', scope: this, params: { condition: _this.sqlcontext, printstr: 'true' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.data; var printType = 'MSOPSEAEPRELIST'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, PrintSelect: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var selectedRecords = []; var storeadd = null; selectedRecords = this.GridCheckBoxModel.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } if (sortstr == "") sortstr = "ETD desc" var feeGidSql = ''; for (var i = 0; i < selectedRecords.length; i++) { var record = selectedRecords[i]; var feeGId = "'" + record.get('BSNO') + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } }; var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.BSNO; } var printType = 'MSOPSEAEPRELISTSELECT'; var sql1 = "select * from op_seae_pre WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select * from op_seae_pre where BSNO='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });