Ext.namespace('Shipping'); Shipping.MsOpAireSaleIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpAireSaleIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpAireSaleIndex, Ext.Panel, { PageSize: 50, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 sqlcontext: '', editype: '', selectbsno: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formMsOpAireSaleIndex"; //页面名称 //定义数据集 this.storePLList = Ext.create('Ext.data.Store', { model: 'MsOpAireModel' }); this.storectndisp = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CtnDispModel', proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' } }); this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpAireModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpAire/GetSaleDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); //#region List列表显示信息 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(); } } } }); Ext.define('Ext.grid.column.Actiontextcolumn', { extend: 'Ext.grid.column.Column', alias: ['widget.actiontextcolumn'], defaultRenderer: function (value) { var me = this; prefix = Ext.baseCSSPrefix; scope = me.origScope || me; // if (value == "") { // } // else value = value + ''; // value = ''; return value; }, processEvent: function (type, view, cell, recordIndex, cellIndex, e, record, row) { var me = this; if (type == 'click') { me.handler.call(me.scope || me.origScope || me, view, recordIndex, cellIndex, e, record, row); } } }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); _this = this; this.initgirdcolums = [{ sortable: true, id: '', dataIndex: '', header: '', width: 0 }, { sortable: true, id: '', dataIndex: 'BSNO', header: '业务编号', width: 0 }, { sortable: true, id: '', dataIndex: 'CUSTNO', header: '委托编号', width: 120 }, { sortable: true, id: '', dataIndex: 'ORDERNO', header: '订舱编号', width: 120 }, { sortable: true, id: '', dataIndex: 'ORDERTYPE', header: '订舱方式', width: 120 }, { sortable: true, id: '', dataIndex: 'BSSTATUSREF', header: '业务锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, id: '', dataIndex: 'FEESTATUSREF', header: '费用锁定', align: 'center', width: 60, renderer: function (value, cellmeta) { if (value == '锁定') { return ""; } } }, { sortable: true, id: '', dataIndex: 'DRFEESTATUS', header: '应收费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } else if (value == '驳回提交') { meta.tdCls = 'feestatus_nopass'; } return value; } }, { sortable: true, id: '', dataIndex: 'CRFEESTATUS', header: '应付费用', align: 'center', width: 60, renderer: function (value, meta) { if (value == '审核通过') { meta.tdCls = 'feestatus_pass'; } else if (value == '录入状态') { } else if (value == '提交审核') { meta.tdCls = 'feestatus_refer'; } else if (value == '部分结算') { meta.tdCls = 'feestatus_refer'; } else if (value == '结算完毕') { meta.tdCls = 'feestatus_settle'; } else if (value == '未录入') { } else if (value == '部分结算') { meta.tdCls = 'feestatus_settle'; } else if (value == '部分审核') { meta.tdCls = 'feestatus_pass'; } else if (value == '部分提交') { meta.tdCls = 'feestatus_refer'; } else if (value == '驳回提交') { meta.tdCls = 'feestatus_nopass'; } return value; } } , { sortable: true, id: '', dataIndex: 'OPSTATUS', header: '业务状态', width: 60 }, { sortable: true, id: '', dataIndex: 'BLTYPE', header: '装运方式', width: 60 }, { sortable: true, id: '', dataIndex: 'ETD', header: '开航日期', width: 80 }, { sortable: true, id: '', dataIndex: 'MBLNO', header: '主提单号', width: 120, renderer: function (value, meta) { meta.tdCls = 'mblno'; return value; } }, { sortable: true, id: '', dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { sortable: true, id: '', dataIndex: 'BSDATE', header: '接单日期', width: 80 }, { sortable: true, id: '', dataIndex: 'GOODSNAME', header: '品名', width: 120 }, { sortable: true, id: '', dataIndex: 'PKGS', header: '件数', width: 80 }, { sortable: true, id: '', dataIndex: 'KGS', header: '毛重', width: 80 }, { sortable: true, id: '', dataIndex: 'CBM', header: '尺码', width: 80 }, { sortable: true, id: '', dataIndex: 'HBLNO', header: '分提单号', width: 120 }, { sortable: true, id: '', dataIndex: 'ACCDATE', header: '会计期间', width: 60 }, { sortable: true, id: '', dataIndex: 'BSSOURCE', header: '业务来源', width: 80 }, { sortable: true, id: '', dataIndex: 'BSSOURCEDETAIL', header: '贸易条款', width: 80 }, { sortable: true, id: '', dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, id: '', dataIndex: 'CREATETIME', header: '创建时间', width: 120 }, { sortable: true, id: '', dataIndex: 'OP', header: '操作员', width: 80 }, { sortable: true, id: '', dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, id: '', dataIndex: 'DOC', header: '单证', width: 80 }, { sortable: true, id: '', dataIndex: 'VESSEL', header: '航班', width: 100 }, { sortable: true, id: '', dataIndex: 'PORTLOAD', header: '始发港', width: 100 }, { sortable: true, id: '', dataIndex: 'PORTDISCHARGE', header: '目的港', width: 100 }, { sortable: true, id: '', dataIndex: 'CUSTOMSER', header: '报关行', width: 80 }, { sortable: true, id: '', dataIndex: 'CUSTOMDATE', header: '报关日期', width: 80 }, { sortable: true, id: '', dataIndex: 'KINDPKGS', header: '件数包装', width: 60 }, { sortable: true, id: '', dataIndex: 'AIRLINES', header: '航空公司', width: 100 }, { sortable: true, id: '', dataIndex: 'TRUCKER', header: '承运车队', width: 100 }, { sortable: true, id: '', dataIndex: 'AGENTID', header: '代理', width: 100 }, { sortable: true, id: '', dataIndex: 'FORWARDER', header: '订舱代理', width: 100 }, { sortable: true, id: '', dataIndex: 'FEEKGS', header: '计费重量', width: 60 }, { sortable: true, id: '', dataIndex: 'VOUNO', header: '凭证号', width: 60 }, { sortable: true, dataIndex: 'ISPRINTPR', header: '打印核算单', width: 100, renderer: function (value, meta, record) { if (value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE1', header: '服务项目1', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value =='1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE2', header: '服务项目2', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE3', header: '服务项目3', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE4', header: '服务项目4', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE5', header: '服务项目5', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE6', header: '服务项目6', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE7', header: '服务项目7', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE8', header: '服务项目8', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE9', header: '服务项目9', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }, { sortable: true, dataIndex: 'IsSERVICE10', header: '服务项目10', hidden: true, width: 100, renderer: function (value, meta, record) { if (value == true || value == '1') return '√'; else return ''; } }]; this.girdcolums = this.initgirdcolums; 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, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, listeners: { cellclick: function (thisTab, record, item, index, e, eOpts) { if (index == 10) {//设置按钮列 // alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode); } } }, columns: this.girdcolums, // 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[0] = new Ext.grid.RowNumberer(); //////////////////////////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsOpAire/SaleEdit', record.data.BSNO); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch 下拉框信息加载 //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOpAireList"} }); //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 _this = this; this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#endregion //#region formSearch 查询面板 _this = this; 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: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '编号', name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCustCode, { fieldLabel: '航班日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', width: 90, text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { 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 }] } ]//end items(fieldset 1) }]//end root items }); //#endregion formSearch _this = this; //按钮工具条_ this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(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 }] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 75, items: [this.panelBtn, this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.InitGrid(this.girdcolums); var myDate = new Date(); var mydatestr = Ext.util.Format.date(myDate, 'Y-m'); this.sqlcontext = " B.ACCDATE='" + mydatestr + "'"; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext, load: 'true' }, waitMsg: "正在查询数据...", scope: this }); this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); }, //end initUIComponents InitGrid: function (grid) { //var agirdcolums = Ext.clone(this.gridList.columns); var agirdcolums = grid; this.storecodeservice.load({ params: { condition: "OPTYPE='3'" }, 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 < agirdcolums.length; j++) { if (agirdcolums[j].dataIndex == 'Is' + memberyf.data.OPField) { agirdcolums[j].header = memberyf.data.SERVICENAME; agirdcolums[j].hidden = false; } } }; } this.gridList.reconfigure(this.storeList, agirdcolums); } }, scope: this }); // this.gridList.reconfigure(this.storeList, agirdcolums); }, onRefreshClick: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); 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 }); }, 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 }); }, //end initUIComponents onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); // var form2 = this.formSearch2.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } //隐藏查询面板 // this.panelSearch.hide(); this.isShowAdvancedQuery = 0; // var sql = ""; //#region formSearch 查询面板 //编号包括(主提单号) var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "(isnull(b.MblNo,'')+' '+isnull(b.CONTRACTNO,'')+' '+isnull(b.CUSTNO,'')+' '+isnull(b.HBLNO,'')+' '+isnull(b.ORDERNO,'') like '%" + MblNo + "%')"); //客户名称 var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'"); //到港日期 var ETDbgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, ETDbgn, "B.ETD >='" + ETDbgn + "'"); var ETDend = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, ETDend, "B.ETD <='" + ETDend + "'"); //#endregion formSearch 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_aire'; ret[5] = this.storePLList; return ret; }, Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } var bsno = '11111'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length != 0) { var record = selections[0]; bsno = record.data.BSNO; } var sortstr = 'ETD,MBLNO '; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/MsOpAire/GetDataListStr', scope: this, params: { condition: _this.sqlcontext, printstr: 'true', sort: sortstr }, 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 = 'MSOPAIRELIST'; var sql1 = returnstr; var sql2 = "select * from op_aire where BSNO='" + bsno + "'"; 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 = 'MBLNO desc'; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } 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 = 'MSOPAIRELISTSELECT'; var sql1 = "select * from op_aire WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select * from op_aire where BSNO='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } });