FormPanelController.js 12 KB

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