FormPanelController.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchasein-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=pu_vendcode]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dataUrl:basePath+'document/vendor/getVendorsByCondition',
  18. dbfinds:[{
  19. from:'ve_code',to:'pu_vendcode'
  20. },{
  21. from:'ve_name',to:'pu_vendname'
  22. }],
  23. dbtpls:[{
  24. field:'ve_code',width:100
  25. },{
  26. field:'ve_name',width:100
  27. }],
  28. dbColumns:[{
  29. conditionCode:'ve_id',
  30. "text": "供应商ID",
  31. "flex": 0,
  32. "dataIndex": "ve_id",
  33. "width": 0,
  34. "xtype": "",
  35. "items": null
  36. },{
  37. conditionCode:'ve_code',
  38. "text": "供应商编号",
  39. "flex": 1,
  40. "dataIndex": "ve_code",
  41. "width": 100,
  42. "xtype": "",
  43. "items": null
  44. }, {
  45. conditionCode:'ve_name',
  46. "text": "供应商名称",
  47. "flex": 1,
  48. "dataIndex": "ve_name",
  49. "xtype": "",
  50. "items": null
  51. }, {
  52. conditionCode:'ve_type',
  53. "text": "供应商类型",
  54. "flex": 0,
  55. "dataIndex": "ve_type",
  56. "width": 200,
  57. "xtype": "",
  58. "items": null
  59. }]
  60. }) ;
  61. }
  62. },
  63. //放大镜赋值关系 以及 tpl模板
  64. 'dbfindtrigger[name=pd_prodcode]':{
  65. beforerender:function(f){
  66. Ext.apply(f,{
  67. conditionCode:'pr_code',
  68. dataUrl:basePath+'document/product/getProductsByCondition',
  69. dbfinds:[{
  70. from:'pr_id',to:'pd_prodid'
  71. },{
  72. from:'pr_code',to:'pd_prodcode'
  73. },{
  74. from:'pr_detail',to:'pr_detail'
  75. },{
  76. from:'pr_unit',to:'pd_unit'
  77. }],
  78. dbtpls:[{
  79. field:'pr_code',width:100
  80. },{
  81. field:'pr_detail',width:100
  82. },{
  83. field:'pr_unit',width:100
  84. }],
  85. dbColumns:[{
  86. "text": "物料ID",
  87. "flex": 0,
  88. "dataIndex": "pr_id",
  89. "width": 0,
  90. "xtype": "",
  91. "items": null
  92. },{
  93. "text": "物料编号",
  94. "flex": 1,
  95. "dataIndex": "pr_code",
  96. "width": 100,
  97. "xtype": "",
  98. "items": null
  99. }, {
  100. "text": "物料名称",
  101. "flex": 1,
  102. "dataIndex": "pr_detail",
  103. "xtype": "",
  104. "items": null
  105. }, {
  106. "text": "物料规格",
  107. "flex": 0,
  108. "dataIndex": "pr_spec",
  109. "width": 200,
  110. "xtype": "",
  111. "items": null
  112. }, {
  113. "text": "物料单位",
  114. "flex": 0,
  115. "dataIndex": "pr_unit",
  116. "width": 200,
  117. "xtype": "",
  118. "items": null
  119. }]
  120. }) ;
  121. }
  122. }
  123. });
  124. },
  125. addCombo:function(){
  126. var combo=this.ownerCmp;
  127. Ext.create('Ext.window.Window',{
  128. layout:'vbox',
  129. bodyPadding: 15,
  130. width:500,
  131. items:[{
  132. fieldLabel:'实际值',
  133. xtype:'textfield'
  134. },{
  135. fieldLabel:'显示值',
  136. xtype:'textfield'
  137. }],
  138. buttons:[{
  139. text:'确认',
  140. handler:function(b){
  141. combo.setValue('ok');
  142. b.up('window').close();
  143. }
  144. }],
  145. renderTo:this.ownerCmp.ownerCt.getEl()
  146. }).show();
  147. },
  148. turnOut: function() {
  149. var me = this,
  150. form = me.getView(),
  151. id = form.getForm().findField(form._idField);
  152. form.BaseUtil.request({
  153. url: form._turnOutUrl+id.value,
  154. method: 'GET',
  155. })
  156. .then(function(res) {
  157. var localJson = new Ext.decode(res.responseText);
  158. if(localJson.success){
  159. Ext.Msg.alert('提示','转单成功');
  160. }
  161. })
  162. .catch(function() {
  163. Ext.Msg.alert('提示','转单失败');
  164. });
  165. }
  166. });