| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.scm.purchase.Vendor', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'scm.purchase.Vendor','core.form.Panel','core.form.MultiField','core.form.FileField',
- 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close','core.button.Print',
- 'core.button.Upload','core.button.Update','core.button.Delete','core.button.ResAudit','core.button.DownLoad','core.button.VendorLevel',
- 'core.button.ResSubmit','core.button.Banned','core.button.ResBanned','core.button.Flow','core.button.VendorUU',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.form.YnField', 'core.button.Sync','core.button.UpdateInfo'
- ],
- init:function(){
- var me = this;
- this.control({
- 'field[name=ve_ifdeliveryonb2b]':{
- beforerender: function(field){
- field.readOnly=false;
- }
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn), codeField = Ext.getCmp(form.codeField);
- if(codeField.value == null || codeField.value == ''){
- me.BaseUtil.getRandomNumber(null,10,null);//自动添加编号
- var res = me.getLeadCode(Ext.getCmp('ve_type').value);
- if(res != null && res != ''){
- codeField.setValue(res + codeField.getValue());
- }
- }
- //保存之前的一些前台的逻辑判定
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpDeleteButton' : {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('ve_id').value);
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addVendor', '新增供应商基本资料', 'jsps/scm/purchase/vendor.jsp');
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- me.FormUtil.beforeClose(me);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('ve_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('ve_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('ve_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('ve_id').value);
- }
- },
- 'erpPrintButton': {
- click: function(btn){
- me.FormUtil.onPrint(Ext.getCmp('ve_id').value);
- }
- },
- 'erpBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value == 'DISABLE'){
- btn.hide();
- }
- },
- click: function(btn){
- this.FormUtil.onBanned(Ext.getCmp('ve_id').value);
- }
- },
- 'erpResBannedButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('ve_auditstatuscode');
- if(status && status.value != 'DISABLE'){
- btn.hide();
- }
- },
- click: function(btn){
- this.FormUtil.onResBanned(Ext.getCmp('ve_id').value);
- }
- },
- 'erpUpdateInfoButton':{
- click:function(){
- var text=Ext.getCmp('ve_ifdeliveryonb2b');
- me.updateInfo(text.value, Ext.getCmp('ve_id').value);
- }
- },
- });
- },
- updateInfo:function(text,id){
- Ext.Ajax.request({
- url : basePath + 'scm/purchase/vendor/updateInfo.action',
- params: {text:text,id:id},
- method : 'post',
- async:false,
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }
- showMessage("提示", '更新成功!');
- window.location.reload();
- }
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- getLeadCode: function(type) {
- var result = null;
- Ext.Ajax.request({
- url : basePath + 'common/getFieldData.action',
- async: false,
- params: {
- caller: 'VendorKind',
- field: 'vk_excode',
- condition: 'vk_kind=\'' + type + '\''
- },
- method : 'post',
- callback : function(opt, s, res){
- var r = new Ext.decode(res.responseText);
- if(r.exceptionInfo){
- showError(r.exceptionInfo);return;
- } else if(r.success){
- result = r.data;
- }
- }
- });
- return result;
- }
- });
|