FormPanelController.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. Ext.define('saas.view.stock.appropriationInOut.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.stock-appropriationinout-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. //数据接口
  18. dataUrl:'/api/document/vendor/list',
  19. addXtype: 'document-vendor-formpanel',
  20. addTitle: '供应商资料',
  21. defaultCondition:"ve_statuscode='OPEN'",
  22. //赋值
  23. dbfinds:[{
  24. from:'id',to:'pi_vendid',ignore:true
  25. },{
  26. from:'ve_code',to:'pi_vendcode'
  27. },{
  28. from:'ve_name',to:'pi_vendname'
  29. }],
  30. //联想设置
  31. dbtpls:[{
  32. field:'ve_code',width:100
  33. },{
  34. field:'ve_name',width:100
  35. }],
  36. defaultCondition: "ve_statuscode='OPEN'",
  37. dbSearchFields:[{
  38. emptyText:'输入供应商编号或名称',
  39. xtype : "textfield",
  40. name : "search",
  41. getCondition: function(v) {
  42. return "(upper(ve_code) like '%"+v.toUpperCase()+"%' or upper(ve_name) like '%"+v.toUpperCase()+"%')";
  43. },
  44. allowBlank : true,
  45. columnWidth : 0.25
  46. }],
  47. //放大镜窗口列表
  48. dbColumns:[{
  49. "text": "供应商ID",
  50. "hidden": true,
  51. "dataIndex": "id",
  52. "width": 100,
  53. "xtype": "numbercolumn"
  54. },{
  55. "text": "供应商编号",
  56. "dataIndex": "ve_code",
  57. "width": 200
  58. }, {
  59. "text": "供应商名称",
  60. "dataIndex": "ve_name",
  61. "width": 200
  62. }, {
  63. "text": "供应商类型",
  64. "dataIndex": "ve_type",
  65. "width": 180,
  66. "items": null
  67. }, {
  68. "text": "税率",
  69. "dataIndex": "ve_taxrate",
  70. "width": 100,
  71. xtype: 'numbercolumn',
  72. align:'end'
  73. }, {
  74. "text": "承付天数",
  75. "dataIndex": "ve_promisedays",
  76. "width": 100,
  77. xtype: 'numbercolumn',
  78. align:'end',
  79. renderer : function(v) {
  80. return Ext.util.Format.number(v, '0');
  81. }
  82. }, {
  83. "text": "纳税人识别号",
  84. "dataIndex": "ve_bankaccount",
  85. "width": 150
  86. }, {
  87. "text": "开户银行",
  88. "dataIndex": "ve_bankaccount",
  89. "width": 100
  90. }, {
  91. "text": "银行账户",
  92. "dataIndex": "ve_bankcode",
  93. "width": 100
  94. }]
  95. }) ;
  96. }
  97. },
  98. //放大镜赋值关系 以及 tpl模板
  99. 'dbfindtrigger[name=pi_custname]': {
  100. beforerender: function (f) {
  101. Ext.apply(f, {
  102. addXtype: 'document-customer-formpanel',
  103. addTitle: '客户资料',
  104. dataUrl: '/api/document/customer/list',
  105. // dataUrl:'http://localhost:9480/customer/list',
  106. dbfinds: [{
  107. from: 'id',to: 'pi_custid',ignore:true
  108. }, {
  109. from: 'cu_code',to: 'pi_custcode'
  110. }, {
  111. from: 'cu_name',to: 'pi_custname'
  112. }],
  113. dbtpls: [{
  114. field: 'cu_code',
  115. width: 100
  116. }, {
  117. field: 'cu_name',
  118. width: 100
  119. }],
  120. defaultCondition:"cu_statuscode='OPEN'",
  121. //放大镜窗口字段
  122. dbSearchFields:[{
  123. emptyText:'输入客户编号或名称',
  124. xtype : "textfield",
  125. name : "cu_name",
  126. allowBlank : true,
  127. columnWidth : 0.25,
  128. getCondition:function(v){
  129. return "(upper(cu_name) like '%"+v.toUpperCase()+"%' or upper(cu_code) like '%"+v.toUpperCase()+"%')";
  130. }
  131. }],
  132. dbColumns:[{
  133. "text": "客户ID",
  134. "hidden": true,
  135. "dataIndex": "id",
  136. },{
  137. "text": "客户编号",
  138. "dataIndex": "cu_code",
  139. "width": 200,
  140. }, {
  141. "text": "客户名称",
  142. "dataIndex": "cu_name",
  143. "width": 200
  144. },{
  145. "text": "客户类型",
  146. "dataIndex": "cu_name",
  147. "width": 100
  148. },{
  149. "text": "业务员",
  150. "dataIndex": "cu_sellername",
  151. "width": 100
  152. },{
  153. "text": "税率",
  154. "dataIndex": "cu_taxrate",
  155. "width": 100,
  156. xtype: 'numbercolumn',
  157. align:'end'
  158. },{
  159. "text": "承付天数",
  160. "dataIndex": "cu_promisedays",
  161. "width": 100,
  162. xtype: 'numbercolumn',
  163. align:'end',
  164. renderer : function(v) {
  165. return Ext.util.Format.number(v, '0');
  166. }
  167. },{
  168. "text": "额度",
  169. "dataIndex": "cu_credit",
  170. "width": 100,
  171. xtype: 'numbercolumn',
  172. align:'end'
  173. }]
  174. });
  175. }
  176. },
  177. //放大镜赋值关系 以及 tpl模板
  178. 'multidbfindtrigger[name=pd_prodcode]':{
  179. beforerender:function(f){
  180. Ext.apply(f,{
  181. dataUrl:'/api/document/product/list',
  182. // dataUrl:'http://localhost:9480/product/list',
  183. addXtype: 'document-product-formpanel',
  184. addTitle: '物料资料',
  185. dbfinds:[{
  186. from:'id',to:'pd_prodid'
  187. },{
  188. from:'pr_code',to:'pd_prodcode'
  189. },{
  190. from:'pr_detail',to:'pr_detail'
  191. },{
  192. from:'pr_spec',to:'pr_spec'
  193. },{
  194. from:'pr_whid',to:'pd_whid'
  195. },{
  196. from:'pr_whcode',to:'pd_whcode'
  197. },{
  198. from:'pr_whname',to:'pd_whname'
  199. }],
  200. dbtpls:[{
  201. field:'pr_code',width:100
  202. },{
  203. field:'pr_detail',width:100
  204. },{
  205. field:'pr_spec',width:100
  206. }],
  207. defaultCondition: "pr_statuscode='OPEN'",
  208. dbSearchFields:[{
  209. emptyText:'输入物料编号、名称或规格',
  210. xtype : "textfield",
  211. name : "search",
  212. width: 200,
  213. getCondition: function(v) {
  214. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  215. },
  216. allowBlank : true,
  217. columnWidth : 0.25
  218. }],
  219. dbColumns:[{
  220. "text": "物料ID",
  221. "hidden": true,
  222. "dataIndex": "id",
  223. }, {
  224. "text": "物料编号",
  225. "dataIndex": "pr_code",
  226. "width": 200,
  227. }, {
  228. "text": "物料名称",
  229. "width": 200,
  230. "dataIndex": "pr_detail",
  231. }, {
  232. "text": "规格",
  233. "dataIndex": "pr_spec",
  234. "width": 100,
  235. }, {
  236. "text": "单位",
  237. "dataIndex": "pr_unit",
  238. "width": 100,
  239. },{
  240. "text": "仓库id",
  241. "dataIndex": "pr_whid",
  242. "hidden": true,
  243. },{
  244. "text": "仓库编号",
  245. "dataIndex": "pr_whcode",
  246. "hidden": true,
  247. },{
  248. "text": "仓库",
  249. "dataIndex": "pr_whname",
  250. "width": 200,
  251. },{
  252. "text": "总库存数",
  253. "dataIndex": "po_onhand",
  254. "width": 100,
  255. xtype: 'numbercolumn',
  256. align:'end'
  257. },{
  258. "text": "类型",
  259. "dataIndex": "pr_kind",
  260. "width": 100,
  261. },{
  262. "text": "型号",
  263. "dataIndex": "pr_orispeccode",
  264. "width": 100,
  265. },{
  266. "text": "品牌",
  267. "dataIndex": "pr_brand",
  268. "width": 100,
  269. },{
  270. "text": "供应商",
  271. "dataIndex": "pr_vendname",
  272. "width": 100,
  273. },{
  274. "text": "最小包装",
  275. "dataIndex": "pr_zxbzs",
  276. "width": 100,
  277. xtype: 'numbercolumn',
  278. align:'end'
  279. },{
  280. "text": "L/T",
  281. "dataIndex": "pr_leadtime",
  282. "width": 100,
  283. }]
  284. }) ;
  285. }
  286. },
  287. //放大镜赋值关系 以及 tpl模板
  288. 'dbfindtrigger[name=pd_whname]':{
  289. beforerender:function(f){
  290. Ext.apply(f,{
  291. dataUrl:'/api/document/warehouse/list',
  292. addXtype: 'other-warehouse',
  293. addTitle: '仓库资料',
  294. defaultCondition:"wh_statuscode='OPEN'",
  295. dbfinds:[{
  296. from:'id',to:'id',ignore:true
  297. },{
  298. from:'wh_code',to:'wh_code'
  299. },{
  300. from:'wh_description',to:'pd_whname'
  301. }],
  302. dbtpls:[{
  303. field:'wh_code',width:100
  304. },{
  305. field:'wh_description',width:100
  306. }],
  307. dbSearchFields:[{
  308. emptyText:'输入仓库编号或名称',
  309. xtype : "textfield",
  310. name : "wh_code",
  311. allowBlank : true,
  312. columnWidth : 0.25,
  313. getCondition:function(v){
  314. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  315. }
  316. }],
  317. dbColumns:[{
  318. "text": "仓库ID",
  319. "flex": 0,
  320. "dataIndex": "id",
  321. "width": 0,
  322. "xtype": "",
  323. "items": null
  324. },{
  325. "text": "仓库编号",
  326. "flex": 1,
  327. "dataIndex": "wh_code",
  328. "width": 100,
  329. "xtype": "",
  330. "items": null
  331. }, {
  332. "text": "仓库名称",
  333. "flex": 1,
  334. "dataIndex": "wh_description",
  335. "xtype": "",
  336. "items": null
  337. }, {
  338. "text": "仓库类型",
  339. "flex": 1,
  340. "dataIndex": "wh_type",
  341. "xtype": "",
  342. "items": null
  343. }]
  344. }) ;
  345. }
  346. },
  347. //放大镜赋值关系 以及 tpl模板
  348. 'dbfindtrigger[name=pd_inwhname]':{
  349. beforerender:function(f){
  350. Ext.apply(f,{
  351. dataUrl:'/api/document/warehouse/list',
  352. addXtype: 'other-warehouse',
  353. addTitle: '仓库资料',
  354. defaultCondition:"wh_statuscode='OPEN'",
  355. dbfinds:[{
  356. from:'id',to:'id',ignore:true
  357. },{
  358. from:'wh_code',to:'wh_code'
  359. },{
  360. from:'wh_description',to:'pd_inwhname'
  361. }],
  362. dbtpls:[{
  363. field:'wh_code',width:100
  364. },{
  365. field:'wh_description',width:100
  366. }],
  367. dbSearchFields:[{
  368. emptyText:'输入仓库编号或名称',
  369. xtype : "textfield",
  370. name : "wh_code",
  371. allowBlank : true,
  372. columnWidth : 0.25,
  373. getCondition:function(v){
  374. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  375. }
  376. }],
  377. dbColumns:[{
  378. "text": "仓库ID",
  379. "flex": 0,
  380. "dataIndex": "id",
  381. "width": 0,
  382. "xtype": "",
  383. "items": null
  384. },{
  385. "text": "仓库编号",
  386. "flex": 1,
  387. "dataIndex": "wh_code",
  388. "width": 100,
  389. "xtype": "",
  390. "items": null
  391. }, {
  392. "text": "仓库名称",
  393. "flex": 1,
  394. "dataIndex": "wh_description",
  395. "xtype": "",
  396. "items": null
  397. }, {
  398. "text": "仓库类型",
  399. "flex": 1,
  400. "dataIndex": "wh_type",
  401. "xtype": "",
  402. "items": null
  403. }]
  404. }) ;
  405. }
  406. }
  407. });
  408. },
  409. addCombo:function(){
  410. var combo=this.ownerCmp;
  411. Ext.create('Ext.window.Window',{
  412. layout:'vbox',
  413. bodyPadding: 15,
  414. width:500,
  415. items:[{
  416. fieldLabel:'实际值',
  417. xtype:'textfield'
  418. },{
  419. fieldLabel:'显示值',
  420. xtype:'textfield'
  421. }],
  422. buttons:[{
  423. text:'确认',
  424. handler:function(b){
  425. combo.setValue('ok');
  426. b.up('window').close();
  427. }
  428. }],
  429. renderTo:this.ownerCmp.ownerCt.getEl()
  430. }).show();
  431. }
  432. });