| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.pm.mps.DeviceInApply', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- GridUtil: Ext.create('erp.util.GridUtil'),
- views:[
- 'pm.mps.DeviceInApply','core.form.Panel','core.grid.Panel2','core.toolbar.Toolbar','core.form.FileField',
- 'core.button.Add','core.button.Save','core.button.Close',
- 'core.button.Submit','core.button.ResSubmit','core.button.Audit','core.button.ResAudit',
- 'core.button.Update','core.button.Delete','core.form.YnField',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.form.YnField'
- ],
- init:function(){
- var me = this;
- this.control({
- 'erpGridPanel2': {
- afterrender: function(g) {
- g.plugins[0].on('beforeedit', function(args) {
- if(args.field == "dep_value") {
- var bool = false;
- if (args.record.get('dep_btcid') != null && args.record.get('dep_btcid') > 0){
- bool = true;
- }
- return bool;
- }
- });
- },
- reconfigure: function(grid){
- Ext.defer(function(){
- var form = grid.ownerCt.down('form'), status = Ext.getCmp('de_statuscode');
- kind = Ext.getCmp('de_kind');
- if(status && status.value == 'ENTERING') {
- if(kind && kind.value){
- grid.readOnly = false;
- } else {
- grid.readOnly = true;
- }
- }
- }, 500);
- }
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
- me.BaseUtil.getRandomNumber();//自动添加编号
- }
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- this.FormUtil.beforeClose(this);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpDeleteButton': {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('de_id').value);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addDeviceInApply', '新增ERP器件入库申请', 'jsps/pm/mps/deviceInApply.jsp');
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('de_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('de_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('de_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('de_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('de_statuscode'), sendstatus = Ext.getCmp('de_sendstatus');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- if(sendstatus && sendstatus.value != '待上传'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('de_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('de_statuscode'), sendstatus = Ext.getCmp('de_sendstatus');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- if(sendstatus && sendstatus.value != '待上传'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('de_id').value);
- }
- }
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- }
- });
|