FormPanelController.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.purchase-purchasein-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'
  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. "flex": 1,
  54. "dataIndex": "ve_code",
  55. "width": 100
  56. }, {
  57. "text": "供应商名称",
  58. "flex": 1,
  59. "dataIndex": "ve_name",
  60. "width": 100
  61. }, {
  62. "text": "供应商类型",
  63. "flex": 0,
  64. "dataIndex": "ve_type",
  65. "width": 200,
  66. "items": null
  67. }, {
  68. "text": "税率",
  69. "flex": 1,
  70. "dataIndex": "ve_taxrate",
  71. "width": 100
  72. }, {
  73. "text": "承付天数",
  74. "flex": 1,
  75. "dataIndex": "ve_promisedays",
  76. "width": 100
  77. }, {
  78. "text": "纳税人识别号",
  79. "flex": 1,
  80. "dataIndex": "ve_bankaccount",
  81. "width": 100
  82. }, {
  83. "text": "开户银行",
  84. "flex": 1,
  85. "dataIndex": "ve_bankaccount",
  86. "width": 100
  87. }, {
  88. "text": "银行账户",
  89. "flex": 1,
  90. "dataIndex": "ve_bankcode",
  91. "width": 100
  92. }]
  93. }) ;
  94. }
  95. },
  96. //放大镜赋值关系 以及 tpl模板
  97. 'multidbfindtrigger[name=pd_prodcode]':{
  98. beforerender:function(f){
  99. Ext.apply(f,{
  100. dataUrl:'/api/document/product/list',
  101. // dataUrl:'http://localhost:9480/product/list',
  102. addXtype: 'document-product-formpanel',
  103. addTitle: '物料资料',
  104. dbfinds:[{
  105. from:'id',to:'pd_prodid'
  106. },{
  107. from:'pr_code',to:'pd_prodcode'
  108. },{
  109. from:'pr_detail',to:'pr_detail'
  110. },{
  111. from:'pr_spec',to:'pr_spec'
  112. },{
  113. from:'pr_whid',to:'pd_whid'
  114. },{
  115. from:'pr_whcode',to:'pd_whcode'
  116. },{
  117. from:'pr_whname',to:'pd_whname'
  118. }],
  119. dbtpls:[{
  120. field:'pr_code',width:100
  121. },{
  122. field:'pr_detail',width:100
  123. },{
  124. field:'pr_spec',width:100
  125. }],
  126. defaultCondition: "pr_statuscode='OPEN'",
  127. dbSearchFields:[{
  128. emptyText:'输入物料编号、名称或规格',
  129. xtype : "textfield",
  130. name : "search",
  131. width: 200,
  132. getCondition: function(v) {
  133. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  134. },
  135. allowBlank : true,
  136. columnWidth : 0.25
  137. }],
  138. //窗口列设置
  139. dbColumns:[{
  140. "text": "物料ID",
  141. "hidden": true,
  142. "dataIndex": "id",
  143. }, {
  144. "text": "物料编号",
  145. "dataIndex": "pr_code",
  146. "width": 100,
  147. "xtype": "",
  148. "items": null
  149. }, {
  150. "text": "物料名称",
  151. "width": 100,
  152. "dataIndex": "pr_detail",
  153. "xtype": "",
  154. "items": null
  155. }, {
  156. "text": "规格",
  157. "flex": 0,
  158. "dataIndex": "pr_spec",
  159. "width": 100,
  160. "xtype": "",
  161. "items": null
  162. }, {
  163. "text": "单位",
  164. "flex": 0,
  165. "dataIndex": "pr_spec",
  166. "width": 100,
  167. "xtype": "",
  168. "items": null
  169. },{
  170. "text": "仓库id",
  171. "flex": 0,
  172. "dataIndex": "pr_whid",
  173. "width": 0,
  174. "xtype": "",
  175. "items": null
  176. },{
  177. "text": "仓库编号",
  178. "flex": 0,
  179. "dataIndex": "pr_whcode",
  180. "width": 0,
  181. "xtype": "",
  182. "items": null
  183. },{
  184. "text": "仓库",
  185. "flex": 0,
  186. "dataIndex": "pr_whname",
  187. "width": 100,
  188. "xtype": "",
  189. "items": null
  190. },{
  191. "text": "总库存数",
  192. "flex": 0,
  193. "dataIndex": "po_onhand",
  194. "width": 100,
  195. "xtype": "",
  196. "items": null
  197. },{
  198. "text": "类型",
  199. "flex": 0,
  200. "dataIndex": "pr_kind",
  201. "width": 100,
  202. "xtype": "",
  203. "items": null
  204. },{
  205. "text": "型号",
  206. "flex": 0,
  207. "dataIndex": "pr_orispeccode",
  208. "width": 100,
  209. "xtype": "",
  210. "items": null
  211. },{
  212. "text": "品牌",
  213. "flex": 0,
  214. "dataIndex": "pr_brand",
  215. "width": 100,
  216. "xtype": "",
  217. "items": null
  218. },{
  219. "text": "供应商",
  220. "flex": 0,
  221. "dataIndex": "pr_vendname",
  222. "width": 100,
  223. "xtype": "",
  224. "items": null
  225. },{
  226. "text": "最小包装",
  227. "flex": 0,
  228. "dataIndex": "pr_zxbzs",
  229. "width": 100,
  230. "xtype": "",
  231. "items": null
  232. },{
  233. "text": "L/T",
  234. "flex": 0,
  235. "dataIndex": "pr_leadtime",
  236. "width": 100,
  237. "xtype": "",
  238. "items": null
  239. }]
  240. }) ;
  241. }
  242. },
  243. //放大镜赋值关系 以及 tpl模板
  244. 'dbfindtrigger[name=pd_whname]':{
  245. beforerender:function(f){
  246. Ext.apply(f,{
  247. dataUrl:'/api/document/warehouse/list',
  248. // dataUrl:'http://localhost:9480/warehouse/list',
  249. addXtype: 'other-warehouse',
  250. addTitle: '仓库资料',
  251. defaultCondition:"wh_statuscode='OPEN'",
  252. dbfinds:[{
  253. from:'id',to:'pd_whid'
  254. },{
  255. from:'wh_code',to:'pd_whcode'
  256. },{
  257. from:'wh_description',to:'pd_whname'
  258. }],
  259. dbtpls:[{
  260. field:'pd_whcode',width:100
  261. },{
  262. field:'pd_whname',width:100
  263. }],
  264. dbSearchFields:[{
  265. emptyText:'输入仓库编号或名称',
  266. xtype : "textfield",
  267. name : "wh_code",
  268. allowBlank : true,
  269. columnWidth : 0.25,
  270. getCondition:function(v){
  271. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  272. }
  273. }],
  274. dbColumns:[{
  275. "text": "仓库ID",
  276. "flex": 0,
  277. "dataIndex": "id",
  278. "width": 0,
  279. "xtype": "",
  280. "items": null
  281. },{
  282. "text": "仓库编号",
  283. "flex": 1,
  284. "dataIndex": "wh_code",
  285. "width": 100,
  286. "xtype": "",
  287. "items": null
  288. }, {
  289. "text": "仓库名称",
  290. "flex": 1,
  291. "dataIndex": "wh_description",
  292. "xtype": "",
  293. "items": null
  294. }, {
  295. "text": "仓库类型",
  296. "flex": 1,
  297. "dataIndex": "wh_type",
  298. "xtype": "",
  299. "items": null
  300. }]
  301. }) ;
  302. }
  303. }
  304. });
  305. },
  306. addCombo:function(){
  307. var combo=this.ownerCmp;
  308. Ext.create('Ext.window.Window',{
  309. layout:'vbox',
  310. bodyPadding: 15,
  311. width:500,
  312. items:[{
  313. fieldLabel:'实际值',
  314. xtype:'textfield'
  315. },{
  316. fieldLabel:'显示值',
  317. xtype:'textfield'
  318. }],
  319. buttons:[{
  320. text:'确认',
  321. handler:function(b){
  322. combo.setValue('ok');
  323. b.up('window').close();
  324. }
  325. }],
  326. renderTo:this.ownerCmp.ownerCt.getEl()
  327. }).show();
  328. },
  329. turnOut: function() {
  330. var me = this,
  331. form = me.getView(),
  332. id = form.getForm().findField(form._idField);
  333. form.BaseUtil.request({
  334. url: form._turnOutUrl+id.value,
  335. method: 'POST',
  336. })
  337. .then(function(localJson) {
  338. if(localJson.success){
  339. var intValue = localJson.data.id,
  340. codeValue= localJson.data.code,
  341. name = localJson.data.name;
  342. openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  343. initId: intValue
  344. });
  345. showToast('转单成功');
  346. }
  347. })
  348. .catch(function(res) {
  349. console.error(res);
  350. showToast('转单失败: ' + res.message);
  351. });
  352. }
  353. });