Ext.namespace('Shipping'); Shipping.MsRptApplyServiceIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsRptApplyServiceIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsRptApplyServiceIndex, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { //定义数据集 this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); this.formname = 'MsRptApplyServiceIndex'; this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, fields: [ { name: 'BSNO', type: 'string' }, { name: 'WORK', type: 'string' }, { name: 'STARTDATETIME', type: 'string' }, { name: 'PLANENDTIME', type: 'string' }, { name: 'ENDDATETIME', type: 'string' }, { name: 'ENDOP', type: 'string' }, { name: 'STATUS', type: 'string' }, { name: 'WORKLOAD', type: 'number' }, { name: 'BSTYPE', type: 'string' }, { name: 'CUSTOMERNAME', type: 'string' }, { name: 'CUSTNO', type: 'string' }, { name: 'MBLNO', type: 'string' }, { name: 'HBLNO', type: 'string' }, { name: 'ETD', type: 'string' }, { name: 'CUSTOMNO', type: 'string' }, { name: 'VESSEL', type: 'string' }, { name: 'VOYNO', type: 'string' }, { name: 'BSSTATUSREF', type: 'string' }, { name: 'FEESTATUSREF', type: 'string' }, { name: 'SALE', type: 'string' }, { name: 'OP', type: 'string' }, { name: 'PORTLOAD', type: 'string' }, { name: 'PORTDISCHARGE', type: 'string' }, { name: 'CUSTOMNO', type: 'string' }, { name: 'ACCDATE', type: 'string' }, { name: 'CARRIER', type: 'string' }, { name: 'BSSOURCE', type: 'string' }, { name: 'OPDATE', type: 'string' }, { name: 'CUSTOMDATE', type: 'string' }, { name: 'ENTERP', type: 'string' }, { name: 'NETWEIGHT', type: 'number' }, { name: 'KGS', type: 'number' }, { name: 'TEU', type: 'number' } ], remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsRptApplyService/BsListData', reader: { id: '', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 150 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 120 }, { sortable: true, dataIndex: 'CUSTOMNO', header: '报关单号', width: 120 }, { sortable: true, dataIndex: 'WORK', header: '服务流程', width: 120 }, { sortable: true, dataIndex: 'STATUS', header: '流程状态', width: 120 }, { sortable: true, dataIndex: 'STARTDATETIME', header: '计划开始时间', width: 120 }, { sortable: true, dataIndex: 'PLANENDTIME', header: '计划结束时间', width: 120 }, { sortable: true, dataIndex: 'ENDDATETIME', header: '完成时间', width: 120 }, { sortable: true, dataIndex: 'ENDOP', header: '完成人', width: 120 }, { sortable: true, dataIndex: 'WORKLOAD', header: '工时', width: 120 }, { sortable: true, dataIndex: 'BSDATE', header: '录入日期', width: 80 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { sortable: true, dataIndex: 'MBLNO', header: '提单号', width: 80 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 80 }, { sortable: true, dataIndex: 'BSTYPE', header: '业务类型', hidden: true, width: 80 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 100 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 40 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 60 }, { sortable: true, dataIndex: 'ETA', header: '到港日期', width: 60 }, { sortable: true, dataIndex: 'PORTLOAD', header: '装货港', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '卸货港', width: 80 }, { sortable: true, dataIndex: 'AOP', header: '业务操作', width: 80 }, { sortable: true, dataIndex: 'SALE', header: '销售', width: 80 }, { sortable: true, dataIndex: 'CUSTOMSER', header: '报关行', width: 80 }, { sortable: true, dataIndex: 'BSSOURCE', header: '业务来源', width: 100 }, { sortable: true, dataIndex: 'BSSOURCEDETAIL', header: '贸易条款', width: 80 }, { sortable: true, dataIndex: 'CUSTOMDATE', header: '报关日期', width: 100 }, { sortable: true, dataIndex: 'INSPECTIONNO', header: '商检单号', width: 100 }, { sortable: true, dataIndex: 'INSPECTIONDATE', header: '商检日期', hidden: true, width: 80 }, { sortable: true, dataIndex: 'INVNO', header: '发票号', width: 80 }, { sortable: true, dataIndex: 'CONTRACTNO', header: '合同号', width: 160 }, { sortable: true, dataIndex: 'ARCOUNTRY', header: '货源国别', width: 80 }, { sortable: true, dataIndex: 'GOODSOURCE', header: '货源地', width: 80 }, { sortable: true, dataIndex: 'DOCNO', header: '批准文号', width: 80 }, { sortable: true, dataIndex: 'TRADETYPE', header: '贸易方式', width: 80 }, { sortable: true, dataIndex: 'BSSTATUS', header: '业务锁定', width: 100 }, { sortable: true, dataIndex: 'FEESTATUS', header: '费用锁定', width: 100 } ]; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolums, bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); //#region formSearch //#region formSearch枚举参照相关 //#endregion this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); this.storecodeservice.load({ params: { condition: "OPTYPE='5'"} }); this.comboxBsType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '服务项目', store: this.storecodeservice, valueField: 'OPField', displayField: 'SERVICENAME', name: 'SERVICE' }); this.StoreStatus = Ext.create('Ext.data.Store', { fields: ['STATUS'] }); this.StoreStatus.add({ "STATUS": "未完成" }); this.StoreStatus.add({ "STATUS": "已完成" }); this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '服务状态', store: this.StoreStatus, valueField: 'STATUS', displayField: 'STATUS', name: 'STATUS' }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '委托编号', name: 'BsNo' }, { fieldLabel: '报关单号', name: 'CustomNo' }, { fieldLabel: '从报关日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateBgn' }, { fieldLabel: '到报关日期', format: 'Y-m-d', xtype: 'datefield', name: 'ExpDateEnd' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBsType, this.comboxStatus, { fieldLabel: '提单号', name: 'MblNo' }, { fieldLabel: '委托单位', name: 'CustName' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ /* { text: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/MvcShipping/MsOpApplyService/Edit'); }, 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 }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 110, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.InitGrid(); this.onRefreshClick(); /* this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); */ }, //end initUIComponents InitGrid: function () { }, onRefreshClick: function (button, event) { // var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var billNo = form.findField('BsNo').getValue(); sql = sql + getAndConSql(sql, billNo, "A.CustNo like '%" + billNo + "%'"); var customNo = form.findField('CustomNo').getValue(); sql = sql + getAndConSql(sql, customNo, "A.CUSTOMNO like '%" + customNo + "%'"); var BsType = form.findField('SERVICE').getValue(); sql = sql + getAndConSql(sql, BsType, "S.OPField= '" + BsType + "'"); var BsStatus = form.findField('STATUS').getValue(); sql = sql + getAndConSql(sql, BsStatus, "S.STATUS= '" + BsStatus + "'"); var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "A.MblNo like '%" + MblNo + "%'"); var custName = form.findField('CustName').getValue(); sql = sql + getAndConSql(sql, custName, "A.CUSTOMERNAME like '%" + custName + "%'"); var expDateBgn = form.findField('ExpDateBgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "A.CUSTOMDATE >='" + expDateBgn + "'"); var expDateEnd = form.findField('ExpDateEnd').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "A.CUSTOMDATE <='" + expDateEnd + "'"); return sql; }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });