| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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(res) {
- console.error(res);
- saas.util.BaseUtil.showErrorToast('启用失败: ' + res.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(res) {
- saas.util.BaseUtil.showErrorToast('禁用失败: ' + res.message);
- });
- }
- });
|