Ext.namespace('Shipping'); Shipping.MsOpPriceYardEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpPriceYardEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpPriceYardEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, editFactryRecord: null, FactryStatus: 'add', initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.GID = ""; //#region 编辑form //枚举参照相关(编辑form) this.formname = 'MsOpPriceYardEdit'; this.thispricetype = PRICETYPE; this.storeListGood = Ext.create('Ext.data.Store', { model: 'MsCodeMSDS', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeMSDS/GetDataListRm', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //this.storeListGood.load({ params: { start: 0, limit: 20000, condition: ""} }); this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListGood, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'GOODNAME', valueField: 'CHEMICALCGOODSNAME', displayField: 'GOODNAMEANDCNAME', }); this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.FeeTypeRefModel', proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' } }); this.storeFeeNameRef.load({ params: { condition: ""} }); this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeNameRef, forceSelection: true, name: 'FEENAME', valueField: 'Name', displayField: 'CodeAndName' }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: ""} }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr, forceSelection: true, name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.storeFeeUnit = Ext.create('DsExt.ux.RefTableStore', { fields: ['UNIT'], proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' } }); this.storeFeeUnit.load({ params: { condition: ""} }); this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeFeeUnit, forceSelection: true, name: 'UNIT', valueField: 'UNIT', displayField: 'UNIT' }); this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeCustomerNameRef.load({ params: { condition: ""} }); this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCustomerNameRef, forceSelection: true, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreCTNSTATUS = Ext.create('DsExt.ux.RefEnumStore', {}); this.StoreCTNSTATUS.load({ params: { enumTypeId: 97029} }); this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCTNSTATUS, forceSelection: true, name: 'CTNSTATUS', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.StoreDATETYPE = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreDATETYPE.add({ "ID": "清洗日", "NAME": "清洗日" }); this.StoreDATETYPE.add({ "ID": "进场日", "NAME": "进场日" }); this.comboxDATETYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreDATETYPE, forceSelection: true, name: 'DATETYPE', valueField: 'ID', displayField: 'NAME' }); this.storePRICECLASS = Ext.create('DsExt.ux.RefEnumStore', {}); this.storePRICECLASS.load({ params: { enumTypeId: 97061 } }); this.comboxPRICECLASS = Ext.create('DsExt.ux.RefTableCombox', { store: this.storePRICECLASS, name: 'PRICECLASS', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.initgirdbillcolums= [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ITEMSNO', header: '序号', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, renderer: Ext.util.Format.numberRenderer('00'), align: 'right', width: 60 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', editor: this.comboxFeeNameRef, width: 140 }, { sortable: true, dataIndex: 'GOODSNAME', header: '品名', editor: this.comboxGoods, width: 140 }, { sortable: true, dataIndex: 'CTNSTATUS', header: '箱状态', editor: this.comboxCTNSTATUS, width: 80 }, { sortable: true, dataIndex: 'FREEDAY', header: '免堆天数', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, renderer: Ext.util.Format.numberRenderer('00'), align: 'right', width: 60 }, { sortable: true, dataIndex: 'UNIT', header: '标准', editor: this.comboxFeeUnit, width: 100 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', editor: this.comboxCurr, width: 60 }, { sortable: true, dataIndex: 'UNITPRICE', header: '单价', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, align: 'right', width: 100 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '收款方', editor: this.comboxCustomerNameRef, width: 110 }, { sortable: true, dataIndex: 'REMARKS', header: '备注', editor: { xtype: 'textfield', selectOnFocus: true, enableKeyEvents: true }, width: 250 }, { sortable: true, dataIndex: 'DATETYPE', header: '起算日', editor: this.comboxDATETYPE, width: 100 }, { sortable: true, dataIndex: 'BEGINDATE', header: '开始日期', //'VGM称重日期', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'PRICECLASS', header: '类别归属', editor: this.comboxPRICECLASS, width: 100 }, { sortable: true, dataIndex: 'FEESTATUS_REF', header: '费用状态', width: 60 }, { sortable: true, dataIndex: 'ISSTOP', header:'是否停用', //'是否海运', width: 60, renderer: function (value, cellmeta) { if (value == '1' || value == true || value == 'true') { return "是"; } else { return "否"; } } }, { sortable: true, dataIndex: 'ENDDATE', header: '失效日期', //'VGM称重日期', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'INPUTBYREF', header: '录入人', width: 60 }, { sortable: true, dataIndex: 'INPUTTIME', header: '录入日期', width: 80 }, { sortable: true, dataIndex: 'AUDITNAME', header: '审核人', width: 60 }, { sortable: true, dataIndex: 'AUDITDATE', header: '审核日期', width: 80 }]; this.girdbillcolums = this.initgirdbillcolums; this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.Lane', proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } }); this.storeLANE.load(); this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '航线', store: this.storeLANE, name: 'LINE', valueField: 'LANE', displayField: 'LANE' }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load(); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '港口', store: this.storeCodeDisport, name: 'PORTDISCHARGE', valueField: 'PORT', displayField: 'PORT' }); //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeYARD.load({ params: { condition: "ISYARD='1'"} }); //场站 this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '场站', store: this.storeYARD, forceSelection: true, name: 'YARD', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeCountry = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeCountry', proxy: { url: '/MvcShipping/MsCodeCountry/GetDataList' } }); this.storeCountry.load({ params: { start: 0, limit:1000,condition: ""} }); this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '国家', store: this.storeCountry, name: 'COUNTRY', valueField: 'COUNTRY', displayField: 'COUNTRY' }); this.storeGOODTYPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeGOODTYPE.load({ params: { enumTypeId: 97028} }); this.comboxGOODTYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeGOODTYPE, fieldLabel: '货物类别', name: 'GOODTYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.StoreFEETYPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.StoreFEETYPE.load({ params: { enumTypeId: 97055 } }); this.comboxFEETYPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFEETYPE, fieldLabel: '货物类别', name: 'FEETYPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); //this.StoreFEETYPE = Ext.create('Ext.data.Store', { // fields: ['FEETYPE'] //}); //this.StoreFEETYPE.add({ "FEETYPE": "维修" }); //this.StoreFEETYPE.add({ "FEETYPE": "清洗" }); //this.StoreFEETYPE.add({ "FEETYPE": "堆存" }); //this.StoreFEETYPE.add({ "FEETYPE": "年检" }); //_this = this; //this.comboxFEETYPE = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '费用类别', // store: this.StoreFEETYPE, // forceSelection: true, // name: 'FEETYPE', // valueField: 'FEETYPE', // displayField: 'FEETYPE', // listeners: { // scope: this, // 'select': function (combo, records, eOpts) { // if (records.length > 0) { // _this.InitGrid(this.bodycolumn, combo.value); // } // } // } //}); //表参照相关(编辑form) //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'COMPANYID', name: 'COMPANYID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'OP', name: 'OP', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'PRICETYPE', name: 'PRICETYPE', flex: 0, hidden: true, margins: '0' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCountry, this.comboxPORTDISCHARGE, this.comboxYARD, this.comboxFEETYPE ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '录入人', readOnly: true, disabled: true, name: 'INPUTBYREF' }, { fieldLabel: '录入日期', readOnly: true, disabled: true, name: 'INPUTTIME' }, this.comboxOP, { fieldLabel: '有效日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'VALIDETD' }, { fieldLabel: '备注', flex: 1, name: 'REMARKS' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion _this = this; //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ id: 'btnEPrev', text: "上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: "下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this }, { text: "保存", iconCls: "btnsave", id: 'btnsave', handler: function (button, event) { this.Save('0'); }, scope: this }, { text: "保存并关闭", id: 'btnsaveandclose', handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: "保存并新建", id: 'btnsaveandnew', handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { text: "复制并新建", id: 'btncopyandsave', handler: function (button, event) { var basicForm = this.formEdit.getForm(); this.opStatus = 'add'; basicForm.findField('GID').setDisabled(false); var field = basicForm.findField('GID'); var BSNO = NewGuid(); field.setValue(BSNO); basicForm.findField('GID').setDisabled(true); var field = basicForm.findField('INPUTBYREF'); field.setValue(''); var field = basicForm.findField('INPUTTIME'); field.setValue(''); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", '*'); memberbody.set("GID", NewGuid()); memberbody.set("FEESTATUS", 1); memberbody.set("AUDITOPERATOR", ''); memberbody.set("AUDITDATE", ''); memberbody.set("AUDITNAME", ''); memberbody.set("FEESTATUS_REF", '录入状态'); }; }, scope: this } ] }); //end 按钮Toolbar //#endregion this.StoreISSTOP = Ext.create('Ext.data.Store', { fields: ['ID', 'NAME'] }); this.StoreISSTOP.add({ "ID": "1", "NAME": "是" }); this.StoreISSTOP.add({ "ID": "0", "NAME": "否" }); this.StoreISSTOP.add({ "ID": "", "NAME": "全部" }); this.comboxISSTOP = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreISSTOP, forceSelection: true, fieldLabel: '是否停用', labelWidth: 60, name: 'ISSTOP', valueField: 'ID', displayField: 'NAME', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.storeBodyList.load(); } }, 'select': function (combo, records, eOpts) { _this.storeBodyList.load(); } } }); //#region 费用信息 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpPriceItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpPrice/GetPriceItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListBody = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selModel: this.GridCheckBoxModel, viewConfig: { autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { var feeStatus = record.get('FEESTATUS'); return Shipping.FeeGetRowClass(feeStatus); } }, selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.addDetail(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDeletePriceItemsClick(); }, scope: this }, '-', { text: '停用明细', tooltip: '停用明细', handler: function (button, event) { this.onStopPriceItemsClick(); }, scope: this }, '-', { text: '提交审核', tooltip: '提交审核', id: "btnSubmitAudit", iconCls: "btnSubmitAudit", handler: function (button, event) { this.onSubmitAuditClick(); }, scope: this }, '-', { text: '引入费用', tooltip: '引入费用', menu: [ { text: "历史引入", handler: function (menu, event) { _this.onHistryAddDetailClick(menu, event); } } ] },{ text: '保存列表样式', menu: [ { text: '保存', handler: function (button, event) { _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.girdbillcolums, 1, true); } }, { text: '初始化', handler: function (menu, event) { _this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.initgirdbillcolums, 1, true); } }], scope: this }, { text: "导出Excel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportBillClick(button, event); }, scope: this }, this.comboxISSTOP], columns: this.girdbillcolums }); this.gridListCellEditing.on('beforeedit', function (editor, e) { return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.panelBody = new Ext.Panel({ title: '运价详细信息', layout: "border", region: 'center', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListBody] }); //#endregion //#region 明细表-单据图片档案管理 _this = this; this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: true, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.DocCM = Ext.create('Ext.selection.CheckboxModel'); this.gridDocList = new Ext.grid.GridPanel({ store: this.storeDocList, enableHdMenu: false, region: 'center', // width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: '删除', tooltip: '删除', iconCls: "btndeletedetail", id: 'btnEDelDoc', handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: '上传附件', tooltip: '上传附件', iconCls: "btnadddetail", id: 'btnEAddDoc', handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', 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: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { xtype: 'actioncolumn', width: 50, text: '图片预览', //操作 items: [{ icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config tooltip: '预览', handler: function (grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex); var filePath = rec.get('Driect_URL') + '?a=' + Math.random(); var imgView = new Shipping.FileView({ filePath: filePath }); imgView.show(); } }] }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERRef', header: '上传人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '上传时间', width: 135 } ] }); this.panelDoc = new Ext.Panel({ id: "panelDoc", layout: "border", region: "north", height: 150, flex: 1.5, title: '需求附件', //autoScroll: true, frame: false, split: true, items: [this.gridDocList] }); //#endregion this.MainTab = new Ext.tab.Panel({ layout: "border", region: "center", split: true, items: [ this.panelBody , this.panelDoc ] }); //#region 布局 //控件布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 140, items: [this.panelBtn, this.formEdit] }); Ext.apply(this, { items: [this.panelTop, this.MainTab] }); //#endregion //绑定查询窗体 this.storeBodyList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; var isstop = this.comboxISSTOP.getValue(); if (isstop == '1') acondition = acondition + " and ISSTOP='1'"; if (isstop == '0') acondition = acondition + " and isnull(ISSTOP,'')<>'1' "; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeDocList.on('beforeload', function (store) { var xcondition = " BSNO='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: xcondition }); }, this); this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 }, //end initUIComponents InitData: function () { this.opStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; this.opentype = ret[3]; } if (this.opStatus == 'edit') { if (this.opentype == "Items") { this.GID = this.editRecord.get('LINKGID'); } else this.GID = this.editRecord.get('GID'); condition = " GID='" + this.GID + "'"; } this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsOpPrice/GetData', params: { handle: opstatus, condition: condition }, 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 data = result.data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); this.formEdit.getForm().findField('PRICETYPE').setValue(PRICETYPE); var acondition = ""; if (this.opStatus == 'edit') acondition = " LINKGID='" + this.GID + "'"; else acondition = " LINKGID='11111'"; this.storeBodyList.load({ params: { condition: acondition } }); var xcondition = " BSNO='" + this.GID + "'"; _this.Loading = true; _this.storeDocList.load({ params: { condition: xcondition }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); this.GetEditStatus(); //this.InitGrid(this.bodycolumn, data.FEETYPE); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('GID').setDisabled(true); if (this.opStatus == 'add') { data.GID = NewGuid(); } var j = 0; var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); var BEGINDATE = member.data.BEGINDATE; if (BEGINDATE != '') BEGINDATE = Ext.util.Format.date(BEGINDATE, 'Y-m-d'); member.data.BEGINDATE = BEGINDATE; bodydatas.push(member); j = j + 1; } if (j == 0) { Ext.Msg.show({ title: '提示', msg: '费用信息不能为空,请先录入费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpPrice/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), body: jsonBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsOpPrice', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; } else if (type == '1') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; window.close(); } else { this.GID = this.editRecord.get('GID'); this.LoadData('add', ''); basicForm.findField('GID').setDisabled(false); } } 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 }); } } }); }, //end save addDetail: function () { // if (this.opStatus == "add") { // Ext.Msg.show({ title: '提示', msg: '商品信息未保存,无法添加工厂信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var MSDSID = this.formEdit.getForm().findField('GID').getValue(); var SerialNo = this.GetHandleSerialNo(this.storeBodyList); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsOpPriceItems', { GID: NewGuid(), LINKGID: '*', ITEMSNO: SerialNo, FEENAME: '', UNIT: '', UNITPRICE: 0, CURRENCY: '', CHANGERATE: 0, FEESTATUS: 1, FEESTATUS_REF: '录入状态', FREEDAY: 0, GOODSNAME: '', CTNSTATUS: '', CUSTOMERNAME: '', VALIDETD: '', REMARKS: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, InitGrid: function (grid, feetype) { if (feetype == '' || feetype == NaN) return; _thisfee = this; var agirdcolums = grid; for (var j = 0; j < agirdcolums.length; j++) { if (feetype == '维修') { if (agirdcolums[j].dataIndex == 'GOODSNAME') agirdcolums[j].hidden = true; if (agirdcolums[j].dataIndex == 'CTNSTATUS') agirdcolums[j].hidden = true; if (agirdcolums[j].dataIndex == 'FREEDAY') agirdcolums[j].hidden = true; } else if (feetype == '清洗') { if (agirdcolums[j].dataIndex == 'GOODSNAME') agirdcolums[j].hidden = false; if (agirdcolums[j].dataIndex == 'CTNSTATUS') agirdcolums[j].hidden = true; if (agirdcolums[j].dataIndex == 'FREEDAY') agirdcolums[j].hidden = true; } else if (feetype == '堆存') { if (agirdcolums[j].dataIndex == 'GOODSNAME') agirdcolums[j].hidden = true; if (agirdcolums[j].dataIndex == 'CTNSTATUS') agirdcolums[j].hidden = false; if (agirdcolums[j].dataIndex == 'FREEDAY') agirdcolums[j].hidden = false; } } _this.gridListBody.reconfigure(_this.storeBodyList, agirdcolums); }, GetHandleSerialNo: function (store) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (parseInt(member.data.ITEMSNO) > parseInt(result)) { result = member.data.ITEMSNO; } } } result = parseInt(result) + 1; return result; }, // gridListAfterEdit: function (editor, e, eOpts) { // if (e.value == e.originalValue) return; // if (e.field == 'GOODNAME') { // var selectrecords = DsStoreQueryBy(this.storeListGood, 'GID', e.value); // if (selectrecords.getCount() > 0) { // var selectdata = selectrecords.getAt(0).data; // e.record.set('GOODNAME', selectdata.GOODNAME); // } else { // e.record.set('GOODNAME', ''); // } // } // }, onHistryAddDetailClick: function (menu, event, type) { DsOpenEditWin("/MvcContainer/MsOpPrice/HistryFeeYardIndex", "历史引入费用"); }, onDeletePriceItemsClick: function () { var selections = this.gridListBody.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.LINKGID=="*"||rec.data.LINKGID==""){ this.storeBodyList.remove(selections[i]); } else { if (rec.data.FEESTATUS != 1 && rec.data.FEESTATUS != 6) { Ext.Msg.show({ title: '提示', msg: '当前状态不允许删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } else { if (rec.data.FEESTATUS == 1 || rec.data.FEESTATUS == 6) bodyAddDatas.push(rec); } } } if (bodyAddDatas.length==0) return; var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpPrice/DeletePriceItems', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeBodyList.load({ params: { condition: acondition} }); 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); }, onStopPriceItemsClick: function () { var selections = this.gridListBody.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要停用的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.LINKGID == "*" || rec.data.LINKGID == "") { } else { bodyAddDatas.push(rec); } } if (bodyAddDatas.length == 0) return; var record = selections[0]; Ext.MessageBox.confirm('提示', '确定停用选中记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpPrice/StopPriceItems', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeBodyList.load({ params: { condition: acondition } }); 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); }, onExportBillClick: function () { _this = this; if (this.storeBodyList.getCount() == 0) { return; } var sortstr = ''; var sql = ''; var billno = this.editRecord.get('GID'); sql = " LINKGID='" + billno + "'" Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcContainer/MsOpPrice/GetPriceItemsListStr', 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, "@@@") sql1 = sql1.replace(/\>/g, "&&&") sql1 = sql1.replace(/\ 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeDocList.remove(selectedRecords[i]); } else { var feeGId = "'" + rec.data.GID + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } _this = this; Ext.Msg.wait('正在删除数据...'); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpReceipt/DeleteUploadFile', params: { data: feeGidSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeDocList.remove(selectedRecords[i]); } 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 } else { Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); } , onUpLoadFileClick: function (button, event) { var billno = this.formEdit.getForm().findField('GID').getValue(); me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, bodyStyle: 'padding:5px 5px 0', autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); // if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) { // Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpReceipt/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { CUSTNO: billno, BSNO: billno }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var condition = billno; var condition2 = " BSNO='" + condition + "' "; me.Loading = true; me.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { me.Loading = false; } }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); } , //#endregion //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; var op = this.formEdit.getForm().findField('OP').getValue(); var modustr = ""; if (PRICETYPE == "1") { modustr = "modPriceSeae"; } else if (PRICETYPE == "2") { modustr = "modPriceSeai"; } else if (PRICETYPE == "3") { modustr = "modPriceAgent"; } else if (PRICETYPE == "4") { modustr = "modPriceYard"; } this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); _this = this; this.StoreOpRange.load({ params: { optype: modustr }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { canedit = false; } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnsave'); var btnESaveAndClose = Ext.getCmp('btnsaveandclose'); var btnESaveAndNew = Ext.getCmp('btnsaveandnew'); var btnECopyAndNew = Ext.getCmp('btncopyandsave'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btnECopyAndNew.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); btnECopyAndNew.disable(); } }, //#endregion PrevRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (j == this.StoreList.count) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opentype == "Items") { this.GID = this.editRecord.get('LINKGID'); } else this.GID = this.editRecord.get('GID'); if (this.opStatus == 'edit') { condition = "GID='" + this.GID + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, NextRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == (this.StoreList.data.length - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opentype == "Items") { this.GID = this.editRecord.get('LINKGID'); } else this.GID = this.editRecord.get('GID'); if (this.opStatus == 'edit') { condition = "GID='" + this.GID + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, getIsModify: function () { var drmodify = this.storeBodyList.getModifiedRecords(); if (drmodify.length != 0) return '运价详细信息'; if (panelEdit.formEdit.getForm().isDirty() == true) return '运价信息'; else return ''; } // });