FormPanelController.js 9.5 KB

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