Ext.namespace('Shipping'); Shipping.CRM_QUOTATIONIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.CRM_QUOTATIONIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.CRM_QUOTATIONIndex, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 sqlcontext: '', editype: '', selectbsno: '', sortfield: '', sortdire: '', initUIComponents: function () { this.formname = "formCRM_QUOTATIONIndex"; //页面名称 //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'CRM_QUOTATIONmb', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/CRM_QUOTATION_CUST/GetDataList', reader: { id: 'GID', 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, // hidden: true, dataIndex: 'GID', header: '询价单编号', width: 115 }, { sortable: true, dataIndex: 'BLTYPE', header: '报价单类型', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BLSTATUS', header: 'BLSTATUS', width: 80 }, { dataIndex: 'GETBJ', header: '报价回复', width: 45, renderer: function (value, cellmeta) { if (parseInt(value) > 0) { return "" + value + ""; } else { return "0"; } } }, { sortable: true, dataIndex: 'BLSTATUS_REF', header: '报价单状态', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CLIENTGID', header: '潜在客户GID', width: 80 }, { sortable: true, dataIndex: 'SHORTNAME', header: '客户简称', width: 80 }, { sortable: true, dataIndex: 'DESCRIPTION', header: '客户描述信息', width: 80 }, { sortable: true, dataIndex: 'SALE', header: '销售', width: 80 }, { sortable: true, dataIndex: 'ASKDATE', header: '询价日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'QUOTATIONDATE', header: '报价日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, hidden: true, dataIndex: 'CORPID', header: '所属分公司代码', width: 80 }, { sortable: true, hidden: true, dataIndex: 'PORTLOAD', header: 'PORTLOAD', width: 80 }, { sortable: true, dataIndex: 'PORTLOAD_REF', header: '装货港', width: 80 }, { sortable: true, dataIndex: 'PORTDISCHARGE_REF', header: '卸货港', width: 80 }, { sortable: true, hidden: true, dataIndex: 'PORTDISCHARGE', header: 'PORTDISCHARGE', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LANE', header: '航线', width: 80 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 80 }, { sortable: true, dataIndex: 'ETD', header: 'ETD', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'ETA', header: 'ETA', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { sortable: true, dataIndex: 'ENTREPORT', header: '中转港', width: 80 }, { sortable: true, dataIndex: 'TT', header: '航程', width: 80 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 80 }, { 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 }, { sortable: true, dataIndex: 'CONTACTNAME', header: '联系人', width: 80 }, { sortable: true, dataIndex: 'TEL', header: '联系人电话', width: 80 }, { sortable: true, dataIndex: 'EMAIL', header: '联系人Email', width: 80 }, { sortable: true, dataIndex: 'VALIDDATE', header: '有效期', width: 80 }, { sortable: true, dataIndex: 'WEEK', header: '开船日期所属星期几', width: 80 }, { sortable: true, hidden: true, dataIndex: '_20GP', header: '20GP', width: 80 }, { sortable: true, hidden: true, dataIndex: '_40GP', header: '40GP', width: 80 }, { sortable: true, hidden: true, dataIndex: '_40HC', header: '40HC', width: 80 }, { sortable: true, hidden: true, dataIndex: '_45', header: '45', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CTN', header: 'CTN', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CTN2', header: 'CTN2', width: 80 }, { sortable: true, hidden: true, dataIndex: 'TimeMark', header: 'TimeMark', width: 80 }]; 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, getRowClass: function (record, rowIndex, rowParams, store) { var BLSTATUS = record.get('BLSTATUS'); return Shipping.GetAuditClass(BLSTATUS); } }, 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, 0); //使用者id,表名,中间column数组,跳过一开始的几列 this.girdcolums.unshift(new Ext.grid.RowNumberer()); 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'; //if (BLTYPE=="国内分单") //DsOpenEditWin('/MvcShipping/MsOpAirn/Edit', record.data.BSNO); //if (BLTYPE == "国内主单") if (BLTYPE == "客户询价") { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CUST/Edit'); } else { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CARRIER/Edit'); } }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch 下拉框信息加载 var _this = this; //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOpAirnList"} }); //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "" } , callback: function (r, options, success) { if (success) { _this.storeCustCode2.add(r); } } }); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '询价单位', store: this.storeCustCode, forceSelection: true, name: 'CLIENTGID', valueField: 'GId', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.comboxCustCode2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '报价单位', store: this.storeCustCode2, forceSelection: true, name: 'ChildCLIENTGID', valueField: 'GId', displayField: 'CodeAndName', enableKeyEvents: true, listeners: { 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/GetCustomRefList' } }); //船公司 this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER, forceSelection: true, name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeBLSTATUS = Ext.create('DsExt.ux.RefTableStore', { model: 'DsExtEnumModel', proxy: { url: '/CommMng/PubSys/GetEnumValueList' } }); this.storeBLSTATUS.load({ params: { enumTypeId: 39} }); this.comboxBLSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '询价单状态', store: this.storeBLSTATUS, //forceSelection: true, name: 'BLSTATUS', valueField: 'EnumValueId', displayField: 'EnumValueName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load({ params: { condition: ""} }); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '揽货人', store: this.storeOpCode, //forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.comboxCREATEUSER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '创建人', store: this.storeOpCode, //forceSelection: true, name: 'CREATEUSER', valueField: 'UserName', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeLoadportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' } }); this.storeCodeLoadport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'EDICODE', displayField: 'EDICODE', forceSelection: true, matchFieldWidth: false }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load(); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', forceSelection: true, matchFieldWidth: false, valueField: 'EDICODE', displayField: 'EDICODE' }); //#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: 90, msgTarget: 'qtip' }, items: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'button', hidden: true, 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 }, this.comboxBLSTATUS , this.comboxCustCode , this.comboxSALE, { fieldLabel: '从..询价日期', format: 'Y-m-d', xtype: 'datefield', name: 'ASKDATEbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到..询价日期', format: 'Y-m-d', xtype: 'datefield', name: 'ASKDATEend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { xtype: 'button', width: 90, flex: 0.5, 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: 'QUOTATIONDATEbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到..报价日期', format: 'Y-m-d', xtype: 'datefield', name: 'QUOTATIONDATEend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '从..ETD', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: '到..ETD', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, this.comboxCREATEUSER , { xtype: 'hiddenfield', flex: 0.5}] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxPORTLOAD , this.comboxPORTDISCHARGE , this.comboxCustCode2 , this.comboxCARRIER , { xtype: 'hiddenfield', flex: 1.5}] } ]//end items(fieldset 1) }]//end root items }); //#endregion formSearch _this = this; //按钮工具条_ this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; if (BLTYPE == "客户询价") { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CUST/Edit'); } else { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CARRIER/Edit'); } }, scope: this }, { text: "复制新建", hidden: true, 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'; if (BLTYPE == "客户询价") { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CUST/Edit'); } else { DsOpenEditWin('/MvcShipping/CRM_QUOTATION_CARRIER/Edit'); } }, scope: this }, { text: "删除", iconCls: "btndelete", handler: function (button, event) { this.onDeleteClick(button, event); }, scope: this }, { 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: "提交审核", disabled: true, id: "StartAudit", handler: function (button, event) { this.StartAudit(button, event); }, scope: this }, { text: "撤回提交", disabled: true, id: "ResetAudit", handler: function (button, event) { this.ResetAudit(button, event); }, scope: this }, { text: "审核通过", disabled: true, //iconCls: "btnreset", id: "Audit", handler: function (button, event) { this.Audit(button, event); }, scope: this }, { text: "驳回提交", disabled: true, //iconCls: "btnreset", id: "AuditBack", handler: function (button, event) { this.AuditBack(button, event); }, scope: this }, { text: "打印", hidden: true, iconCls: 'btnprint', menu: [ { text: "全部", handler: function (menu, event) { _this.Print(); } }, { text: "选择打印", handler: function (menu, event) { _this.PrintSelect(); } }], scope: this }, '-', { text: "其他操作", hidden: true, menu: [ { text: "提单信息", handler: function (menu, event) { _this.onBillEditClick(menu, event); } }, { text: "生成分部订舱", handler: function (menu, event) { _this.onCreateSubOrderClick(menu, event, 1); } }, { text: "批量状态更新", handler: function (menu, event) { _this.onUpOpStatusClick(menu, event, 1); } }, { text: "费用编辑", handler: function (menu, event) { _this.onFeeEditClick(menu, event); } }, { text: "批量费用提交", handler: function (menu, event) { _this.onPiLiangSubmitClick(menu, event, 1); } }, { text: "业务批量修改", handler: function (menu, event) { _this.winModifyShow.show(); } }], scope: this }] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 128, 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); //#region 下载窗体 this.formDownloadShow = Ext.widget('form', { frame: true, region: 'center', height: 100, 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', id: 'downloadfile', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '', width: 120, text: '' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); me = this; this.winDownloadShow = Ext.create('Ext.window.Window', { title: "下载文件", width: 450, 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.formDownloadShow], buttons: [{ text: "关闭", minWidth: 70, handler: function () { me.winDownloadShow.close(); } }] }); //#endregion //#region 批量修改窗体 //客户加载_代理 // this.storeShipper.load({ params: { condition: "ISCONTROLLER='1'"} }); //收货人 this.comboxAgent2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '代 理', store: this.storeagent, // forceSelection: true, name: 'AGENTID', valueField: 'SHORTNAME', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeagent, 'SHORTNAME', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formModify.getForm().findField('AGENT').setValue(selectdata.SHIPPERDETAIL); } else { this.formModify.getForm().findField('AGENT').setValue(''); } } } } }); this.comboxPORTLOAD2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '装货港', store: this.storeCodeLoadport, name: 'PORTLOAD', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeLoadport, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formModify.getForm().findField('PORTLOADID').setValue(selectdata.EDICODE); } else { this.formModify.getForm().findField('PORTLOADID').setValue(''); } } } } }); this.comboxPORTDISCHARGE2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '卸货港', store: this.storeCodeDisport, name: 'PORTDISCHARGE', valueField: 'PORT', queryMode: 'local', displayField: 'PORT', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; this.formModify.getForm().findField('PORTDISCHARGEID').setValue(selectdata.EDICODE); } else { this.formModify.getForm().findField('PORTDISCHARGEID').setValue(''); } } } } }); this.formModify = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxYARD2, this.comboxCARRIER2, this.comboxFORWARDER2, this.comboxLANE2 ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxAgent2, this.comboxCUSTOMSER2, this.comboxTRUCKER2, { xtype: 'hiddenfield' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxPORTLOAD2, { fieldLabel: '装港代码', name: 'PORTLOADID' }, this.comboxPORTDISCHARGE2, { fieldLabel: '卸港代码', name: 'PORTDISCHARGEID' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, fieldLabel: 'AGENT', height: 70, name: 'AGENT', anchor: '100%' } ] } ]//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 //#region 选择load this.gridList.getSelectionModel().on('select', function (model, record, index) { //this.CHILDEGID = record.data.GID; if (record.data.BLSTATUS == "0" || record.data.BLSTATUS == "1") { //可以提交 Ext.getCmp("StartAudit").enable(); Ext.getCmp("ResetAudit").disable(); Ext.getCmp("Audit").disable(); Ext.getCmp("AuditBack").disable(); } else if (record.data.BLSTATUS == "2") { //可以审核 可以驳回 Ext.getCmp("StartAudit").disable(); Ext.getCmp("ResetAudit").enable(); Ext.getCmp("Audit").enable(); Ext.getCmp("AuditBack").enable(); } else if (record.data.BLSTATUS == "3") { //可以驳回 Ext.getCmp("StartAudit").disable(); Ext.getCmp("ResetAudit").disable(); Ext.getCmp("Audit").disable(); Ext.getCmp("AuditBack").enable(); } //点中同一行的话什么都不做。 // }, this); //#endregion }, //end initUIComponents InitGrid: function (grid) { //var agirdcolums = Ext.clone(this.gridList.columns); var agirdcolums = grid; // 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 }); }, 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.BLSTATUS != "0") { 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/CRM_QUOTATION_CUST/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); }, //end initUIComponents //#region 状态更新和批量修改 onUpOpStatusClick: function (menu, event, type) { var selections = this.GridCheckBoxModel.selected.items; if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BSNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BSNO = "'" + rec.data.BSNO + "'"; if (BSNOStr == '') BSNOStr = BSNO; else { BSNOStr = BSNOStr + ',' + BSNO; } } if (BSNOStr == '') { Ext.Msg.show({ title: '提示', msg: '没有要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { this.selectbsno = " BSNO IN (" + BSNOStr + ")"; window.open('/MvcShipping/MsOpStatus/PiLiang', "PILIANGOPSTATUS", 'width=1200,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes'); } }, onPiLiangSubmitClick: function (menu, event, type) { var selections = this.GridCheckBoxModel.selected.items; if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var BSNOStr = ''; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BSNO = "'" + rec.data.BSNO + "'"; if (BSNOStr == '') BSNOStr = BSNO; else { BSNOStr = BSNOStr + ',' + BSNO; } } this.storePLList.removeAll(); for (var i = 0; i < selections.length; i++) { var rec = selections[i]; this.storePLList.add(rec.data); } if (BSNOStr == '') { Ext.Msg.show({ title: '提示', msg: '没有要更新的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { this.selectbsno = " BSNO IN (" + BSNOStr + ")"; window.open('/Account/Chfee_Audit/PiLiangSubmit', "PILIANGSUBMIT", 'width=1200,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes'); } }, //#endregion //#region 拼箱操作 onFeeEditClick: 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'; DsOpenEditWin('/MvcShipping/MsOpAirn/PiLiangFeeEdit'); }, onBillEditClick: 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'; DsOpenEditWin('/MvcShipping/MsOpAirn/PiLiangOpBill'); }, onFenBillListClick: 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]; if (record.data.BLTYPE != '拼箱主票') { Ext.Msg.show({ title: '提示', msg: '只有拼箱主票才能拼箱预配!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsOpAirn/FenBillList'); }, //#endregion onImportEdiClick: function (button, event) { var winAccess = new Shipping.EDIImport({ }); winAccess.StoreList = this.storeList; winAccess.show(); return; }, 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 bodyAddDatas = []; for (var i = 0; i < records.length; i++) { var rec = records[i]; if (rec.data.BSSTATUS == 'true') { Ext.Msg.show({ title: '警告', msg: '业务已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); } else { var op = rec.data.OP; var inputby = rec.data.INPUTBY; var mrecords = DsStoreQueryBy(this.StoreOpRange, 'OPID', op); if (mrecords.getCount() > 0) { bodyAddDatas.push(rec); } else { var recordins = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby); if (recordins.getCount() > 0) { bodyAddDatas.push(rec); } else { canedit = false; Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); } } } } var data = this.formModify.getForm().getValues(); _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/MsOpAirn/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.onRefreshClick(); _this.winModifyShow.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } }, 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 = " BLTYPE='" + BLTYPE + "' "; //#region formSearch 查询面板 var BLSTATUS = form.findField('BLSTATUS').getValue(); sql = sql + getAndConSql(sql, BLSTATUS, "cq.BLSTATUS=" + BLSTATUS + ""); //客户名称 var CLIENTGID = form.findField('CLIENTGID').getValue(); sql = sql + getAndConSql(sql, CLIENTGID, "cq.CLIENTGID='" + CLIENTGID + "'"); var ChildCLIENTGID = form.findField('ChildCLIENTGID').getValue(); sql = sql + getAndConSql(sql, ChildCLIENTGID, " cq.GID in(select CUSTCQGID from CRM_QUOTATION_LINK where CARRIERCQGID ='" + ChildCLIENTGID + "') "); var SALE = form.findField('SALE').getValue(); sql = sql + getAndConSql(sql, SALE, " cq.SALE='" + SALE + "'"); var CREATEUSER = form.findField('CREATEUSER').getValue(); sql = sql + getAndConSql(sql, CREATEUSER, " cq.CREATEUSER='" + CREATEUSER + "'"); var ASKDATEbgn = form.findField('ASKDATEbgn').getRawValue(); sql = sql + getAndConSql(sql, ASKDATEbgn, "cq.ASKDATE >='" + ASKDATEbgn + "'"); var ASKDATEend = form.findField('ASKDATEend').getRawValue(); sql = sql + getAndConSql(sql, ASKDATEend, "cq.ASKDATE <='" + ASKDATEend + " 23:59:59'"); var QUOTATIONDATEbgn = form.findField('QUOTATIONDATEbgn').getRawValue(); sql = sql + getAndConSql(sql, QUOTATIONDATEbgn, "cq.QUOTATIONDATE >='" + QUOTATIONDATEbgn + "'"); var QUOTATIONDATEend = form.findField('QUOTATIONDATEend').getRawValue(); sql = sql + getAndConSql(sql, QUOTATIONDATEend, "cq.QUOTATIONDATE <='" + QUOTATIONDATEend + " 23:59:59'"); //到港日期 var ETDbgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, ETDbgn, "cq.ETD >='" + ETDbgn + "'"); var ETDend = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, ETDend, "cq.ETD <='" + ETDend + "'"); var PORTLOAD = form.findField('PORTLOAD').getValue(); sql = sql + getAndConSql(sql, PORTLOAD, " cq.PORTLOAD='" + PORTLOAD + "'"); var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue(); sql = sql + getAndConSql(sql, PORTDISCHARGE, " cq.PORTDISCHARGE='" + PORTDISCHARGE + "'"); var CARRIER = form.findField('CARRIER').getValue(); sql = sql + getAndConSql(sql, CARRIER, " (cq.CARRIER='" + CARRIER + "' or EXISTS (select * from crm_quotation where CLIENTGID='" + CARRIER + "' and GID in(select CARRIERCQGID from CRM_QUOTATION_LINK where CUSTCQGID=CQ.GID)) ) "); //#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] = "CUSTINDEX"; ret[5] = ""; 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/MsOpAirn/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 = 'MsOpAirnLIST'; var sql1 = returnstr; var sql2 = "select * from op_Airn 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 = 'MsOpAirnLISTSELECT'; var sql1 = "select * from op_Airn WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr; var sql2 = "select * from op_Airn where BSNO='" + bsno + "'"; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } , StartAudit: function () { var selections = this.gridList.getSelectionModel().getSelection(); var bill = ""; for (var i = 0; i < selections.length; i++) { record = selections[i]; if (record.data.BLSTATUS != "1") { alert("只能提交向供应商询价阶段的报价单"); } if (bill == "") { bill = record.data.GID; } else { bill = bill + "," + record.data.GID; } } //var bill = record.data.GID; Ext.Ajax.request({ waitMsg: '正在提交数据...', url: '/MvcShipping/CRM_QUOTATION_CUST/StartAudit', params: { USERID: USERID, bill: bill }, callback: function (options, success, response) { if (success) { this.onRefreshClick(); } }, 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 } , ResetAudit: function () { var selections = this.gridList.getSelectionModel().getSelection(); var bill = ""; for (var i = 0; i < selections.length; i++) { record = selections[i]; if (record.data.BLSTATUS != "2") { alert("只能撤回未审核的报价单"); } if (bill == "") { bill = record.data.GID; } else { bill = bill + "," + record.data.GID; } } //var bill = record.data.GID; Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/CRM_QUOTATION_CUST/ResetAudit', params: { USERID: USERID, bill: bill }, callback: function (options, success, response) { if (success) { this.onRefreshClick(); } }, 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 } , Audit: function () { var selections = this.gridList.getSelectionModel().getSelection(); var bill = ""; for (var i = 0; i < selections.length; i++) { record = selections[i]; if (record.data.BLSTATUS != "2") { alert("只能审批提交审核(供应商报价)的报价单"); } if (bill == "") { bill = record.data.GID; } else { bill = bill + "," + record.data.GID; } } //var bill = record.data.GID; Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/CRM_QUOTATION_CUST/Audit', params: { USERID: USERID, bill: bill }, callback: function (options, success, response) { if (success) { this.onRefreshClick(); } }, 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 } , AuditBack: function () { var selections = this.gridList.getSelectionModel().getSelection(); var bill = ""; for (var i = 0; i < selections.length; i++) { record = selections[i]; if (record.data.BLSTATUS != "3") { alert("只能驳回已审核的报价单"); } if (bill == "") { bill = record.data.GID; } else { bill = bill + "," + record.data.GID; } } //var bill = record.data.GID; Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/CRM_QUOTATION_CUST/AuditBack', params: { USERID: USERID, bill: bill }, callback: function (options, success, response) { if (success) { this.onRefreshClick(); } }, 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 } });