FormPanelController.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. Ext.define('saas.view.sale.saleout.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.sale-saleout-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. /**放大镜新增demo*/
  8. "field[name=combo]":{
  9. beforerender:function(f){
  10. f.addHandler=me.addCombo;
  11. }
  12. },
  13. //放大镜赋值关系 以及 tpl模板
  14. 'dbfindtrigger[name=pd_prodcode]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. conditionCode:'pr_code',
  18. dataUrl:basePath+'document/product/getProductsByCondition',
  19. dbfinds:[{
  20. from:'pr_code',to:'pd_prodcode',
  21. from:'pr_unit',to:'pd_unit'
  22. }],
  23. dbtpls:[{
  24. field:'pr_code',width:100
  25. },{
  26. field:'pr_detail',width:100
  27. },{
  28. field:'pr_unit',width:100
  29. }],
  30. dbColumns:[{
  31. "text": "物料ID",
  32. "flex": 0,
  33. "dataIndex": "pr_id",
  34. "width": 0,
  35. "xtype": "",
  36. "items": null
  37. },{
  38. "text": "物料编号",
  39. "flex": 1,
  40. "dataIndex": "pr_code",
  41. "width": 100,
  42. "xtype": "",
  43. "items": null
  44. }, {
  45. "text": "物料名称",
  46. "flex": 1,
  47. "dataIndex": "pr_detail",
  48. "xtype": "",
  49. "items": null
  50. }, {
  51. "text": "物料规格",
  52. "flex": 0,
  53. "dataIndex": "pr_spec",
  54. "width": 200,
  55. "xtype": "",
  56. "items": null
  57. }, {
  58. "text": "物料单位",
  59. "flex": 0,
  60. "dataIndex": "pr_unit",
  61. "width": 200,
  62. "xtype": "",
  63. "items": null
  64. }]
  65. }) ;
  66. }
  67. }
  68. });
  69. },
  70. addCombo:function(){
  71. var combo=this.ownerCmp;
  72. Ext.create('Ext.window.Window',{
  73. layout:'vbox',
  74. bodyPadding: 15,
  75. width:500,
  76. items:[{
  77. fieldLabel:'实际值',
  78. xtype:'textfield'
  79. },{
  80. fieldLabel:'显示值',
  81. xtype:'textfield'
  82. }],
  83. buttons:[{
  84. text:'确认',
  85. handler:function(b){
  86. combo.setValue('ok');
  87. b.up('window').close();
  88. }
  89. }],
  90. renderTo:this.ownerCmp.ownerCt.getEl()
  91. }).show();
  92. },
  93. turnProdIn: function() {
  94. var me = this,
  95. form = me.getView(),
  96. id = form.getForm().findField(form._idField);
  97. form.BaseUtil.request({
  98. url: form._turnInUrl+id.value,
  99. method: 'GET',
  100. })
  101. .then(function(res) {
  102. var localJson = new Ext.decode(res.responseText);
  103. if(localJson.success){
  104. Ext.Msg.alert('提示','转单成功');
  105. }
  106. })
  107. .catch(function() {
  108. Ext.Msg.alert('提示','转单失败');
  109. });
  110. }
  111. });