|
|
@@ -2,6 +2,7 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
extend: 'Ext.app.ViewController',
|
|
|
alias: 'controller.core-form-formpanel',
|
|
|
|
|
|
+ BaseUtil: Ext.create('saas.util.BaseUtil'),
|
|
|
FormUtil: Ext.create('saas.util.FormUtil'),
|
|
|
|
|
|
add: function(btn){
|
|
|
@@ -20,10 +21,13 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
xtype:form.xtype
|
|
|
};
|
|
|
mainTab.setActiveTab(mainTab.add(form));
|
|
|
+ }else {
|
|
|
+ mainTab.setActiveTab(existingItem);
|
|
|
}
|
|
|
},
|
|
|
delete: Ext.emptyFn,
|
|
|
save:function(btn){
|
|
|
+ var me = this;
|
|
|
var form = btn.ownerCt.ownerCt;
|
|
|
if(form.getForm().wasDirty==false){
|
|
|
Ext.Msg.alert('提示','未修改数据,请修改后保存');
|
|
|
@@ -59,23 +63,34 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
main:formData,
|
|
|
items:newGridData
|
|
|
}
|
|
|
- Ext.Ajax.request({
|
|
|
- url: 'http://192.168.253.58:8800/purchase/form',
|
|
|
+ me.BaseUtil.request({
|
|
|
+ url: me.saveUrl,
|
|
|
params: JSON.stringify(params),
|
|
|
method: 'POST',
|
|
|
- headers: {
|
|
|
- 'Access-Control-Allow-Origin': '*',
|
|
|
- "Content-Type": 'application/json;charset=UTF-8'
|
|
|
- },
|
|
|
- success: function (response, opts) {
|
|
|
- //解析参数
|
|
|
- Ext.Msg.alert('提示','保存成功');
|
|
|
- },
|
|
|
- failure: function (response, opts) {
|
|
|
- //失败
|
|
|
- Ext.Msg.alert('提示','保存失败');
|
|
|
- }
|
|
|
+ })
|
|
|
+ .then(function() {
|
|
|
+ Ext.Msg.alert('提示','保存成功');
|
|
|
+ })
|
|
|
+ .catch(function() {
|
|
|
+ Ext.Msg.alert('提示','保存失败');
|
|
|
});
|
|
|
+ // Ext.Ajax.request({
|
|
|
+ // url: 'http://192.168.253.58:8800/purchase/form',
|
|
|
+ // params: JSON.stringify(params),
|
|
|
+ // method: 'POST',
|
|
|
+ // headers: {
|
|
|
+ // 'Access-Control-Allow-Origin': '*',
|
|
|
+ // "Content-Type": 'application/json;charset=UTF-8'
|
|
|
+ // },
|
|
|
+ // success: function (response, opts) {
|
|
|
+ // //解析参数
|
|
|
+ // Ext.Msg.alert('提示','保存成功');
|
|
|
+ // },
|
|
|
+ // failure: function (response, opts) {
|
|
|
+ // //失败
|
|
|
+ // Ext.Msg.alert('提示','保存失败');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
audit: function(btn){
|
|
|
var form = btn.ownerCt.ownerCt;
|
|
|
@@ -126,5 +141,11 @@ Ext.define('saas.view.core.form.FormPanelController', {
|
|
|
Ext.Msg.alert('提示','审核失败');
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取form数据
|
|
|
+ */
|
|
|
+ getFormData: function() {
|
|
|
+
|
|
|
}
|
|
|
});
|