FormPanelController.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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/list',
  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. dbtpls:[
  23. {
  24. field:'cu_code',width:100
  25. },{
  26. field:'cu_name',width:100
  27. }],
  28. dbColumns:[
  29. {
  30. conditionCode:'id',
  31. "text": "客户ID",
  32. "flex": 0,
  33. "dataIndex": "id",
  34. "width": 100,
  35. "xtype": "",
  36. "items": null
  37. },{
  38. conditionCode:'cu_code',
  39. "text": "客户编号",
  40. "flex": 1,
  41. "dataIndex": "cu_code",
  42. "width": 100,
  43. "xtype": "",
  44. "items": null
  45. }, {
  46. conditionCode:'cu_name',
  47. "text": "客户名称",
  48. "flex": 1,
  49. "dataIndex": "cu_name",
  50. "xtype": "",
  51. "items": null
  52. }, {
  53. conditionCode:'cu_type',
  54. "text": "客户类型",
  55. "flex": 0,
  56. "dataIndex": "cu_type",
  57. "width": 200,
  58. "xtype": "",
  59. "items": null
  60. }]
  61. }) ;
  62. }
  63. },
  64. 'dbfindtrigger[name=pd_prodcode]':{
  65. beforerender:function(f){
  66. Ext.apply(f,{
  67. conditionCode:'pr_code',
  68. dataUrl:'/api/document/product/list',
  69. addXtype: 'document-product-formpanel',
  70. addTitle: '物料资料',
  71. dbfinds:[
  72. {
  73. from:'id',to:'pd_prodid'
  74. },
  75. {
  76. from:'pr_code',to:'pd_prodcode'
  77. }, {
  78. from:'pr_detail',to:'pr_detail'
  79. }, {
  80. from:'pr_spec',to:'pr_spec'
  81. }],
  82. dbtpls:[{
  83. field:'pr_code',width:100
  84. },{
  85. field:'pr_detail',width:100
  86. }],
  87. dbColumns:[{
  88. "text": "物料ID",
  89. "flex": 0,
  90. "dataIndex": "id",
  91. "width": 0,
  92. "xtype": "",
  93. "items": null
  94. },{
  95. "text": "物料编号",
  96. "flex": 1,
  97. "dataIndex": "pr_code",
  98. "width": 100,
  99. "xtype": "",
  100. "items": null
  101. }, {
  102. "text": "物料名称",
  103. "flex": 1,
  104. "dataIndex": "pr_detail",
  105. "xtype": "",
  106. "items": null
  107. }, {
  108. "text": "物料规格",
  109. "flex": 0,
  110. "dataIndex": "pr_spec",
  111. "width": 200,
  112. "xtype": "",
  113. "items": null
  114. }, {
  115. "text": "物料单位",
  116. "flex": 0,
  117. "dataIndex": "pr_unit",
  118. "width": 200,
  119. "xtype": "",
  120. "items": null
  121. }]
  122. }) ;
  123. }
  124. },
  125. 'dbfindtrigger[name=pd_whname]':{
  126. beforerender:function(f){
  127. Ext.apply(f,{
  128. conditionCode:'wh_code',
  129. dataUrl:'/api/document/warehouse/list',
  130. addXtype: 'other-storeinformation',
  131. addTitle: '仓库资料',
  132. dbfinds:[{
  133. from:'id',to:'pd_whid',
  134. }, {
  135. from:'wh_code',to:'pd_whcode'
  136. }, {
  137. from:'wh_description',to:'pd_whname'
  138. }],
  139. dbtpls:[{
  140. field:'wh_code',width:100
  141. },{
  142. field:'wh_description',width:100
  143. }],
  144. dbColumns:[{
  145. "text": "仓库ID",
  146. "flex": 0,
  147. "dataIndex": "id",
  148. "width": 0,
  149. "xtype": "",
  150. "items": null
  151. },{
  152. "text": "仓库编号",
  153. "flex": 1,
  154. "dataIndex": "wh_code",
  155. "width": 100,
  156. "xtype": "",
  157. "items": null
  158. }, {
  159. "text": "仓库名称",
  160. "flex": 1,
  161. "dataIndex": "wh_description",
  162. "xtype": "",
  163. "items": null
  164. }, {
  165. "text": "仓库类型",
  166. "flex": 0,
  167. "dataIndex": "wh_type",
  168. "width": 200,
  169. "xtype": "",
  170. "items": null
  171. }, {
  172. "text": "仓库状态",
  173. "flex": 0,
  174. "dataIndex": "wh_status",
  175. "width": 200,
  176. "xtype": "",
  177. "items": null
  178. }]
  179. }) ;
  180. }
  181. }
  182. });
  183. },
  184. turnProdIn: function() {
  185. var me = this,
  186. form = me.getView(),
  187. id = form.getForm().findField(form._idField);
  188. form.BaseUtil.request({
  189. url: form._turnInUrl+id.value,
  190. method: 'GET',
  191. })
  192. .then(function(localJson) {
  193. if(localJson.success){
  194. showToast('转单成功');
  195. }
  196. })
  197. .catch(function(res) {
  198. console.error(res);
  199. showToast('转单失败: ' + res.message);
  200. });
  201. }
  202. });