| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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({});
- },
- auditBtnClick: function() {
- var me = this,
- form = me.getView(),
- statusCodeField = form._statusCodeField,
- viewModel = me.getViewModel(),
- status = viewModel.data[statusCodeField];
- status == 'OPEN' ? me.unAudit() : me.audit();
- },
- audit: function(){
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- me.BaseUtil.request({
- url: form._openUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- showToast('启用成功');
- form.initId = localJson.data.id;
- form.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- }
- })
- .catch(function(res) {
- console.error(res);
- showToast('启用失败: ' + res.message);
- });
- },
- unAudit: function() {
- var me = this,
- form = this.getView(),
- viewModel = me.getViewModel();
-
- me.BaseUtil.request({
- url: form._closeUrl+'/'+viewModel.data.id,
- params: '',
- method: 'POST',
- })
- .then(function(localJson) {
- if(localJson.success){
- form.initId = localJson.data.id;
- form.FormUtil.loadData(form);
- viewModel.set('base.editable', false);
- showToast('禁用成功');
- }
- })
- .catch(function(res) {
- showToast('禁用失败: ' + res.message);
- });
- }
- });
|