| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.oa.officialDocument.fileManagement.AddDossier', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'oa.officialDocument.fileManagement.dossier.AddDossier','core.form.Panel','core.form.YearDateField',
- 'core.button.Save','core.button.Close','core.button.Update','core.button.Delete',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger'
- ],
- init:function(){
- var me = this;
- this.control({
- 'erpSaveButton': {
- click: function(btn){
- this.FormUtil.beforeSave(this);
- // parent.window.location.href = parent.window.location.href;
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- // parent.window.location.href = parent.window.location.href;
- }
- },
- 'erpDeleteButton': {
- click: function(btn){
- me.onDelete((Ext.getCmp('do_id').value));
- // me.FormUtil.onDelete((Ext.getCmp('dr_id').value));
- // parent.window.location.href = parent.window.location.href;
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- parent.Ext.getCmp('grid').getCount('Dossier',"do_documentroom_id=" + Ext.getCmp('do_documentroom_id').value);
- this.FormUtil.onClose(this);
- // window.close();
- }
- },
- 'textfield[id=do_documentroom]':{
- afterrender: function(field){
- if(getUrlParam('name') != null && getUrlParam('name') != ''){
- field.setValue(getUrlParam('name'));
- Ext.getCmp('do_documentroom_id').setValue(getUrlParam('id'));
- }
- }
- },
- 'textfield[id=do_charger]':{
- change: function(field){
- if(field.value == null || field.value == ''){
- Ext.getCmp('do_charger_id').setValue(null);
- }
- }
- },
- 'datefield[id=do_enddate]': {
- change: function(field){
- var time = Ext.getCmp('do_startdate').value;
- if(time == null || time == ''){
- showError('请先选择文件开始日期');
- field.setValue('');
- } else {
- var start = Date.parse(time);
- var end = Date.parse(field.value);
- if(start > end){
- showError('结束日期不能早于开始日期 ');
- field.setValue('');
- }
- }
- }
- },
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
-
- openTab : function (panel,id){
- var o = (typeof panel == "string" ? panel : id || panel.id);
- var main = parent.Ext.getCmp("content-panel");
- var tab = main.getComponent(o);
- if (tab) {
- main.setActiveTab(tab);
- } else if(typeof panel!="string"){
- panel.id = o;
- var p = main.add(panel);
- main.setActiveTab(p);
- }
- },
- onDelete: function(id){
- var me = this;
- warnMsg($I18N.common.msg.ask_del_main, function(btn){
- if(btn == 'yes'){
- var form = Ext.getCmp('form');
- if(!contains(form.deleteUrl, '?caller=', true)){
- form.deleteUrl = form.deleteUrl + "?caller=" + caller;
- }
- // me.getActiveTab().setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + form.deleteUrl,
- params: {
- id: id
- },
- method : 'post',
- callback : function(options,success,response){
- // me.getActiveTab().setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);return;
- }
- if(localJson.success){
- delSuccess(function(){
- parent.window.location.href = parent.window.location.href;
- me.FormUtil.onClose();
- });//@i18n/i18n.js
- } else {
- delFailure();
- }
- }
- });
- }
- });
- }
- });
|