FormPanelController.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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. "hidden": true
  252. },{
  253. "text": "总库存数",
  254. "dataIndex": "po_onhand",
  255. "width": 100,
  256. xtype: 'numbercolumn',
  257. renderer : function(v) {
  258. var arr = (v + '.').split('.');
  259. var xr = (new Array(arr[1].length)).fill('0');
  260. var format = '0,000.' + xr.join();
  261. return Ext.util.Format.number(v, format);
  262. },
  263. align:'end'
  264. },{
  265. "text": "类型",
  266. "dataIndex": "pr_kind",
  267. "width": 100,
  268. },{
  269. "text": "型号",
  270. "dataIndex": "pr_orispeccode",
  271. "width": 100,
  272. },{
  273. "text": "品牌",
  274. "dataIndex": "pr_brand",
  275. "width": 100,
  276. },{
  277. "text": "供应商",
  278. "dataIndex": "pr_vendname",
  279. "width": 100,
  280. },{
  281. "text": "最小包装",
  282. "dataIndex": "pr_zxbzs",
  283. "width": 100,
  284. xtype: 'numbercolumn',
  285. align:'end'
  286. },{
  287. "text": "L/T",
  288. "dataIndex": "pr_leadtime",
  289. "width": 100,
  290. }]
  291. }) ;
  292. }
  293. },
  294. //放大镜赋值关系 以及 tpl模板
  295. 'dbfindtrigger[name=pd_whname]':{
  296. beforerender:function(f){
  297. Ext.apply(f,{
  298. dataUrl:'/api/document/warehouse/list',
  299. addXtype: 'other-warehouse',
  300. addTitle: '仓库资料',
  301. defaultCondition:"wh_statuscode='OPEN'",
  302. dbfinds:[{
  303. from:'id',to:'id',ignore:true
  304. },{
  305. from:'wh_code',to:'wh_code'
  306. },{
  307. from:'wh_description',to:'pd_whname'
  308. }],
  309. dbtpls:[{
  310. field:'wh_code',width:100
  311. },{
  312. field:'wh_description',width:100
  313. }],
  314. dbSearchFields:[{
  315. emptyText:'输入仓库编号或名称',
  316. xtype : "textfield",
  317. name : "wh_code",
  318. allowBlank : true,
  319. columnWidth : 0.25,
  320. getCondition:function(v){
  321. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  322. }
  323. }],
  324. dbColumns:[{
  325. "text": "仓库ID",
  326. "flex": 0,
  327. "dataIndex": "id",
  328. "width": 0,
  329. "xtype": "",
  330. "items": null
  331. },{
  332. "text": "仓库编号",
  333. "flex": 1,
  334. "dataIndex": "wh_code",
  335. "width": 100,
  336. "xtype": "",
  337. "items": null
  338. }, {
  339. "text": "仓库名称",
  340. "flex": 1,
  341. "dataIndex": "wh_description",
  342. "xtype": "",
  343. "items": null
  344. }, {
  345. "text": "仓库类型",
  346. "flex": 1,
  347. "dataIndex": "wh_type",
  348. "xtype": "",
  349. "items": null
  350. }]
  351. }) ;
  352. }
  353. },
  354. //放大镜赋值关系 以及 tpl模板
  355. 'dbfindtrigger[name=pd_inwhname]':{
  356. beforerender:function(f){
  357. Ext.apply(f,{
  358. dataUrl:'/api/document/warehouse/list',
  359. addXtype: 'other-warehouse',
  360. addTitle: '仓库资料',
  361. defaultCondition:"wh_statuscode='OPEN'",
  362. dbfinds:[{
  363. from:'id',to:'id',ignore:true
  364. },{
  365. from:'wh_code',to:'wh_code'
  366. },{
  367. from:'wh_description',to:'pd_inwhname'
  368. }],
  369. dbtpls:[{
  370. field:'wh_code',width:100
  371. },{
  372. field:'wh_description',width:100
  373. }],
  374. dbSearchFields:[{
  375. emptyText:'输入仓库编号或名称',
  376. xtype : "textfield",
  377. name : "wh_code",
  378. allowBlank : true,
  379. columnWidth : 0.25,
  380. getCondition:function(v){
  381. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  382. }
  383. }],
  384. dbColumns:[{
  385. "text": "仓库ID",
  386. "flex": 0,
  387. "dataIndex": "id",
  388. "width": 0,
  389. "xtype": "",
  390. "items": null
  391. },{
  392. "text": "仓库编号",
  393. "flex": 1,
  394. "dataIndex": "wh_code",
  395. "width": 100,
  396. "xtype": "",
  397. "items": null
  398. }, {
  399. "text": "仓库名称",
  400. "flex": 1,
  401. "dataIndex": "wh_description",
  402. "xtype": "",
  403. "items": null
  404. }, {
  405. "text": "仓库类型",
  406. "flex": 1,
  407. "dataIndex": "wh_type",
  408. "xtype": "",
  409. "items": null
  410. }]
  411. }) ;
  412. }
  413. }
  414. });
  415. },
  416. addCombo:function(){
  417. var combo=this.ownerCmp;
  418. Ext.create('Ext.window.Window',{
  419. layout:'vbox',
  420. bodyPadding: 15,
  421. width:500,
  422. items:[{
  423. fieldLabel:'实际值',
  424. xtype:'textfield'
  425. },{
  426. fieldLabel:'显示值',
  427. xtype:'textfield'
  428. }],
  429. buttons:[{
  430. text:'确认',
  431. handler:function(b){
  432. combo.setValue('ok');
  433. b.up('window').close();
  434. }
  435. }],
  436. renderTo:this.ownerCmp.ownerCt.getEl()
  437. }).show();
  438. }
  439. });