Ext.namespace('Shipping'); Shipping.MsInfoClientContractDsEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsInfoClientContractDsEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsInfoClientContractDsEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, EditRecord: null, MainEditRecord: null, strBSNO: '', //需求编号:SR2017061200005-1 initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; //#region 编辑form //枚举参照相关(编辑form) //表参照相关(编辑form) //所属部门 this.storeDept = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.DeptModel', proxy: { url: '/CommMng/BasicDataRef/GetDeptList' } }); this.storeDept.load(); this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.DEPTGID, //'签订部门', store: this.storeDept, forceSelection: true, flex: 0.5, name: 'DEPTGID', valueField: 'GID', displayField: 'DeptName' //,hidden: true }); //客户加载_场站 this.storeCustName = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); this.storeCustName.load(); // this.comboxCustName = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel:'客户名称', //'场站', store: this.storeCustName, forceSelection: true, queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', name: 'LINKID', valueField: 'GId', displayField: 'CodeAndFull' }); this.storeContractRangeList = Ext.create('Ext.data.Store', { model: 'MsInfoClientContractRange', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsInfoClient/GetContractRangeList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //箱型_集装箱列表中的下拉框加载 this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); this.storeOpCode2.load(); this.comboxUser = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeOpCode2, forceSelection: true, name: 'USERID', valueField: 'GID', displayField: 'CodeAndName' }); this.gridListRangeCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListRange = new Ext.grid.GridPanel({ store: this.storeContractRangeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListRangeCellEditing], 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.deleteDetail(); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { dataIndex: 'USERID', header: '人员', //'箱型', width: 120, editor: this.comboxUser, renderer: function (value, p, record) { return record.data.SHOWNAME; }, } ] }); this.storeContractRangeList.on('beforeload', function (store) { var billNo = this.editRecord.get('GID'); var condition = "LINKID='" + billNo + "'"; Ext.apply(store.proxy.extraParams, { condition: condition }); }, this); this.panelBodyRange = new Ext.Panel({ title: '合同查看人员', //'集装箱信息', layout: "border", region: 'east', width: 250, margin: '5 20', frame: true, items: [this.gridListRange] }); this.gridListRange.on('edit', function (editor, e, eOpts) { this.gridRangeAfterEdit(editor, e, eOpts); }, this); //编辑form this.formEdit = Ext.widget('form', { region: 'north', frame: true, bodyPadding: 5, autoScroll: true, 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: [{ fieldLabel: Zi.LAN.GID, //'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: Zi.LAN.CREATEUSER, //'CREATEUSER', name: 'CREATEUSER', flex: 0, hidden: true, margins: '0' }, { fieldLabel:'CUSTNAME', //'CREATEUSER', name: 'CUSTNAME', flex: 0, hidden: true, margins: '0' },this.comboxCustName,{ fieldLabel: Zi.LAN.CONTRACTNO, //'合同号', name: 'CONTRACTNO' }, { fieldLabel: Zi.LAN.CONTRACTNAME, //'合同号', name: 'CONTRACTNAME' }, { fieldLabel: Zi.LAN.CHIEF, //'负责人', flex: 0.5, name: 'CHIEF' }, this.comboxDept ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.SIGNINGDATE, //'签订日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'SIGNINGDATE' }, { fieldLabel: Zi.LAN.STARTDATE, //'生效日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'STARTDATE' }, { fieldLabel: Zi.LAN.CANCELDATE, //'结束日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CANCELDATE' }, { fieldLabel: Zi.LAN.CREATEUSERREF, //'录入人', flex: 0.5, name: 'CREATEUSERREF' }, { fieldLabel: Zi.LAN.CREATETIME, //'录入日期', flex: 0.5, name: 'CREATETIME' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, fieldLabel: Zi.LAN.REMARK, //'备 注', height: 60, flex: 3, name: 'REMARK', anchor: '100%' }] } ]//end items(fieldset 1) }//end fieldset 1 ] }); //end this.formEdit //#endregion //#region 账期 子表 //#region 定义数据集 往来单位账期 this.storeBodyList_ACCDATE = Ext.create('Ext.data.Store', { model: 'Info_Client_ACCDATEmb', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsInfoClient/GetACCDATEList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeOPLBNAME = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeOPLBNAME.load({ params: { enumTypeId: 96005 } }); this.comboxOPLBNAME = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '税率', store: this.storeOPLBNAME, name: 'OPLBNAME', valueField: 'EnumValueName', displayField: 'EnumValueName' //,id: "OPLBNAME" }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load(); //揽货人 this.comboxSALE2 = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.SALE, //'揽货人', store: this.storeOpCode, //forceSelection: true, name: 'SALE', valueField: 'UserName', displayField: 'CodeAndName', value: SHOWNAME }); this.storeStlName = Ext.create('Ext.data.Store', { fields: ['FRT'] }); this.storeStlName.add({ "FRT": "月结" }); this.storeStlName.add({ "FRT": "半月结" }); this.storeStlName.add({ "FRT": "约定天数" }); this.storeStlName.add({ "FRT": "季结" }); this.storeStlName.add({ "FRT": "旬结" }); this.comboxStlName2 = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.STLNAME, //'结费方式', store: this.storeStlName, forceSelection: true, name: 'ACCTYPE', valueField: 'FRT', displayField: 'FRT', listeners: { scope: this, change: function (field, newValue, oldValue, eOpts) { } } }); //#endregion //#region 列定义 this.girdcolums_ACCDATE = [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKGID', header: 'LINKGID', width: 80 }, { sortable: true, dataIndex: 'OPLBNAME', header: Zi.LAN.OPLBNAME, //'业务类型', width: 80, editor: this.comboxOPLBNAME }, { sortable: true, dataIndex: 'SALE', header: Zi.LAN.SALE, //'销售员', width: 80, editor: this.comboxSALE2 }, { sortable: true, dataIndex: 'BGNDATE', header: Zi.LAN.BGNDATE, //'合同生效日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: { xtype: 'datefield', selectOnFocus: true } }, { sortable: true, dataIndex: 'ENDDATE', header: Zi.LAN.ENDDATE, //'合同失效日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: { xtype: 'datefield', selectOnFocus: true } }, { sortable: true, dataIndex: 'ACCTYPE', header: Zi.LAN.ACCTYPE, //'账期类型', width: 80, editor: this.comboxStlName2 }, { sortable: true, dataIndex: 'ACCSTARTDATE', tooltip: Zi.LAN.ACCSTARTDATE2, //'从哪天开始计算。通常使用默认的“ETD”', header: Zi.LAN.ACCSTARTDATE, //'账期起算日', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { sortable: true, hidden: true, dataIndex: 'ACCMONTH', header: Zi.LAN.ACCMONTH, //'间隔月', width: 80 }, { sortable: true, hidden: true, dataIndex: 'ACCDAYS', header: Zi.LAN.ACCDAYS, //'间隔日', width: 80 }, { sortable: true, dataIndex: 'ALLOWAMOUNT', header: Zi.LAN.ALLOWAMOUNT, //'信用额度', width: 80, editor: { xtype: 'numberfield', selectOnFocus: true } }, { sortable: true, dataIndex: 'MODIFIEDUSER', header: Zi.LAN.MODIFIEDUSER, //'修改人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: Zi.LAN.MODIFIEDTIME, //'修改日期', width: 80 }, { sortable: true, dataIndex: 'REMARK', header: Zi.LAN.REMARK, //'备注', width: 300, editor: { xtype: 'textfield', selectOnFocus: true } }]; //#endregion //#region gridList列表显示信息 this.gridListCellEditing_ACCDATE = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 //1单击,2双击 }); this.gridList_ACCDATE = new Ext.grid.GridPanel({ region: 'center', store: this.storeBodyList_ACCDATE, enableHdMenu: false, //是否显示表格列的菜单 hideHeaders: false, //是否隐藏表头 rowLines: true, columnLines: true, tbar: [{ text: '', tooltip: Zi.LAN.onAddACCDATE, //'添加账期', iconCls: "btnadd", handler: function (button, event) { this.onAddACCDATE(button, event); }, scope: this }, { text: '', tooltip: Zi.LAN.onDelACCDATE, //'删除账期', iconCls: "btndelete", handler: function (button, event) { this.onDelACCDATE(button, event); }, scope: this }, '-', { text: Zi.LAN.onSetACCDATE, //'更改相关业务结算日期', tooltip: Zi.LAN.onSetACCDATE2, //'将符合条件的业务的结算日期按选定的账期重新设定。', iconCls: "btnup", handler: function (button, event) { this.onSetACCDATE(button, event); }, scope: this } ], loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..." plugins: [this.gridListCellEditing_ACCDATE], selType: 'cellmodel', columns: this.girdcolums_ACCDATE }); //#endregion //#region 编辑日期 this.formACCDATE = Ext.widget('form', { region: 'center', frame: true, height: 40, bodyPadding: 5, layout: 'anchor', trackResetOnLoad: true, fieldDefaults: { margins: '1 1 1 1', labelAlign: 'right', flex: 1, labelWidth: 100, msgTarget: 'qtip' }, items: [{ xtype: 'container', id: "ACCEditForm",//hidden:true, layout: 'hbox', defaultType: 'numberfield', items: [{ fieldLabel: Zi.LAN.ACCMONTH2, //'账期月份', id: "ACCMONTH", hidden: true, tooltip: Zi.LAN.SetACCDATE, //'每月一结选1,每两月一结选2,以此类推', flex: 1, name: 'ACCMONTH', listeners: { change: function (field, eOpts) { this.SetACCDATE(); }, scope: this } }, { fieldLabel: Zi.LAN.STLDATE, //'结费日期', id: "ACCDAYS", hidden: true, flex: 1, name: 'ACCDAYS', listeners: { change: function (field, eOpts) { this.SetACCDATE(); }, scope: this } }, { xtype: 'hiddenfield', id: "ACChidden", flex: 2 }] } ] }); //end this.formEdit //#endregion //#region 选择load this.gridList_ACCDATE.getSelectionModel().on('select', function (model, record, index) { var ACCTYPE = record.data.ACCTYPE; var ACCMONTH = record.data.ACCMONTH; var ACCDAYS = record.data.ACCDAYS; this.SetShowACCEdit(ACCTYPE, ACCMONTH, ACCDAYS); }, this); //#endregion //#endregion this.panelACCDATE = new Ext.Panel({ layout: "border", region: "center", //split: true, items: [this.gridList_ACCDATE] }); this.panelACCDATE_form = new Ext.Panel({ layout: "border", region: "north", height: 40, //split: true, items: [this.formACCDATE] }); this.panel_ACCDATEEdit = new Ext.Panel({ layout: "border", region: "center", split: true, items: [this.panelACCDATE_form, this.panelACCDATE] }); this.panelACCDATE = new Ext.Panel({ title: Zi.LAN.ZhangQiXinXi, //'账期信息', layout: "border", region: 'north', animate: true, height:200, //autoScroll: true, // containerScroll: true, frame: false, items: [this.panel_ACCDATEEdit, this.panelBodyRange] }); //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.btnESave, //"保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { text: Zi.LAN.btnESaveAndClose, //"保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: Zi.LAN.btnESaveAndNew, //"保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this } ] }); //end 按钮Toolbar //#endregion //#region 明细表-单据图片档案管理 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: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..." trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: Zi.LAN.btnDelete, //'删除', tooltip: Zi.LAN.btnDelete, //'删除', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: Zi.LAN.onUpLoadFileClick, //'上传附件', tooltip: Zi.LAN.onUpLoadFileClick, //'上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: Zi.LAN.GID, //'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'R_GID', header: Zi.LAN.R_GID, //'R_GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: Zi.LAN.BSNO, //'BSNO', width: 80 }, { sortable: true, dataIndex: 'URL', header: Zi.LAN.URL, //'文件名', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: Zi.LAN.Driect_URL, //'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: Zi.LAN.MODIFIEDUSER, //'MODIFIEDUSER', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERRef', header: Zi.LAN.MODIFIEDUSERRef, //'上传人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: Zi.LAN.MODIFIEDTIMERef, //'上传时间', width: 135 } ] }); // this.gridDocList.getSelectionModel().on('select', function (model, record, index) { // if (this.Loading == true) { // return; // } // var PICURL = record.data.Driect_URL; // if ((PICURL!=undefined)&&(PICURL!='')) // Ext.getCmp('panelPic').body.update(' '); // }, this); // this.panelPic = new Ext.Panel({ // id: "panelPic", // layout: "fit", // region: "center", // autoScroll: true, // frame: false, // html: ' '//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg // }); this.panelDoc = new Ext.Panel({ id: "panelDoc", layout: "border", region: "center", //autoScroll: true, frame: false, split: true, items: [this.gridDocList] }); //#endregion this.panelCenter = new Ext.Panel({ id: "panelCenter", layout: "border", region: "center", autoScroll: true, items: [this.formEdit,this.panelACCDATE,this.panelDoc] }); //#region 布局 //控件布局 Ext.apply(this, { items: [this.panelBtn, this.panelCenter] }); //#endregion //绑定查询窗体 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.MainEditRecord = ret[3]; } if (this.opStatus == 'edit') { condition = " GID='" + this.editRecord.get('GID') + "'"; this.strBSNO = this.editRecord.get('GID'); this.storeDocList.load({ params: { condition: "BSNO='" + this.editRecord.get('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: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...', url: '/MvcShipping/MsInfoClient/GetContractData', 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: Zi.LAN.TiShi, 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.strBSNO = data.GID; this.storeBodyList_ACCDATE.load({ params: { condition: "LINKGID='" + data.LINKID + "'", isedit: "1" } }); this.storeContractRangeList.load({ params: { condition: "LINKID='" + data.GID + "'" } }); //if (this.opStatus == 'add') { // this.formEdit.getForm().findField('LINKID').setValue(this.MainEditRecord.GID); //} } else { Ext.MessageBox.alert(Zi.LAN.FuWuQiXiangYingChuCuo, 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 bodydatas2 = []; for (var i = 0; i < this.storeBodyList_ACCDATE.getCount() ; i += 1) { var member = this.storeBodyList_ACCDATE.getAt(i); bodydatas2.push(member); } var ACCDATEbody = ConvertRecordsToJson(bodydatas2); var bodydatas3 = []; for (var i = 0; i < this.storeContractRangeList.getCount(); i += 1) { var member = this.storeContractRangeList.getAt(i); bodydatas3.push(member); } var rangebody = ConvertRecordsToJson(bodydatas3); Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在保存数据...', url: '/MvcShipping/MsInfoClient/SaveContractAll', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), body: ACCDATEbody, rangebody: rangebody }, 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); this.strBSNO = returnData.GID; this.storeBodyList_ACCDATE.load({ params: { condition: "CONTRACTGID='" + returnData.GID + "'", isedit: "1" } }); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsInfoClientContractModel', 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(); } this.opStatus = 'edit'; if (type == '0') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); } else if (type == '1') { window.close(); } else { this.LoadData('add', ''); basicForm.findField('GID').setDisabled(false); } this.storeContractRangeList.load({ params: { condition: "LINKID='" + returnData.GID + "'" } }); } else { Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //#region 账期明细 onAddACCDATE: function (button, event) { var LINKGID = this.formEdit.getForm().findField('LINKID').getValue(); var CONTRACTGID = this.formEdit.getForm().findField('GID').getValue(); var BGNDATE = this.formEdit.getForm().findField('STARTDATE').getRawValue(); var ENDDATE = this.formEdit.getForm().findField('CANCELDATE').getRawValue(); var record = Ext.create('Info_Client_ACCDATEmb', { GID: NewGuid(), LINKGID: LINKGID, CONTRACTGID: '*', OPLBNAME: '', SALE: '', BGNDATE: BGNDATE, ENDDATE: ENDDATE, ACCTYPE: "月结", ACCSTARTDATE: "ETD", ACCMONTH: "1", ACCDAYS: "1", ALLOWAMOUNT: "0", MODIFIEDUSER: SHOWNAME, MODIFIEDUSER_REF: SHOWNAME, MODIFIEDTIME: '', REMARK: '' }); this.storeBodyList_ACCDATE.add(record); var n = this.storeBodyList_ACCDATE.getCount(); this.gridListCellEditing_ACCDATE.startEditByPosition({ row: n - 1, column: 2 }); }, onDelACCDATE: function (button, event) { var selectedRecords = this.gridList_ACCDATE.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.LINKGID == "" || rec.data.LINKGID == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList_ACCDATE.remove(selectedRecords[i]); this.SetShowACCEdit("隐藏"); } else { Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsInfoClient/DeleteACCDATE', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeBodyList_ACCDATE.remove(rec); this.SetShowACCEdit("隐藏"); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, onSetACCDATE: function (button, event) { var selectedRecords = this.gridList_ACCDATE.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.LINKGID == "" || rec.data.LINKGID == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeBodyList_ACCDATE.remove(selectedRecords[i]); this.SetShowACCEdit("隐藏"); } else { Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingYaoPiLiangSheDingJieSuanRiQiMa, function (btn) { if (btn == 'yes') { Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, url: '/MvcShipping/MsInfoClient/SetACCDATE', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //this.storeBodyList_ACCDATE.remove(rec); //this.SetShowACCEdit("隐藏"); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, SetShowACCEdit: function (ACCTYPE,_ACCMONTH,_ACCDAYS){ //根据ACCTYPE决定ACCEDIT的labelfield如何显示 var ACCMONTH=Ext.getCmp("ACCMONTH"); var ACCDAYS=Ext.getCmp("ACCDAYS"); var ACChidden=Ext.getCmp("ACChidden"); if (ACCTYPE=="月结"){ Ext.DomQuery.selectNode('label[id=ACCMONTH-labelEl]').innerHTML = Zi.LAN.ACCMONTH; //'间隔月份'; ACCMONTH.tooltip= Zi.LAN.ACCMONTH2; //'每月一结选1,每两月一结选2,以此类推'; ACCMONTH.setValue(_ACCMONTH); ACCMONTH.maxValue= 24; ACCMONTH.minValue= 1; ACCMONTH.show(); Ext.DomQuery.selectNode('label[id=ACCDAYS-labelEl]').innerHTML = Zi.LAN.ZhangQiRiQi; //'账期日期'; ACCDAYS.tooltip= Zi.LAN.ZhangQiRiQi2; //'该月几日为结算期限'; ACCDAYS.setValue(_ACCDAYS); ACCDAYS.maxValue= 31; ACCDAYS.minValue= 0; ACCDAYS.show(); //ACChidden.flex=2; } if (ACCTYPE=="半月结"){ Ext.DomQuery.selectNode('label[id=ACCMONTH-labelEl]').innerHTML = Zi.LAN.STLFIRSTHALFDATE; //'上半月'; ACCMONTH.tooltip= Zi.LAN.STLFIRSTHALFDATE2; //'上半月账期'; ACCMONTH.setValue(_ACCMONTH); ACCMONTH.maxValue= 15; ACCMONTH.minValue= 1; ACCMONTH.show(); Ext.DomQuery.selectNode('label[id=ACCDAYS-labelEl]').innerHTML = Zi.LAN.STLMIDDLEDATE; //'下半月'; ACCDAYS.tooltip= Zi.LAN.STLMIDDLEDATE2; //'下半月账期,如大于28日则都按照该月最后一天处理。'; ACCDAYS.setValue(_ACCDAYS); ACCDAYS.maxValue= 31; ACCDAYS.minValue= 16; ACCDAYS.show(); //ACChidden.flex=2; } if (ACCTYPE=="约定天数"){ Ext.DomQuery.selectNode('label[id=ACCMONTH-labelEl]').innerHTML = Zi.LAN.ACCMONTH; //'间隔月份'; ACCMONTH.tooltip= Zi.LAN.ACCMONTH2; //'每月一结选1,每两月一结选2,以此类推'; ACCMONTH.setValue("0"); ACCMONTH.hide(); Ext.DomQuery.selectNode('label[id=ACCDAYS-labelEl]').innerHTML = Zi.LAN.ZhangQiRiQi; //'账期日期'; ACCDAYS.tooltip= Zi.LAN.ZhangQiRiQi3; //'将结算日期设为开船日期后的多少天。'; ACCDAYS.setValue(_ACCDAYS); ACCDAYS.maxValue= 1000; ACCDAYS.minValue= 0; ACCDAYS.show(); //ACChidden.flex=4; } if (ACCTYPE=="隐藏"){ ACCMONTH.hide(); ACCDAYS.hide(); //ACChidden.flex=4; } }, SetACCDATE: function () { var ACCMONTH=Ext.getCmp("ACCMONTH"); var ACCDAYS=Ext.getCmp("ACCDAYS"); var selectedRecords = this.gridList_ACCDATE.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; rec.set('ACCMONTH',ACCMONTH.getValue()); rec.set('ACCDAYS',ACCDAYS.getValue()); } }, //#endregion gridRangeAfterEdit: function (editor, e, eOpts) { if (e.field == 'USERID') { var records = DsStoreQueryBy(this.storeOpCode2, 'GID', e.value); if (records.getCount() > 0) { var data = records.getAt(0).data; var CLIENTNAME = data.UserName; e.record.set('SHOWNAME', CLIENTNAME); } } }, addDetail: function () { var record = Ext.create('MsInfoClientContractRange', { GID: NewGuid(), LINKID: '*', USERID: '', SHOWNAME: '' }); this.storeContractRangeList.add(record); var n = this.storeContractRangeList.getCount(); this.gridListRangeCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, deleteDetail: function () { var selectedRecords = this.gridListRange.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.LINKID == "" || rec.data.LINKID == "*")//如果是新增但没有保存的数据,没有必要提交到后台 { this.storeContractRangeList.remove(selectedRecords[i]); } else { Ext.MessageBox.confirm('提示', '确实要删除该数据吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在操作数据'); Ext.Ajax.request({ waitMsg: '正在操作数据', //'正在删除数据...', url: '/MvcShipping/MsInfoClient/DeleteContractRange', params: { data: Ext.JSON.encode(rec.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeContractRangeList.remove(rec); 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 }); }, scope: this }); //end Ext.Ajax.request } }, this); } //this.storeBodyList.remove(selectedRecords[i]); } }, //#region 上传图片 onAddFileClick: function (button, event) { var myDate = new Date(); var record = Ext.create('ReceiptDocmb', { GID: NewGuid(), RECEIPTTYPE: '', R_GID: '', BSNO: '', //ContractNo URL: '', Driect_URL: '', MODIFIEDUSER: SHOWNAME, MODIFIEDTIME: myDate.format('yyyy-MM-dd hh:mm:ss') }); this.storeDocList.add(record); var n = this.storeDocList.getCount(); this.DocListCellEditing.startEditByPosition({ row: n - 1, column: 5 }); } , onPostFileClick: function (button, event) { if (USERID == "") { alert(Zi.LAN.QingChongXinDengLu); //"登录信息不全,请退出重新登录" return; } var billno = this.strBSNO; var bodyDatas = []; var i; var DocBody = ConvertRecordsToJsonAll(bodyDatas); _this = this; //var Docdatas = []; //var DocBody = ConvertRecordsToJson(Docdatas); //var DocBodyDel = ConvertRecordsToJsonAll(this.DocDel); var _this = this; Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在保存数据...', url: '/Import/ReceiptDoc/SaveDoc', scope: this, params: { BSNO: _this.strBSNO, DocBody: DocBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var condition = _this.strBSNO; var condition2 = " BSNO='" + condition + "' "; _this.Loading = true; _this.storeDocList.load({ params: { condition: condition2 }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this, callback: function () { _this.Loading = false; } }); } else { Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } //alert('03'); } }); } //end save , onDelFileClick: function (button, event) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.DocCM.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {//'确定要删除选中的附件吗?' if (btn == 'yes') { if (selectedRecords.length > 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(Zi.LAN.ZhengZaiCaoZuoShuJu); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在删除数据...', 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: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } else { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); } , onUpLoadFileClick: function (button, event) { var billno = this.strBSNO; me = this; if (this.opStatus == 'add') { alert('请先保存合同信息!'); //"登录信息不全,请退出重新登录" return; } 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: Zi.LAN.LoadFile, //'选择文件', fieldLabel: Zi.LAN.LoadFile, //'选择文件', buttonText: Zi.LAN.LoadFile, //'选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: Zi.LAN.submit, //'上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); // if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) { // Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: Zi.LAN.QingQueRenNiShangChuanDeWenJianWeiTuPianWenJian, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpReceipt/UploadFile', waitMsg: Zi.LAN.ZhengZaiShangChuan, //'正在上传', method: 'POST', submitEmptyText: false, async: false, params: { CUSTNO: billno, BSNO: me.strBSNO }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var condition = me.strBSNO; var condition2 = " BSNO='" + condition + "' "; me.Loading = true; me.storeDocList.load({ params: { condition: condition2 }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this, callback: function () { me.Loading = false; } }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert(Zi.LAN.JingGao, action.result.errors.msg); } }); } }, { text: Zi.LAN.btnClose, //'关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: Zi.LAN.ShangChuanWenJian, //"上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); } //#endregion });