123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /**
- * 更新供应商返还
- */
- Ext.define('erp.view.core.button.UpdateUseStatus',{
- extend: 'Ext.Button',
- alias: 'widget.erpUpdateUseStatusButton',
- iconCls: 'x-button-icon-submit',
- cls: 'x-btn-gray',
- tooltip: '更新使用状况',
- id: 'erpUpdateUseStatusButton',
- text: $I18N.common.button.erpUpdateUseStatusButton,
- width: 120,
- initComponent : function(){
- this.callParent(arguments);
- },
- listeners: {
- afterrender: function(btn) {
- var me = this;
- var status = Ext.getCmp('ac_statuscode');
- if(status && (status.value == 'ENTERING')){
- btn.hide();
- }
- }
- },
- handler: function() {
- var me = this, win = Ext.getCmp('Complaint-win');
- var states = Ext.create('Ext.data.Store', {
- fields: ['abbr', 'name'],
- data : [
- {"abbr":"正常使用", "name":"正常使用"},
- {"abbr":"未使用", "name":"未使用"},
- {"abbr":"停用", "name":"停用"}
- ]
- });
- if(!win) {
- var cs = Ext.getCmp('ac_usestatus'),
- val1 = cs ? cs.value : '';
- win = Ext.create('Ext.Window', {
- id: 'Complaint-win',
- title: '更新使用状况',
- height: 200,
- width: 400,
- items: [{
- xtype: 'form',
- height: '100%',
- width: '100%',
- bodyStyle: 'background:#f1f2f5;',
- items: [{
- margin: '10 0 0 0',
- xtype: 'combo',
- fieldLabel: '使用状况',
- name:'ac_usestatus',
- allowBlank: false,
- store: states,
- queryMode: 'local',
- displayField: 'name',
- valueField: 'abbr',
- value: val1
- }],
- closeAction: 'hide',
- buttonAlign: 'center',
- layout: {
- type: 'vbox',
- align: 'center'
- },
- buttons: [{
- text: $I18N.common.button.erpConfirmButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- var form = btn.ownerCt.ownerCt,
- cs = form.down('textfield[name=ac_usestatus]');
- if(form.getForm().isDirty()) {
- me.updateUseStatus(Ext.getCmp('ac_id').value, cs.value);
- }
- }
- }, {
- text: $I18N.common.button.erpCloseButton,
- cls: 'x-btn-blue',
- handler: function(btn) {
- btn.up('window').hide();
- }
- }]
- }]
- });
- }
- win.show();
- },
- updateUseStatus: function(id, cs, cr) {
- Ext.Ajax.request({
- url: basePath + 'fa/fix/assetscard/updateusestatus.action',
- params: {
- id: id,
- usestatus: cs
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(rs.exceptionInfo);
- } else {
- Ext.Msg.alert("提示","更新成功!");
- window.location.reload();
- }
- }
- });
- }
- });
|