FormPanelController.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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'
  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. }, {
  85. "text": "承付天数",
  86. "flex": 1,
  87. "dataIndex": "cu_promisedays",
  88. "width": 100
  89. }, {
  90. "text": "额度",
  91. "flex": 1,
  92. "dataIndex": "cu_credit",
  93. "width": 100
  94. }, {
  95. "text": "客户地址",
  96. "flex": 1,
  97. "dataIndex": "ca_address",
  98. "width": 250
  99. }]
  100. }) ;
  101. }
  102. },
  103. 'multidbfindtrigger[name=pd_prodcode]':{
  104. beforerender:function(f){
  105. Ext.apply(f,{
  106. conditionCode:'pr_code',
  107. dataUrl:'/api/document/product/list',
  108. addXtype: 'document-product-formpanel',
  109. addTitle: '物料资料',
  110. dbfinds:[
  111. {
  112. from:'id',to:'pd_prodid'
  113. },
  114. {
  115. from:'pr_code',to:'pd_prodcode'
  116. }, {
  117. from:'pr_detail',to:'pr_detail'
  118. }, {
  119. from:'pr_spec',to:'pr_spec'
  120. }],
  121. dbtpls:[{
  122. field:'pr_code',width:100
  123. },{
  124. field:'pr_detail',width:100
  125. }],
  126. defaultCondition: 'pr_statuscode="OPEN"',
  127. dbSearchFields:[{
  128. emptyText:'输入物料编号、名称或规格',
  129. xtype : "textfield",
  130. name : "search",
  131. width: 200,
  132. getCondition: function(v) {
  133. return "upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%'";
  134. },
  135. allowBlank : true,
  136. columnWidth : 0.25
  137. }],
  138. dbColumns:[
  139. {
  140. "text": "物料ID",
  141. "hidden": true,
  142. "dataIndex": "id",
  143. },{
  144. "text": "物料编号",
  145. "flex": 1,
  146. "dataIndex": "pr_code",
  147. "width": 100,
  148. "xtype": "",
  149. "items": null
  150. }, {
  151. "text": "物料名称",
  152. "flex": 1,
  153. "dataIndex": "pr_detail",
  154. "xtype": "",
  155. "items": null
  156. }, {
  157. "text": "规格",
  158. "flex": 1,
  159. "dataIndex": "pr_spec",
  160. "width": 200,
  161. "xtype": "",
  162. "items": null
  163. }, {
  164. "text": "单位",
  165. "flex": 1,
  166. "dataIndex": "pr_unit",
  167. "width": 200,
  168. "xtype": "",
  169. "items": null
  170. }, {
  171. "text": "品牌",
  172. "flex": 1,
  173. "dataIndex": "pr_brand",
  174. "width": 200,
  175. "xtype": "",
  176. "items": null
  177. }, {
  178. "text": "供应商ID",
  179. "flex": 0,
  180. "dataIndex": "pr_vendid",
  181. "width": 0,
  182. "xtype": "",
  183. "items": null
  184. }, {
  185. "text": "供应商编号",
  186. "flex": 1,
  187. "dataIndex": "pr_vendcode",
  188. "width": 200,
  189. "xtype": "",
  190. "items": null
  191. }, {
  192. "text": "供应商名称",
  193. "flex": 1,
  194. "dataIndex": "pr_vendname",
  195. "width": 200,
  196. "xtype": "",
  197. "items": null
  198. }, {
  199. "text": "最小包装量",
  200. "flex": 1,
  201. "dataIndex": "pr_zxbzs",
  202. "width": 200,
  203. "xtype": "",
  204. "items": null
  205. }]
  206. }) ;
  207. }
  208. },
  209. 'dbfindtrigger[name=pd_whname]':{
  210. beforerender:function(f){
  211. Ext.apply(f,{
  212. conditionCode:'wh_code',
  213. dataUrl:'/api/document/warehouse/list',
  214. addXtype: 'other-storeinformation',
  215. addTitle: '仓库资料',
  216. dbfinds:[{
  217. from:'id',to:'pd_whid',
  218. }, {
  219. from:'wh_code',to:'pd_whcode'
  220. }, {
  221. from:'wh_description',to:'pd_whname'
  222. }],
  223. dbtpls:[{
  224. field:'wh_code',width:100
  225. },{
  226. field:'wh_description',width:100
  227. }],
  228. dbColumns:[{
  229. "text": "仓库ID",
  230. "flex": 0,
  231. "dataIndex": "id",
  232. "width": 0,
  233. "xtype": "",
  234. "items": null
  235. },{
  236. "text": "仓库编号",
  237. "flex": 1,
  238. "dataIndex": "wh_code",
  239. "width": 100,
  240. "xtype": "",
  241. "items": null
  242. }, {
  243. "text": "仓库名称",
  244. "flex": 1,
  245. "dataIndex": "wh_description",
  246. "xtype": "",
  247. "items": null
  248. }, {
  249. "text": "仓库类型",
  250. "flex": 0,
  251. "dataIndex": "wh_type",
  252. "width": 200,
  253. "xtype": "",
  254. "items": null
  255. }, {
  256. "text": "仓库状态",
  257. "flex": 0,
  258. "dataIndex": "wh_status",
  259. "width": 200,
  260. "xtype": "",
  261. "items": null
  262. }]
  263. }) ;
  264. }
  265. }
  266. });
  267. },
  268. turnProdIn: function() {
  269. var me = this,
  270. form = me.getView(),
  271. id = form.getForm().findField(form._idField);
  272. form.BaseUtil.request({
  273. url: form._turnInUrl+id.value,
  274. method: 'POST',
  275. })
  276. .then(function(localJson) {
  277. if(localJson.success){
  278. var intValue = localJson.data.id,
  279. codeValue= localJson.data.code,
  280. name = localJson.data.name;
  281. openTab('sale-salein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  282. initId: intValue
  283. });
  284. showToast('转单成功');
  285. form.FormUtil.loadData(form);
  286. }
  287. })
  288. .catch(function(res) {
  289. console.error(res);
  290. showToast('转单失败: ' + res.message);
  291. });
  292. }
  293. });