Ext.namespace('Shipping'); Shipping.MsSeaeWebOrderAudit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsSeaeWebOrderAudit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsSeaeWebOrderAudit, Ext.Panel, { PageSize: 50, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 IsAudit: true, accdate: null, seaeop: "", seaecustservice: "", reason: "", initUIComponents: function () { this.formname = "formMsSeaeWebOrderAudit"; //页面名称 //定义数据集 this.storectndisp = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CtnDispModel', proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' } }); Ext.Ajax.timeout = 120000; this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsSeaeOrderModel', remoteSort: true, proxy: { type: 'ajax', timeout: 120000, url: '/MvcShipping/MsSeaeOrder/GetWebDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); //#region List列表显示信息 Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.girdcolums = [{ sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 0 }, { sortable: true, dataIndex: 'ORDNO', header: '订舱编号', width: 120 }, { sortable: true, dataIndex: 'ORSTATUSREF', header: '状态', width: 60 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 120 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', width: 80 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 100 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 60 }, { sortable: true, dataIndex: 'PORTLOAD', header: '装货港', width: 100 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '卸货港', width: 100 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { sortable: true, dataIndex: 'PKGS', header: '件数', width: 80 }, { sortable: true, dataIndex: 'KINDPKGS', header: '件数包装', width: 60 }, { sortable: true, dataIndex: 'KGS', header: '毛重', width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: '集装箱', width: 80 }, { sortable: true, dataIndex: 'BLFRT', header: '付费方式', width: 60 }, { sortable: true, dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, dataIndex: 'CARGOID', header: '货物标识', width: 60 }, { sortable: true, dataIndex: 'BSDATE', header: '接单日期', width: 80 }, { sortable: true, dataIndex: 'CARRIER', header: '船公司', width: 100 }, { sortable: true, dataIndex: 'SALE', header: '揽货人', width: 80 }, { sortable: true, dataIndex: 'BLTYPE', header: '装运方式', width: 60 }, { sortable: true, dataIndex: 'STLNAME', header: '结算方式', width: 60 }, { sortable: true, dataIndex: 'STLDATE', header: '结算日期', width: 60 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', width: 120 }, { sortable: true, dataIndex: 'OP', header: '操作员', width: 80 }, { sortable: true, dataIndex: 'CUSTOMSER', header: '报关行', width: 80 }]; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, 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: "没有数据" }) }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = 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'; var openUrl = ""; if (record.data.ORSTATUSREF.indexOf("提单确认") >= 0) { openUrl = "/MvcShipping/MsSeaeOrder/WebBillEdit"; } else { openUrl = "/MvcShipping/MsSeaeOrder/WebEdit"; } DsOpenEditWin(openUrl); }, this); //#region formSearch 下拉框信息加载 //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modSeaeOrderList"} }); //人员信息加载 this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeOpCode.load(); //客服 //客户加载_委托单位 this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); //委托单位 this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeCustCode, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); //客户加载_船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} }); //船公司 this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER, forceSelection: true, name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreStatus = Ext.create('DsExt.ux.RefTableStore', { model: 'MsSeaeOrderStatus', proxy: { url: '/MvcShipping/MsSeaeOrder/GetOrderStatus' } }); this.StoreStatus.load(); this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreStatus, fieldLabel: '订舱状态', forceSelection: true, name: 'ORSTATUS', valueField: 'STATUS_ID', displayField: 'STATUSSTR' }); //#endregion //#region formSearch 查询面板 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: [/*this.comboxStatus, */{ fieldLabel: '订舱编号', name: 'BsNo' }, { fieldLabel: '开船日期', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn' }, { fieldLabel: '到', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, { fieldLabel: '主提单号', name: 'MblNo' }] }]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //#region formSearch2 隐藏查询面板 // this.formSearch2 = Ext.widget('form', { // frame: true, // region: 'north', // bodyPadding: 0, // fieldDefaults: { // margins: '2 2 2 2', // labelAlign: 'right', // flex: 1, //所占列 // labelWidth: 70, //值 能够使 text框也是对齐状态 // msgTarget: 'qtip'//文本框显示的必填样式,修改这里的值msgTarget:"title" msgTarget:"under" msgTarget:"side" // }, // items: [{//fieldset 1 // xtype: 'container', // defaultType: 'textfield', // layout: 'anchor', // defaults: { // anchor: '100%' // }, // items: [{ // xtype: 'container', // layout: 'hbox', // defaultType: 'textfield', // items: [this.comboxCARRIER, { // fieldLabel: '集装箱', // name: 'CNTRTOTAL' // }, this.comboxBLTYPE, { // fieldLabel: '备注', // name: 'REMARK' // }] // }, { // xtype: 'container', // layout: 'hbox', // defaultType: 'textfield', // items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, { // fieldLabel: '船名', // name: 'VESSEL' // }, { // fieldLabel: '航次', // name: 'VOYNO' // }] // }]//end items(fieldset 1) // }]//end root items // }); //#endregion formSearch2 this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxSeaeOp = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作', store: this.storeUser, forceSelection: true, name: 'OP', valueField: 'UserName', displayField: 'CodeAndName' }); this.comboxSeaeCustService = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客服', store: this.storeUser, forceSelection: true, name: 'CUSTSERVICE', valueField: 'UserName', displayField: 'CodeAndName' }); Ext.define('DataInputType', { extend: 'Ext.data.Model', fields: [ { name: 'ID', type: 'string' }, { name: 'InputType', type: 'string' } ] }); var DataInputType = [{ "ID": "0", "InputType": "海运出口" }, { "ID": "1", "InputType": "海运进口" }]; this.storeDataInputType = Ext.create('Ext.data.Store', { model: 'DataInputType', data: DataInputType }); this.comboxDataInputType = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '海运类型', store: this.storeDataInputType, name: 'DataInputType', //id: "ISPAYED", valueField: 'InputType', displayField: 'InputType', allowBlank: false, value:'海运出口' }); this.formAudit = 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: '会计期间', xtype: 'monthfield', name: 'ACCDATE' }, this.comboxSeaeOp ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSeaeCustService ] } ]//end items(fieldset 1) },this.comboxDataInputType//end fieldset 1 ]//end root items }); me = this; this.winAuditShow = 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.formAudit], buttons: [{ text: "确认接受", minWidth: 70, handler: function () { var form = me.formAudit.getForm(); var ACCDATE = form.findField('ACCDATE').getRawValue(); if (ACCDATE == '' || ACCDATE == null || ACCDATE == undefined) { Ext.Msg.show({ title: '提示', msg: '会计期间为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.accdate = ACCDATE; var User = me.comboxSeaeOp.getValue(); if (User == '' || User == null || User == undefined) { Ext.Msg.show({ title: '提示', msg: '操作员为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.seaeop = User; me.seaecustservice = me.comboxSeaeCustService.getValue(); me.onAuditPassClick(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditShow.close(); } }] }); this.formAuditBack = Ext.widget('form', { frame: true, region: 'center', title: "驳回原因", bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'textareafield', grow: true, fieldLabel: '', labelSeparator: '', labelWidth: 0, height: 100, name: 'ORREASON', anchor: '100%' } ]//end root items }); me = this; this.winAuditBackShow = 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.formAuditBack], buttons: [{ text: "确认驳回", minWidth: 70, handler: function () { var form = me.formAuditBack.getForm(); var ORREASON = form.findField('ORREASON').getRawValue(); if (ORREASON == '' || ORREASON == null || ORREASON == undefined) { Ext.Msg.show({ title: '提示', msg: '驳回原因为必填!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; me.reason = ORREASON; me.onAuditBack(); } }, { text: "关闭", minWidth: 70, handler: function () { me.winAuditBackShow.close(); } }] }); //按钮工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ 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 }, '-', { text: "审核通过", iconCls: "btnadd", handler: function (button, event) { this.onAuditClick(); }, scope: this }, '-', { text: "驳回提交", iconCls: "btndelete", handler: function (button, event) { this.onAuditBackClick(); }, scope: this }, '-', { text: "保存列表样式", id: "btntest", handler: function (button, event) { this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true); }, scope: this }] }); this.panelSearch = new Ext.Panel({ layout: "border", region: "north", height: 80, autoSize: true, hidden: true, items: [this.formSearch2] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, items: [this.panelBtn, this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.panelSearch, this.gridList] }); var sql = " (B.BSSTATUS='CI20150711000004' OR B.BSSTATUS='CI_BLC_Send') "; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents onAuditClick: function () { var form = this.formAudit.getForm(); var VoucherDate = form.findField('ACCDATE'); var thisday = this.getToMonth(); VoucherDate.setRawValue(thisday) this.winAuditShow.show(); }, onAuditPassClick: function () { 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.ORSTATUS != 'CI20150711000004') { Ext.Msg.show({ title: '警告', msg: '当前状态,不无法审核!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } _this = this; Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcShipping/MsSeaeOrder/AuditWebOrder', params: { data: Ext.JSON.encode(record.data), accdate: _this.accdate, op: _this.seaeop, custservice: _this.seaecustservice }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '审核成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } _this.winAuditShow.close() } }, 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); }, onAuditBackClick: function () { this.winAuditBackShow.show(); }, onAuditBack: function () { 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.ORSTATUS != 'CI20150711000004') { Ext.Msg.show({ title: '警告', msg: '当前状态,不无法驳回!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } _this = this; Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回数据...'); Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/MvcShipping/MsSeaeOrder/AuditBackWebOrder', params: { data: Ext.JSON.encode(record.data), orreason: _this.reason }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '驳回成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } _this.winAuditBackShow.close(); } }, 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); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, getToMonth: function () { var now = new Date(); var year = now.getFullYear(); //年 var month = now.getMonth() + 1; //月 var clock = year + "-"; if (month < 10) clock = clock + "0" + month; else clock = clock + month; return (clock); }, 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 = " (B.BSSTATUS='CI20150711000004' OR B.BSSTATUS='CI_BLC_Send')"; var sql = " B.BSSTATUS!='CI20150711000002'"; //#region formSearch 查询面板 //编号包括(主提单号) var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "(MBLNO like '%" + MblNo + "%' )"); var BsNo = form.findField('BsNo').getValue(); sql = sql + getAndConSql(sql, BsNo, " BsNo like '%" + BsNo + "%' "); //状态 /*var ORSTATUS = form.findField('ORSTATUS').getValue(); sql = sql + getAndConSql(sql, ORSTATUS, "BSSTATUS='" + ORSTATUS + "'");*/ //客户名称 var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); //到港日期 var ETDbgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, ETDbgn, "ETD >='" + ETDbgn + "'"); var ETDend = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, ETDend, "ETD <='" + ETDend + "'"); // //操作人 // var OP = form.findField('OP').getValue(); // sql = sql + getAndConSql(sql, OP, "OP='" + OP + "'"); // //揽货人 // var SALE = form.findField('SALE').getValue(); // sql = sql + getAndConSql(sql, SALE, "SALE='" + SALE + "'"); // //牌号 // var CNTRTOTAL = form2.findField('CNTRTOTAL').getValue(); // sql = sql + getAndConSql(sql, CNTRTOTAL, "CNTRTOTAL like '%" + CNTRTOTAL + "%'"); // //装货港 // var PORTLOAD = form2.findField('PORTLOAD').getValue(); // sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD like '%" + PORTLOAD + "%'"); // //卸货港 // var PORTDISCHARGE = form2.findField('PORTDISCHARGE').getValue(); // sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE like '%" + PORTDISCHARGE + "%'"); // //船名 // var VESSEL = form2.findField('VESSEL').getValue(); // sql = sql + getAndConSql(sql, VESSEL, "VESSEL like '%" + VESSEL + "%'"); // //航次 // var VOYNO = form2.findField('VOYNO').getValue(); // sql = sql + getAndConSql(sql, VOYNO, "VOYNO like '%" + VOYNO + "%'"); // //船公司 // var CARRIER = form2.findField('CARRIER').getValue(); // sql = sql + getAndConSql(sql, CARRIER, "CARRIER='" + CARRIER + "'"); // //备注 // var REMARK = form2.findField('REMARK').getValue(); // sql = sql + getAndConSql(sql, REMARK, "REMARK like '%" + REMARK + "%'"); //#endregion formSearch2 return sql; }, setIsShowAdvancedQuery: function () { if (this.isShowAdvancedQuery == 0) { this.panelSearch.show(); this.isShowAdvancedQuery = 1; } else { this.panelSearch.hide(); this.isShowAdvancedQuery = 0; } }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.IsAudit; return ret; } });