FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. Ext.define('saas.view.sale.saleout.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.sale-saleout-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=pi_custname]':{
  9. beforerender:function(f){
  10. Ext.apply(f,{
  11. dataUrl:'/api/document/customer/dbfind',
  12. addXtype: 'document-customer-formpanel',
  13. addTitle: '客户资料',
  14. defaultCondition:"cu_statuscode='OPEN'",
  15. dbfinds:[
  16. {
  17. from:'id',to:'pi_custid',ignore:true
  18. },{
  19. from:'cu_code',to:'pi_custcode'
  20. },{
  21. from:'cu_name',to:'pi_custname'
  22. },{
  23. from:'ca_address',to:'pi_address'
  24. }],
  25. dbtpls:[
  26. {
  27. field:'cu_code',width:100
  28. },{
  29. field:'cu_name',width:100
  30. }],
  31. dbSearchFields:[{
  32. emptyText:'输入客户编号或客户名称',
  33. xtype : "textfield",
  34. name : "search",
  35. getCondition: function(v) {
  36. return "(upper(cu_code) like '%"+v.toUpperCase()+"%' or upper(cu_name) like '%"+v.toUpperCase()+"%')";
  37. },
  38. allowBlank : true,
  39. columnWidth : 0.25
  40. }],
  41. dbColumns:[
  42. {
  43. "text": "客户ID",
  44. "flex": 0,
  45. "dataIndex": "id",
  46. "width": 0,
  47. "xtype": "",
  48. "items": null
  49. },{
  50. "text": "客户编号",
  51. "flex": 1,
  52. "dataIndex": "cu_code",
  53. "width": 100,
  54. "xtype": "",
  55. "items": null
  56. }, {
  57. "text": "客户名称",
  58. "flex": 1,
  59. "dataIndex": "cu_name",
  60. "xtype": "",
  61. "items": null
  62. }, {
  63. "text": "客户类型",
  64. "flex": 1,
  65. "dataIndex": "cu_type",
  66. "width": 200,
  67. "xtype": "",
  68. "items": null
  69. }, {
  70. "text": "业务员编号",
  71. "flex": 1,
  72. "dataIndex": "cu_sellercode",
  73. "width": 100
  74. }, {
  75. "text": "业务员",
  76. "flex": 1,
  77. "dataIndex": "cu_sellername",
  78. "width": 100
  79. }, {
  80. "text": "税率",
  81. "flex": 1,
  82. "dataIndex": "cu_taxrate",
  83. "width": 100,
  84. align:'right'
  85. }, {
  86. "text": "承付天数",
  87. "flex": 1,
  88. "dataIndex": "cu_promisedays",
  89. "width": 100,
  90. align:'right'
  91. }, {
  92. "text": "额度",
  93. "flex": 1,
  94. "dataIndex": "cu_credit",
  95. "width": 100,
  96. align:'right'
  97. }, {
  98. "text": "客户地址",
  99. "flex": 1,
  100. "dataIndex": "ca_address",
  101. "width": 250
  102. }]
  103. }) ;
  104. }
  105. },
  106. 'multidbfindtrigger[name=pd_prodcode]':{
  107. beforerender:function(f){
  108. Ext.apply(f,{
  109. conditionCode:'pr_code',
  110. dataUrl:'/api/document/product/list',
  111. addXtype: 'document-product-formpanel',
  112. addTitle: '物料资料',
  113. dbfinds:[{
  114. from:'id',to:'pd_prodid',ignore:true
  115. },
  116. {
  117. from:'pr_code',to:'pd_prodcode'
  118. }, {
  119. from:'pr_detail',to:'pr_detail'
  120. }, {
  121. from:'pr_spec',to:'pr_spec'
  122. }],
  123. dbtpls:[{
  124. field:'pr_code',width:100
  125. },{
  126. field:'pr_detail',width:100
  127. }],
  128. defaultCondition: "pr_statuscode='OPEN'",
  129. dbSearchFields:[{
  130. emptyText:'输入物料编号、名称或规格',
  131. xtype : "textfield",
  132. name : "search",
  133. width: 200,
  134. getCondition: function(v) {
  135. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  136. },
  137. allowBlank : true,
  138. columnWidth : 0.25
  139. }],
  140. dbColumns:[{
  141. "text": "物料ID",
  142. "hidden": true,
  143. "dataIndex": "id",
  144. }, {
  145. "text": "物料编号",
  146. "dataIndex": "pr_code",
  147. "width": 200,
  148. }, {
  149. "text": "物料名称",
  150. "width": 200,
  151. "dataIndex": "pr_detail",
  152. }, {
  153. "text": "规格",
  154. "dataIndex": "pr_spec",
  155. "width": 100,
  156. }, {
  157. "text": "单位",
  158. "dataIndex": "pr_unit",
  159. "width": 100,
  160. },{
  161. "text": "仓库id",
  162. "dataIndex": "pr_whid",
  163. "hidden": true,
  164. },{
  165. "text": "仓库编号",
  166. "dataIndex": "pr_whcode",
  167. "hidden": true,
  168. },{
  169. "text": "仓库",
  170. "dataIndex": "pr_whname",
  171. "width": 200,
  172. },{
  173. "text": "总库存数",
  174. "dataIndex": "po_onhand",
  175. "width": 100,
  176. },{
  177. "text": "类型",
  178. "dataIndex": "pr_kind",
  179. "width": 100,
  180. },{
  181. "text": "型号",
  182. "dataIndex": "pr_orispeccode",
  183. "width": 100,
  184. },{
  185. "text": "品牌",
  186. "dataIndex": "pr_brand",
  187. "width": 100,
  188. },{
  189. "text": "供应商",
  190. "dataIndex": "pr_vendname",
  191. "width": 100,
  192. },{
  193. "text": "最小包装",
  194. "dataIndex": "pr_zxbzs",
  195. "width": 100,
  196. },{
  197. "text": "L/T",
  198. "dataIndex": "pr_leadtime",
  199. "width": 100,
  200. }]
  201. }) ;
  202. }
  203. },
  204. 'dbfindtrigger[name=pd_whname]':{
  205. beforerender:function(f){
  206. Ext.apply(f,{
  207. conditionCode:'wh_code',
  208. dataUrl:'/api/document/warehouse/list',
  209. addXtype: 'other-storeinformation',
  210. addTitle: '仓库资料',
  211. dbfinds:[{
  212. from:'id',to:'pd_whid',ignore:true
  213. }, {
  214. from:'wh_code',to:'pd_whcode'
  215. }, {
  216. from:'wh_description',to:'pd_whname'
  217. }],
  218. dbtpls:[{
  219. field:'wh_code',width:100
  220. },{
  221. field:'wh_description',width:100
  222. }],
  223. defaultCondition: "wh_statuscode='OPEN'",
  224. dbSearchFields:[{
  225. emptyText:'输入物料编号、名称或规格',
  226. xtype : "textfield",
  227. name : "search",
  228. width: 200,
  229. getCondition: function(v) {
  230. return "(upper(wh_code) like '%" + v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  231. },
  232. allowBlank : true,
  233. columnWidth : 0.25
  234. }],
  235. dbColumns:[{
  236. "text": "仓库ID",
  237. "flex": 0,
  238. "dataIndex": "id",
  239. "width": 0,
  240. "xtype": "",
  241. "items": null
  242. },{
  243. "text": "仓库编号",
  244. "flex": 1,
  245. "dataIndex": "wh_code",
  246. "width": 100,
  247. "xtype": "",
  248. "items": null
  249. }, {
  250. "text": "仓库名称",
  251. "flex": 1,
  252. "dataIndex": "wh_description",
  253. "xtype": "",
  254. "items": null
  255. }, {
  256. "text": "仓库类型",
  257. "flex": 0,
  258. "dataIndex": "wh_type",
  259. "width": 200,
  260. "xtype": "",
  261. "items": null
  262. }, {
  263. "text": "仓库状态",
  264. "flex": 0,
  265. "dataIndex": "wh_status",
  266. "width": 200,
  267. "xtype": "",
  268. "items": null
  269. }]
  270. }) ;
  271. }
  272. }
  273. });
  274. },
  275. turnProdIn: function() {
  276. var me = this,
  277. form = me.getView(),
  278. id = form.getForm().findField(form._idField);
  279. form.BaseUtil.request({
  280. url: form._turnInUrl+id.value,
  281. method: 'POST',
  282. })
  283. .then(function(localJson) {
  284. if(localJson.success){
  285. var intValue = localJson.data.id,
  286. codeValue= localJson.data.code,
  287. name = localJson.data.name;
  288. openTab('sale-salein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  289. initId: intValue
  290. });
  291. showToast('转单成功');
  292. form.FormUtil.loadData(form);
  293. }
  294. })
  295. .catch(function(res) {
  296. console.error(res);
  297. showToast('转单失败: ' + res.message);
  298. });
  299. }
  300. });