Ext.namespace('Shipping'); Shipping.DJYORDER_ACCOUNTINFOEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.DJYORDER_ACCOUNTINFOEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.DJYORDER_ACCOUNTINFOEdit, Ext.Panel, { parentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, Editdata: null, MainEditRecord: null, stroplb: '大简云订舱_账号密码管理',///与视图 V_op_bs 的OPLBNAME相同 依赖于枚举类型96005 isfen: false, panelFee_Name: 'modDJYORDER_ACCOUNTINFO_AllFee',//对应sys_module.name panelAmend_Name: 'modDJYORDER_ACCOUNTINFO_AmendFee', initUIComponents: function () { this.serialNo = 0; //this.bodyDel = []; this.itemindex = 1; this.initloaddata = 0; this.accdatesameetd = 0; this.MsPeriod = null; this.SALEORDERDEPTBYOP = 0; this.formname = "DJYORDER_ACCOUNTINFOEdit"; this.carrier = getUrlParam('CARRIER'); this.carrierName = ""; _this = this; parentWin = window.parent.opener; mainWin = getMainForm(parentWin); opflex = 0.6;//上方几个用户下拉框 《操作》等的宽度 ViaWidth = 90;//中转港信息的的标签宽度 //#region 信息加载 this.storeDefValue = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpDef/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeMustBe = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsCodeOpMustField/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCodeOpService', proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' } }); //权限范围 this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); //this.StoreOpRange.load({ params: { optype: "modOrderManagement" } }); //#region 客户 往来单位 相关【委托单位 收货人 船公司 车队 场站】 //船公司 this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' } }); this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司',hidden:true, store: this.storeCARRIER, allowBlank: true, //queryMode: 'remote', //minChars: 1, //queryParam: 'CODENAME', name: 'CARRIER', valueField: 'CustName', displayField: 'CodeAndName', listeners: { scope: this, 'beforequery': function (e) { return FilterCombox(e);//在beforequery使用此方法 }, blur: function (field, The, eOpts) { if (isNullorEmpty(field.rawValue.toUpperCase().trim())) { field.setRawValue(""); field.value = ""; } } } }); this.storeCountryFa = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CangDanCountry', proxy: { url: '/CommMng/BasicDataRef/GetCountryList' } }); this.storeCountryFa.load({ params: { condition: "" } }); this.comboxCountryFa2 = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.COUNTRY, emptyText: Zi.LAN.COUNTRY, store: this.storeCountryFa, queryParam: 'CodeName', queryMode: 'remote', flex: 1, name: 'BookingCountry', valueField: 'CountryCode', forceSelection: true, id: 'BookingCountry', allowBlank: false, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt1.load({ params: { code: code } }); } } } }); this.comboxCountryDing = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.COUNTRY, emptyText: Zi.LAN.COUNTRY, store: this.storeCountryFa, queryParam: 'CodeName', queryMode: 'remote', flex: 1, name: 'BookingCountry', valueField: 'CountryCode', forceSelection: true, allowBlank: false, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt1.load({ params: { code: code } }); } } } }); //#region 国家(收货人) this.storeCountryShou = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CangDanCountry', proxy: { url: '/CommMng/BasicDataRef/GetCountryList' } }); this.storeCountryShou.load({ params: { condition: "" } }); this.comboxCountryShou = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.COUNTRY, store: this.storeCountryShou, name: 'CONSIGNEECOUNTRY', valueField: 'CountryCode', forceSelection: true, flex: 0.5, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox1.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt2.load({ params: { code: code } }); //_this.formAMS.getForm().findField('CONSIGNEECOUNTRY').setValue(code); } } } }); this.comboxCountryShou_2 = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.COUNTRY, emptyText: Zi.LAN.COUNTRY, store: this.storeCountryShou, name: 'ConsigneeCountry', valueField: 'CountryCode', forceSelection: true, allowBlank: false, flex: 1, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox1.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt2.load({ params: { code: code } }); //_this.formAMS.getForm().findField('CONSIGNEECOUNTRY').setValue(code); } } } }); //#endregion //#region 国家(通知人) this.storeCountryTong = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CangDanCountry', proxy: { url: '/CommMng/BasicDataRef/GetCountryList' } }); this.storeCountryTong.load({ params: { condition: "" } }); this.comboxCountryTong = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: Zi.LAN.COUNTRY, store: this.storeCountryTong, queryParam: 'CodeAndName', name: 'NOTIFYPARTYCOUNTRY', valueField: 'CountryCode', flex: 0.5, forceSelection: true, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox2.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt3.load({ params: { code: code } }); //_this.formAMS.getForm().findField('NOTIFYPARTYCOUNTRY').setValue(code); } } } }); this.comboxCountryTong_2 = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: Zi.LAN.COUNTRY, emptyText: Zi.LAN.COUNTRY, store: this.storeCountryTong, queryParam: 'CodeAndName', name: 'NotifypartCountry', valueField: 'CountryCode', flex: 1, forceSelection: true, allowBlank: false, displayField: 'CodeAndName', listeners: { beforequery: function (e) { var combo = e.combo; if (!e.forceAll) { var value = e.query; combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); return (text.indexOf(value) != -1); }); combo.expand(); return false; } }, select: function (combo, records, eOpts) { if (records.length > 0) { //_this.enterpriseCodetypeCombox2.setValue(''); //var code = records[0].data.CountryCode; //_this.storeMFrt3.load({ params: { code: code } }); //_this.formAMS.getForm().findField('NOTIFYPARTYCOUNTRY').setValue(code); } } } }); //#endregion _this = this; //#endregion //#region 分公司 所属分部 this.storeCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'MsCompanysEntity', proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' } }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '所属分部', store: this.storeCompany, flex: 1, name: 'CORPID', valueField: 'gid', displayField: 'name', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.storeUser.load({ params: { condition: "CORPID='" + combo.value + "'", dbname: records[0].data.DBNAME } , callback: function (options, success, response) { if (success) { //.... } } }); } } } }); //#endregion //#region 系统用户:操作 客服 销售 this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserLinkRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' } }); //#endregion this.storeCONTACTTITLE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsExtEnumModel', proxy: { url: '/CommMng/PubSys/GetEnumValueList' } }); this.storeCONTACTTITLE.load({ params: { enumTypeId: 81014 } }); this.comboxCONTACTTITLE = Ext.create('DsExt.ux.RefTableCombox', { hidden: true, flex: 1, //fieldLabel: '性别', hidden: true, store: this.storeCONTACTTITLE, forceSelection: true, emptyText: 'MR/MS', blankText: 'MR/MS', id: 'BookingCONTACTTITLE', name: 'BookingCONTACTTITLE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); //#endregion //#region 主表信息 this.formHead = Ext.widget('form', { //layout: "border", region: 'north', // title:'委托结算服务', height: 285, //grow:true, frame: true, bodyPadding: 5, collapsed: false, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 0', labelAlign: 'right', flex: 1, labelWidth: 80, msgTarget: 'qtip' }, items: [ { //第一格 xtype: 'container', //title:'委托信息', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: 'GID', name: 'GID' }, { fieldLabel: 'CORPID', name: 'CORPID' }, { fieldLabel: 'CREATETIME', name: 'CREATETIME' }, { fieldLabel: 'CREATOR', name: 'CREATOR' }, { fieldLabel: 'CREATORID', name: 'CREATORID' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCARRIER , { xtype:"hiddenfield" } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.DJYORDER_ACCOUNT, allowBlank: false, name: 'ACCOUNT' }, { fieldLabel: Zi.LAN.DJYORDER_ACCOUNTPSW, //allowBlank: false, hidden: true, name: 'ACCOUNTPSW' }, { xtype: "hiddenfield" } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.BookingName, allowBlank: false, name: 'BookingName' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { id:'BookingAddress', fieldLabel: Zi.LAN.BookingAddress, allowBlank: false, name: 'BookingAddress' } ] } , { xtype: 'container', layout: 'hbox', id: 'CountryLine', defaultType: 'textfield', items: [ this.comboxCountryFa2, { xtype: 'textfield', emptyText: '省份', blankText: '省份', name: 'BookingProvince' }, { xtype: 'textfield', allowBlank: false, emptyText: '城市', blankText: '城市', id: 'BookingCity', name: 'BookingCity' }, { xtype: 'textfield', //allowBlank: false, emptyText: '县/区', blankText: '县/区', name: 'BookingCounty' }, { xtype: 'textfield', //allowBlank: false, emptyText: '邮编', blankText: '邮编', name: 'BookingPostCode' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ this.comboxCONTACTTITLE, { xtype: 'textfield', emptyText: '姓', blankText: '姓', name: 'BookingLastName' }, { xtype: 'textfield', emptyText: '名', blankText: '名', name: 'BookingFirstName' }, { xtype: 'textfield', emptyText: '国家区号', blankText: '国家区号', name: 'BookingPhoneCountryCode' }, { xtype: 'textfield', emptyText: '省市区号', blankText: '省市区号', name: 'BookingPhoneCode' }, { xtype: 'textfield', emptyText: '电话', blankText: '电话', name: 'BookingPhone' }, { xtype: 'textfield', hidden: true, id: 'BookingPhoneExtension', emptyText: '分机号', blankText: '分机号', name: 'BookingPhoneExtension' } ] } , { xtype: 'textareafield', name: 'REMARK', id: "REMARK", height: 80, grow: true, fieldLabel: Zi.LAN.REMARK //'备注', } ] } ]//end items(fieldset 1) }); //end this.formHead //#endregion this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { idProperty: '', 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', border: false, //width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: '删除', tooltip: '删除', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: '上传附件', tooltip: '上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }, { text: '批量上传附件', tooltip: '批量上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.UploadFile("", ""); }, scope: this } //, '-', { // text: '保存', // tooltip: '保存', // // iconCls: "btnadddetail", // handler: function (button, event) { // this.onPostFileClick(button, event); // }, // scope: this //} ], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, dataIndex: 'RECEIPTTYPE', header: '单据类型', editor: this.comboxReceiptid_DOC, width: 80, renderer: function (value, p, record) { if (value != "发票" && value != "账单") { return "原始单据" } else { return value; } } }, { 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: 340, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSERRef', header: '修改人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDTIME', header: '修改时间', width: 85 } ] }); //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { id: 'btnESave', text: "保存",//保存 iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { id: 'btnESaveAndClose', text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, { text: "关闭", handler: function (button, event) { window.close(); }, scope: this } , '-' //, //{ // text: "打印", // iconCls: "btnprint", // handler: function (button, event) { // this.Print(); // }, // scope: this //} //, //{ // text: "test", // handler: function (button, event) { // this.Test(); // }, // scope: this //} ] }); //end 按钮Toolbar //#endregion //#region 框架结构 this.treestore = new Ext.data.TreeStore({ model: 'DsShipping.ux.ModuleModel', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } }, autoLoad: true, root: { name: '根节点', expanded: true, id: 'A9837D95-10FB-4BB7-A7E8-53FE8C83F3B5' } }); this.tabtree = new Ext.tree.Panel({ region: 'west', hidden: true, title: '业务信息', split: true, width: 180, collapsible: true, margins: '0 0 0 0', store: this.treestore, rootVisible: false, hideHeaders: true, animate: false, lines: false, columns: [{ xtype: 'treecolumn', text: '合约信息', width: 178, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (_this, record, item, index, e, eOpts) { var finded = false; if (record.data.MODULEURL == '@') { this.tabOpPanel.setActiveTab(0); } else if (record.data.MODULEURL != '#') { var children = this.tabOpPanel.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { if (children.items[i].id) { if (children.items[i].id == 'pnl' + record.data.NAME) { this.tabOpPanel.setActiveTab(i); finded = true; } } } } if (finded == false) { if (this.formHead.getForm().findField('GID').getValue() == "") { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunYeWu, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });//'请先保存业务信息后再打开其他模块!' } else { //if (record.data.NAME == _this.panelFee_Name) { // var paneltabitems = new Shipping.SeaeFee({ // id: 'pnl' + record.data.NAME, // layout: "border", // region: "center", // autoScroll: true, // frame: false, // closable: true, // title: record.data.DESCRIPTION // }); //} else if (record.data.NAME == _this.panelAmend_Name) { // var paneltabitems = new Shipping.SeaeAmendFee({ // id: 'pnl' + record.data.NAME, // layout: "border", // region: "center", // autoScroll: true, // frame: false, // closable: true, // title: record.data.DESCRIPTION // }); //} //else { var paneltabitems = new Ext.Panel({ id: 'pnl' + record.data.NAME, layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, title: record.data.DESCRIPTION, html: ' ' }); } this.tabOpPanel.add(paneltabitems); this.tabOpPanel.setActiveTab(paneltabitems); this.tabOpPanel.doLayout(); } } } } } }); this.panelEdit = new Ext.Panel({ title: '合约信息', id: 'pnlmodDJYORDER_ACCOUNTINFO', layout: "border", region: 'center', animate: true, autoScroll: true, frame: false, //closable:true, items: [ this.panelBtn, this.formHead //,this.gridDocList ] }); this.tabOpPanel = new Ext.TabPanel({ activeTab: 0, width: 100, layout: 'border', border: true, frame: false, region: 'center', id: "TabOpPanel", enableTabScroll: true, items: [ this.panelEdit ], listeners: { scope: this, 'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) { if (oldCard.id == _this.panelFee_Name) { var feemodify = oldCard.panelFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunFeiYong, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'费用未保存,请先保存费用!' return false; } } if (newCard.id == _this.panelFee_Name) { newCard.panelFee.loadUnit(); } if (oldCard.id == _this.panelAmend_Name) { var feemodify = oldCard.panelAmendFee.getModifyStatus(); if (feemodify) { Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QingXianBaoCunFeiYong, icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });//'费用未保存,请先保存费用!' return false; } } if (newCard.id == _this.panelAmend_Name) { newCard.panelAmendFee.loadUnit(); } } } }); Ext.apply(this, { items: [ //this.tabtree, this.tabOpPanel ] }); //#endregion parentWin = window.parent.opener; this.LoadInitData(); this.LoadMustBe(); this.InitData(); //this.setformStatus(); //#region 其他 //this.formDetail.on('edit', function (editor, e, eOpts) { // this.AfterEdit(editor, e, eOpts); //}, this); //#endregion }, //end initUIComponents SetFieldShow(CARRIER) { //根据船公司 隐藏或显示一些字段 //中远 不做任何变动 if (CARRIER == "COSCO") { this.carrierName = "中远合约模板维护"; } if (CARRIER == "EMC") { //长荣 this.carrierName = "长荣合约模板维护"; Ext.getCmp("BookingAddress").allowBlank = true;//发货人地址 隐藏 Ext.getCmp("BookingAddress").hide(); Ext.getCmp("CountryLine").hide(); Ext.getCmp("BookingCountry").allowBlank = true; Ext.getCmp("BookingCity").allowBlank = true; Ext.getCmp("BookingCONTACTTITLE").show();//性别 ms mr 显示 Ext.getCmp("BookingPhoneExtension").show();//分机号 显示 } this.formHead.setTitle(this.carrierName); }, //#region 加载事件 InitData: function () { this.opStatus = 'add'; var condition = ''; _this = this; if (parentWin) { var ret = parentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; _storeCARRIER = ret[3]; this.storeCARRIER.loadData(_storeCARRIER.data.items); } if (this.opStatus == 'edit' || this.opStatus == 'copyadd') { Headcondition = "GID='" + this.editRecord.get('GID') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; this.SetFieldShow(this.editRecord.get('CARRIER')); //this.storeBodyList.load({ params: { condition: condition} }); } else { Headcondition = ""; Bodycondition = "1=2"; this.SetFieldShow(this.carrier); } this.LoadData(this.opStatus, Headcondition, Bodycondition); }, //end InitData LoadData: function (opstatus, condition, Bodycondition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; //if (this.opStatus == 'edit') { // var CUSTNO = this.editRecord.get('CUSTNO').toString().trim(); // if (CUSTNO != "") { // document.title = "委托编号:" + this.editRecord.get('CUSTNO').toString().trim(); // } //} Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/GetEditData', 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; } this.Editdata = result.data; //this.LoadInit(data); if (this.Editdata.ETA) this.Editdata.ETA = this.Editdata.ETA.replace(" 00:00:00", ""); if (opstatus == 'add') { //this.LoadDefValue(); this.Editdata.CARRIER = this.carrier; } this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.Editdata); BSNO = this.Editdata.GID; //if (opstatus == 'add') { // //this.LoadDefValue(); //} if (opstatus == 'copyadd') { this.CopyNew(); } //this.SetLockStatus(this.Editdata); this.GetEditStatus(); var _this = this; this.LoadUploadFile(BSNO); //checkboxgroup = Ext.getCmp("ServiceGroup"); //SetCheckGroupValue(checkboxgroup, this.Editdata.SERVICE); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var billno = '*'; var gid = '*'; }, //SetLockStatus: function (data) { // if (isTrue(data.FEESTATUS)) // this.formHead.getForm().findField('FEESTATUSREF').setValue("是"); // else // this.formHead.getForm().findField('FEESTATUSREF').setValue("否"); // if (isTrue(data.BSSTATUS)) // this.formHead.getForm().findField('BSSTATUSREF').setValue("是"); // else // this.formHead.getForm().findField('BSSTATUSREF').setValue("否"); //}, //loadBody: function (condition) { // this.storeBody.load({ params: { condition: condition } }); //}, // end LoadDate //#endregion LoadInitData: function () { //this.storeCustCode.load({ params: { condition: "" } }); }, //#region 保存/添加/删除 Save: function (type) { var ServiceGroup = Ext.getCmp("ServiceGroup"); //var _s = ServiceGroup.items; //var service = ""; //for (var i = 0; i < ServiceGroup.items.getCount(); i += 1) { // var list = ServiceGroup.items.items; // var rec = ServiceGroup.items.items[i]; // if (rec.checked == true) { // //alert(ServiceGroup.items[i]); // if (service != "") service += ","; // service += rec.id; //} var Form = this.formHead.getForm(); if (!Form.isValid()) { return; } var data = Form.getValues(); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/DJYORDER_ACCOUNTINFO/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var returnData = jsonresult.Data; this.Editdata = returnData; if (this.Editdata.ETA) this.Editdata.ETA = this.Editdata.ETA.replace(" 00:00:00", ""); this.formHead.getForm().reset(); this.formHead.getForm().setValues(this.Editdata); //checkboxgroup = Ext.getCmp("ServiceGroup"); //SetCheckGroupValue(checkboxgroup, this.Editdata.SERVICE); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; this.opStatus = 'edit'; } else if (this.opStatus == 'edit') { var editp = Ext.create('DJYORDER_ACCOUNTINFOmb', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'GID') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); //this.Editdata = result.data; } //this.LoadInit(data); this.GetEditStatus(); if (type == '0') { this.opStatus = 'edit'; //this.setformStatus(); } else if (type == '1') { window.close(); } //else if (type == '2') { // var Headcondition = "BSNO='" + this.editRecord.get('BSNO') + "'"; // var Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; // this.LoadData('copyadd', Headcondition, Bodycondition); //} } 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 //#endregion //#region 载入初始信息 LoadInit: function (data) { }, //#endregion //#region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; _this = this; var op = USERID; this.StoreOpRange.load({ params: { optype: "modOp_InternalTrade" }, 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; } _this.setSaveBtnStatus(canedit); } } }); }, GetStringNum: function (str) { var num = 0; if (str == null || str == '') return num; if (str.length == 0) return num; var if_find = false; var str_num = ''; for (var i = 0; i < str.length; i += 1) { var member = str.substr(i, 1); if ((member == '0') || (member == '1') || (member == '2') || (member == '3') || (member == '4') || (member == '5') || (member == '6') || (member == '7') || (member == '8') || (member == '9') || (member == '.') || (member == '-')) { if (!if_find) { str_num = str_num + member; } } else { if_find = true; } } return str_num; }, LoadDefValue: function () { this.storeDefValue.load({ params: { condition: "BSTYPE='大简云订舱_账号密码设置'" }, callback: function (r, options, success) { if (success) { if (this.storeDefValue.getCount() > 0) { for (var j = 0; j < this.storeDefValue.getCount(); j += 1) { var member = this.storeDefValue.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) headfield.setValue(member.data.DEFVALUE); }; } else { } } }, scope: this }); }, LoadMustBe: function () { this.storeMustBe.load({ params: { condition: "BSTYPE='内贸海运业务'" }, callback: function (r, options, success) { if (success) { if (this.storeMustBe.getCount() > 0) { for (var j = 0; j < this.storeMustBe.getCount(); j += 1) { var member = this.storeMustBe.getAt(j); var headfield = this.formHead.getForm().findField(member.data.FIELDNAME); if (headfield != NaN && headfield != null) { if (member.data.ISMUST == "1") headfield.allowBlank = false; if (member.data.ISCOLOR == "1") headfield.setFieldStyle({ background: '#ffc' }); if (member.data.ISREADONLY == "1") headfield.setReadOnly(true); } }; } else { } } }, scope: this }); }, setSaveBtnStatus: function (enable) { var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); //var btndeletedetail = Ext.getCmp('btndeletedetail'); if (enable) { btnESave.enable(); btnESaveAndClose.enable(); //btndeletedetail.enable(); } else { btnESave.disable(); btnESaveAndClose.disable(); //btndeletedetail.disable(); } }, setformStatus: function () { if (this.opStatus == 'add') { var basicForm = this.formHead.getForm(); basicForm.findField('CORPID').readOnly = false; basicForm.findField('INPUTBY').readOnly = false; basicForm.findField('TEL').readOnly = false; basicForm.findField('MBLNO').readOnly = false; basicForm.findField('CARRIER').readOnly = false; basicForm.findField('VOYNO').readOnly = false; basicForm.findField('VESSEL').readOnly = false; basicForm.findField('ETA').readOnly = false; basicForm.findField('SHIPAGENCY').readOnly = false; basicForm.findField('REMARK').readOnly = false; Ext.getCmp('REMARK').height = 120; Ext.getCmp('REMARK2').hide(); Ext.getCmp('btnESave').show(); Ext.getCmp('btnESaveAndClose').show(); Ext.getCmp('btnESave2').hide(); Ext.getCmp('btnESaveAndClose2').hide(); servicegroup = Ext.getCmp('ServiceGroup'); SetCheckGroupReadonly(servicegroup, false); } else { var basicForm = this.formHead.getForm(); basicForm.findField('CORPID').readOnly = true; basicForm.findField('INPUTBY').readOnly = true; basicForm.findField('TEL').readOnly = true; basicForm.findField('MBLNO').readOnly = true; basicForm.findField('CARRIER').readOnly = true; basicForm.findField('VOYNO').readOnly = true; basicForm.findField('VESSEL').readOnly = true; basicForm.findField('ETA').readOnly = true; basicForm.findField('SHIPAGENCY').readOnly = true; servicegroup = Ext.getCmp('ServiceGroup'); SetCheckGroupReadonly(servicegroup, true); basicForm.findField('REMARK').readOnly = true; Ext.getCmp('REMARK').height = 75; Ext.getCmp('REMARK2').show(); Ext.getCmp('btnESave').hide(); Ext.getCmp('btnESaveAndClose').hide(); Ext.getCmp('btnESave2').show(); Ext.getCmp('btnESaveAndClose2').show(); } }, //#endregion //#region 上一票下一票 PrevRecord: function () { if (this.opStatus == 'add') { Ext.Msg.show({ title: '警告', msg: '请先保存当前业务', 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; } j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { Headcondition = "GID='" + this.editRecord.get('GID') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData(this.opStatus, Headcondition, Bodycondition); //this.LoadData(this.opStatus, condition); } }, NextRecord: function () { if (this.opStatus == 'add') { Ext.Msg.show({ title: '警告', msg: '请先保存当前业务', 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; } j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { Headcondition = "GID='" + this.editRecord.get('GID') + "'"; Bodycondition = "D.BSNO='" + this.editRecord.get('BSNO') + "'"; this.LoadData(this.opStatus, Headcondition, Bodycondition); //this.LoadData(this.opStatus, condition); } }, //#endregion //#region 打印 Print: function () { var basicForm = this.formHead.getForm(); var BSNO = basicForm.findField('GID').value; if (BSNO == '*' || BSNO == '') { Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var printType = 'DJYORDER_ACCOUNTINFOEDIT'; var sql1 = ""; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOp_InternalTrade/GetPrintSql', params: { printname: "Print1", BSNOList: "'" + BSNO + "'" }, 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; } //this.Editdata = result.data; //this.LoadInit(data); sql1 = result.Data.sql1; sql2 = result.Data.sql2; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, //#endregion AfterEdit: function (editor, e, eOpts) { //if (e.value==e.originalValue){return;} function decimal(str, length) { var _r = round2(str, length); return (_r); } } , onUpLoadFileClick: function (button, event) { var billno = this.Editdata.CUSTNO; var BSNO = this.Editdata.GID; if (this.opStatus == 'add') { BSNO = USERID; } //var FILETYPE = "订舱附件"; //枚举维护表tSysEnumValue_附件类型97048 //需求编号:SR2017081100003 //this.storeFileType = Ext.create('DsExt.ux.RefTableStore', { // model: 'DsShipping.ux.TSysEnumValueDataModel', // proxy: { url: '/CommMng/BasicDataRef/GetTSysEnumValueList' } //}); //this.storeFileType.load({ params: { condition: " and EnumTypeID=97048" } }); //var comboxFileType = Ext.create('DsExt.ux.RefTableCombox', { // fieldLabel: '附件类型', // hidden:true, // store: this.storeFileType, // forceSelection: true, // id: 'FILETYPE', // name: 'FILETYPE', // valueField: 'EnumValueName', // displayField: 'EnumValueName' //}); _this = 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%' }, { xtype: 'textfield', hidden: true, id: 'FILETYPEField', name: 'FILETYPE', fieldLabel: '文件类型', values: '' } , { xtype: 'textfield', hidden: true, id: 'DOCUMENTATTACHEDCODE', name: 'DOCUMENTATTACHEDCODE', fieldLabel: '随附单证代码'//需求编号:SR2017081100003 }, { xtype: 'textfield', hidden: true, id: 'DOCUMENTATTACHEDNO', name: 'DOCUMENTATTACHEDNO', fieldLabel: '随附单证编号'//需求编号:SR2017081100003 } ], 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: BSNO, TYPE: "",//Ext.getCmp('FILETYPEField').getValue(), DOCUMENTATTACHEDCODE: Ext.getCmp('DOCUMENTATTACHEDCODE').getValue(), //需求编号:SR2017081100003 DOCUMENTATTACHEDNO: Ext.getCmp('DOCUMENTATTACHEDNO').getValue() //需求编号:SR2017081100003 }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //var condition = _this.strBSNO; _this.Loading = true; _this.LoadUploadFile(BSNO); }, 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: 200, modal: true, resizable: false, border: false, items: imgform }); win.show(); } , UploadFile: function (uploadFileType, title) { var billno = this.Editdata.CUSTNO; var BSNO = this.Editdata.BSNO; if (this.opStatus == 'add') { BSNO = USERID; } //if (this.storeList.getCount() == 0) { // return; //} //selectedRecords = this.GridCheckBoxModel.selected.items; //if (selectedRecords.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择要上传文件的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} //var sortstr = 'CTNNO'; //if (this.sortfield != '' && this.sortdire != '') { // sortstr = this.sortfield + ' ' + this.sortdire; //} //var record = selectedRecords[0]; //var feeGId = record.get('GID'); //var feeGidSql = ''; //for (var i = 0; i < selectedRecords.length; i++) { // var record = selectedRecords[i]; // var feeGId = "'" + record.get('GID') + "'"; // if (feeGidSql == '') { // feeGidSql = feeGId; // } else { // feeGidSql = feeGidSql + "," + feeGId; // } //}; //if (feeGidSql == '') { // Ext.Msg.show({ title: '提示', msg: '没有选择要上传文件的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; //} var winUpload = Ext.create('Ext.window.Window', { layout: 'fit', title: '上传' + title, width: 600, height: 500, modal: true, plain: true, autoScroll: true, bodyStyle: "padding:5px 0 0 5px", items: { xtype: "panel", layout: 'fit', border: false, frame: false, autoScroll: true, html: "" }, buttonAlign: "center", buttons: [{ text: "关 闭", handler: function () { winUpload.close(); } }] }); _UploadFileStore = this.storeDocList; _condition = " BSNO='" + BSNO + "' "; _BSNO = BSNO; _CUSTNO = billno; winFXTZModifyShow = _this.winFXTZModifyShow; extParentWinFrame = winUpload; winUpload.show(); } , LoadUploadFile: function (BSNO) { var condition2 = " BSNO='" + BSNO + "' "; if (this.opStatus == 'add') { condition2 = " BSNO='" + USERID + "'"; } this.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); } , onDelFileClick: function (button, event) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.DocCM.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', 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('正在删除数据...'); 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); } , Test() { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/OP_SERVICEBILL/Test', params: { }, 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; } //this.Editdata = result.data; //this.LoadInit(data); sql1 = result.Data.sql1; sql2 = result.Data.sql2; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); } });