| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- Ext.define('saas.view.sale.sale.FormPanelController', {
- extend: 'saas.view.core.form.FormPanelController',
- alias: 'controller.sale-sale-formpanel',
- init: function (form) {
- var me = this;
- this.control({
- //放大镜赋值关系 以及 tpl模板
- 'dbfindtrigger[name=sa_custname]': {
- beforerender: function (f) {
- Ext.apply(f, {
- dbfinds: [{
- from: 'id',
- to: 'sa_custid',
- ignore: true
- }, {
- from: 'cu_code',
- to: 'sa_custcode'
- }, {
- from: 'cu_name',
- to: 'sa_custname'
- }, {
- from: 'ca_address',
- to: 'sa_toplace'
- }, {
- from: 'cu_sellercode',
- to: 'sa_sellercode'
- }, {
- from: 'cu_sellername',
- to: 'sa_seller'
- }, {
- from:'cu_sellerid',to:'cu_sellerid'
- }],
- });
- }
- }, // 主表-采购员名称
- 'dbfindtrigger[name=sa_seller]': {
- beforerender: function (f) {
- Ext.apply(f, {
- dbfinds: [{
- from: 'id',
- to: 'sa_sellerid',
- ignore: true
- }, {
- from: 'em_code',
- to: 'sa_sellercode'
- }, {
- from: 'em_name',
- to: 'sa_seller'
- }],
- });
- }
- },
- //放大镜赋值关系 以及 tpl模板
- 'multidbfindtrigger[name=sd_prodcode]': {
- beforerender: function (f) {
- Ext.apply(f, {
- dbfinds: [{
- from: 'pr_code', to: 'sd_prodcode'
- }, {
- from: 'pr_saleprice', to: 'sd_price'
- }, {
- from: 'pr_detail', to: 'pr_detail'
- }, {
- from: 'pr_spec', to: 'pr_spec'
- }, {
- from: 'id', to: 'sd_prodid', ignore: true
- }],
- });
- }
- },
- 'remotecombo[name=sa_toplace]':{
- focus:function(f){
- //获取客户ID
- var sa_custid = f.ownerCt.down('[name=sa_custid]').value;
- if(sa_custid&&sa_custid!=""){
- Ext.apply(f.store.proxy.extraParams, {
- id:sa_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())
- }
- }
- }
- });
- },
- turnOut: function () {
- var me = this,
- form = me.getView(),
- id = form.getForm().findField(form._idField);
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._turnOutUrl + '/' + id.value,
- method: 'POST',
- })
- .then(function (localJson) {
- form.setLoading(false);
- if (localJson.success) {
- var intValue = localJson.data.id,
- codeValue = localJson.data.code,
- name = '出货单';
- saas.util.BaseUtil.openTab('sale-saleout-formpanel', name + "(" + codeValue + ")", codeValue + intValue, {
- initId: intValue
- });
- saas.util.BaseUtil.showSuccessToast('转单成功');
- saas.util.FormUtil.loadData(form);
- }
- })
- .catch(function (res) {
- form.setLoading(false);
- console.error(res);
- saas.util.BaseUtil.showErrorToast('转单失败: ' + res.message);
- });
- },
- turnPurchase: function () {
- var me = this,
- form = me.getView(),
- id = form.getForm().findField(form._idField);
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._turnPurchase + '/' + 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('purchase-purchase-formpanel', name + "(" + codeValue + ")", codeValue + intValue, {
- initId: intValue
- });
- saas.util.BaseUtil.showSuccessToast('转单成功');
- saas.util.FormUtil.loadData(form);
- }
- })
- .catch(function (res) {
- form.setLoading(false);
- console.error(res);
- saas.util.BaseUtil.showErrorToast('转单失败: ' + res.message);
- });
- }
- });
|