FormPanelController.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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=pi_vendname]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dataUrl:'/api/document/vendor/list',
  18. // dataUrl:'http://localhost:9480/vendor/list',
  19. addXtype: 'document-vendor-formpanel',
  20. addTitle: '供应商资料',
  21. dbfinds:[{
  22. from:'ve_id',to:'pi_vendid'
  23. },{
  24. from:'ve_code',to:'pi_vendcode'
  25. },{
  26. from:'ve_name',to:'pi_vendname'
  27. }],
  28. dbtpls:[{
  29. field:'ve_code',width:100
  30. },{
  31. field:'ve_name',width:100
  32. }],
  33. dbColumns:[{
  34. conditionCode:'ve_id',
  35. "text": "供应商ID",
  36. "flex": 0,
  37. "dataIndex": "ve_id",
  38. "width": 0,
  39. "xtype": "",
  40. "items": null
  41. },{
  42. conditionCode:'ve_code',
  43. "text": "供应商编号",
  44. "flex": 1,
  45. "dataIndex": "ve_code",
  46. "width": 100,
  47. "xtype": "",
  48. "items": null
  49. }, {
  50. conditionCode:'ve_name',
  51. "text": "供应商名称",
  52. "flex": 1,
  53. "dataIndex": "ve_name",
  54. "xtype": "",
  55. "items": null
  56. }, {
  57. conditionCode:'ve_type',
  58. "text": "供应商类型",
  59. "flex": 0,
  60. "dataIndex": "ve_type",
  61. "width": 200,
  62. "xtype": "",
  63. "items": null
  64. }]
  65. }) ;
  66. }
  67. },
  68. //放大镜赋值关系 以及 tpl模板
  69. 'multidbfindtrigger[name=pd_prodcode]':{
  70. beforerender:function(f){
  71. Ext.apply(f,{
  72. dataUrl:'/api/document/product/list',
  73. // dataUrl:'http://localhost:9480/product/list',
  74. addXtype: 'document-product-formpanel',
  75. addTitle: '物料资料',
  76. dbfinds:[{
  77. from:'id',to:'pd_prodid'
  78. },{
  79. from:'pr_code',to:'pd_prodcode'
  80. },{
  81. from:'pr_detail',to:'pr_detail'
  82. },{
  83. from:'pr_spec',to:'pr_spec'
  84. }],
  85. dbtpls:[{
  86. field:'pr_code',width:100
  87. },{
  88. field:'pr_detail',width:100
  89. },{
  90. field:'pr_spec',width:100
  91. }],
  92. dbColumns:[{
  93. "text": "物料ID",
  94. "flex": 0,
  95. "dataIndex": "pr_id",
  96. "width": 0,
  97. "xtype": "",
  98. "items": null
  99. },{
  100. "text": "物料编号",
  101. "flex": 1,
  102. "dataIndex": "pr_code",
  103. "width": 100,
  104. "xtype": "",
  105. "items": null
  106. }, {
  107. "text": "物料名称",
  108. "flex": 1,
  109. "dataIndex": "pr_detail",
  110. "xtype": "",
  111. "items": null
  112. }, {
  113. "text": "物料规格",
  114. "flex": 0,
  115. "dataIndex": "pr_spec",
  116. "width": 200,
  117. "xtype": "",
  118. "items": null
  119. }, {
  120. "text": "物料单位",
  121. "flex": 0,
  122. "dataIndex": "pr_unit",
  123. "width": 200,
  124. "xtype": "",
  125. "items": null
  126. }]
  127. }) ;
  128. }
  129. },
  130. //放大镜赋值关系 以及 tpl模板
  131. 'dbfindtrigger[name=pd_whname]':{
  132. beforerender:function(f){
  133. Ext.apply(f,{
  134. dataUrl:'/api/document/warehouse/list',
  135. // dataUrl:'http://localhost:9480/warehouse/list',
  136. addXtype: 'other-warehouse',
  137. addTitle: '仓库资料',
  138. dbfinds:[{
  139. from:'id',to:'pd_whid'
  140. },{
  141. from:'wh_code',to:'pd_whcode'
  142. },{
  143. from:'wh_description',to:'pd_whname'
  144. }],
  145. dbtpls:[{
  146. field:'pd_whcode',width:100
  147. },{
  148. field:'pd_whname',width:100
  149. }],
  150. dbColumns:[{
  151. "text": "仓库ID",
  152. "flex": 0,
  153. "dataIndex": "id",
  154. "width": 0,
  155. "xtype": "",
  156. "items": null
  157. },{
  158. "text": "仓库编号",
  159. "flex": 1,
  160. "dataIndex": "wh_code",
  161. "width": 100,
  162. "xtype": "",
  163. "items": null
  164. }, {
  165. "text": "仓库名称",
  166. "flex": 1,
  167. "dataIndex": "wh_description",
  168. "xtype": "",
  169. "items": null
  170. }, ]
  171. }) ;
  172. }
  173. }
  174. });
  175. },
  176. addCombo:function(){
  177. var combo=this.ownerCmp;
  178. Ext.create('Ext.window.Window',{
  179. layout:'vbox',
  180. bodyPadding: 15,
  181. width:500,
  182. items:[{
  183. fieldLabel:'实际值',
  184. xtype:'textfield'
  185. },{
  186. fieldLabel:'显示值',
  187. xtype:'textfield'
  188. }],
  189. buttons:[{
  190. text:'确认',
  191. handler:function(b){
  192. combo.setValue('ok');
  193. b.up('window').close();
  194. }
  195. }],
  196. renderTo:this.ownerCmp.ownerCt.getEl()
  197. }).show();
  198. },
  199. turnOut: function() {
  200. var me = this,
  201. form = me.getView(),
  202. id = form.getForm().findField(form._idField);
  203. form.BaseUtil.request({
  204. url: form._turnOutUrl+id.value,
  205. method: 'POST',
  206. })
  207. .then(function(localJson) {
  208. if(localJson.success){
  209. var intValue = localJson.data.id,
  210. codeValue= localJson.data.code,
  211. name = localJson.data.name;
  212. openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  213. initId: intValue
  214. });
  215. showToast('转单成功');
  216. }
  217. })
  218. .catch(function(res) {
  219. console.error(res);
  220. showToast('转单失败: ' + res.message);
  221. });
  222. }
  223. });