FormPanelController.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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',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_spec',to:'pr_spec'
  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_spec',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. },{
  173. "text": "总库存数",
  174. "dataIndex": "po_onhand",
  175. "width": 100,
  176. xtype: 'numbercolumn',
  177. align:'end'
  178. },{
  179. "text": "类型",
  180. "dataIndex": "pr_kind",
  181. "width": 100,
  182. },{
  183. "text": "型号",
  184. "dataIndex": "pr_orispeccode",
  185. "width": 100,
  186. },{
  187. "text": "品牌",
  188. "dataIndex": "pr_brand",
  189. "width": 100,
  190. },{
  191. "text": "供应商",
  192. "dataIndex": "pr_vendname",
  193. "width": 100,
  194. },{
  195. "text": "最小包装",
  196. "dataIndex": "pr_zxbzs",
  197. "width": 100,
  198. xtype: 'numbercolumn',
  199. },{
  200. "text": "L/T",
  201. "dataIndex": "pr_leadtime",
  202. "width": 100,
  203. }]
  204. });
  205. }
  206. },
  207. //放大镜赋值关系 以及 tpl模板
  208. 'dbfindtrigger[name=pd_whname]':{
  209. beforerender:function(f){
  210. Ext.apply(f,{
  211. dataUrl:'/api/document/warehouse/list',
  212. // dataUrl:'http://localhost:9480/warehouse/list',
  213. addXtype: 'other-warehouse',
  214. addTitle: '仓库资料',
  215. defaultCondition:"wh_statuscode='OPEN'",
  216. dbfinds:[{
  217. from:'id',to:'pd_whid',ignore:true
  218. },{
  219. from:'wh_code',to:'pd_whcode'
  220. },{
  221. from:'wh_description',to:'pd_whname'
  222. }],
  223. dbtpls:[{
  224. field:'pd_whcode',width:100
  225. },{
  226. field:'pd_whname',width:100
  227. }],
  228. dbSearchFields:[{
  229. emptyText:'输入仓库编号或名称',
  230. xtype : "textfield",
  231. name : "wh_code",
  232. allowBlank : true,
  233. columnWidth : 0.25,
  234. getCondition:function(v){
  235. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  236. }
  237. }],
  238. dbColumns:[{
  239. "text": "仓库ID",
  240. "flex": 0,
  241. "dataIndex": "id",
  242. "width": 0,
  243. "xtype": "",
  244. "items": null
  245. },{
  246. "text": "仓库编号",
  247. "flex": 1,
  248. "dataIndex": "wh_code",
  249. "width": 100,
  250. "xtype": "",
  251. "items": null
  252. }, {
  253. "text": "仓库名称",
  254. "flex": 1,
  255. "dataIndex": "wh_description",
  256. "xtype": "",
  257. "items": null
  258. }, {
  259. "text": "仓库类型",
  260. "flex": 1,
  261. "dataIndex": "wh_type",
  262. "xtype": "",
  263. "items": null
  264. }]
  265. }) ;
  266. }
  267. }
  268. });
  269. },
  270. addCombo:function(){
  271. var combo=this.ownerCmp;
  272. Ext.create('Ext.window.Window',{
  273. layout:'vbox',
  274. bodyPadding: 15,
  275. width:500,
  276. items:[{
  277. fieldLabel:'实际值',
  278. xtype:'textfield'
  279. },{
  280. fieldLabel:'显示值',
  281. xtype:'textfield'
  282. }],
  283. buttons:[{
  284. text:'确认',
  285. handler:function(b){
  286. combo.setValue('ok');
  287. b.up('window').close();
  288. }
  289. }],
  290. renderTo:this.ownerCmp.ownerCt.getEl()
  291. }).show();
  292. },
  293. turnOut: function() {
  294. var me = this,
  295. form = me.getView(),
  296. id = form.getForm().findField(form._idField);
  297. form.BaseUtil.request({
  298. url: form._turnOutUrl+id.value,
  299. method: 'POST',
  300. })
  301. .then(function(localJson) {
  302. if(localJson.success){
  303. var intValue = localJson.data.id,
  304. codeValue= localJson.data.code,
  305. name = localJson.data.name;
  306. openTab('purchase-purchaseout-formpanel',name+"("+codeValue+")",codeValue+intValue, {
  307. initId: intValue
  308. });
  309. showToast('转单成功');
  310. }
  311. })
  312. .catch(function(res) {
  313. console.error(res);
  314. showToast('转单失败: ' + res.message);
  315. });
  316. }
  317. });