FormPanelController.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. Ext.define('saas.view.stock.appropriationInOut.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.stock-appropriationinout-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/list',
  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_code',to:'pd_prodcode'
  71. }],
  72. dbtpls:[{
  73. field:'pr_code',width:100
  74. },{
  75. field:'pr_detail',width:100
  76. }],
  77. dbColumns:[{
  78. "text": "物料ID",
  79. "flex": 0,
  80. "dataIndex": "pr_id",
  81. "width": 0,
  82. "xtype": "",
  83. "items": null
  84. },{
  85. "text": "物料编号",
  86. "flex": 1,
  87. "dataIndex": "pr_code",
  88. "width": 100,
  89. "xtype": "",
  90. "items": null
  91. }, {
  92. "text": "物料名称",
  93. "flex": 1,
  94. "dataIndex": "pr_detail",
  95. "xtype": "",
  96. "items": null
  97. }, {
  98. "text": "物料规格",
  99. "flex": 0,
  100. "dataIndex": "pr_spec",
  101. "width": 200,
  102. "xtype": "",
  103. "items": null
  104. }]
  105. }) ;
  106. }
  107. }
  108. });
  109. },
  110. addCombo:function(){
  111. var combo=this.ownerCmp;
  112. Ext.create('Ext.window.Window',{
  113. layout:'vbox',
  114. bodyPadding: 15,
  115. width:500,
  116. items:[{
  117. fieldLabel:'实际值',
  118. xtype:'textfield'
  119. },{
  120. fieldLabel:'显示值',
  121. xtype:'textfield'
  122. }],
  123. buttons:[{
  124. text:'确认',
  125. handler:function(b){
  126. combo.setValue('ok');
  127. b.up('window').close();
  128. }
  129. }],
  130. renderTo:this.ownerCmp.ownerCt.getEl()
  131. }).show();
  132. },
  133. turnIn: function() {
  134. var me = this,
  135. form = me.getView(),
  136. id = form.getForm().findField(form._idField);
  137. form.BaseUtil.request({
  138. url: form._turnInUrl+id.value,
  139. method: 'GET',
  140. })
  141. .then(function(localJson) {
  142. if(localJson.success){
  143. Ext.Msg.alert('提示','转单成功');
  144. }
  145. })
  146. .catch(function() {
  147. Ext.Msg.alert('提示','转单失败');
  148. });
  149. }
  150. });