FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. Ext.define('saas.view.purchase.purchaseOut.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchaseout-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. /**放大镜新增demo*/
  8. "field[name=combo]":{
  9. beforerender:function(f){
  10. f.addHandler=me.addCombo;
  11. }
  12. },
  13. //放大镜赋值关系 以及 tpl模板
  14. 'dbfindtrigger[name=pi_vendname]':{
  15. beforerender:function(f){
  16. Ext.apply(f,{
  17. dataUrl:'/api/document/vendor/list',
  18. // dataUrl:'http://localhost:9480/vendor/list',
  19. addXtype: 'document-vendor-formpanel',
  20. addTitle: '供应商资料',
  21. defaultCondition:"ve_statuscode='OPEN'",
  22. dbfinds:[{
  23. from:'id',to:'pi_vendid',ignore:true
  24. },{
  25. from:'ve_code',to:'pi_vendcode'
  26. },{
  27. from:'ve_name',to:'pi_vendname'
  28. }],
  29. dbtpls:[{
  30. field:'ve_code',width:100
  31. },{
  32. field:'ve_name',width:100
  33. }],
  34. defaultCondition: "ve_statuscode='OPEN'",
  35. dbSearchFields:[{
  36. emptyText:'输入供应商编号或名称',
  37. xtype : "textfield",
  38. name : "search",
  39. getCondition: function(v) {
  40. return "(upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%')";
  41. },
  42. allowBlank : true,
  43. columnWidth : 0.25
  44. }],
  45. dbColumns:[{
  46. "text": "供应商ID",
  47. "hidden": true,
  48. "dataIndex": "id",
  49. "width": 100,
  50. "xtype": "numbercolumn"
  51. },{
  52. "text": "供应商编号",
  53. "dataIndex": "ve_code",
  54. "width": 200
  55. }, {
  56. "text": "供应商名称",
  57. "dataIndex": "ve_name",
  58. "width": 200
  59. }, {
  60. "text": "供应商类型",
  61. "dataIndex": "ve_type",
  62. "width": 180,
  63. "items": null
  64. }, {
  65. "text": "税率",
  66. "dataIndex": "ve_taxrate",
  67. "width": 100,
  68. xtype: 'numbercolumn',
  69. align:'end'
  70. }, {
  71. "text": "承付天数",
  72. "dataIndex": "ve_promisedays",
  73. "width": 100,
  74. xtype: 'numbercolumn',
  75. align:'end',
  76. renderer : function(v) {
  77. return Ext.util.Format.number(v, '0');
  78. }
  79. }, {
  80. "text": "纳税人识别号",
  81. "dataIndex": "ve_bankaccount",
  82. "width": 150
  83. }, {
  84. "text": "开户银行",
  85. "dataIndex": "ve_bankaccount",
  86. "width": 100
  87. }, {
  88. "text": "银行账户",
  89. "dataIndex": "ve_bankcode",
  90. "width": 100
  91. }]
  92. }) ;
  93. }
  94. },
  95. //放大镜赋值关系 以及 tpl模板
  96. 'multidbfindtrigger[name=pd_prodcode]':{
  97. beforerender:function(f){
  98. Ext.apply(f,{
  99. dataUrl:'/api/document/product/list',
  100. // dataUrl:'http://localhost:9480/product/list',
  101. addXtype: 'document-product-formpanel',
  102. addTitle: '物料资料',
  103. dbfinds:[{
  104. from:'id',to:'pd_prodid',ignore:true
  105. },{
  106. from:'pr_code',to:'pd_prodcode'
  107. },{
  108. from:'pr_detail',to:'pr_detail'
  109. },{
  110. from:'pr_unit',to:'pd_unit'
  111. },{
  112. from:'pr_whid',to:'pd_whid'
  113. },{
  114. from:'pr_whcode',to:'pd_whcode'
  115. },{
  116. from:'pr_whname',to:'pd_whname'
  117. },,{
  118. from:'pr_purcprice',to:'pd_orderprice'
  119. }],
  120. dbtpls:[{
  121. field:'pr_code',width:100
  122. },{
  123. field:'pr_detail',width:100
  124. },{
  125. field:'pr_unit',width:100
  126. }],
  127. defaultCondition: "pr_statuscode='OPEN'",
  128. dbSearchFields:[{
  129. emptyText:'输入物料编号、名称或规格',
  130. xtype : "textfield",
  131. name : "search",
  132. width: 200,
  133. getCondition: function(v) {
  134. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  135. },
  136. allowBlank : true,
  137. columnWidth : 0.25
  138. }],
  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. "hidden": true
  173. },{
  174. "text": "总库存数",
  175. "dataIndex": "po_onhand",
  176. "width": 100,
  177. xtype: 'numbercolumn',
  178. renderer : function(v) {
  179. var arr = (v + '.').split('.');
  180. var xr = (new Array(arr[1].length)).fill('0');
  181. var format = '0,000.' + xr.join();
  182. return Ext.util.Format.number(v, format);
  183. },
  184. align:'end'
  185. },{
  186. "text": "类型",
  187. "dataIndex": "pr_kind",
  188. "width": 100,
  189. },{
  190. "text": "型号",
  191. "dataIndex": "pr_orispeccode",
  192. "width": 100,
  193. },{
  194. "text": "品牌",
  195. "dataIndex": "pr_brand",
  196. "width": 100,
  197. },{
  198. "text": "供应商",
  199. "dataIndex": "pr_vendname",
  200. "width": 100,
  201. },{
  202. "text": "最小包装",
  203. "dataIndex": "pr_zxbzs",
  204. "width": 100,
  205. xtype: 'numbercolumn',
  206. align:'end'
  207. },{
  208. "text": "L/T",
  209. "dataIndex": "pr_leadtime",
  210. "width": 100,
  211. }]
  212. }) ;
  213. }
  214. },
  215. //放大镜赋值关系 以及 tpl模板
  216. 'dbfindtrigger[name=pd_whname]':{
  217. beforerender:function(f){
  218. Ext.apply(f,{
  219. dataUrl:'/api/document/warehouse/list',
  220. // dataUrl:'http://localhost:9480/warehouse/list',
  221. addXtype: 'other-warehouse',
  222. addTitle: '仓库资料',
  223. defaultCondition:"wh_statuscode='OPEN'",
  224. dbfinds:[{
  225. from:'id',to:'pd_whid',ignore:true
  226. },{
  227. from:'wh_code',to:'pd_whcode'
  228. },{
  229. from:'wh_description',to:'pd_whname'
  230. }],
  231. dbtpls:[{
  232. field:'pd_whcode',width:100
  233. },{
  234. field:'pd_whname',width:100
  235. }],
  236. dbSearchFields:[{
  237. emptyText:'输入仓库编号或名称',
  238. xtype : "textfield",
  239. name : "wh_code",
  240. allowBlank : true,
  241. columnWidth : 0.25,
  242. getCondition:function(v){
  243. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  244. }
  245. }],
  246. dbColumns:[{
  247. "text": "仓库ID",
  248. "flex": 0,
  249. "dataIndex": "id",
  250. "width": 0,
  251. "xtype": "",
  252. "items": null
  253. },{
  254. "text": "仓库编号",
  255. "flex": 1,
  256. "dataIndex": "wh_code",
  257. "width": 100,
  258. "xtype": "",
  259. "items": null
  260. },{
  261. "text": "仓库名称",
  262. "flex": 1,
  263. "dataIndex": "wh_description",
  264. "xtype": "",
  265. "items": null
  266. },{
  267. "text": "仓库类型",
  268. "flex": 1,
  269. "dataIndex": "wh_type",
  270. "xtype": "",
  271. "items": null
  272. }]
  273. }) ;
  274. }
  275. }
  276. });
  277. },
  278. addCombo:function(){
  279. var combo=this.ownerCmp;
  280. Ext.create('Ext.window.Window',{
  281. layout:'vbox',
  282. bodyPadding: 15,
  283. width:500,
  284. items:[{
  285. fieldLabel:'实际值',
  286. xtype:'textfield'
  287. },{
  288. fieldLabel:'显示值',
  289. xtype:'textfield'
  290. }],
  291. buttons:[{
  292. text:'确认',
  293. handler:function(b){
  294. combo.setValue('ok');
  295. b.up('window').close();
  296. }
  297. }],
  298. renderTo:this.ownerCmp.ownerCt.getEl()
  299. }).show();
  300. }
  301. });