| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- Ext.define('saas.view.document.customer.FormController', {
- extend: 'saas.view.core.form.FormPanelController',
- alias: 'controller.document-customer-formpanel',
-
- init: function (form) {
- var me = this;
- this.control({
- 'employeeDbfindTrigger[name=cu_sellername]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[{
- from:'id',to:'cu_sellerid',ignore:true
- },{
- from:'em_code',to:'cu_sellercode'
- },{
- from:'em_name',to:'cu_sellername'
- }],
- }) ;
- }
- }
- });
- },
- auditBtnClick: function() {
- var me = this,
- form = me.getView(),
- statusCodeField = form._statusCodeField,
- viewModel = me.getViewModel(),
- status = viewModel.data[statusCodeField];
- status == 'ENABLE' ? me.unAudit() : me.audit();
- },
- audit: function(){
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- saas.util.BaseUtil.request({
- url: form._openUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- saas.util.BaseUtil.showSuccessToast('启用成功');
- form.initId = localJson.data.id;
- saas.util.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- }
- })
- .catch(function(e) {
- saas.util.BaseUtil.showErrorToast('启用失败: ' + e.message);
- });
- },
- unAudit: function() {
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- saas.util.BaseUtil.request({
- url: form._closeUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- form.initId = localJson.data.id;
- saas.util.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- saas.util.BaseUtil.showSuccessToast('禁用成功');
- }
- })
- .catch(function(e) {
- saas.util.BaseUtil.showErrorToast('禁用失败: ' + e.message);
- });
- }
- });
|