FormPanelController.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. dbfinds:[
  15. {
  16. from:'id',to:'pi_custid'
  17. },{
  18. from:'cu_code',to:'pi_custcode'
  19. },{
  20. from:'cu_name',to:'pi_custname'
  21. },{
  22. from:'ca_address',to:'pi_address'
  23. }],
  24. dbtpls:[
  25. {
  26. field:'cu_code',width:100
  27. },{
  28. field:'cu_name',width:100
  29. }],
  30. dbColumns:[
  31. {
  32. "text": "客户ID",
  33. "flex": 0,
  34. "dataIndex": "id",
  35. "width": 0,
  36. "xtype": "",
  37. "items": null
  38. },{
  39. "text": "客户编号",
  40. "flex": 1,
  41. "dataIndex": "cu_code",
  42. "width": 100,
  43. "xtype": "",
  44. "items": null
  45. }, {
  46. "text": "客户名称",
  47. "flex": 1,
  48. "dataIndex": "cu_name",
  49. "xtype": "",
  50. "items": null
  51. }, {
  52. "text": "客户类型",
  53. "flex": 1,
  54. "dataIndex": "cu_type",
  55. "width": 200,
  56. "xtype": "",
  57. "items": null
  58. }, {
  59. "text": "业务员编号",
  60. "flex": 1,
  61. "dataIndex": "cu_sellercode",
  62. "width": 100
  63. }, {
  64. "text": "业务员",
  65. "flex": 1,
  66. "dataIndex": "cu_sellername",
  67. "width": 100
  68. }, {
  69. "text": "税率",
  70. "flex": 1,
  71. "dataIndex": "cu_taxrate",
  72. "width": 100
  73. }, {
  74. "text": "承付天数",
  75. "flex": 1,
  76. "dataIndex": "cu_promisedays",
  77. "width": 100
  78. }, {
  79. "text": "额度",
  80. "flex": 1,
  81. "dataIndex": "cu_credit",
  82. "width": 100
  83. }, {
  84. "text": "客户地址",
  85. "flex": 1,
  86. "dataIndex": "ca_address",
  87. "width": 250
  88. }]
  89. }) ;
  90. }
  91. },
  92. 'multidbfindtrigger[name=pd_prodcode]':{
  93. beforerender:function(f){
  94. Ext.apply(f,{
  95. conditionCode:'pr_code',
  96. dataUrl:'/api/document/product/list',
  97. addXtype: 'document-product-formpanel',
  98. addTitle: '物料资料',
  99. dbfinds:[
  100. {
  101. from:'id',to:'pd_prodid'
  102. },
  103. {
  104. from:'pr_code',to:'pd_prodcode'
  105. }, {
  106. from:'pr_detail',to:'pr_detail'
  107. }, {
  108. from:'pr_spec',to:'pr_spec'
  109. }],
  110. dbtpls:[{
  111. field:'pr_code',width:100
  112. },{
  113. field:'pr_detail',width:100
  114. }],
  115. dbColumns:[
  116. {
  117. "text": "物料ID",
  118. "flex": 0,
  119. "dataIndex": "id",
  120. "width": 0,
  121. "xtype": "",
  122. "items": null
  123. },{
  124. "text": "物料编号",
  125. "flex": 1,
  126. "dataIndex": "pr_code",
  127. "width": 100,
  128. "xtype": "",
  129. "items": null
  130. }, {
  131. "text": "物料名称",
  132. "flex": 1,
  133. "dataIndex": "pr_detail",
  134. "xtype": "",
  135. "items": null
  136. }, {
  137. "text": "规格",
  138. "flex": 1,
  139. "dataIndex": "pr_spec",
  140. "width": 200,
  141. "xtype": "",
  142. "items": null
  143. }, {
  144. "text": "单位",
  145. "flex": 1,
  146. "dataIndex": "pr_unit",
  147. "width": 200,
  148. "xtype": "",
  149. "items": null
  150. }, {
  151. "text": "品牌",
  152. "flex": 1,
  153. "dataIndex": "pr_brand",
  154. "width": 200,
  155. "xtype": "",
  156. "items": null
  157. }, {
  158. "text": "供应商ID",
  159. "flex": 0,
  160. "dataIndex": "pr_vendid",
  161. "width": 0,
  162. "xtype": "",
  163. "items": null
  164. }, {
  165. "text": "供应商编号",
  166. "flex": 1,
  167. "dataIndex": "pr_vendcode",
  168. "width": 200,
  169. "xtype": "",
  170. "items": null
  171. }, {
  172. "text": "供应商名称",
  173. "flex": 1,
  174. "dataIndex": "pr_vendname",
  175. "width": 200,
  176. "xtype": "",
  177. "items": null
  178. }, {
  179. "text": "最小包装量",
  180. "flex": 1,
  181. "dataIndex": "pr_zxbzs",
  182. "width": 200,
  183. "xtype": "",
  184. "items": null
  185. }]
  186. }) ;
  187. }
  188. },
  189. 'dbfindtrigger[name=pd_whname]':{
  190. beforerender:function(f){
  191. Ext.apply(f,{
  192. conditionCode:'wh_code',
  193. dataUrl:'/api/document/warehouse/list',
  194. addXtype: 'other-storeinformation',
  195. addTitle: '仓库资料',
  196. dbfinds:[{
  197. from:'id',to:'pd_whid',
  198. }, {
  199. from:'wh_code',to:'pd_whcode'
  200. }, {
  201. from:'wh_description',to:'pd_whname'
  202. }],
  203. dbtpls:[{
  204. field:'wh_code',width:100
  205. },{
  206. field:'wh_description',width:100
  207. }],
  208. dbColumns:[{
  209. "text": "仓库ID",
  210. "flex": 0,
  211. "dataIndex": "id",
  212. "width": 0,
  213. "xtype": "",
  214. "items": null
  215. },{
  216. "text": "仓库编号",
  217. "flex": 1,
  218. "dataIndex": "wh_code",
  219. "width": 100,
  220. "xtype": "",
  221. "items": null
  222. }, {
  223. "text": "仓库名称",
  224. "flex": 1,
  225. "dataIndex": "wh_description",
  226. "xtype": "",
  227. "items": null
  228. }, {
  229. "text": "仓库类型",
  230. "flex": 0,
  231. "dataIndex": "wh_type",
  232. "width": 200,
  233. "xtype": "",
  234. "items": null
  235. }, {
  236. "text": "仓库状态",
  237. "flex": 0,
  238. "dataIndex": "wh_status",
  239. "width": 200,
  240. "xtype": "",
  241. "items": null
  242. }]
  243. }) ;
  244. }
  245. }
  246. });
  247. },
  248. turnProdIn: function() {
  249. var me = this,
  250. form = me.getView(),
  251. id = form.getForm().findField(form._idField);
  252. form.BaseUtil.request({
  253. url: form._turnInUrl+id.value,
  254. method: 'GET',
  255. })
  256. .then(function(localJson) {
  257. if(localJson.success){
  258. var intValue = localJson.data.id,
  259. codeValue= localJson.data.code,
  260. name = localJson.data.name;
  261. openTab('sale-salein-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  262. initId: intValue
  263. });
  264. showToast('转单成功');
  265. }
  266. })
  267. .catch(function(res) {
  268. console.error(res);
  269. showToast('转单失败: ' + res.message);
  270. });
  271. }
  272. });