Ext.namespace('Shipping'); Shipping.RepairAddEdit= function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.RepairAddEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.RepairAddEdit, Ext.Window, { StoreList: null, ParentPanel: null, //Tab页编辑模式 OpStatus: 'add', StoreBill: null, StoreCustType: null, stroplb:'', EditRecord: null, // region: 'center', initUIComponents: function () { _thisAddRepaire = this; //#region 申请修改和删除界面 this.storeITEMS = Ext.create('DsExt.ux.RefTableStore', { fields: [{ name: 'FEENAME', type: 'string' } ], proxy: { url: '/MvcContainer/MsOpPrice/GetWXFEELIST' } }); this.storeITEMS.load({ params: { condition: "" } }); this.comboxITEMS = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeITEMS, fieldLabel: '维修项目', forceSelection: true, name: 'ITEMNAME', valueField: 'FEENAME', displayField: 'FEENAME' }); //客户加载_场站 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', { store: this.storeYARD, fieldLabel: '场站', forceSelection: true, name: 'CURSTATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); 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, fieldLabel: '费用名称', 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, fieldLabel: '币别', name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.DataLoading = false; this.NewFeeEdit = Ext.widget('form', { frame: true, region: 'center', trackResetOnLoad: true, // title: Zi.LAN.FEE.NewFeeEdit, //'费用新值', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 80, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxITEMS, { fieldLabel: '维修改装日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'REPAIRTIME' }, this.comboxYARD] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxFeeNameRef, this.comboxCurr,{ fieldLabel:'金额', //'不含税单价', xtype: 'numberfield', value: 0, name: 'AMOUNT' } ] },{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '备注', //'备注', name: 'Remark' }] } ]//end items(fieldset 1) }//end fieldset 1 ], buttons: [{ text: '确定添加', id: 'btnEnter', handler: function (button, event) { _thisAddRepaire.execSql(); }, scope: this }, { text:'取消', handler: function (button, event) { var win = this.up("window"); win.close(); } }]//end root items }); //#endregion //#region 布局 Ext.apply(this, { height: 250, closable: true, draggable: true, title: '新增维修改装', defaultButton: 'btnEnter', resizable: false, items: [this.NewFeeEdit], layout: "border", width: 800, xtype: "window", id: "DsAddRepairWin" }); //#endregion }, execSql: function () { var form = _thisAddRepaire.NewFeeEdit.getForm(); var FeeName = form.findField('ITEMNAME').getValue(); if (FeeName == '' || FeeName == null || FeeName == undefined) { Ext.Msg.show({ title:'提示', msg:'项目名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!' return; }; var CustomerName = form.findField('CURSTATOIN').getValue(); if (CustomerName == '' || CustomerName == null || CustomerName == undefined) { Ext.Msg.show({ title:'提示', msg:'场站不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var FeeName = form.findField('FEENAME').getValue(); if (FeeName == '' || FeeName == null || FeeName == undefined) { Ext.Msg.show({ title: '提示', msg: '费用名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!' return; }; var Currency = form.findField('CURRENCY').getValue(); if (Currency == '' || Currency == null || Currency == undefined) { Ext.Msg.show({ title:'提示', msg:'币别不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var Amount = form.findField('AMOUNT').getValue();; if (Amount == 0) { Ext.Msg.show({ title: '提示', msg:'金额不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var bodyAddDatas = []; for (i = 0; i < this.StoreList.getCount(); i += 1) { var memberyf = this.StoreList.getAt(i); bodyAddDatas.push(memberyf); } var data = this.NewFeeEdit.getForm().getValues(); var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Ajax.request({ waitMsg:'正在操作数据...', url: '/MvcContainer/MsOpCtnBsCard/SavePLRepair', params: { bslist: jsonbodyAddDatas, body: 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 }); var win = Ext.getCmp("DsAddRepairWin"); win.close(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } });