FormPanelController.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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',
  187. to: 'pd_prodid',ignore:true
  188. }, {
  189. from: 'pr_code',
  190. to: 'pd_prodcode'
  191. }, {
  192. from: 'pr_detail',
  193. to: 'pr_detail'
  194. }, {
  195. from: 'pr_spec',
  196. to: 'pr_spec'
  197. },{
  198. from:'pr_whid',to:'pd_whid'
  199. },{
  200. from:'pr_whcode',to:'pd_whcode'
  201. },{
  202. from:'pr_whname',to:'pd_whname'
  203. },{
  204. from:'pr_purcprice',to:'pd_orderprice'
  205. }],
  206. dbtpls: [{
  207. field: 'pr_code',
  208. width: 100
  209. }, {
  210. field: 'pr_detail',
  211. width: 100
  212. }, {
  213. field: 'pr_spec',
  214. width: 100
  215. }],
  216. defaultCondition: "pr_statuscode='OPEN'",
  217. dbSearchFields:[{
  218. emptyText:'输入物料编号、名称或规格',
  219. xtype : "textfield",
  220. name : "search",
  221. width: 200,
  222. getCondition: function(v) {
  223. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  224. },
  225. allowBlank : true,
  226. columnWidth : 0.25
  227. }],
  228. dbColumns:[{
  229. "text": "物料ID",
  230. "hidden": true,
  231. "dataIndex": "id",
  232. }, {
  233. "text": "物料编号",
  234. "dataIndex": "pr_code",
  235. "width": 200,
  236. }, {
  237. "text": "物料名称",
  238. "width": 200,
  239. "dataIndex": "pr_detail",
  240. }, {
  241. "text": "规格",
  242. "dataIndex": "pr_spec",
  243. "width": 100,
  244. }, {
  245. "text": "单位",
  246. "dataIndex": "pr_unit",
  247. "width": 100,
  248. },{
  249. "text": "仓库id",
  250. "dataIndex": "pr_whid",
  251. "hidden": true,
  252. },{
  253. "text": "仓库编号",
  254. "dataIndex": "pr_whcode",
  255. "hidden": true,
  256. },{
  257. "text": "仓库",
  258. "dataIndex": "pr_whname",
  259. "width": 200,
  260. "hidden": true
  261. },{
  262. "text": "总库存数",
  263. "dataIndex": "po_onhand",
  264. "width": 100,
  265. xtype: 'numbercolumn',
  266. renderer : function(v) {
  267. var arr = (v + '.').split('.');
  268. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  269. var format = '0,000.' + xr.join();
  270. return Ext.util.Format.number(v, format);
  271. },
  272. align:'end'
  273. },{
  274. "text": "类型",
  275. "dataIndex": "pr_kind",
  276. "width": 100,
  277. },{
  278. "text": "型号",
  279. "dataIndex": "pr_orispeccode",
  280. "width": 100,
  281. },{
  282. "text": "品牌",
  283. "dataIndex": "pr_brand",
  284. "width": 100,
  285. },{
  286. "text": "供应商",
  287. "dataIndex": "pr_vendname",
  288. "width": 100,
  289. },{
  290. "text": "最小包装",
  291. "dataIndex": "pr_zxbzs",
  292. "width": 100,
  293. xtype: 'numbercolumn',
  294. align: 'end'
  295. },{
  296. "text": "L/T",
  297. "dataIndex": "pr_leadtime",
  298. "width": 100,
  299. }]
  300. });
  301. }
  302. },
  303. //放大镜赋值关系 以及 tpl模板
  304. 'dbfindtrigger[name=pd_whname]':{
  305. beforerender:function(f){
  306. Ext.apply(f,{
  307. dataUrl:'/api/document/warehouse/list',
  308. addXtype: 'other-warehouse',
  309. addTitle: '仓库资料',
  310. defaultCondition:"wh_statuscode='OPEN'",
  311. dbfinds:[{
  312. from:'id',to:'id',ignore:true
  313. },{
  314. from:'wh_code',to:'wh_code'
  315. },{
  316. from:'wh_description',to:'pd_whname'
  317. }],
  318. dbtpls:[{
  319. field:'wh_code',width:100
  320. },{
  321. field:'wh_description',width:100
  322. }],
  323. dbSearchFields:[{
  324. emptyText:'输入仓库编号或名称',
  325. xtype : "textfield",
  326. name : "wh_code",
  327. allowBlank : true,
  328. columnWidth : 0.25,
  329. getCondition:function(v){
  330. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  331. }
  332. }],
  333. dbColumns:[{
  334. "text": "仓库ID",
  335. "flex": 0,
  336. "dataIndex": "id",
  337. "width": 0,
  338. "xtype": "",
  339. "items": null
  340. },{
  341. "text": "仓库编号",
  342. "flex": 1,
  343. "dataIndex": "wh_code",
  344. "width": 100,
  345. "xtype": "",
  346. "items": null
  347. }, {
  348. "text": "仓库名称",
  349. "flex": 1,
  350. "dataIndex": "wh_description",
  351. "xtype": "",
  352. "items": null
  353. }, {
  354. "text": "仓库类型",
  355. "flex": 1,
  356. "dataIndex": "wh_type",
  357. "xtype": "",
  358. "items": null
  359. }]
  360. }) ;
  361. }
  362. },
  363. //放大镜赋值关系 以及 tpl模板
  364. 'dbfindtrigger[name=pd_inwhname]':{
  365. beforerender:function(f){
  366. Ext.apply(f,{
  367. dataUrl:'/api/document/warehouse/list',
  368. addXtype: 'other-warehouse',
  369. addTitle: '仓库资料',
  370. defaultCondition:"wh_statuscode='OPEN'",
  371. dbfinds:[{
  372. from:'id',to:'pd_inwhid',ignore:true
  373. },{
  374. from:'wh_code',to:'pd_inwhcode'
  375. },{
  376. from:'wh_description',to:'pd_inwhname'
  377. }],
  378. dbtpls:[{
  379. field:'wh_code',width:100
  380. },{
  381. field:'wh_description',width:100
  382. }],
  383. dbSearchFields:[{
  384. emptyText:'输入仓库编号或名称',
  385. xtype : "textfield",
  386. name : "wh_code",
  387. allowBlank : true,
  388. columnWidth : 0.25,
  389. getCondition:function(v){
  390. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  391. }
  392. }],
  393. dbColumns:[{
  394. "text": "仓库ID",
  395. "flex": 0,
  396. "dataIndex": "id",
  397. "width": 0,
  398. "xtype": "",
  399. "items": null
  400. },{
  401. "text": "仓库编号",
  402. "flex": 1,
  403. "dataIndex": "wh_code",
  404. "width": 100,
  405. "xtype": "",
  406. "items": null
  407. }, {
  408. "text": "仓库名称",
  409. "flex": 1,
  410. "dataIndex": "wh_description",
  411. "xtype": "",
  412. "items": null
  413. }, {
  414. "text": "仓库类型",
  415. "flex": 1,
  416. "dataIndex": "wh_type",
  417. "xtype": "",
  418. "items": null
  419. }]
  420. }) ;
  421. }
  422. }
  423. });
  424. },
  425. addCombo:function(){
  426. var combo=this.ownerCmp;
  427. Ext.create('Ext.window.Window',{
  428. layout:'vbox',
  429. bodyPadding: 15,
  430. width:500,
  431. items:[{
  432. fieldLabel:'实际值',
  433. xtype:'textfield'
  434. },{
  435. fieldLabel:'显示值',
  436. xtype:'textfield'
  437. }],
  438. buttons:[{
  439. text:'确认',
  440. handler:function(b){
  441. combo.setValue('ok');
  442. b.up('window').close();
  443. }
  444. }],
  445. renderTo:this.ownerCmp.ownerCt.getEl()
  446. }).show();
  447. }
  448. });