| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- Ext.define('saas.view.sale.saleout.FormPanelController', {
- extend: 'saas.view.core.form.FormPanelController',
- alias: 'controller.sale-saleout-formpanel',
-
- init: function (form) {
- var me = this;
- this.control({
- //放大镜赋值关系 以及 tpl模板
- 'dbfindtrigger[name=pi_custname]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[
- {
- from:'id',to:'pi_custid',ignore:true
- },{
- from:'cu_code',to:'pi_custcode'
- },{
- from:'cu_name',to:'pi_custname'
- },{
- from:'ca_address',to:'pi_address'
- }],
- }) ;
- }
- },
- 'multidbfindtrigger[name=pd_prodcode]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[{
- from:'id',to:'pd_prodid',ignore:true
- }, {
- from:'pr_code',to:'pd_prodcode'
- }, {
- from:'pr_detail',to:'pr_detail'
- }, {
- from:'pr_spec',to:'pr_spec'
- },{
- from: 'pr_brand', to: 'pr_brand'
- },{
- from: 'pr_orispeccode', to: 'pr_orispeccode'
- },{
- from: 'pr_unit', to: 'pr_unit'
- }, {
- from:'pr_whid',to:'pd_whid'
- }, {
- from:'pr_whcode',to:'pd_whcode'
- }, {
- from:'pr_whname',to:'pd_whname'
- }, {
- from:'pr_saleprice',to:'pd_sendprice'
- }],
- }) ;
- }
- },
- 'dbfindtrigger[name=pd_whname]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[{
- from:'id',to:'pd_whid',ignore:true
- }, {
- from:'wh_code',to:'pd_whcode'
- }, {
- from:'wh_description',to:'pd_whname'
- }],
- }) ;
- }
- },
- 'dbfindtrigger[name=pi_seller]': {
- beforerender: function (f) {
- Ext.apply(f, {
- dbfinds: [{
- from: 'id',
- to: 'pi_sellerid',
- ignore: true
- }, {
- from: 'em_code',
- to: 'pi_sellercode'
- }, {
- from: 'em_name',
- to: 'pi_seller'
- }],
- });
- }
- },
- 'remotecombo[name=pi_address]':{
- focus:function(f){
- //获取客户ID
- var pi_custid = f.ownerCt.down('[name=pi_custid]').value;
- if(pi_custid&&pi_custid!=""){
- Ext.apply(f.store.proxy.extraParams, {
- id:pi_custid
- });
- f.store.load();
- }else{
- saas.util.BaseUtil.showErrorToast('请先选择客户后在维护交货地址');
- f.setDisabled(true);
- }
- },
- expand:function(f){
- if(f.picker&&f.isExpanded){
- f.picker.setHeight(33*f.store.getCount())
- }
- }
- }
- });
- },
- turnProdIn: function() {
- var me = this,
- form = me.getView(),
- id = form.getForm().findField(form._idField);
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._turnInUrl + '/' + id.value,
- method: 'POST',
- })
- .then(function(localJson) {
- form.setLoading(false);
- if(localJson.success){
- var intValue = localJson.data.id,
- codeValue= localJson.data.code,
- name = localJson.data.name;
- saas.util.BaseUtil.openTab('sale-salein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
- initId: intValue
- });
- saas.util.BaseUtil.showSuccessToast('转单成功');
- saas.util.FormUtil.loadData(form);
- }
- })
- .catch(function(e) {
- form.setLoading(false);
- saas.util.BaseUtil.showErrorToast('转单失败: ' + e.message);
- });
- }
- });
|