FormPanelController.js 13 KB

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