FormPanelController.js 13 KB

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