//押箱管理 Ext.namespace('Shipping'); Shipping.DJYORDER_ACCOUNTINFOIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.DJYORDER_ACCOUNTINFOIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.DJYORDER_ACCOUNTINFOIndex, Ext.Panel, { PageSize: 50, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', pageSize: 50, sortfield: '', sortdire: '', ChangeListData: null, initUIComponents: function () { this.formname = "DJYORDER_ACCOUNTINFOIndex"; this.sqlcontext = ''; ///////////////////////////////////////// //#region 主列表 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'DJYORDER_ACCOUNTINFOmb', remoteSort: false, proxy: { type: 'ajax', //url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/GetDataList', //this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL'; reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.column = [ { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CORPID', header: 'CORPID', width: 30 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 120 }, { sortable: true, dataIndex: 'ACCOUNT', header: '第三方账号', width: 120 }, { sortable: true, dataIndex: 'BookingName', header: Zi.LAN.BookingName, width: 220 } ]; Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 40 }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); 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.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, //selModel: this.MainCB, columns: this.column, plugins: [ //this.cellEditing ], features: [{ ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性 }], /*features: [{ id: 'group', ftype: 'grouping', groupHeaderTpl: '{name}', hideGroupedHeader: true, enableGroupingMenu: true }],*/ viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { //var YXSTATE = record.get('YXSTATE'); //return Shipping.GetAuditClass(BLSTATUS); } }, bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum], }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column); //使用者id,表名 ,中间column数组 this.column.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.column); //////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { // alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString()); this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/DJYORDER_ACCOUNTINFO/Edit', record.data.GID, "350", "600", 200, 400); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); var _this = this; //#endregion ////////////////////////////////////////////////////////////// //#region formSearch //#region formSearch枚举参照相关 parentWin = window.parent.opener; this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'" } }); this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 } } }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserLinkRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeUser.load({ params: { condition: "" } }); //#endregion _this = this; this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '1 1 1 1', labelAlign: 'right', flex: 1, labelWidth: 85, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCARRIER , { fieldLabel: '账号', //labelWidth: 110, name: 'ACCOUNT', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { xtype: "hiddenfield" } , { xtype: "hiddenfield" } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); saveQuerySetting(this.formname, this.formSearch, true, true); }, scope: this }, '-' , { text: "新建", id: "btnadd", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/MvcShipping/DJYORDER_ACCOUNTINFO/Edit', "船公司账号密码设置", "350", "600", 200, 400); }, scope: this } , '-', { text: "新建", id: "btnadd", iconCls: "btnadd", menu: [ { text: "中远", id: "btnadd_cosco", handler: function (button, event) { this.OprationStatus = 'add'; //DsOpenEditWin('/MvcShipping/DJYORDER_ACCOUNTINFO/Edit?CARRIER=COSCO', "新建服务订单", "350", "600", 200, 400); DsOpenEditWin('/MvcShipping/DJYORDER_ACCOUNTINFO/Edit?CARRIER=COSCO', "船公司账号密码设置_中远", "350", "600", 200, 400); }, scope: this }, { text: "长荣", id: "btnadd_emc", handler: function (button, event) { this.OprationStatus = 'add'; //DsOpenEditWin('/MvcShipping/DJYORDER_CONTRACTNO/Edit?CARRIER=EMC', "船公司账号密码设置_长荣", "320", "600", 200, 400); DsOpenEditWin('/MvcShipping/DJYORDER_ACCOUNTINFO/Edit?CARRIER=EMC', "船公司账号密码设置_长荣", "350", "600", 200, 400); }, scope: this } ] } , { text: "删除", id: "btndelete", iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this } , { text: "导出", id: "export", tooltip: 'export', handler: function (button, event) { //this.PushState("30011"); this.onExportClick(); }, scope: this } , { xtype: 'button', hidden: true, 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 }, { text: "保存列表样式", id: "btntest", handler: function (button, event) { var formname = this.formname; var tempcolumns = this.gridList.columns; DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 0, false); }, scope: this } //,this.CB_EditMode ] }); //#region 布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 95, items: [this.formSearch, this.panelBtn] }); this.panelMain = new Ext.Panel({ //title: '', layout: "border", region: 'center', height: 600, margin: '1 2', split: true, items: [this.gridList] }); Ext.apply(this, { items: [this.panelTop, this.panelMain] }); //#endregion //#region 以下集中绑定事件 this.storeList.on('beforeload', function (store) { var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext, sort: sortstr }); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#endregion this.LoadInitData(); this.LoadData(); this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { idProperty: '', root: 'data', totalProperty: 'totalCount' } } }); //this.DocCM = Ext.create('Ext.selection.CheckboxModel'); this.gridDocList = new Ext.grid.GridPanel({ store: this.storeDocList, enableHdMenu: false, region: 'center', border: false, hideHeaders: true, //width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, //selModel: this.DocCM, selType: 'cellmodel', tbar: [ ], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'RECEIPTTYPE', header: '单据类型', editor: this.comboxReceiptid_DOC, width: 80 }, { sortable: true, hidden: true, dataIndex: 'R_GID', header: 'R_GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, dataIndex: 'URL', header: '文件名', width: 260, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSERRef', header: '修改人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: '修改时间', width: 85 } ] }); this.winDocShow = Ext.create('Ext.window.Window', { title: "", //"生成INTTR", width: 300, height: 200, id: "winDocShow", //height :600, //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.gridDocList ], }); }, //end initUIComponents LoadInitData: function () { if (this.sqlcontext == '') { this.sqlcontext = ""; } this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: this.sqlcontext }, waitMsg: "正在查询数据...", scope: this }); }, onRefreshClick: function (button, event) { this.PageSize = this.Pagenum.getValue(); var sql = this.getCondition(); this.sqlcontext = sql; var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql, sort: sortstr }, waitMsg: "正在查询数据...", scope: this }); //} }, onDsQuery: function (button, event) { var sql = this.sqlcontext; var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql, sort: sortstr }, 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]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/DelHead', params: { GID: record.data.GID }, 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); }, //onDeleteClickwinChangeShow getCondition: function () { var form = this.formSearch.getForm(); var sql = ''; //20170309 增加逻辑 // //只能看到“” var CARRIER = form.findField('CARRIER').getRawValue(); sql = sql + getAndConSql(sql, CARRIER, " CARRIER='" + CARRIER + "'"); var ACCOUNT = form.findField('ACCOUNT').getRawValue(); sql = sql + getAndConSql(sql, ACCOUNT, " ACCOUNT like '%" + ACCOUNT + "%'"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.storeCARRIER; return ret; }, //onAddClick: function (button, event) { // this.OprationStatus = 'add'; // DsOpenEditWin2("/MvcShipping/OP_SERVICEBILL/Edit", "新建服务订单", "500", "600", 200, 400); //}, //onDeleteClick //onExportClick: function (button, event) { // GridExportExcelPage(this.gridList); //}, //#region 打印 Print: function () { _this = this; if (this.storeList.getCount() == 0) { return; } Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/GetDataListStr', params: { condition: _this.sqlcontext }, 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; } var returnstr = jsonresult.data; var printType = 'DJYORDER_ACCOUNTINFOLIST'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } //#endregion , ShowBILLSTATUS_Log: function (BSNO) { //var customername = this.formHead.getForm().findField('CUSTOMERNAME').getValue(); title = "状态信息"; model = Ext.define('op_status_md', { extend: 'Ext.data.Model', idProperty: 'ST_ID', fields: [ { name: 'ST_ID', type: 'string' }, { name: 'BSNO', type: 'string' }, { name: 'STATUS', type: 'string' }, { name: 'ISCOMP', type: 'bool' }, { name: 'ISOPEN', type: 'string' }, { name: 'ISOPENREF', type: 'string' }, { name: 'COMPTIME', type: 'date', dateFormat: 'Y-m-d H:i:s' }, { name: 'COMPOP', type: 'string' }, { name: 'INPUTBY', type: 'string' }, { name: 'INPUTTIME', type: 'string' }, { name: 'OPTIME', type: 'string' }, { name: 'REMARK', type: 'string' }, { name: 'STATUS_OPSEAE', type: 'string' }, { name: 'ORDNO', type: 'number' }, { name: 'STTYPE', type: 'string' }, { name: 'STTYPESTR', type: 'string' } ] }); proxyUrl = '/MvcShipping/MsOpStatus/GetListData'; condition = " BSNO='" + BSNO + "' "; columns = [ { sortable: true, dataIndex: 'STATUS', header: '业务状态', width: 90 }, { sortable: true, dataIndex: 'COMPTIME', header: '状态时间', width: 120, renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s') }, { sortable: true, dataIndex: 'COMPOP', header: '操作人', width: 120 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 140 } ]; ShowPublicINFO(title, model, proxyUrl, condition, columns, 500); } , LoadData() { this.onRefreshClick(); } , onExportClick: function (button, event) { _this = this; var sortstr = ''; if (this.sortfield != '' && this.sortdire != '') { sortstr = this.sortfield + ' ' + this.sortdire; } var sql = this.getCondition(); Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/GetDataListStr', scope: this, params: { condition: sql, 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 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 }); } } }); }, });