FormPanelController.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. // //联想查询条件
  28. // dbCondition:"CONCAT(ve_code, ve_name) like '{0}%'",
  29. // //放大镜窗口字段
  30. // dbSearchFields:[{
  31. // xtype : "textfield",
  32. // name : "ve_name",
  33. // conditionExpression:"ve_name like '{0}%'",//传入后台条件 替换占位符
  34. // fieldLabel : "供应商名称",
  35. // columnWidth : 0.25
  36. // }],
  37. // //放大镜窗口列表
  38. // dbColumns:[{
  39. // "text": "供应商ID",
  40. // "flex": 0,
  41. // "dataIndex": "ve_id",
  42. // "width": 0,
  43. // "xtype": "",
  44. // "items": null
  45. // },{
  46. // "text": "供应商编号",
  47. // "flex": 1,
  48. // "dataIndex": "ve_code",
  49. // "width": 100,
  50. // "xtype": "",
  51. // "items": null
  52. // }, {
  53. // "text": "供应商名称",
  54. // "flex": 1,
  55. // "dataIndex": "ve_name",
  56. // "xtype": "",
  57. // "items": null
  58. // }, {
  59. // "text": "供应商类型",
  60. // "flex": 0,
  61. // "dataIndex": "ve_type",
  62. // "width": 200,
  63. // "xtype": "",
  64. // "items": null
  65. // }]
  66. // }) ;
  67. // }
  68. // },
  69. //从表单选放大镜赋值关系 以及 tpl模板
  70. 'dbfindtrigger[name=mm_prodcode]':{
  71. beforerender:function(f){
  72. Ext.apply(f,{
  73. //数据接口
  74. dataUrl:'/api/document/product/list',
  75. addXtype: 'document-product-formpanel',
  76. addTitle: '物料资料',
  77. //放大镜赋值设置
  78. dbfinds:[{
  79. from:'pr_code',to:'mm_prodcode'
  80. },{
  81. from:'pr_unit',to:'pd_unit'
  82. }],
  83. //联想查询条件
  84. dbCondition:"CONCAT(pr_code, pr_detail) like '{0}%'",
  85. //联想设置
  86. dbtpls:[{
  87. field:'pr_code',width:100
  88. },{
  89. field:'pr_detail',width:100
  90. }],
  91. //窗口字段设置
  92. dbSearchFields:[{
  93. emptyText:'输入物料编号或物料名称',
  94. xtype : "textfield",
  95. name : "search",
  96. conditionExpression:"CONCAT(pr_code, pr_detail) like '{0}%'",
  97. allowBlank : true,
  98. columnWidth : 0.25
  99. }],
  100. //窗口列设置
  101. dbColumns:[{
  102. "text": "物料ID",
  103. "flex": 0,
  104. "dataIndex": "pr_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. }) ;
  130. }
  131. },
  132. //从表多选放大镜赋值关系 以及 tpl模板
  133. 'multidbfindtrigger[name=pd_prodcode]':{
  134. beforerender:function(f){
  135. Ext.apply(f,{
  136. //数据接口
  137. dataUrl:'http://192.168.253.31:9480/product/getProductsByCondition',
  138. //放大镜赋值设置
  139. dbfinds:[{
  140. from:'pr_code',to:'pd_prodcode'
  141. },{
  142. from:'pr_unit',to:'pd_unit'
  143. }],
  144. //联想查询条件
  145. dbCondition:"CONCAT(pr_code, pr_detail) like '{0}%'",
  146. //联想设置
  147. dbtpls:[{
  148. field:'pr_code',width:100
  149. },{
  150. field:'pr_detail',width:100
  151. }],
  152. //窗口字段设置
  153. dbSearchFields:[{
  154. emptyText:'输入物料编号或物料名称',
  155. xtype : "textfield",
  156. name : "search",
  157. conditionExpression:"CONCAT(pr_code, pr_detail) like '{0}%'",
  158. allowBlank : true,
  159. columnWidth : 0.25
  160. }],
  161. //窗口列设置
  162. dbColumns:[{
  163. "text": "物料ID",
  164. "flex": 0,
  165. "dataIndex": "pr_id",
  166. "width": 0,
  167. "xtype": "",
  168. "items": null
  169. },{
  170. "text": "物料编号",
  171. "flex": 1,
  172. "dataIndex": "pr_code",
  173. "width": 100,
  174. "xtype": "",
  175. "items": null
  176. }, {
  177. "text": "物料名称",
  178. "flex": 1,
  179. "dataIndex": "pr_detail",
  180. "xtype": "",
  181. "items": null
  182. }, {
  183. "text": "物料规格",
  184. "flex": 0,
  185. "dataIndex": "pr_spec",
  186. "width": 200,
  187. "xtype": "",
  188. "items": null
  189. }]
  190. }) ;
  191. }
  192. }
  193. });
  194. },
  195. turnIn: function() {
  196. var me = this,
  197. form = me.getView(),
  198. id = form.getForm().findField(form._idField);
  199. form.BaseUtil.request({
  200. url: form._turnInUrl+id.value,
  201. method: 'GET',
  202. })
  203. .then(function(localJson) {
  204. if(localJson.success){
  205. showToast('转单成功');
  206. }
  207. })
  208. .catch(function(res) {
  209. console.error(res);
  210. showToast('转单失败: ' + res.message);
  211. });
  212. }
  213. });