FormPanelController.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. Ext.define('saas.view.sale.saleIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.sale-salein-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:'http://192.168.0.181:8570/api/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:'http://192.168.0.181:8570/api/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. ],
  79. dbtpls:[{
  80. field:'pr_code',width:100
  81. },{
  82. field:'pr_detail',width:100
  83. },{
  84. field:'pr_unit',width:100
  85. }],
  86. dbColumns:[{
  87. "text": "物料ID",
  88. "flex": 0,
  89. "dataIndex": "pr_id",
  90. "width": 0,
  91. "xtype": "",
  92. "items": null
  93. },{
  94. "text": "物料编号",
  95. "flex": 1,
  96. "dataIndex": "pr_code",
  97. "width": 100,
  98. "xtype": "",
  99. "items": null
  100. }, {
  101. "text": "物料名称",
  102. "flex": 1,
  103. "dataIndex": "pr_detail",
  104. "xtype": "",
  105. "items": null
  106. }, {
  107. "text": "物料规格",
  108. "flex": 0,
  109. "dataIndex": "pr_spec",
  110. "width": 200,
  111. "xtype": "",
  112. "items": null
  113. }, {
  114. "text": "物料单位",
  115. "flex": 0,
  116. "dataIndex": "pr_unit",
  117. "width": 200,
  118. "xtype": "",
  119. "items": null
  120. }]
  121. }) ;
  122. }
  123. }
  124. });
  125. },
  126. addCombo:function(){
  127. var combo=this.ownerCmp;
  128. Ext.create('Ext.window.Window',{
  129. layout:'vbox',
  130. bodyPadding: 15,
  131. width:500,
  132. items:[{
  133. fieldLabel:'实际值',
  134. xtype:'textfield'
  135. },{
  136. fieldLabel:'显示值',
  137. xtype:'textfield'
  138. }],
  139. buttons:[{
  140. text:'确认',
  141. handler:function(b){
  142. combo.setValue('ok');
  143. b.up('window').close();
  144. }
  145. }],
  146. renderTo:this.ownerCmp.ownerCt.getEl()
  147. }).show();
  148. },
  149. turnOut: function() {
  150. var me = this,
  151. form = me.getView(),
  152. id = form.getForm().findField(form._idField);
  153. form.BaseUtil.request({
  154. url: form._turnOutUrl+id.value,
  155. method: 'GET',
  156. })
  157. .then(function(res) {
  158. var localJson = new Ext.decode(res.responseText);
  159. if(localJson.success){
  160. Ext.Msg.alert('提示','转单成功');
  161. }
  162. })
  163. .catch(function() {
  164. Ext.Msg.alert('提示','转单失败');
  165. });
  166. }
  167. });