|
|
@@ -0,0 +1,85 @@
|
|
|
+Ext.QuickTips.init();
|
|
|
+Ext.define('erp.controller.scm.product.ProductRelation', {
|
|
|
+ extend: 'Ext.app.Controller',
|
|
|
+ FormUtil: Ext.create('erp.util.FormUtil'),
|
|
|
+ BaseUtil: Ext.create('erp.util.BaseUtil'),
|
|
|
+ GridUtil: Ext.create('erp.util.GridUtil'),
|
|
|
+ views:[
|
|
|
+ 'scm.product.ProductRelation','core.form.Panel','core.button.Add','core.button.Save','core.button.Close',
|
|
|
+ 'core.button.Update','core.button.CleanDetail','core.form.YnField','core.grid.YnColumn','core.button.Flow',
|
|
|
+ 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.form.MultiField','core.grid.Panel2'
|
|
|
+ ],
|
|
|
+ init:function(){
|
|
|
+ var me = this;
|
|
|
+ this.control({
|
|
|
+ 'erpFormPanel': {
|
|
|
+ afterload: function(form) {
|
|
|
+ var items = form.items.items;
|
|
|
+ Ext.each(items, function(item) {
|
|
|
+ item.setReadOnly(true);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'erpGridPanel2': {
|
|
|
+ itemclick: function(view,record){
|
|
|
+ me.itemclick(view,record,me);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'erpSaveButton': {
|
|
|
+ click: function(btn){
|
|
|
+ this.FormUtil.beforeSave(this);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'erpCloseButton': {
|
|
|
+ click: function(btn){
|
|
|
+ this.FormUtil.beforeClose(this);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'erpUpdateButton': {
|
|
|
+ afterrender: function(btn){
|
|
|
+ if(Ext.getCmp('bd_id').value == null || Ext.getCmp('bd_id').value == ''){
|
|
|
+ btn.hide();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ click: function(btn){
|
|
|
+ this.FormUtil.onUpdate(this);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'erpCleanDetailButton': {
|
|
|
+ afterrender: function(btn){
|
|
|
+ if(Ext.getCmp('bd_id').value == null || Ext.getCmp('bd_id').value == ''){
|
|
|
+ btn.hide();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ click: function(btn){
|
|
|
+ var bd_id = Ext.getCmp('bd_id');
|
|
|
+ Ext.Ajax.request({
|
|
|
+ url: basePath + 'scm/product/deleteProductRelation.action',
|
|
|
+ params: {
|
|
|
+ id: Ext.getCmp('bd_id').value,
|
|
|
+ pr_code: bd_id.value,
|
|
|
+ caller: caller
|
|
|
+ },
|
|
|
+ callback: function(opt, s, r) {
|
|
|
+ var rs = Ext.decode(r.responseText);
|
|
|
+ if(rs.exceptionInfo) {
|
|
|
+ showError(rs.exceptionInfo);return;
|
|
|
+ } else {
|
|
|
+ var grid = Ext.getCmp('grid');
|
|
|
+ Ext.Msg.alert("提示", "清除明细成功!", function(){
|
|
|
+ me.GridUtil.loadNewStore(grid, {
|
|
|
+ caller: caller,
|
|
|
+ condition: "prr_bdid='"+bd_id.value+"'"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ itemclick:function(view,record,me){
|
|
|
+ me.GridUtil.onGridItemClick(view,record);
|
|
|
+ }
|
|
|
+});
|