FormPanelController.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. Ext.define('saas.view.stock.make.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.stock-make-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //主表单选放大镜模板
  8. // 'dbfindtrigger[name=pu_vendcode]':{
  9. // beforerender:function(f){
  10. // Ext.apply(f,{
  11. // //数据接口
  12. // dataUrl:'/api/document/vendor/list',
  13. // addXtype: 'document-vendor-formpanel',
  14. // addTitle: '供应商资料',
  15. // //赋值
  16. // dbfinds:[{
  17. // from:'ve_code',to:'pu_vendcode'
  18. // },{
  19. // from:'ve_name',to:'pu_vendname'
  20. // }],
  21. // //联想设置
  22. // dbtpls:[{
  23. // field:'ve_code',width:100
  24. // },{
  25. // field:'ve_name',width:100
  26. // }],
  27. // defaultCondition:"ve_statuscode='OPEN'",
  28. // //放大镜窗口字段
  29. // dbSearchFields:[{
  30. // emptyText:'输入仓库编号或名称',
  31. // xtype : "textfield",
  32. // name : "name",
  33. // allowBlank : true,
  34. // columnWidth : 0.25,
  35. // getCondition:function(v){
  36. // return "upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%'";
  37. // }
  38. // }],
  39. // //放大镜窗口列表
  40. // dbColumns:[{
  41. // "text": "供应商ID",
  42. // "flex": 0,
  43. // "dataIndex": "ve_id",
  44. // "width": 0,
  45. // "xtype": "",
  46. // "items": null
  47. // },{
  48. // "text": "供应商编号",
  49. // "flex": 1,
  50. // "dataIndex": "ve_code",
  51. // "width": 100,
  52. // "xtype": "",
  53. // "items": null
  54. // }, {
  55. // "text": "供应商名称",
  56. // "flex": 1,
  57. // "dataIndex": "ve_name",
  58. // "xtype": "",
  59. // "items": null
  60. // }, {
  61. // "text": "供应商类型",
  62. // "flex": 0,
  63. // "dataIndex": "ve_type",
  64. // "width": 200,
  65. // "xtype": "",
  66. // "items": null
  67. // }]
  68. // }) ;
  69. // }
  70. // },
  71. //从表单选放大镜赋值关系 以及 tpl模板
  72. 'dbfindtrigger[name=mm_prodcode]':{
  73. beforerender:function(f){
  74. Ext.apply(f,{
  75. //数据接口
  76. dataUrl:'/api/document/product/list',
  77. addXtype: 'document-product-formpanel',
  78. addTitle: '物料资料',
  79. //放大镜赋值设置
  80. dbfinds:[{
  81. from:'pr_code',to:'mm_prodcode'
  82. },{
  83. from:'pr_unit',to:'pd_unit'
  84. }],
  85. //联想设置
  86. dbtpls:[{
  87. field:'pr_code',width:100
  88. },{
  89. field:'pr_detail',width:100
  90. }],
  91. defaultCondition:"pr_statuscode='OPEN'",
  92. //窗口字段设置
  93. dbSearchFields:[{
  94. emptyText:'输入仓库编号或名称',
  95. xtype : "textfield",
  96. name : "name",
  97. allowBlank : true,
  98. columnWidth : 0.25,
  99. getCondition:function(v){
  100. return "(upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  101. }
  102. }],
  103. //窗口列设置
  104. dbColumns:[{
  105. "text": "物料ID",
  106. "flex": 0,
  107. "dataIndex": "pr_id",
  108. "width": 0,
  109. "xtype": "",
  110. "items": null
  111. },{
  112. "text": "物料编号",
  113. "flex": 1,
  114. "dataIndex": "pr_code",
  115. "width": 100,
  116. "xtype": "",
  117. "items": null
  118. }, {
  119. "text": "物料名称",
  120. "flex": 1,
  121. "dataIndex": "pr_detail",
  122. "xtype": "",
  123. "items": null
  124. }, {
  125. "text": "物料规格",
  126. "flex": 0,
  127. "dataIndex": "pr_spec",
  128. "width": 200,
  129. "xtype": "",
  130. "items": null
  131. }]
  132. }) ;
  133. }
  134. },
  135. //从表多选放大镜赋值关系 以及 tpl模板
  136. 'multidbfindtrigger[name=pd_prodcode]':{
  137. beforerender:function(f){
  138. Ext.apply(f,{
  139. //数据接口
  140. dataUrl:'/api/document/product/list',
  141. addXtype: 'document-product-formpanel',
  142. addTitle: '物料资料',
  143. //放大镜赋值设置
  144. dbfinds:[{
  145. from:'pr_code',to:'pd_prodcode'
  146. },{
  147. from:'pr_unit',to:'pd_unit'
  148. }],
  149. //联想设置
  150. dbtpls:[{
  151. field:'pr_code',width:100
  152. },{
  153. field:'pr_detail',width:100
  154. }],
  155. defaultCondition:"pr_statuscode='OPEN'",
  156. //窗口字段设置
  157. dbSearchFields:[{
  158. emptyText:'输入仓库编号或名称',
  159. xtype : "textfield",
  160. name : "name",
  161. allowBlank : true,
  162. columnWidth : 0.25,
  163. getCondition:function(v){
  164. return "(upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  165. }
  166. }],
  167. //窗口列设置
  168. dbColumns:[{
  169. "text": "物料ID",
  170. "flex": 0,
  171. "dataIndex": "pr_id",
  172. "width": 0,
  173. "xtype": "",
  174. "items": null
  175. },{
  176. "text": "物料编号",
  177. "flex": 1,
  178. "dataIndex": "pr_code",
  179. "width": 100,
  180. "xtype": "",
  181. "items": null
  182. }, {
  183. "text": "物料名称",
  184. "flex": 1,
  185. "dataIndex": "pr_detail",
  186. "xtype": "",
  187. "items": null
  188. }, {
  189. "text": "物料规格",
  190. "flex": 0,
  191. "dataIndex": "pr_spec",
  192. "width": 200,
  193. "xtype": "",
  194. "items": null
  195. }]
  196. }) ;
  197. }
  198. }
  199. });
  200. },
  201. turnIn: function() {
  202. var me = this,
  203. form = me.getView(),
  204. id = form.getForm().findField(form._idField);
  205. form.BaseUtil.request({
  206. url: form._turnInUrl+id.value,
  207. method: 'GET',
  208. })
  209. .then(function(localJson) {
  210. if(localJson.success){
  211. showToast('转单成功');
  212. }
  213. })
  214. .catch(function(res) {
  215. console.error(res);
  216. showToast('转单失败: ' + res.message);
  217. });
  218. }
  219. });