FormPanelController.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. Ext.define('make.view.make.makePick.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.make-makepick-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. 'departDbfindTrigger[name=pi_departmentname]':{
  8. beforerender: function (f) {
  9. Ext.apply(f, {
  10. dbfinds: [{
  11. from: 'dp_name', to: 'pi_departmentname'
  12. },{
  13. from: 'dp_code', to: 'pi_departmentcode'
  14. }]
  15. });
  16. }
  17. },
  18. //从表多选放大镜赋值关系 以及 tpl模板
  19. 'multidbfindtrigger[name=pd_prodcode]':{
  20. beforerender:function(f){
  21. Ext.apply(f,{
  22. //放大镜赋值设置
  23. dbfinds:[{
  24. from:'id',to:'pd_prodid',ignore:true
  25. },{
  26. from:'pr_code',to:'pd_prodcode'
  27. },{
  28. from:'pr_detail',to:'pr_detail'
  29. },{
  30. from:'pr_spec',to:'pr_spec'
  31. },{
  32. from: 'pr_brand', to: 'pr_brand'
  33. },{
  34. from: 'pr_orispeccode', to: 'pr_orispeccode'
  35. },{
  36. from: 'pr_unit', to: 'pr_unit'
  37. }, {
  38. from:'pr_purcprice',to:'pd_lastprice'
  39. },{
  40. from:'pr_zxbzs',to:'pr_zxbzs'
  41. }],
  42. });
  43. }
  44. },
  45. 'multidbfindtrigger[name=pr_detail]': {
  46. beforerender: function (f) {
  47. Ext.apply(f, {
  48. dbfinds:[{
  49. from:'id',to:'pd_prodid',ignore:true
  50. },{
  51. from:'pr_code',to:'pd_prodcode'
  52. },{
  53. from:'pr_detail',to:'pr_detail'
  54. },{
  55. from:'pr_spec',to:'pr_spec'
  56. },{
  57. from: 'pr_brand', to: 'pr_brand'
  58. },{
  59. from: 'pr_orispeccode', to: 'pr_orispeccode'
  60. },{
  61. from: 'pr_unit', to: 'pr_unit'
  62. }, {
  63. from:'pr_purcprice',to:'pd_lastprice'
  64. },{
  65. from:'pr_zxbzs',to:'pr_zxbzs'
  66. }],
  67. });
  68. }
  69. },
  70. 'dbfindtrigger[name=pd_whname]':{
  71. beforerender:function(f){
  72. Ext.apply(f,{
  73. dbfinds:[{
  74. from:'id',to:'pd_whid',ignore:true
  75. }, {
  76. from:'wh_code',to:'pd_whcode'
  77. }, {
  78. from:'wh_description',to:'pd_whname'
  79. }]
  80. }) ;
  81. },
  82. beforequery: function(f) {
  83. var me = this,
  84. viewModel = me.getViewModel();
  85. var s= f.ownerCt.ownerCmp.getSelectionModel(),
  86. id = s.lastSelected.id,
  87. record = s.store.getById(id),
  88. pd_prodid = record.get("pd_prodid");
  89. if(pd_prodid) {
  90. Ext.apply(f, {
  91. efaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)",
  92. queryListMode:'OUT',
  93. dbColumns: [{
  94. text: "仓库ID",
  95. flex: 0,
  96. dataIndex: "id",
  97. hidden:true
  98. }, {
  99. text: "仓库编号",
  100. dataIndex: "wh_code",
  101. width: 150
  102. }, {
  103. text: "仓库名称",
  104. dataIndex: "wh_description",
  105. width: 200
  106. }, {
  107. text: "仓库类型",
  108. dataIndex: "wh_type",
  109. width: 110
  110. }, {
  111. text: "库存",
  112. dataIndex: "pw_onhand",
  113. width: 100,
  114. xtype: 'numbercolumn',
  115. renderer : function(v, m, r) {
  116. return saas.util.BaseUtil.numberFormat(v, 6, true);
  117. }
  118. }, {
  119. dataIndex: '',
  120. flex: 1
  121. }]
  122. });
  123. }else{
  124. Ext.apply(f, {
  125. efaultCondition:"wh_statuscode='ENABLE'",
  126. queryListMode:'',
  127. dbColumns: [{
  128. text: "仓库ID",
  129. flex: 0,
  130. dataIndex: "id",
  131. hidden:true
  132. }, {
  133. text: "仓库编号",
  134. dataIndex: "wh_code",
  135. width: 150
  136. }, {
  137. text: "仓库名称",
  138. dataIndex: "wh_description",
  139. width: 200
  140. }, {
  141. text: "仓库类型",
  142. dataIndex: "wh_type",
  143. width: 110
  144. }, {
  145. dataIndex: '',
  146. flex: 1
  147. }]
  148. });
  149. }
  150. },
  151. beforetriggerclick: function(f) {
  152. var me = this,
  153. viewModel = me.getViewModel();
  154. var s= f.ownerCt.ownerCmp.getSelectionModel(),
  155. id = s.lastSelected.id,
  156. record = s.store.getById(id),
  157. pd_prodid = record.get("pd_prodid");
  158. if(pd_prodid) {
  159. Ext.apply(f, {
  160. defaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)",
  161. queryListMode:'OUT',
  162. dbColumns: [{
  163. text: "仓库ID",
  164. flex: 0,
  165. dataIndex: "id",
  166. hidden:true
  167. }, {
  168. text: "仓库编号",
  169. dataIndex: "wh_code",
  170. width: 150
  171. }, {
  172. text: "仓库名称",
  173. dataIndex: "wh_description",
  174. width: 200
  175. }, {
  176. text: "仓库类型",
  177. dataIndex: "wh_type",
  178. width: 110
  179. }, {
  180. text: "库存",
  181. dataIndex: "pw_onhand",
  182. width: 100,
  183. xtype: 'numbercolumn',
  184. renderer : function(v, m, r) {
  185. return saas.util.BaseUtil.numberFormat(v, 6, true);
  186. }
  187. }, {
  188. dataIndex: '',
  189. flex: 1
  190. }]
  191. });
  192. }else{
  193. Ext.apply(f, {
  194. defaultCondition:"wh_statuscode='ENABLE'",
  195. queryListMode:'',
  196. dbColumns: [{
  197. text: "仓库ID",
  198. flex: 0,
  199. dataIndex: "id",
  200. hidden:true
  201. }, {
  202. text: "仓库编号",
  203. dataIndex: "wh_code",
  204. width: 150
  205. }, {
  206. text: "仓库名称",
  207. dataIndex: "wh_description",
  208. width: 200
  209. }, {
  210. text: "仓库类型",
  211. dataIndex: "wh_type",
  212. width: 110
  213. }, {
  214. dataIndex: '',
  215. flex: 1
  216. }]
  217. });
  218. }
  219. }
  220. }
  221. });
  222. },
  223. });