FormPanelController.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. "hidden": true,
  107. "dataIndex": "id",
  108. }, {
  109. "text": "物料编号",
  110. "dataIndex": "pr_code",
  111. "width": 200,
  112. }, {
  113. "text": "物料名称",
  114. "width": 200,
  115. "dataIndex": "pr_detail",
  116. }, {
  117. "text": "规格",
  118. "dataIndex": "pr_spec",
  119. "width": 100,
  120. }, {
  121. "text": "单位",
  122. "dataIndex": "pr_spec",
  123. "width": 100,
  124. },{
  125. "text": "仓库id",
  126. "dataIndex": "pr_whid",
  127. "hidden": true,
  128. },{
  129. "text": "仓库编号",
  130. "dataIndex": "pr_whcode",
  131. "hidden": true,
  132. },{
  133. "text": "仓库",
  134. "dataIndex": "pr_whname",
  135. "width": 200,
  136. },{
  137. "text": "总库存数",
  138. "dataIndex": "po_onhand",
  139. "width": 100,
  140. },{
  141. "text": "类型",
  142. "dataIndex": "pr_kind",
  143. "width": 100,
  144. },{
  145. "text": "型号",
  146. "dataIndex": "pr_orispeccode",
  147. "width": 100,
  148. },{
  149. "text": "品牌",
  150. "dataIndex": "pr_brand",
  151. "width": 100,
  152. },{
  153. "text": "供应商",
  154. "dataIndex": "pr_vendname",
  155. "width": 100,
  156. },{
  157. "text": "最小包装",
  158. "dataIndex": "pr_zxbzs",
  159. "width": 100,
  160. },{
  161. "text": "L/T",
  162. "dataIndex": "pr_leadtime",
  163. "width": 100,
  164. }]
  165. }) ;
  166. }
  167. },
  168. //从表多选放大镜赋值关系 以及 tpl模板
  169. 'multidbfindtrigger[name=pd_prodcode]':{
  170. beforerender:function(f){
  171. Ext.apply(f,{
  172. //数据接口
  173. dataUrl:'/api/document/product/list',
  174. addXtype: 'document-product-formpanel',
  175. addTitle: '物料资料',
  176. //放大镜赋值设置
  177. dbfinds:[{
  178. from:'pr_code',to:'pd_prodcode'
  179. },{
  180. from:'pr_unit',to:'pd_unit'
  181. }],
  182. //联想设置
  183. dbtpls:[{
  184. field:'pr_code',width:100
  185. },{
  186. field:'pr_detail',width:100
  187. }],
  188. defaultCondition:"pr_statuscode='OPEN'",
  189. //窗口字段设置
  190. dbSearchFields:[{
  191. emptyText:'输入仓库编号或名称',
  192. xtype : "textfield",
  193. name : "name",
  194. allowBlank : true,
  195. columnWidth : 0.25,
  196. getCondition:function(v){
  197. return "(upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  198. }
  199. }],
  200. //窗口列设置
  201. dbColumns:[{
  202. "text": "物料ID",
  203. "hidden": true,
  204. "dataIndex": "id",
  205. }, {
  206. "text": "物料编号",
  207. "dataIndex": "pr_code",
  208. "width": 200,
  209. }, {
  210. "text": "物料名称",
  211. "width": 200,
  212. "dataIndex": "pr_detail",
  213. }, {
  214. "text": "规格",
  215. "dataIndex": "pr_spec",
  216. "width": 100,
  217. }, {
  218. "text": "单位",
  219. "dataIndex": "pr_spec",
  220. "width": 100,
  221. },{
  222. "text": "仓库id",
  223. "dataIndex": "pr_whid",
  224. "hidden": true,
  225. },{
  226. "text": "仓库编号",
  227. "dataIndex": "pr_whcode",
  228. "hidden": true,
  229. },{
  230. "text": "仓库",
  231. "dataIndex": "pr_whname",
  232. "width": 200,
  233. },{
  234. "text": "总库存数",
  235. "dataIndex": "po_onhand",
  236. "width": 100,
  237. },{
  238. "text": "类型",
  239. "dataIndex": "pr_kind",
  240. "width": 100,
  241. },{
  242. "text": "型号",
  243. "dataIndex": "pr_orispeccode",
  244. "width": 100,
  245. },{
  246. "text": "品牌",
  247. "dataIndex": "pr_brand",
  248. "width": 100,
  249. },{
  250. "text": "供应商",
  251. "dataIndex": "pr_vendname",
  252. "width": 100,
  253. },{
  254. "text": "最小包装",
  255. "dataIndex": "pr_zxbzs",
  256. "width": 100,
  257. },{
  258. "text": "L/T",
  259. "dataIndex": "pr_leadtime",
  260. "width": 100,
  261. }]
  262. }) ;
  263. }
  264. }
  265. });
  266. },
  267. turnIn: function() {
  268. var me = this,
  269. form = me.getView(),
  270. id = form.getForm().findField(form._idField);
  271. form.BaseUtil.request({
  272. url: form._turnInUrl+id.value,
  273. method: 'GET',
  274. })
  275. .then(function(localJson) {
  276. if(localJson.success){
  277. showToast('转单成功');
  278. }
  279. })
  280. .catch(function(res) {
  281. console.error(res);
  282. showToast('转单失败: ' + res.message);
  283. });
  284. }
  285. });